Back in August 2022, the hosting provider Heroku announced that they would no longer offer a free tier for hosting web applications. This was understandable, but inconvenient, because I have been using Heroku to host Geneac since before Geneac was Geneac (sound Familiar?)

Anyway, I decided to make the switch to full-AWS for my own personal Geneac instance. To do this, I’ve created two EC2 hosts: one for the Postgres database and Redis, and one to host Geneac itself in Docker containers. I installed postgres and redis on the first host with yum and configured the network security to disallow access from outside the AWS VPC. Then, on the second host, I have a docker-compose.yml that looks like this:

version: '3'

services:
  prod-web:
    image: ghcr.io/mrysav/geneac:latest
    command: ['sh', '/usr/bin/rails_web.sh']
    ports:
      - '3001:3001'
    env_file: docker.prod.env
  
  prod-worker:
    image: ghcr.io/mrysav/geneac:latest
    command: ['sh', '/usr/bin/rails_worker.sh']
    env_file: docker.prod.env

The docker.prod.env file contains everything that Geneac needs to run, such as database credentials:

# AWS credentials: obviously don't commit these anywhere
AWS_ACCESS_KEY_ID=
AWS_REGION=
AWS_SECRET_ACCESS_KEY=
S3_BUCKET_NAME=

# Database credentials, host, and port
DATABASE_URL=
REDIS_URL=

# Configurable options for the host you're running on
HOSTNAME=my-hostname
MAILER_HOSTNAME=my-hostname
MAILER_SENDER=no-reply@my-hostname

# Misc. application options for tuning performance and behavior
PORT=3001
NODE_ENV=production
RACK_ENV=production
RAILS_ENV=production
RAILS_LOG_TO_STDOUT=enabled
RAILS_MAX_THREADS=3
RAILS_SERVE_STATIC_FILES=enabled
WEB_CONCURRENCY=2
DISABLE_SPRING=1
BUNDLE_WITHOUT=development:test
LOG_LEVEL=INFO

# Generate these with `rake secret`
SECRET_KEY_BASE=

Originally, I ran Postgres and Redis as containers in docker-compose.yml as well, but since I wanted to run on the smallest EC2 hosts possible, I found I was frequently running out of memory and space. Additionally, running containerized databases meant that migrating between hosts was a pain since I had to dump the database from a volume and restore it on a new host. I could have paid for AWS RDS, but it is too expensive for what I want to do. So, I just moved the databases to a cheap ARM instance and kept the Docker containers on their own host.

I’m bummed that I am no longer running Geneac for free, but so far I am liking the setup! It is fun to see the Geneac Docker container in production use. I attempted to use Docker in the original Familiar setup, but I really had no idea what I was doing and it was a mess.

The official documentation has been updated to reflect that Heroku is no longer the primary supported target, and contains instructions for deploying with Docker.