forked from adrigardi90/video-chat
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request adrigardi90#2 from adrigardi90/develop
Develop
- Loading branch information
Showing
33 changed files
with
2,283 additions
and
635 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module.exports = { | ||
presets: [ | ||
'@vue/app' | ||
] | ||
} | ||
presets: [ | ||
'@vue/app' | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
Oops, something went wrong.