Using Docker

We highly recommend using Docker's Compose feature, to ensure the database is in the same container group as the MoR container.

This is an example docker-compose.yml file for running MoR with the database content stored in the db_data directory beside the compose file:

name: mall

services:
  postgres:
    image: postgres:16-alpine
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    pids_limit: 100
    read_only: true
    tmpfs:
      - /tmp
      - /var/run/postgresql
    volumes:
      - ./db_data:/var/lib/postgresql/data
    environment:
      - TZ
      - POSTGRES_USER
      - POSTGRES_PASSWORD
      - POSTGRES_DB

  website:
    depends_on:
      - postgres
    image: registry.atwilcox.tech/infrastructure/mall:latest
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    pids_limit: 100
    environment:
      - TZ
      - RAILS_MASTER_KEY
      - DATABASE_URL
      - IDP_SSO_URL
    volumes:
      - ./idp.pem:/srv/mall/config/idp.pem
    ports:
      - 127.0.0.1:4000:3000

The idp.pem file should be provided by your SAML provider.

In the .env file, you will need to specify the database credentials, the Rails master key, and timezone. For example:

TZ=America/Chicago

POSTGRES_USER=merchant
POSTGRES_PASSWORD=MySeKureP4ssphras3
POSTGRES_DB=merchant_production

DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
RAILS_MASTER_KEY=generate one!!!!

IDP_SSO_URL=https://auth.mynewstore.example/realms/store/protocol/saml/clients/mall