Browse Source

refactor(docker-compose): formatting

pull/4237/head
Wing-Kam Wong 2 years ago
parent
commit
6430f72acb
  1. 48
      docker-compose/mssql/docker-compose.yml
  2. 61
      docker-compose/mysql/docker-compose.yml
  3. 98
      docker-compose/nginx-proxy-manager/docker-compose.yml
  4. 126
      docker-compose/nginx/docker-compose.yml
  5. 45
      docker-compose/pg/docker-compose.yml
  6. 203
      docker-compose/traefik/docker-compose.yml

48
docker-compose/mssql/docker-compose.yml

@ -1,33 +1,31 @@
version: '2.4' version: "2.4"
services:
services: nocodb:
root_db: depends_on:
image: mcr.microsoft.com/mssql/server:2017-latest root_db:
condition: service_healthy
environment:
NC_DB: "mssql://root_db:1433?u=sa&p=Password123.&d=root_db"
image: "nocodb/nocodb:latest"
ports:
- "8080:8080"
restart: always restart: always
volumes: volumes:
- db_data:/var/opt/mssql - "nc_data:/usr/app/data"
environment: root_db:
environment:
ACCEPT_EULA: "Y"
SA_PASSWORD: Password123. SA_PASSWORD: Password123.
ACCEPT_EULA: Y healthcheck:
healthcheck:
test: /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$$SA_PASSWORD" -Q "SELECT 1" || exit 1
interval: 10s interval: 10s
timeout: 3s
retries: 10 retries: 10
start_period: 10s start_period: 10s
test: "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P \"$$SA_PASSWORD\" -Q \"SELECT 1\" || exit 1"
nocodb: timeout: 3s
depends_on: image: "mcr.microsoft.com/mssql/server:2017-latest"
root_db:
condition: service_healthy
image: nocodb/nocodb:latest
ports:
- "8080:8080"
restart: always restart: always
volumes: volumes:
- nc_data:/usr/app/data - "db_data:/var/opt/mssql"
environment: volumes:
NC_DB: "mssql://root_db:1433?u=sa&p=Password123.&d=root_db"
volumes:
db_data: {} db_data: {}
nc_data: {} nc_data: {}

61
docker-compose/mysql/docker-compose.yml

@ -1,36 +1,39 @@
version: '2.1' version: "2.1"
services:
services: nocodb:
root_db: depends_on:
image: mysql:5.7 root_db:
volumes: condition: service_healthy
- db_data:/var/lib/mysql environment:
# below line shows how to change charset and collation NC_DB: "mysql2://root_db:3306?u=noco&p=password&d=root_db"
# uncomment it if necessary image: "nocodb/nocodb:latest"
# command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci ports:
- "8080:8080"
restart: always restart: always
environment: volumes:
MYSQL_ROOT_PASSWORD: password - "nc_data:/usr/app/data"
root_db:
environment:
MYSQL_DATABASE: root_db MYSQL_DATABASE: root_db
MYSQL_USER: noco
MYSQL_PASSWORD: password MYSQL_PASSWORD: password
healthcheck: MYSQL_ROOT_PASSWORD: password
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ] MYSQL_USER: noco
timeout: 20s healthcheck:
retries: 10 retries: 10
test:
nocodb: - CMD
depends_on: - mysqladmin
root_db: - ping
condition: service_healthy - "-h"
image: nocodb/nocodb:latest - localhost
ports: timeout: 20s
- "8080:8080" image: "mysql:5.7"
restart: always restart: always
volumes: volumes:
- nc_data:/usr/app/data - "db_data:/var/lib/mysql"
environment: # below line shows how to change charset and collation
NC_DB: "mysql2://root_db:3306?u=noco&p=password&d=root_db" # uncomment it if necessary
volumes: # command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
volumes:
db_data: {} db_data: {}
nc_data: {} nc_data: {}

98
docker-compose/nginx-proxy-manager/docker-compose.yml

