ERROR: Service "nginx-proxy" uses an undefined network "proxy"

Hi,

I’m trying to install a production instance on Oracle Cloud for a Linux 7.9 setup, I already installed docker, docker compose and Nginx directory as well but I get a ERROR: Service “nginx-proxy” uses an undefined network “proxy”. :smiling_face_with_tear:

Everything went well as I was following the production video guide:
How to set up a production instance of Corteza - YouTube

I see in the video im directed to click on the link download on cortezaproject.org and then on “setting up the nginx proxy” i dont see that option so i clicked on the “online deployment” which took me here: Single-Image with MySQL Database :: Corteza Docs
or here Single-Image with PostgreSQL Database :: Corteza Docs

But I dont see the “custum.conf” section so I searched for “NGINX” on Devops guide and came to this link:
DevOps Guide :: Corteza Docs which does have the custom.conf as described in the video. (this was after I was directed to the more updated release: " You are reading the documentation for an outdated Corteza release. 2022.3 is the latest stable Corteza release."

So I copied the docker-compose.yaml and the .env aswell as the custom.conf from this link Single-Image with MySQL Database :: Corteza Docs when running my commands on Gitbash, please see the last few lines of code where I get error and now im stuck dont know how to proceed:

Installed:
  docker-engine.x86_64 0:19.03.11.ol-13.el7

Dependency Installed:
  container-selinux.noarch 2:2.119.2-1.911c772.el7_8
  containerd.x86_64 0:1.4.8-1.el7
  criu.x86_64 0:3.12-2.el7
  docker-cli.x86_64 0:19.03.11.ol-13.el7
  libnet.x86_64 0:1.1.6-7.el7
  protobuf-c.x86_64 0:1.0.2-3.el7
  runc.x86_64 3:1.1.1-1.el7

Complete!
[opc@free-docker-runner ~]$ sudo systemctl start docker
[opc@free-docker-runner ~]$ sudo systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[opc@free-docker-runner ~]$ docker -v
Docker version 19.03.11-ol, build 9bb540d
[opc@free-docker-runner ~]$ docker-compose -v
-bash: docker-compose: command not found
[opc@free-docker-runner ~]$ sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 11.2M  100 11.2M    0     0  16.7M      0 --:--:-- --:--:-- --:--:-- 16.7M
[opc@free-docker-runner ~]$ sudo chmod +x /usr/local/bin/docker-compose
[opc@free-docker-runner ~]$ docker-compose --version
docker-compose version 1.23.2, build 1110ad01
[opc@free-docker-runner ~]$ docker-compose -v
docker-compose version 1.23.2, build 1110ad01
[opc@free-docker-runner ~]$ mkdir nginx
[opc@free-docker-runner ~]$ cd nginx
[opc@free-docker-runner nginx]$ vi docker-compose.yaml
[opc@free-docker-runner nginx]$ vi custom.conf
[opc@free-docker-runner nginx]$ docker-compose up -d
ERROR: Service "nginx-proxy" uses an undefined network "proxy"
[opc@free-docker-runner nginx]$

:wave: Please help me… :woozy_face:

Kind Regards,
Richard

1 Like

hi Rich3art

i’ve also had some trouble with the docs about it, if you look here
Link
There’s the link to how i managed, basically the docker-images used in the docs is outdated

so try to follow this
github

let me know if this will help you

1 Like

Hi Cromalde,

Thank you for your reply, honnestly speaking i havent tried what you mentioned here but im also abit confused to where i start with this process you mentioned here?

Will that be after I install docker, docker compose do i then install using nginx these steps? And then after that continue with the steps to install Corteza?

I’m so sorry, im still in the infant stages whe. It comes to coding i know the basic stuff.

Is there a way you can create a instance for me or meaby schedule a TeamViewer session if you dont mind to help me install the production instance?

Hi Rich3art

so you just have to follow that instruction on gitHub Instead of the nginx-proxy part (on the Docs).

so you install docker, install compose, and inside the “corteza-nginx”.yaml you use that image referred in GitHub, simply because the one in the documentation is old images that is actually merged into the new one on GH.

For reference, this is my (working) docker-compose.yaml inside the nginx folder

ersion: '3.5'

services:
  nginx-proxy:
    image: nginxproxy/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-acme:
    image: nginxproxy/acme-companion
    container_name: nginx-acme
    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
      - acme:/etc/acme.sh
# volume declaration
volumes:
  acme:
# Create network if it does not exist
networks: { proxy: { name: proxy } }
~                                     

The directory three is something like that :

 ~ 
   /corteza
                 /docker-compose.yaml 
                 /.env 
                 /corredor/
   /nginx 
              /docker-compose.yaml
              custom.conf

Hope that helps

2 Likes

Hi Cromalde,

Thanks for the effort and help, I really appreciate it.

I have done what you said i installed docker + d compose and then moved over to install the images on github and also created the docker-compose.yaml file just like your example here above but still came into an eror when running docker up -d. I then decided to delete all the containers and instead just after docker + d compose instalation i copied your docker-compose.yaml contents and successfully ran the docker up -d command.

I finished installing nginx inside nginx folder (as your guide here) and then also pulled corteza project sucessfully, I’ve also changed my domains dns settings to point the the public IP address of the server im hosting the docker etc on but when i search my domain name it still shows this site cant be reched. I used a Cname record and also tried a A record but somewhere Im doing something wrong, I will share the contents of my diff files:

Oky this is my process thus far please help me:

Oky im using Ubuntu so after logging into my server I’m not allowed to log in as root so i just enterred the command sudo su which gives me root access

This is my file structure:
corteza-production = (.env + docker-compose.yaml)
nginx = (custom.conf + docker-compose.yaml)

This is my custom.conf file inside my nginx folder:

# Make sure we can upload at least 200Mb files
client_max_body_size    200M;

# Add other custom configs.

This is my docker-compose.yaml inside nginx folder:

nginx-proxy:
    image: nginxproxy/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-acme:
    image: nginxproxy/acme-companion
    container_name: nginx-acme
    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
      - acme:/etc/acme.sh
# volume declaration
volumes:
  acme:
# Create network if it does not exist
networks: { proxy: { name: proxy } }

After this i ran the comand docker-compose up -d and everything was fine. I then exited the folder and enterred into corteza-production folder

This is my .env file inside corteza-production folder:

########################################################################################################################
# docker-compose supports environment variable interpolation/substitution in compose configuration file
# (more info: https://docs.docker.com/compose/environment-variables)

########################################################################################################################
# General settings
DOMAIN=fakeportal.online
VERSION=2022.3.0

########################################################################################################################
# Database connection

DB_DSN=postgres://corteza:corteza@db:5432/corteza?sslmode=disable

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

########################################################################################################################
# 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.gmail.com:465
SMTP_USER=fakemail@gmail.com
SMTP_PASS=fakepassword123
SMTP_FROM='"Richard" <fakemail@gmail.com>'

This is my docker-compose.yaml file inside corteza-production folder:

version: '3.5'

services:
  server:
    image: cortezaproject/corteza:${VERSION}
    networks: [ proxy, internal ]
    restart: always
    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 https://hub.docker.com/_/postgres for details
    image: postgres:13
    networks: [ internal ]
    restart: always
    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 }

After this I ran docker-compose up -d and everything was up and running.
I then changed my domains cname record

But even after 24 hours I still get: “the site cant be reached”

Please help me as to where am I going wrong?

Really appreciate it

Kind Regards,
Richard

Hi,

This sounds like there might be either a misconfig on the DNS server. Are you able to confirm the URL and Public IP are correctly routed? There potentially could be an issue with the reverse proxy requests reaching the container. Have you followed and installed the Nginx reverse proxy package?
Please see link in docs where this is mentioned for production instances.
https://docs.cortezaproject.org/corteza-docs/2022.3/devops-guide/system-requirements.html#_domain_and_hostname

Here is a video tutorial(a little outdated) on how to install Corteza in production:

On a side note rather try using the latest version when installing. I see you are behind a couple of patch releases in your config. 2022.3.4 would be the latest I believe with the 2022.9 release coming at the end of the month.

1 Like