From 13dd220ef2f7f0d889fe09da98589b6f7dcf3f80 Mon Sep 17 00:00:00 2001 From: Chris Trevino Date: Mon, 6 Dec 2021 11:14:08 -0800 Subject: [PATCH] update docker-compose settings --- .devcontainer/docker-compose.yml | 2 ++ packages/api/config/codespaces.json | 8 ++++++++ packages/api/config/default.json | 8 ++++---- packages/api/config/development.json | 8 -------- packages/api/config/integration.json | 4 ++++ packages/api/config/production.json | 4 ++++ packages/api/docker-compose.yml | 7 ++++++- packages/api/package.json | 7 ++++--- 8 files changed, 32 insertions(+), 16 deletions(-) create mode 100644 packages/api/config/codespaces.json delete mode 100644 packages/api/config/development.json diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 815e94b7..60ba2509 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -7,6 +7,8 @@ services: volumes: - .:/ws:cached command: /bin/sh -c "while sleep 1000; do :; done" + environment: + - 'NODE_CONFIG_ENV=codespaces' links: - mongodb diff --git a/packages/api/config/codespaces.json b/packages/api/config/codespaces.json new file mode 100644 index 00000000..105a299a --- /dev/null +++ b/packages/api/config/codespaces.json @@ -0,0 +1,8 @@ +{ + "db": { + "automigrate": true, + "seedMockData": true, + "seedConnectionString": "mongodb://mongodb:27017", + "connectionString": "mongodb://mongodb:27017" + } +} diff --git a/packages/api/config/default.json b/packages/api/config/default.json index ae438492..31eb130c 100644 --- a/packages/api/config/default.json +++ b/packages/api/config/default.json @@ -13,10 +13,10 @@ "pretty": true }, "db": { - "connectionString": "mongodb://mongodb:27017", - "seedConnectionString": "mongodb://mongodb:27017", - "automigrate": false, - "seedMockData": false, + "automigrate": true, + "seedMockData": true, + "seedConnectionString": "mongodb://localhost:27017", + "connectionString": "mongodb://localhost:27017", "database": "greenlight", "usersCollection": "users", "organizationsCollection": "organizations", diff --git a/packages/api/config/development.json b/packages/api/config/development.json deleted file mode 100644 index b594c1ed..00000000 --- a/packages/api/config/development.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "db": { - "automigrate": true, - "seedMockData": true, - "seedConnectionString": "mongodb://localhost:27017", - "connectionString": "mongodb://localhost:27017" - } -} diff --git a/packages/api/config/integration.json b/packages/api/config/integration.json index 4afc7ef0..4cb56e3d 100644 --- a/packages/api/config/integration.json +++ b/packages/api/config/integration.json @@ -9,5 +9,9 @@ }, "security": { "jwtSecret": null + }, + "db": { + "automigrate": false, + "seedMockData": false } } diff --git a/packages/api/config/production.json b/packages/api/config/production.json index f304b606..2b58ac80 100644 --- a/packages/api/config/production.json +++ b/packages/api/config/production.json @@ -14,5 +14,9 @@ }, "security": { "jwtSecret": null + }, + "db": { + "automigrate": false, + "seedMockData": false } } diff --git a/packages/api/docker-compose.yml b/packages/api/docker-compose.yml index a91e1416..fb2619cc 100644 --- a/packages/api/docker-compose.yml +++ b/packages/api/docker-compose.yml @@ -1,11 +1,16 @@ +# +# compose file for local env - +# spins up a database instance for the app to use +# version: '3' services: - mongodb_3616: + mongodb: image: mongo:4.0.27 ports: - '27017:27017' volumes: - dbvolume:/data environment: { AUTH: 'no' } + volumes: dbvolume: {} diff --git a/packages/api/package.json b/packages/api/package.json index 5f79ae18..0a304ca2 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -5,9 +5,10 @@ "license": "MIT", "scripts": { "clean": "essex clean .version dist/ deploy.zip", - "start": "docker-compose up -d && NODE_CONFIG_ENV='development' DEBUG='cbosuite:*' nodemon src/index.ts", - "start:api": "yarn start", - "start:api:static": "docker-compose up -d && NODE_CONFIG_ENV='development' DEBUG='cbosuite:*' yarn node dist/src/index.js", + "start_db": "docker-compose up -d ", + "start_api": "DEBUG='cbosuite:*' nodemon src/index.ts", + "start:api": "yarn start_db && yarn start_api", + "start:api:static": "yarn start_db && DEBUG='cbosuite:*' yarn node dist/src/index.js", "build": "run-s compile write_deploy_package", "build:api": "yarn build", "archive": "./scripts/archive.sh",