-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ENHANCEMENT] Add MongoDB and Docker
Add mongodb with docker-compose and change generate proto method for docker
- Loading branch information
1 parent
393e16b
commit e2fa39d
Showing
15 changed files
with
108 additions
and
72 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,5 @@ | ||
#!/bin/bash | ||
|
||
cp -r /cache/node_modules/. /app/node_modules/ | ||
|
||
exec npm-run-all generate:server server:dev |
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 @@ | ||
MONGO_URI=mongodb://root:developer@localhost:27017/microservices | ||
MONGO_URI=mongodb://localhost:27017/microservices |
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,23 @@ | ||
FROM node:10-alpine | ||
|
||
RUN mkdir -p /cache | ||
|
||
WORKDIR /cache | ||
|
||
COPY package*.json ./ | ||
|
||
RUN npm i | ||
RUN npm i -g npm-run-all | ||
RUN npm rebuild grpc --target_libc=musl --target_platform=linux | ||
|
||
RUN mkdir -p /app | ||
|
||
WORKDIR /app | ||
|
||
COPY tsconfig.json ./ | ||
COPY . . | ||
|
||
ENTRYPOINT ["sh", "/app/.docker/entrypoint.sh"] | ||
|
||
EXPOSE 3000 | ||
EXPOSE 27017 |
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,30 @@ | ||
version: '3' | ||
services: | ||
app_service: | ||
image: node:11 | ||
container_name: microservices | ||
build: . | ||
depends_on: | ||
- mongodb_container | ||
env_file: | ||
- .env | ||
environment: | ||
DB_HOST: localhost | ||
volumes: | ||
- .:/app | ||
ports: | ||
- 3000:3000 | ||
working_dir: /app/ | ||
network_mode: host | ||
command: /app/.docker/entrypoint.sh | ||
tty: true | ||
|
||
mongodb_container: | ||
image: mongo | ||
ports: | ||
- 27017:27017 | ||
volumes: | ||
- mongodb_data_container:/data/db | ||
|
||
volumes: | ||
mongodb_data_container: |
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
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
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,16 @@ | ||
import Generator from './generator' | ||
import GeneratorServer from './generator/generator-server' | ||
import GenerateApp from './generator/generator-app' | ||
import GeneratorDatabase from './generator/generator-database' | ||
import GeneratorLatency from './generator/generator-latency' | ||
import GeneratorGraphql from './generator/generator-graphql' | ||
|
||
const generatorServer = new GeneratorServer() | ||
const generatorApp = new GenerateApp() | ||
const generatorDatabase = new GeneratorDatabase() | ||
const generatorLatency = new GeneratorLatency() | ||
const generatorGraphql = new GeneratorGraphql() | ||
|
||
const generator = new Generator(generatorServer, generatorApp, generatorDatabase, generatorLatency, generatorGraphql) | ||
|
||
generator.proto() |
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
Binary file not shown.