In this section
On this page
Running in Docker
Cookifed publishes a container image for every release, plus a nightly build
off main. Run the latest release unless you specifically want to test an
unreleased change:
codeberg.org/cookifed/cookifed:v0.1.1
We tag nightly images nightly-<commit> and list them on the
package
page.
Requirements
The container only runs the Rails app (Puma) and Sidekiq. You still need:
- PostgreSQL 17 or higher
- Redis
Configuring the app
Cookifed reads its configuration from environment variables, see Configure the app for the full list. A production container needs at least:
RAILS_ENV=production
SECRET_KEY_BASE=<a long random value>
DATABASE_URL=postgres://cookifed:your_password@postgres:5432/cookifed_production
REDIS_URL=redis://redis:6379/0
INSTANCE_HOST=your-domain.example
FORCE_SSL=true
Generate a SECRET_KEY_BASE with:
docker run --rm codeberg.org/cookifed/cookifed:v0.1.1 bin/rails secret
Docker Compose
services:
postgres:
restart: always
image: postgres:18-alpine
networks:
- internal_network
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
volumes:
- ./data/postgres:/var/lib/postgresql
environment:
- 'POSTGRES_HOST_AUTH_METHOD=trust'
redis:
restart: always
image: redis:8-alpine
networks:
- internal_network
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
volumes:
- ./data/redis:/data
setup:
image: codeberg.org/cookifed/cookifed:v0.1.1
env_file: .env
networks:
- internal_network
depends_on:
postgres:
condition: service_healthy
entrypoint: ['bash', '-c', 'bundle exec rails db:prepare db:seed']
web:
image: codeberg.org/cookifed/cookifed:v0.1.1
restart: always
env_file: .env
command: bundle exec puma -C config/puma.rb
networks:
- external_network
- internal_network
ports:
- '127.0.0.1:3000:3000'
volumes:
- ./data/storage:/home/cookifed/storage
depends_on:
setup:
condition: service_completed_successfully
redis:
condition: service_healthy
sidekiq:
image: codeberg.org/cookifed/cookifed:v0.1.1
restart: always
env_file: .env
command: bundle exec sidekiq
networks:
- external_network
- internal_network
volumes:
- ./data/storage:/home/cookifed/storage
depends_on:
setup:
condition: service_completed_successfully
redis:
condition: service_healthy
networks:
external_network:
internal_network:
internal: trueWrite your configuration values from the previous section to .env, then
start the stack:
docker compose up -d
The setup service creates the database, runs migrations and seeds the
initial data (including the Instance record for your INSTANCE_HOST), then
exits. web and sidekiq wait for it to finish before starting.
Put a reverse proxy in front of the web container to handle SSL and
forward requests to port 3000.
Upgrading
Bump the image tag in your compose file to the new version, then:
docker compose pull
docker compose up -d setup
docker compose up -d
