Skip to content

Commit

Permalink
feat: set docker to production environment (#25)
Browse files Browse the repository at this point in the history
* feat: set docker to production environment

* fix: cleanup package.json scripts

* docs: update README.md
  • Loading branch information
nicolaspearson authored Nov 30, 2021
1 parent 78b2808 commit 7480e9f
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ yarn workspace svc-consents test:integration

The project can also be built and started using docker:

> Note: Using docker will start the services in production mode, which excludes database fixtures.
```bash
# Build the package using docker
yarn workspace svc-consents docker:build
Expand Down
6 changes: 3 additions & 3 deletions consents.http
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@baseUrl = http://localhost:3000/v1/consents
@token = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1dWlkIjoiNjA2MjU4MjUtNGJjNS00YjUzLWJlNmYtNzNkMDkwZjNmMzRiIiwiaWF0IjoxNjM4MTk3MTkzLCJleHAiOjE2MzgxOTgwOTMsImlzcyI6InN1cHBvcnRAZ3Jhbml0ZS5jb20iLCJqdGkiOiI5ZTRmZWU0OC01MDMyLTRkNjktODI0Ni1kODRkY2E2MTdlN2IifQ.PSquNTiSPPpR0n84KgBlB04gU_kfkoyjAm5N1AakQ8I
@token = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1dWlkIjoiNWMyNzY3ZjktN2QzYy00NmEzLWIwZTMtNmI1NzNhYWY5MDNjIiwiaWF0IjoxNjM4MjUxMDMxLCJleHAiOjE2MzgyNTE5MzEsImlzcyI6InN1cHBvcnRAZ3Jhbml0ZS5jb20iLCJqdGkiOiJjNDBjOGVkNC1lMDY1LTRlNGEtOGVmMi03Njg5Nzc3ODUxYjgifQ.Ci4uXe_-k0ez1Q0zqlPx3LdAR8Rza2_VEJxel2qECWw

########################################################################
########### AUTH ###########
Expand Down Expand Up @@ -27,7 +27,7 @@ Authorization: Bearer {{token}}

{
"id": "email_notifications",
"enabled": false
"enabled": true
}

########################################################################
Expand Down Expand Up @@ -61,6 +61,6 @@ Accept: application/json
Content-Type: application/json

{
"email": "alex[email protected]",
"email": "john[email protected]",
"password": "secret"
}
3 changes: 2 additions & 1 deletion db/scripts/docker-bootstrap.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-- The database is created by the docker-compose.yaml
SET search_path TO postgres;
CREATE EXTENSION IF NOT EXISTS pgcrypto;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

-- Create the schemas
CREATE SCHEMA IF NOT EXISTS consents;
3 changes: 3 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:
#########################

svc-consents:
image: granite-svc-consents:latest
build:
args:
PACKAGE: svc-consents
Expand All @@ -20,6 +21,8 @@ services:
environment:
- API_HOST=0.0.0.0
- API_PORT=3000
- ENVIRONMENT=production
- NODE_ENV=production
- TYPEORM_DATABASE=granite
- TYPEORM_HOST=db
- TYPEORM_PASSWORD=secret
Expand Down
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,24 @@
"clean": "yarn clean:jest && yarn clean:yarn",
"db:attach": "yarn exec:docker-compose exec db psql granite-db granite",
"db:attach:integration": "yarn exec:docker-compose exec db-integration psql granite-db-integration granite",
"db:logs:integration": "yarn exec:docker-compose logs -f db-integration",
"db:logs": "yarn exec:docker-compose logs -f db",
"db:start:integration": "yarn exec:docker-compose up -d --force-recreate db-integration",
"db:logs:integration": "yarn exec:docker-compose logs -f db-integration",
"db:start": "yarn exec:docker-compose up -d --force-recreate db",
"db:start:integration": "yarn exec:docker-compose up -d --force-recreate db-integration",
"db:stop": "docker-compose rm -f -s -v db",
"db:stop:integration": "docker-compose rm -f -s -v db-integration",
"doctor": "yarn dlx @yarnpkg/doctor .",
"exec:docker-compose": "docker-compose -f docker-compose.yaml",
"exec:eslint": "eslint --cache",
"exec:jest": "jest --coverage --color --forceExit --runInBand",
"exec:prettier": "prettier",
"exec:script:generate-migration": "./shell/generate-migration.sh",
"exec:ts-node": "ts-node -T -r tsconfig-paths/register",
"exec:tsc": "tsc",
"lint:markdown": "markdownlint -c markdownlint.yaml $(find . -name '*.md' -not -path './.yarn/*')",
"lint:yaml": "yamllint -d yamllint.yaml .",
"lint": "yarn lint:markdown && yarn lint:yaml",
"postinstall": "husky install",
"prettier:fix": "prettier --config .prettierrc --no-editorconfig --write packages/**/*.ts",
"prettier": "prettier --config .prettierrc --no-editorconfig --check packages/**/*.ts",
"postinstall": "husky install"
"prettier": "prettier --config .prettierrc --no-editorconfig --check packages/**/*.ts"
},
"dependencies": {
"@commitlint/cli": "^15.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/svc-consents/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "svc-consents",
"private": true,
"version": "0.0.0",
"description": "The consent management service",
"description": "The consent management service.",
"keywords": [
"backend"
],
Expand Down

0 comments on commit 7480e9f

Please sign in to comment.