Multi-Image MySQL
DevNote: Describe this configuration; how many/what services it runs and things like that. |
docker-compose.yaml
version: '3.5'
services:
server:
image: cortezaproject/corteza:${VERSION}
restart: always
env_file: [ .env ]
depends_on: [ db ]
networks: [ proxy, internal ]
# Uncomment to use local fs for data persistence
volumes: [ "./data/server:/data" ]
environment:
# This two are needed only if you are using NginX Lets-Encrypt companion
# (see docs.cortezaproject.org for details)
# VIRTUAL_HOST helps NginX proxy route traffic for specific virtual host to this container
VIRTUAL_HOST: ${DOMAIN}
# LETSENCRYPT_HOST helps NginX LE companion pull and configure SSL certificates for your domain
LETSENCRYPT_HOST: ${DOMAIN}
db:
# MySQL Database
# See https://hub.docker.com/r/percona/percona-server for details
image: percona:8.0
restart: always
volumes: [ "./data/db:/var/lib/mysql" ]
environment:
MYSQL_DATABASE: dbname
MYSQL_USER: dbuser
MYSQL_PASSWORD: dbpass
# get the random generated password by running: docker-compose logs db | grep "GENERATED ROOT PASSWORD"
MYSQL_RANDOM_ROOT_PASSWORD: random
healthcheck: { test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"], timeout: 20s, retries: 10 }
networks: [ internal ]
networks:
internal: {}
proxy: { external: true }
.env
########################################################################################################################
# docker-compose supports environment variable interpolation/substitution in compose configuration file
# (more info: https://docs.docker.com/compose/environment-variables)
########################################################################################################################
# General settings
DOMAIN=your-demo.example.tld
VERSION=2022.3.0
########################################################################################################################
# Database connection
DB_DSN=dbuser:dbpass@tcp(db:3306)/dbname?collation=utf8mb4_general_ci
########################################################################################################################
# Server settings
# Serve Corteza webapps alongside API
HTTP_WEBAPP_ENABLED=true
# Send action log to container logs as well
# ACTIONLOG_DEBUG=true
# Uncomment for extra debug info if something goes wrong
# LOG_LEVEL=debug
# Use nicer and colorful log instead of JSON
# LOG_DEBUG=true
########################################################################################################################
# Authentication
# Secret to use for JWT token
# Make sure you change it (>30 random characters) if
# you expose your deployment to outside traffic
# AUTH_JWT_SECRET=this-is-only-for-demo-purpose--make-sure-you-change-it-for-production
########################################################################################################################
# SMTP (mail sending) settings
# Point this to your local or external SMTP server if you want to send emails.
# In most cases, Corteza can detect that SMTP is disabled and skips over sending emails without an error
#SMTP_HOST=smtp-server.example.tld:587
#SMTP_USER=postmaster@smtp-server.example.tld
#SMTP_PASS=this-is-your-smtp-password
#SMTP_FROM='"Demo" <info@your-demo.example.tld>'