Skip to content

Commit

Permalink
Merge pull request adrigardi90#2 from adrigardi90/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
adrigardi90 authored Apr 10, 2019
2 parents 9fa22d8 + eef098a commit dd515a1
Show file tree
Hide file tree
Showing 33 changed files with 2,283 additions and 635 deletions.
Empty file added .env
Empty file.
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:8.6 as build

WORKDIR /videochat
COPY package.json /videochat/
RUN npm install

COPY ./ /videochat

ARG VUE_APP_SOCKET_HOST=NOT_SET
ARG VUE_APP_SOCKET_PORT=NOT_SET

RUN export VUE_APP_SOCKET_HOST=${VUE_APP_SOCKET_HOST} VUE_APP_SOCKET_PORT=${VUE_APP_SOCKET_PORT} && npm run build

CMD ["npm", "run", "run:server"]
46 changes: 45 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,45 @@
# video-chat
# video-chat
> Video chat application using [VueJS](https://vuejs.org), [Vuex](https://vuex.vuejs.org), [WebRTC](https://webrtc.org/start/), [SocketIO](https://socket.io), NodeJS and [Redis](https://github.com/NodeRedis/node_redis)
## Quick start
First of all, you need to install and run the redis in your PC. Here there is an [article](https://medium.com/@petehouston/install-and-config-redis-on-mac-os-x-via-homebrew-eb8df9a4f298) for Mac OS X. Once Redis is up and running:

```bash
# Clone the repo
git clone https://github.com/adrigardi90/video-chat

# Change into the repo directory
cd video-chat

# install
npm install

# Start the FE in dev mode
npm run serve

# Start the server
npm run run:server

```
Then visit http://localhost:8080 in your browser

## Horizontal scaling
To test the horizontal scaling we need to run two different instances. Each one will run a nodeJS process serving the FE and
exposing the API

<p align="center">
<img src="https://github.com/adrigardi90/video-chat/blob/master/src/assets/scaling.png" alt="scaling" width="500" height="250"/>
</p>


```bash
# Build the images
docker-compose build

# Create and run the two instances
docker-compose up

```

Then you'll find on http://localhost:3000 and http://localhost:3001 both FE applications, each one with a different socket connection

8 changes: 4 additions & 4 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
presets: [
'@vue/app'
]
}
presets: [
'@vue/app'
]
}
53 changes: 53 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
version: '3'

services:

redis:
image: redis:4.0.5-alpine
networks:
- video-chat
ports:
- 6379:6379
expose:
- "6379"
restart: always
command: ["redis-server", "--appendonly", "yes"]

# Copy 1
chat1:
build:
context: .
args:
VUE_APP_SOCKET_HOST: localhost
VUE_APP_SOCKET_PORT: 3000
ports:
- 3000:3000
networks:
- video-chat
depends_on:
- redis
environment:
PORT: 3000
REDIS_HOST: redis
REDIS_PORT: 6379

# Copy 2
chat2:
build:
context: .
args:
VUE_APP_SOCKET_HOST: localhost
VUE_APP_SOCKET_PORT: 3001
ports:
- 3001:3001
networks:
- video-chat
depends_on:
- redis
environment:
PORT: 3001
REDIS_HOST: redis
REDIS_PORT: 6379

networks:
video-chat:
Loading

0 comments on commit dd515a1

Please sign in to comment.