@ -1,58 +1,58 @@
version: '2.1' version: '2.1'
networks:
services: default: ~
root_db: nginxproxy: ~
image: mysql:5.7 services:
volumes: nginx-proxy-manager:
- db_data:/var/lib/mysql environment:
restart: always
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: root_db
MYSQL_USER: noco
MYSQL_PASSWORD: password
healthcheck:
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
timeout: 20s
retries: 10
networks:
- default
nocodb:
depends_on:
root_db:
condition: service_healthy
image: nocodb/nocodb:latest
restart: always
volumes:
- nc_data:/usr/app/data
environment:
NC_DB: "mysql2://root_db:3306?u=noco&p=password&d=root_db"
networks:
- default
- nginxproxy
nginx-proxy-manager:
image: jlesage/nginx-proxy-manager
restart: always
environment:
PUID: 1000
PGID: 1000 PGID: 1000
PUID: 1000
TZ: Europe/Amsterdam TZ: Europe/Amsterdam
ports: image: jlesage/nginx-proxy-manager
networks:
- nginxproxy
ports:
- "8181:8181" - "8181:8181"
- "80:8080" - "80:8080"
- "443:4443" - "443:4443"
volumes: restart: always
- nginx-proxy-manager:/config:rw volumes:
networks: - "nginx-proxy-manager:/config:rw"
nocodb:
depends_on:
root_db:
condition: service_healthy
environment:
NC_DB: "mysql2://root_db:3306?u=noco&p=password&d=root_db"
image: "nocodb/nocodb:latest"
networks:
- default
- nginxproxy - nginxproxy
restart: always
volumes: volumes:
nginx-proxy-manager: {} - "nc_data:/usr/app/data"
root_db:
environment:
MYSQL_DATABASE: root_db
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: password
MYSQL_USER: noco
healthcheck:
retries: 10
test:
- CMD
- mysqladmin
- ping
- "-h"
- localhost
timeout: 20s
image: "mysql:5.7"
networks:
- default
restart: always
volumes:
- "db_data:/var/lib/mysql"
volumes:
db_data: {} db_data: {}
nc_data: {} nc_data: {}
nginx-proxy-manager: {}
networks:
default:
nginxproxy:

126
docker-compose/nginx/docker-compose.yml

