Created
March 13, 2021 09:29
-
-
Save siygle/3d5618863679b468f5865e1b41a6ea7d to your computer and use it in GitHub Desktop.
local dev mongodb transaction
This file contains hidden or 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
version: '3' | |
services: | |
api-backend: | |
build: | |
context: . | |
ports: | |
- "3000:3000" | |
depends_on: | |
- api-backend-db-primary | |
links: | |
- "api-backend-db-primary:mongo" | |
volumes: | |
- .:/home/app/api-backend | |
networks: | |
- vpc | |
api-backend-db-primary: | |
image: "bitnami/mongodb:4.4.3" | |
environment: | |
- MONGODB_ADVERTISED_HOSTNAME=api-backend-db-primary | |
- MONGODB_REPLICA_SET_MODE=primary | |
- MONGODB_ROOT_PASSWORD=password123 | |
- MONGODB_REPLICA_SET_KEY=replicasetkey123 | |
- MONGODB_USERNAME=pguser | |
- MONGODB_PASSWORD=12345 | |
- MONGODB_DATABASE=dev_staging | |
networks: | |
- vpc | |
volumes: | |
- 'mongodb_master_data:/bitnami' | |
ports: | |
- 27017:27017 | |
api-backend-db-secondary: | |
image: "bitnami/mongodb:4.4.3" | |
depends_on: | |
- api-backend-db-primary | |
environment: | |
- MONGODB_ADVERTISED_HOSTNAME=api-backend-db-secondary | |
- MONGODB_REPLICA_SET_MODE=secondary | |
- MONGODB_INITIAL_PRIMARY_HOST=api-backend-db-primary | |
- MONGODB_INITIAL_PRIMARY_PORT_NUMBER=27017 | |
- MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD=password123 | |
- MONGODB_REPLICA_SET_KEY=replicasetkey123 | |
networks: | |
- vpc | |
api-backend-db-arbiter: | |
image: 'bitnami/mongodb:4.4.3' | |
depends_on: | |
- api-backend-db-primary | |
environment: | |
- MONGODB_ADVERTISED_HOSTNAME=api-backend-db-arbiter | |
- MONGODB_REPLICA_SET_MODE=arbiter | |
- MONGODB_INITIAL_PRIMARY_HOST=api-backend-db-primary | |
- MONGODB_INITIAL_PRIMARY_PORT_NUMBER=27017 | |
- MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD=password123 | |
- MONGODB_REPLICA_SET_KEY=replicasetkey123 | |
networks: | |
- vpc | |
networks: | |
vpc: | |
volumes: | |
mongodb_master_data: | |
driver: local |
This file contains hidden or 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
FROM node:14 | |
WORKDIR /usr/src/app | |
ARG NPM_TOKEN | |
COPY .npmrc .npmrc | |
COPY package*.json ./ | |
RUN npm install | |
COPY . . | |
RUN rm -f .npmrc | |
env MONGO_URI=mongodb://pguser:12345@api-backend-db-primary:27017/dev_staging?replicaSet=replicaset | |
EXPOSE 3000 | |
cmd npm start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment