2024-10-29 Setting Up Corteza for Pointegrity

I have created a quick landing page for Pointegrity, which is only a static website accepting no user interaction. I'd like to allow people to submit forms either as guests or members. Corteza seems to provide required capability and more, so I'd like to find out if I can use it as the backbone to support user management and CRM in the future.

Installation

Visit Corteza and find the DevOp Guide. Following the instruction, create a folder for the container:

mkdir pi-corteza
cd pi-corteza

According to Online Deployment, we can setup an Nginx reverse proxy along-side with Corteza. Since I am using NPM which also handle SSL certificates, I can skip this and set up the containers for Corteza directly. Create docker-compose.yaml:

networks:
  internal: {}
  mynet:
    name: mynet
    external: true

services:
  corteza:
    image: cortezaproject/corteza:${VERSION}
    networks: [ mynet, internal ]
    restart: unless-stopped
    env_file: [ .env ]
    depends_on: [ db ]
    volumes: [ "./data/server:/data" ]
    expose:
      - 80
    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
    # Support for postgres 13, 14 and 15 is available in the latest version of Corteza
    image: postgres:15
    networks: [ internal ]
    restart: unless-stopped
    healthcheck: { test: ["CMD-SHELL", "pg_isready -U corteza"], interval: 10s, timeout: 5s, retries: 5 }
    volumes: [ "./data/db:/var/lib/postgresql/data" ]
    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

Note that

  • The LETSENCRYPT_HOST: ${DOMAIN} entry is still needed, or the client-side code will not work properly.
  • The volumes: [ "./data/db:/var/lib/postgresql/data" ] entry is also added, which seems to be needed to persist data between restarts.
  • The network mynet uses the one from NPM container.

Also create the .env file:

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

########################################################################################################################
# General settings
DOMAIN=<domain>
VERSION=2023.9

########################################################################################################################
# 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
# use tr -dc A-Za-z0-9 </dev/urandom | head -c 32; echo
AUTH_JWT_SECRET=<...somesecret...>

########################################################################################################################
# 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_USER=<...>
SMTP_PASS=<...>
SMTP_FROM=<...>
  • I use tr -dc A-Za-z0-9 </dev/urandom | head -c 32; echo to generate the required secret key.
  • The SMTP settings are similar to which when setting up Ghost.

After the container started and ready, I visit the website and get:

After creating the first user, verified via e-mail, I get:

For now, I just go to the Admin Area and disable signup in Auth Settings.

Because it is still fairly new to me and there are more experiments to do, like how to process forms for guests, this site will be disabled for a while.