This guide walks through installing Cookifed directly on a Linux server, running it with Ruby, PostgreSQL and Redis installed on the host.

If you’d rather run Cookifed as containers, see Running in Docker instead.

Requirements

  • Ruby 4.0.7
  • PostgreSQL 17 or higher
  • Redis
  • Node.js and Yarn, to build the JavaScript and CSS assets

Download the source

Clone the repository and check out the version you want to run. We recommend running the latest release rather than main:

git clone https://codeberg.org/cookifed/cookifed.git
cd cookifed
git checkout v0.1.1

Installing Ruby

Since most Linux distributions only ship older Ruby versions, use rbenv to install the version required by Cookifed.

For apt-based distributions:

sudo apt install rbenv

Otherwise see the rbenv installation instructions.

Install the ruby-build plugin and set up shell integration:

mkdir -p ~/.rbenv/plugins
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc

From the Cookifed directory, install the pinned Ruby version:

rbenv install

Installing Ruby dependencies

Configure bundler to install gems into a user-writable directory, then install them. Use deployment mode and skip the development and test groups, since this is a production install:

bundle config set --local path '~/.local/share/gem'
bundle config set --local deployment true
bundle config set --local without 'development test'
bundle install

Installing Node.js, Yarn and building assets

Install Node.js (see the download instructions if your distribution’s version is too old) and Yarn (see the Yarn install instructions).

Then install JavaScript dependencies and precompile the assets:

yarn install --frozen-lockfile
RAILS_ENV=production SECRET_KEY_BASE=$(bin/rails secret) bundle exec rake assets:precompile

Installing Redis

sudo apt install redis
sudo systemctl enable --now redis-server

If you’re not using an apt-based system, use your distribution’s package manager instead.

Installing PostgreSQL

If your distribution only ships PostgreSQL 16 or older, add the official PGDG repository, see the official documentation:

sudo apt install curl ca-certificates
sudo install -d /usr/share/postgresql-common/pgdg
sudo curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
sudo sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt update
sudo apt install postgresql-17

Create a database user for Cookifed:

sudo -u postgres psql -c "CREATE USER cookifed WITH PASSWORD 'your_password' CREATEDB;"

Configuring the app

You configure Cookifed through environment variables or a YAML config file. See Configure the app for the full list of values.

A production install needs:

RAILS_ENV=production
SECRET_KEY_BASE=<a long random value, e.g. the output of `bin/rails secret`>
DATABASE_URL=postgres://cookifed:your_password@127.0.0.1:5432/cookifed_production
REDIS_URL=redis://127.0.0.1:6379/0
INSTANCE_HOST=your-domain.example
FORCE_SSL=true

Note: FORCE_SSL assumes Cookifed sits behind an SSL-terminating reverse proxy (such as nginx or Caddy). Set RAILS_SERVE_STATIC_FILES=true only if that proxy doesn’t already serve the public/ directory for you.

Export these in the environment you’ll use to run the app, or write them to a .env file and load it with your process manager.

Preparing the database

Create the database, run migrations and seed the initial data (this also creates the Instance record for your INSTANCE_HOST):

bin/rails db:prepare
bin/rails db:seed

Running the app

Cookifed needs two long-running processes: the Puma web server and a Sidekiq worker for background jobs.

bundle exec puma -C config/puma.rb
bundle exec sidekiq

A minimal systemd setup could look like this:

# /etc/systemd/system/cookifed-web.service
[Unit]
Description=Cookifed web
After=network.target postgresql.service redis.service

[Service]
Type=simple
User=cookifed
WorkingDirectory=/home/cookifed/cookifed
EnvironmentFile=/home/cookifed/cookifed/.env
ExecStart=/home/cookifed/.rbenv/shims/bundle exec puma -C config/puma.rb
Restart=on-failure

[Install]
WantedBy=multi-user.target

Duplicate this unit for cookifed-sidekiq, replacing the ExecStart command with bundle exec sidekiq.

Once both services are running, Cookifed is reachable on the port configured by Config.port (3000 by default). Put a reverse proxy in front of it to handle SSL and forward requests to that port.

Upgrading

To upgrade to a newer release, fetch the new tag, reinstall dependencies, rebuild assets, run migrations, then restart both services:

git fetch --tags
git checkout v<new-version>
bundle install
yarn install --frozen-lockfile
RAILS_ENV=production SECRET_KEY_BASE=$(bin/rails secret) bundle exec rake assets:precompile
bin/rails db:migrate
sudo systemctl restart cookifed-web cookifed-sidekiq