diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..cf636f5 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,45 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "client build", + "command": "npm", + "args": ["start"], + "options": { + "cwd": "${workspaceFolder}/client" + }, + "presentation": { "group": "runwithme" } + }, + { + "label": "api-server build", + "command": "npm", + "args": ["run", "start:dev"], + "options": { + "cwd": "${workspaceFolder}/server" + }, + "presentation": { "group": "runwithme" } + }, + { + "label": "noti-server build", + "command": "npm", + "args": ["run", "start:dev"], + "options": { + "cwd": "${workspaceFolder}/noti-server" + }, + "presentation": { "group": "runwithme" } + }, + { + "label": "chat-server build", + "command": "npm", + "args": ["run", "start:dev"], + "options": { + "cwd": "${workspaceFolder}/chat-server" + }, + "presentation": { "group": "runwithme" } + }, + { + "label": "Total build", + "dependsOn": ["api-server build", "noti-server build", "chat-server build"] + } + ] +} diff --git a/chat-server/.gitignore b/chat-server/.gitignore index 94709eb..649008e 100644 --- a/chat-server/.gitignore +++ b/chat-server/.gitignore @@ -33,4 +33,7 @@ lerna-debug.log* !.vscode/settings.json !.vscode/tasks.json !.vscode/launch.json -!.vscode/extensions.json \ No newline at end of file +!.vscode/extensions.json + +# mongodb data +/data \ No newline at end of file diff --git a/chat-server/Dockerfile b/chat-server/Dockerfile new file mode 100644 index 0000000..2ef1d27 --- /dev/null +++ b/chat-server/Dockerfile @@ -0,0 +1,11 @@ +FROM node:latest + +WORKDIR /usr/src/app + +COPY package*.json ./ + +RUN npm install --silent + +COPY . . + +EXPOSE 27017 \ No newline at end of file diff --git a/chat-server/docker-compose.yml b/chat-server/docker-compose.yml new file mode 100644 index 0000000..7b08cd4 --- /dev/null +++ b/chat-server/docker-compose.yml @@ -0,0 +1,31 @@ +services: + chat-server: + build: + context: . + dockerfile: Dockerfile + container_name: chat-server + ports: + - '8080:8080' + command: npm run start + networks: + - webnet + depends_on: + - mongodb_chat + environment: + - MONGO_URL=mongodb://mongodb_chat:27017/chat + + mongodb_chat: + container_name: mongodb_chat + command: mongod --quiet --logpath /dev/null + image: mongo + volumes: + - ./data:/data/db + networks: + - webnet + logging: + driver: 'none' + +networks: + webnet: +volumes: + chat-server: diff --git a/docker-compose.yml b/docker-compose.yml index a8a7457..2c91855 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,10 @@ services: depends_on: - redis + environment: + - REDIS_HOST=redis + - REDIS_PORT=6379 + redis: container_name: redis image: redis:5 diff --git a/noti-server/docker-compose.yml b/noti-server/docker-compose.yml index 02ecfb8..6e871c2 100644 --- a/noti-server/docker-compose.yml +++ b/noti-server/docker-compose.yml @@ -11,13 +11,16 @@ services: - webnet depends_on: - noti-redis + environment: + - REDIS_HOST=noti-redis + - REDIS=6000 noti-redis: container_name: noti-redis image: redis:5 command: redis-server ports: - - '6379:6379' + - '6000:6000' networks: - webnet diff --git a/server/docker-compose.yml b/server/docker-compose.yml index 520df5a..2159aa4 100644 --- a/server/docker-compose.yml +++ b/server/docker-compose.yml @@ -17,6 +17,9 @@ services: depends_on: - mysqldb - redis + environment: + - REDIS_HOST=redis + - REDIS_PORT=6379 redis: container_name: redis