Installation of corteza in production

Hi
I folleowed the video on youtube that describe the installation of corteza in a production environment. So i respected all the step except the domaine name in .env file that i replaced with my public IP adress as i don’t have a domaine yet. So when i finish the tutorial, i could not reach my corteza App, Only the Nginx shows with error code 502.
Im an using ubuntu 20.04 and i did only install docker and docker compose.
I did not install MySQL on my production environment also.
Can you please advise me a solution

Hi @bouba

Setting up Corteza in the production environment requires some technical skills and a little bit of experience with networking.

I doubt that replacing your public IP in the .env will achieve the effect you wish.

Can you share your config files here?
Did you use nginx proxy in front of Corteza?

If you get 502 from Nginx I’m pretty sure Nginx can not connect to it for some reason - might b best if you inspect the logs.

Hi,
Thank you for your reply . I set up Nginx proxy after creating of folder named nginx and run the container with docker-compose up -d.
find the configuration of .env file or which specific conf file do you need ?

########################################################################################################################
# General settings
DOMAIN=194.163.xx.xx
VERSION=2021.3

########################################################################################################################
# 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=<redacted>

I’ve took the liberty and edited your post a bit, putting the .env into backticks and redacted your JWT secret (change it asap anyway).

DOMAIN should contain your domain.
The rest look ok.

Can you share your docker-compose.yaml files. Both of them - corteza & nginx.

Hi,
Thank you for the reply , here are both docker-compose.yaml files

corteza yaml file

version: ‘3.5’

services:
server:
image: cortezaproject/corteza-server:${VERSION}
networks: [ proxy, internal ]
restart: on-failure
env_file: [ .env ]
depends_on: [ db ]
volumes: [ “./data/server:/data” ]
environment:
# VIRTUAL_HOST helps NginX proxy route traffic for specific virtual host to
# this container
# This value is also picked up by initial boot auto-configuration procedure
# If this is changed, make sure you change settings accordingly
VIRTUAL_HOST: ${DOMAIN}
# This is needed only if you are using NginX Lets-Encrypt companion
# (see docs.cortezaproject.org for details)
LETSENCRYPT_HOST: ${DOMAIN}

db:
# PostgreSQL Database
# See Docker Hub for details
image: postgres:13
networks: [ internal ]
restart: on-failure
healthcheck: { test: [“CMD-SHELL”, “pg_isready -U corteza”], interval: 10s, timeout: 5s, retries: 5 }
environment:
# Warning: these are values that are only used on 1st start
# if you want to change it later, you need to do that
# manually inside db container
POSTGRES_USER: corteza
POSTGRES_PASSWORD: corteza

networks:
internal: {}
proxy: { external: true }

NGINX compose yaml file

version: ‘3.5’

services:
nginx-proxy:
image: jwilder/nginx-proxy
container_name: nginx-proxy
restart: always
networks:
- proxy
ports:
- “80:80”
- “443:443”
labels:
- “com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy”
volumes:
- ./certs:/etc/nginx/certs
- ./htpasswd:/etc/nginx/htpasswd
- ./vhost.d:/etc/nginx/vhost.d
- ./html:/usr/share/nginx/html
- ./custom.conf:/etc/nginx/conf.d/custom.conf:ro
- /var/run/docker.sock:/tmp/docker.sock:ro

nginx-letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: nginx-letsencrypt
restart: always
depends_on:
- nginx-proxy
volumes:
- ./certs:/etc/nginx/certs
- ./vhost.d:/etc/nginx/vhost.d
- ./html:/usr/share/nginx/html
- /var/run/docker.sock:/var/run/docker.sock:ro

Create network if it does not exist

networks: { proxy: { name: proxy } }

I see you’re trying to format your post, this might help you:
https://commonmark.org/help/

Thanks for the tips.

Hello, Any feedback ?

It Finally works after I restarted all containers.
Thank you

1 Like