Using Docker

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

This is an example docker-compose.yml file for running RR 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
      - MALL_DOMAIN
    volumes:
      - ./log:/srv/mall/log
    ports:
      - 127.0.0.1:4000:3000

You'll need to provide a production.yml.enc file and a production.key which are Rails credential files. More information about working with Rails credentials can be found in the Rails Guides.

An example, decrypted production.yml.enc is below:

sso:
  idp_url: https://keycloak/realms/mycorp/protocol/saml/clients/retail
  idp_cert: |
    the certificate should be here.
facebook:
  secret_key: Facebook Key here
apple:
  bundle_id: your.apple.bundle.id
  key_id: apple_key
  team_id: apple_team
  p8_content: |
    the key should be here.
paypal:
  client_id: client_id
  client_secret: ENC_secret
stripe:
  api_key: sk_test_...
database:
  host: postgres-retail
  database: db_prod
  username: username
  password: your password here
secret_key_base: ...