Basic setup for local demo
Provided configuration files for demo a few extra settings that enable it to run on a local environment. All services are on the same network, ports binded to host’s network, etc. This is not optimal setup for production environment. See [Nginx Proxy] and [Production deployment] below configuration examples that are more suited for production deployment. |
.env
# Version of Corteza Docker images
VERSION=2019.12.0
# Database connection
DB_DSN=corteza:change-me@tcp(db:3306)/corteza?collation=utf8mb4_general_ci
# 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-purpuses--make-sure-you-change-it-for-production
############################################################
# Only part of an documentation example
# In case you have other services running on your localhost,
# change these two numbers to an available port no.
LOCAL_DEMO_SPA_PORT=8080
LOCAL_DEMO_API_PORT=8081
LOCAL_DEMO_CRD_PORT=8082
docker-compose.yaml
version: '3.5'
services:
db:
image: percona:8.0
restart: on-failure
environment:
# To be picked up by percona image when creating the database
# Must match with DB_DSN settings inside .env
MYSQL_DATABASE: corteza
MYSQL_USER: corteza
MYSQL_PASSWORD: change-me
MYSQL_ROOT_PASSWORD: change-me-too
healthcheck: { test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"], timeout: 20s, retries: 10 }
server:
image: cortezaproject/corteza-server:${VERSION}
restart: on-failure
env_file: [ .env ]
environment:
# Informing Corredor where it he contact us
CORREDOR_API_BASE_URL_SYSTEM: "http://server:80/system"
CORREDOR_API_BASE_URL_MESSAGING: "http://server:80/messaging"
CORREDOR_API_BASE_URL_COMPOSE: "http://server:80/compose"
CORREDOR_ADDR: "corredor:${LOCAL_DEMO_CRD_PORT}"
depends_on: [ db, corredor ]
# Binds internal port 80 to port LOCAL_DEMO_API_PORT on localhost
ports: [ "127.0.0.1:${LOCAL_DEMO_API_PORT}:80" ]
corredor:
image: cortezaproject/corteza-server-corredor:${VERSION}
restart: on-failure
env_file: [ .env ]
environment:
# Informing Corredor where it he contact us
CORREDOR_ADDR: "corredor:${LOCAL_DEMO_CRD_PORT}"
# Binds internal port to port LOCAL_DEMO_CRD_PORT on localhost
ports: [ "127.0.0.1:${LOCAL_DEMO_CRD_PORT}:50051" ]
webapp:
image: cortezaproject/corteza-webapp:${VERSION}
restart: on-failure
depends_on: [ server ]
environment:
# Monolith server in the backend, all services can be found under one base URL
MONOLITH_API: 1
# Configure web application with API location
API_BASEURL: "127.0.0.1:${LOCAL_DEMO_API_PORT}"
# Binds internal port 80 to port LOCAL_DEMO_SPA_PORT on localhost
ports: [ "127.0.0.1:${LOCAL_DEMO_SPA_PORT}:80" ]
Some of the configuration lines in the provided YAML examples and files are written in a single line for brevity and simpler enabling/disabling (commenting-out). |
Create an empty directory, with .env
and docker-compose.yaml
files and copy contents from the examples above.
Some operating systems do not like files that start with a dot so make sure .env
file is properly named.
docker-compose up -d
docker-compose ps
should produce something like: Name Command State Ports
-----------------------------------------------------------------------------------------
basic_corredor_1 docker-entrypoint.sh node ... Up 127.0.0.1:8082->50051/tcp, 80/tcp
basic_db_1 /docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp
basic_server_1 /bin/corteza-server serve-api Up 127.0.0.1:8081->80/tcp
basic_webapp_1 /entrypoint.sh Up 127.0.0.1:8080->80/tcp
You can see 4 services up and running. Two of them are accessible on localhost (ports 8080 and 8081).
Direct your browser to http://localhost:8080
(use another port if you changed value for LOCAL_DEMO_SPA_PORT
).
On first visit, you should be redirected to /auth
where you can login, sign up, etc.
Create your account through the sign-up form. Corteza detects if the database is empty and auto-promotes first user to administration role.
docker-compose rm --force --stop -v
Other useful docker-compose commands:
docker-compose logs --follow --tail 20