ci(docker): use docker compose yaml anchor values and extension fields
This commit is contained in:
parent
786937f847
commit
ff8b22274f
|
@ -13,11 +13,15 @@
|
|||
"extensions": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode", "lokalise.i18n-ally"],
|
||||
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
"forwardPorts": [3000, 3100, 3200, 5432],
|
||||
"forwardPorts": [80, 5432],
|
||||
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
"postCreateCommand": "pnpm install",
|
||||
|
||||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||
"remoteUser": "node"
|
||||
"remoteUser": "node",
|
||||
|
||||
"features": {
|
||||
"docker-from-docker": "latest"
|
||||
}
|
||||
}
|
||||
|
|
21
.env.example
21
.env.example
|
@ -1,12 +1,14 @@
|
|||
# Global
|
||||
# Shared
|
||||
TZ=UTC
|
||||
PUBLIC_URL=http://localhost
|
||||
PUBLIC_SERVER_URL=http://localhost/api
|
||||
PUBLIC_GOOGLE_CLIENT_ID=
|
||||
|
||||
# Server
|
||||
SECRET_KEY=
|
||||
PUBLIC_URL=http://<SERVER-IP>
|
||||
POSTGRES_HOST=localhost
|
||||
POSTGRES_HOST=postgres
|
||||
POSTGRES_PORT=5432
|
||||
POSTGRES_USERNAME=postgres
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=postgres
|
||||
POSTGRES_DATABASE=postgres
|
||||
POSTGRES_SSL_CERT=
|
||||
|
@ -20,12 +22,5 @@ SENDGRID_FORGOT_PASSWORD_TEMPLATE_ID=
|
|||
SENDGRID_FROM_NAME=
|
||||
SENDGRID_FROM_EMAIL=
|
||||
|
||||
# Client
|
||||
PUBLIC_URL=http://<SERVER-IP>
|
||||
PUBLIC_SERVER_URL=http://<SERVER-IP>/api
|
||||
PUBLIC_GOOGLE_CLIENT_ID=
|
||||
|
||||
# Postgres
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=postgres
|
||||
POSTGRES_DATABASE=postgres
|
||||
# Flags
|
||||
PUBLIC_FLAG_DISABLE_SIGNUPS=false
|
|
@ -1,71 +0,0 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:14.2-alpine
|
||||
container_name: postgres
|
||||
ports:
|
||||
- 5432:5432
|
||||
env_file: .env
|
||||
volumes:
|
||||
- ./scripts/database/initialize.sql:/docker-entrypoint-initdb.d/initialize.sql
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres" ]
|
||||
interval: 30s
|
||||
timeout: 30s
|
||||
start_period: 15s
|
||||
retries: 3
|
||||
restart: always
|
||||
|
||||
traefik:
|
||||
image: traefik
|
||||
container_name: traefik
|
||||
command:
|
||||
- --providers.docker=true
|
||||
- --providers.docker.exposedbydefault=false
|
||||
- --entrypoints.web.address=:80
|
||||
ports:
|
||||
- 80:80
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
|
||||
server:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: server/Dockerfile
|
||||
container_name: server
|
||||
env_file: .env
|
||||
environment:
|
||||
- PUBLIC_URL=http://localhost
|
||||
- POSTGRES_HOST=postgres
|
||||
- POSTGRES_DATABASE=reactive_resume
|
||||
depends_on:
|
||||
- traefik
|
||||
- postgres
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.http.routers.server.entrypoints=web
|
||||
- traefik.http.routers.server.rule=Host(`localhost`) && PathPrefix(`/api/`)
|
||||
- traefik.http.routers.server.middlewares=server-stripprefix
|
||||
- traefik.http.middlewares.server-stripprefix.stripprefix.prefixes=/api
|
||||
- traefik.http.middlewares.server-stripprefix.stripprefix.forceslash=true
|
||||
|
||||
client:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: client/Dockerfile
|
||||
container_name: client
|
||||
env_file: .env
|
||||
environment:
|
||||
- PUBLIC_SERVER_URL=http://localhost/api
|
||||
depends_on:
|
||||
- traefik
|
||||
- server
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.http.routers.client.rule=Host(`localhost`)
|
||||
- traefik.http.routers.client.entrypoints=web
|
||||
|
||||
volumes:
|
||||
pgdata:
|
|
@ -1,22 +1,46 @@
|
|||
version: '3'
|
||||
|
||||
x-env-shared: &env-shared
|
||||
environment:
|
||||
- TZ=UTC
|
||||
- PUBLIC_URL=http://localhost
|
||||
- PUBLIC_SERVER_URL=http://localhost/api
|
||||
- PUBLIC_GOOGLE_CLIENT_ID=
|
||||
|
||||
x-env-server: &env-server
|
||||
environment:
|
||||
- SECRET_KEY=
|
||||
- POSTGRES_HOST=postgres
|
||||
- POSTGRES_PORT=5432
|
||||
- POSTGRES_USER=postgres
|
||||
- POSTGRES_PASSWORD=postgres
|
||||
- POSTGRES_DATABASE=postgres
|
||||
- POSTGRES_SSL_CERT=
|
||||
- JWT_SECRET=
|
||||
- JWT_EXPIRY_TIME=604800
|
||||
- PUBLIC_GOOGLE_CLIENT_ID=
|
||||
- GOOGLE_CLIENT_SECRET=
|
||||
- GOOGLE_API_KEY=
|
||||
- SENDGRID_API_KEY=
|
||||
- SENDGRID_FORGOT_PASSWORD_TEMPLATE_ID=
|
||||
- SENDGRID_FROM_NAME=
|
||||
- SENDGRID_FROM_EMAIL=
|
||||
|
||||
x-env-flags: &env-flags
|
||||
environment:
|
||||
- PUBLIC_FLAG_DISABLE_SIGNUPS=false
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:14.2-alpine
|
||||
container_name: postgres
|
||||
ports:
|
||||
- 5432:5432
|
||||
environment:
|
||||
- POSTGRES_USER="postgres"
|
||||
- POSTGRES_PASSWORD="postgres"
|
||||
- POSTGRES_DATABASE="postgres"
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres" ]
|
||||
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
|
||||
start_period: 15s
|
||||
interval: 30s
|
||||
timeout: 30s
|
||||
start_period: 15s
|
||||
retries: 3
|
||||
restart: always
|
||||
|
||||
|
@ -35,32 +59,15 @@ services:
|
|||
server:
|
||||
image: amruthpillai/reactive-resume:server-latest
|
||||
container_name: server
|
||||
environment:
|
||||
- TZ="UTC"
|
||||
- SECRET_KEY=""
|
||||
- PUBLIC_URL="http://<SERVER-IP>"
|
||||
- POSTGRES_HOST="postgres"
|
||||
- POSTGRES_PORT="5432"
|
||||
- POSTGRES_USERNAME="postgres"
|
||||
- POSTGRES_PASSWORD="postgres"
|
||||
- POSTGRES_DATABASE="postgres"
|
||||
- POSTGRES_SSL_CERT=""
|
||||
- JWT_SECRET=""
|
||||
- JWT_EXPIRY_TIME="604800"
|
||||
- PUBLIC_GOOGLE_CLIENT_ID=""
|
||||
- GOOGLE_CLIENT_SECRET=""
|
||||
- GOOGLE_API_KEY=""
|
||||
- SENDGRID_API_KEY="" # Optional
|
||||
- SENDGRID_FORGOT_PASSWORD_TEMPLATE_ID="" # Optional
|
||||
- SENDGRID_FROM_NAME="" # Optional
|
||||
- SENDGRID_FROM_EMAIL="" # Optional
|
||||
<<: *env-shared
|
||||
<<: *env-server
|
||||
depends_on:
|
||||
- traefik
|
||||
- postgres
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.http.routers.server.entrypoints=web
|
||||
- traefik.http.routers.server.rule=Host(`<SERVER-IP>`) && PathPrefix(`/api/`)
|
||||
- traefik.http.routers.server.rule=Host(`localhost`) && PathPrefix(`/api/`)
|
||||
- traefik.http.routers.server.middlewares=server-stripprefix
|
||||
- traefik.http.middlewares.server-stripprefix.stripprefix.prefixes=/api
|
||||
- traefik.http.middlewares.server-stripprefix.stripprefix.forceslash=true
|
||||
|
@ -69,17 +76,14 @@ services:
|
|||
client:
|
||||
image: amruthpillai/reactive-resume:client-latest
|
||||
container_name: client
|
||||
environment:
|
||||
- TZ="UTC"
|
||||
- PUBLIC_URL="http://<SERVER-IP>"
|
||||
- PUBLIC_SERVER_URL="http://<SERVER-IP>/api"
|
||||
- PUBLIC_GOOGLE_CLIENT_ID=""
|
||||
<<: *env-shared
|
||||
<<: *env-flags
|
||||
depends_on:
|
||||
- traefik
|
||||
- server
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.http.routers.client.rule=Host(`<SERVER-IP>`)
|
||||
- traefik.http.routers.client.rule=Host(`localhost`)
|
||||
- traefik.http.routers.client.entrypoints=web
|
||||
restart: always
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ This URL is used when export PDF functionality is used within the app and has to
|
|||
**Default Value:** `5432`
|
||||
**Description:** Port of the PostgreSQL Server
|
||||
|
||||
### `POSTGRES_USERNAME`
|
||||
### `POSTGRES_USER`
|
||||
|
||||
**Required**: `yes`
|
||||
**Default Value:** `postgres`
|
||||
|
|
|
@ -21,7 +21,7 @@ const validationSchema = Joi.object({
|
|||
// Database
|
||||
POSTGRES_HOST: Joi.string().required(),
|
||||
POSTGRES_PORT: Joi.number().default(5432),
|
||||
POSTGRES_USERNAME: Joi.string().required(),
|
||||
POSTGRES_USER: Joi.string().required(),
|
||||
POSTGRES_PASSWORD: Joi.string().required(),
|
||||
POSTGRES_DATABASE: Joi.string().required(),
|
||||
POSTGRES_SSL_CERT: Joi.string().allow(''),
|
||||
|
|
|
@ -3,7 +3,7 @@ import { registerAs } from '@nestjs/config';
|
|||
export default registerAs('postgres', () => ({
|
||||
host: process.env.POSTGRES_HOST,
|
||||
port: parseInt(process.env.POSTGRES_PORT, 10) || 5432,
|
||||
username: process.env.POSTGRES_USERNAME,
|
||||
username: process.env.POSTGRES_USER,
|
||||
password: process.env.POSTGRES_PASSWORD,
|
||||
database: process.env.POSTGRES_DATABASE,
|
||||
certificate: process.env.POSTGRES_SSL_CERT,
|
||||
|
|
Loading…
Reference in New Issue