@ -1,68 +1,66 @@
version: '3.9' version: "3.9"
networks:
networks: backend:
frontend: external: false
external: false frontend:
backend: external: false
external: false
# This is an example setup with an Nginx reverse proxy. # This is an example setup with an Nginx reverse proxy.
# If you already have an Nginx reverse proxy running, # If you already have an Nginx reverse proxy running,
# then allow the docker-compose.yml to reference an external network that the reverse proxy container is on # then allow the docker-compose.yml to reference an external network that the reverse proxy container is on
# (in lieu of the frontend network in this file) and have the NocoDB container connect to it. # (in lieu of the frontend network in this file) and have the NocoDB container connect to it.
services:
services: certbot:
reverse_proxy: command: "certonly --webroot --webroot-path=/var/www/html --email user@example.domain --agree-tos --no-eff-email -d example.domain,www.example.domain,nocodb.example.domain"
image: nginx:alpine container_name: certbot
container_name: reverse_proxy depends_on:
volumes: - reverse_proxy
- ./certbot:/etc/letsencrypt:ro # SSL certs image: certbot/certbot
- ./nginx:/etc/nginx # Nginx config file volumes:
- path/to/webroot:/usr/share/nginx/html # Mount directory web site files for webroot certificate validation with Certbot - "./certbot:/etc/letsencrypt"
ports: - "path/to/webroot:/var/www/html" # For webroot certificate validation
- 80:80 nocodb_app:
- 443:443 container_name: nocodb_app
restart: unless-stopped depends_on:
networks: - nocodb_database
- frontend environment:
NC_AUTH_JWT_SECRET: "${NC_AUTH_JWT_SECRET}"
certbot: # while it is not good practice to use the Root user,
image: certbot/certbot # there were issues with granting privileges to a new user using the Linux server MariaDB image.
container_name: certbot NC_DB: "mysql2://nocodb_database:3306?u=root&p=${MYSQL_ROOT_PASSWORD}&d=${MYSQL_DATABASE}"
volumes: NC_PUBLIC_URL: "${NC_PUBLIC_URL}"
- ./certbot:/etc/letsencrypt image: "nocodb/nocodb:latest"
- path/to/webroot:/var/www/html # For webroot certificate validation networks:
depends_on: - backend
- reverse_proxy - frontend
command: certonly --webroot --webroot-path=/var/www/html --email user@example.domain --agree-tos --no-eff-email -d example.domain,www.example.domain,nocodb.example.domain restart: unless-stopped
volumes:
nocodb_app: - "./nocodb/data:/usr/app/data"
image: nocodb/nocodb:latest nocodb_database:
container_name: nocodb_app container_name: nocodb_database
restart: unless-stopped environment:
volumes: - MYSQL_ROOT_PASSWORD
- ./nocodb/data:/usr/app/data - MYSQL_DATABASE
networks: - MYSQL_USER
- backend - MYSQL_PASSWORD
- frontend # using the non-official MariaDB image
environment: # because it is an alpine distro and has a considerably smaller footprint
NC_DB: mysql2://nocodb_database:3306?u=root&p=${MYSQL_ROOT_PASSWORD}&d=${MYSQL_DATABASE} # While it is not good practice to use the Root user, there were issues with granting privileges to a new user using the Linuxserver MariaDB image. image: "ghcr.io/linuxserver/mariadb:alpine"
NC_PUBLIC_URL: ${NC_PUBLIC_URL} networks:
NC_AUTH_JWT_SECRET: ${NC_AUTH_JWT_SECRET} - backend
depends_on: restart: always
- nocodb_database volumes:
- "./mariadb/config:/config"
nocodb_database: - "./mariadb/data:/var/lib/mysql"
image: ghcr.io/linuxserver/mariadb:alpine # Using the non-official MariaDB image because it is an alpine distro and has a considerably smaller footprint. reverse_proxy:
container_name: nocodb_database container_name: reverse_proxy
volumes: image: "nginx:alpine"
- ./mariadb/config:/config networks:
- ./mariadb/data:/var/lib/mysql - frontend
networks: ports:
- backend - "80:80"
restart: always - "443:443"
environment: restart: unless-stopped
- MYSQL_ROOT_PASSWORD volumes:
- MYSQL_DATABASE - "./certbot:/etc/letsencrypt:ro" # SSL certs
- MYSQL_USER - "./nginx:/etc/nginx" # Nginx config file
- MYSQL_PASSWORD - "path/to/webroot:/usr/share/nginx/html" # Mount directory web site files for webroot certificate validation with Certbot

45
docker-compose/pg/docker-compose.yml

@ -1,32 +1,31 @@
version: '2.1' version: '2.1'
services:
services: nocodb:
root_db: depends_on:
image: postgres root_db:
condition: service_healthy
environment:
NC_DB: "pg://root_db:5432?u=postgres&p=password&d=root_db"
image: "nocodb/nocodb:latest"
ports:
- "8080:8080"
restart: always restart: always
volumes: volumes:
- db_data:/var/lib/postgresql/data - "nc_data:/usr/app/data"
environment: root_db:
environment:
POSTGRES_DB: root_db
POSTGRES_PASSWORD: password POSTGRES_PASSWORD: password
POSTGRES_USER: postgres POSTGRES_USER: postgres
POSTGRES_DB: root_db healthcheck:
healthcheck:
test: pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"
interval: 10s interval: 10s
timeout: 2s
retries: 10 retries: 10
nocodb: test: "pg_isready -U \"$$POSTGRES_USER\" -d \"$$POSTGRES_DB\""
depends_on: timeout: 2s
root_db: image: postgres
condition: service_healthy
image: nocodb/nocodb:latest
ports:
- "8080:8080"
restart: always restart: always
volumes: volumes:
- nc_data:/usr/app/data - "db_data:/var/lib/postgresql/data"
environment: volumes:
NC_DB: "pg://root_db:5432?u=postgres&p=password&d=root_db"
volumes:
db_data: {} db_data: {}
nc_data: {} nc_data: {}

203
docker-compose/traefik/docker-compose.yml

@ -1,107 +1,102 @@
version: "3.7" version: "3.7"
networks:
networks: traefik_proxy:
traefik_proxy: name: traefik_proxy
name: traefik_proxy services:
nocodb:
volumes: container_name: nocodb
letsencrypt: depends_on:
- nocodb-db
environment:
- "NC_DB=pg://nocodb-db:5432?u=${DATABASE_USER}&p=${DATABASE_PW}&d=${DATABASE_NAME}"
- "NC_PUBLIC_URL=https://nocodb.${DOMAINNAME}"
- NC_DISABLE_TELE=true
image: "nocodb/nocodb:latest"
labels:
- traefik.enable=true
- traefik.http.services.nocodb.loadbalancer.server.port=8080
- "traefik.http.routers.nocodb.rule=Host(`nocodb.${DOMAINNAME}`)"
- traefik.http.routers.nocodb.entrypoints=https
- com.centurylinklabs.watchtower.enable=true
networks:
- traefik_proxy
restart: always
volumes:
- "nocodb-data:/usr/app/data"
nocodb-db:
container_name: nocodb-db
environment:
POSTGRES_DB: "${DATABASE_NAME}"
POSTGRES_PASSWORD: "${DATABASE_PW}"
POSTGRES_USER: "${DATABASE_USER}"
healthcheck:
interval: 10s
retries: 10
test: "pg_isready -U ${DATABASE_USER} -d ${DATABASE_NAME}"
timeout: 2s
image: "postgres:12.1-alpine"
networks:
- traefik_proxy
restart: always
volumes:
- "nocodb-db:/var/lib/postgresql/data"
traefik:
command:
- "--providers.docker=true"
- "--ping=true"
- "--ping.entryPoint=ping"
- "--providers.docker.exposedbydefault=false"
- "--providers.docker.network=traefik_proxy"
- "--entryPoints.ping.address=:8081"
- "--entrypoints.http.address=:80"
- "--entrypoints.https.address=:443"
- "--entrypoints.https.http.tls.certresolver=letsencrypt"
- "--entrypoints.https.http.tls.domains[0].main=${DOMAINNAME}"
- "--entrypoints.https.http.tls.domains[0].sans=*.${DOMAINNAME}"
- "--entrypoints.http.http.redirections.entryPoint.to=https"
- "--entrypoints.http.http.redirections.entryPoint.scheme=https"
- "--certificatesresolvers.letsencrypt.acme.dnsChallenge.delayBeforeCheck=15"
- "--certificatesresolvers.letsencrypt.acme.dnschallenge.provider=cloudflare"
- "--certificatesresolvers.letsencrypt.acme.email=info@${DOMAINNAME}"
- "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json"
- "--certificatesResolvers.letsencrypt.acme.dnsChallenge.resolvers=1.1.1.1:53,1.0.0.1:53"
container_name: traefik
environment:
- "CF_DNS_API_TOKEN=${CLOUDFLARE_TOKEN}"
healthcheck:
retries: 3
test:
- CMD
- wget
- "-c"
- "http://localhost:8081/ping"
timeout: 3s
image: "traefik:v2.2"
networks:
- default
- traefik_proxy
ports:
- "80:80"
- "443:443"
restart: always
volumes:
- "letsencrypt:/letsencrypt"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
watchtower:
command: "--schedule \"0 5 * * *\" --cleanup --label-enable"
container_name: watchtower
image: containrrr/watchtower
labels:
- com.centurylinklabs.watchtower.enable=true
networks:
- traefik_proxy
restart: always
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
volumes:
letsencrypt:
name: traefik-letsencrypt name: traefik-letsencrypt
nocodb-db: nocodb-data:
name: nocodb-db
nocodb-data:
name: nocodb-data name: nocodb-data
nocodb-db:
services: name: nocodb-db
traefik:
image: traefik:v2.2
container_name: traefik
restart: always
command:
#- "--log.level=DEBUG"
- "--providers.docker=true"
- "--ping=true"
- "--ping.entryPoint=ping"
- "--providers.docker.exposedbydefault=false"
- "--providers.docker.network=traefik_proxy"
- "--entryPoints.ping.address=:8081"
- "--entrypoints.http.address=:80"
- "--entrypoints.https.address=:443"
- "--entrypoints.https.http.tls.certresolver=letsencrypt"
- "--entrypoints.https.http.tls.domains[0].main=${DOMAINNAME}"
- "--entrypoints.https.http.tls.domains[0].sans=*.${DOMAINNAME}"
- "--entrypoints.http.http.redirections.entryPoint.to=https"
- "--entrypoints.http.http.redirections.entryPoint.scheme=https"
- "--certificatesresolvers.letsencrypt.acme.dnsChallenge.delayBeforeCheck=15"
- "--certificatesresolvers.letsencrypt.acme.dnschallenge.provider=cloudflare"
- "--certificatesresolvers.letsencrypt.acme.email=info@${DOMAINNAME}"
- "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json"
- "--certificatesResolvers.letsencrypt.acme.dnsChallenge.resolvers=1.1.1.1:53,1.0.0.1:53"
environment:
- CF_DNS_API_TOKEN=${CLOUDFLARE_TOKEN}
healthcheck:
test: ["CMD", "wget", "-c", "http://localhost:8081/ping"]
timeout: 3s
retries: 3
networks:
- default
- traefik_proxy
ports:
- "80:80"
- "443:443"
volumes:
- "letsencrypt:/letsencrypt"
- /var/run/docker.sock:/var/run/docker.sock:ro
watchtower:
image: containrrr/watchtower
container_name: watchtower
restart: always
networks:
- traefik_proxy
command: --schedule "0 5 * * *" --cleanup --label-enable
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
labels:
- "com.centurylinklabs.watchtower.enable=true"
nocodb:
container_name: nocodb
image: nocodb/nocodb:latest
restart: always
volumes:
- nocodb-data:/usr/app/data
networks:
- traefik_proxy
environment:
- NC_DB=pg://nocodb-db:5432?u=${DATABASE_USER}&p=${DATABASE_PW}&d=${DATABASE_NAME}
- NC_PUBLIC_URL=https://nocodb.${DOMAINNAME}
- NC_DISABLE_TELE=true
labels:
- "traefik.enable=true"
- "traefik.http.services.nocodb.loadbalancer.server.port=8080"
- "traefik.http.routers.nocodb.rule=Host(`nocodb.${DOMAINNAME}`)"
- "traefik.http.routers.nocodb.entrypoints=https"
- "com.centurylinklabs.watchtower.enable=true"
depends_on:
- nocodb-db
nocodb-db:
image: postgres:12.1-alpine
container_name: nocodb-db
restart: always
networks:
- traefik_proxy
environment:
POSTGRES_USER: ${DATABASE_USER}
POSTGRES_PASSWORD: ${DATABASE_PW}
POSTGRES_DB: ${DATABASE_NAME}
volumes:
- nocodb-db:/var/lib/postgresql/data
healthcheck:
test: pg_isready -U ${DATABASE_USER} -d ${DATABASE_NAME}
interval: 10s
timeout: 2s
retries: 10

Loading…
Cancel
Save