How to Install Tandoor Recipes on Ubuntu 24.04 with Docker Compose

Estimated reading: 5 minutes 227 views

Introduction

Tandoor Recipes is a self-hosted recipe management platform that allows you to organize recipes, create meal plans, and manage shopping lists through a modern web interface.

In this guide, we will install Tandoor Recipes on Ubuntu 24.04 using Docker Compose, PostgreSQL, and Nginx. The application will be accessible through your server’s public IP address without requiring a domain name or SSL certificate.

By the end of this tutorial, Tandoor Recipes will be available at:

http://YOUR_SERVER_IP

Step 1: Connect to Your Server

Connect to your Ubuntu server using SSH.

Linux/macOS

ssh root@YOUR_SERVER_IP

Windows (PuTTY)

  1. Open PuTTY.
  2. Enter your server IP address.
  3. Click Open.
  4. Log in as root.

You are now ready to install Tandoor Recipes.

Step 2: Install Docker and Dependencies

Update the Package Index

Refresh the package database.

apt update

Install Required Packages

Install packages required to add external repositories.

apt install -y ca-certificates curl gnupg

Create the Docker Key Directory

Create a secure directory for Docker repository keys.

install -m 0755 -d /etc/apt/keyrings

Add Docker’s Official GPG Key

Download Docker’s official signing key.

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Set Proper Permissions

Allow the package manager to read the key.

chmod a+r /etc/apt/keyrings/docker.gpg

Add the Docker Repository

Add Docker’s stable repository to Ubuntu.

echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null

Update Package Information

Reload package information including the Docker repository.

apt update

Install Docker Engine and Docker Compose

Install Docker Engine and the Docker Compose plugin.

apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Verify the Installation

Confirm Docker Compose is installed correctly.

docker compose version

Example output:

Docker Compose version v2.x.x

Step 3: Create the Tandoor Project Directory

Create a dedicated directory for the application.

mkdir -p /opt/tandoor
cd /opt/tandoor

Step 4: Download and Configure the Environment File

Download the Environment Template

Download the default Tandoor environment file.

wget https://raw.githubusercontent.com/vabene1111/recipes/develop/.env.template -O .env

Generate a Secure Secret Key

Generate a random secret key for Django.

python3 -c "import secrets; print(secrets.token_urlsafe(50))"

Copy the generated value for the next step.

Edit the Environment File

Open the configuration file.

nano .env

Update the following values:

DEBUG=0

SECRET_KEY=YOUR_GENERATED_SECRET_KEY

POSTGRES_HOST=db_recipes
POSTGRES_PORT=5432
POSTGRES_USER=djangouser
POSTGRES_PASSWORD=StrongPassword123
POSTGRES_DB=djangodb

ALLOWED_HOSTS=*

Be sure to:

  • Replace SECRET_KEY with the generated key.
  • Replace POSTGRES_PASSWORD with a secure password.
  • Leave ALLOWED_HOSTS=* to allow access through the server IP address.

Save and exit the editor.

Step 5: Create the Docker Compose Configuration

Create the Docker Compose file.

nano docker-compose.yml

Paste the following configuration:

services:
  web_recipes:
    image: vabene1111/recipes:latest
    restart: always

    env_file:
      - ./.env

    volumes:
      - staticfiles:/opt/recipes/staticfiles
      - nginx_config:/opt/recipes/nginx/conf.d
      - ./mediafiles:/opt/recipes/mediafiles

    ports:
      - "8080:80"

    depends_on:
      - db_recipes

  db_recipes:
    image: postgres:15-alpine
    restart: always

    volumes:
      - ./postgresql:/var/lib/postgresql/data

    env_file:
      - ./.env

volumes:
  staticfiles:
  nginx_config:

Save and exit the editor.

Step 6: Start the Containers

Download the required images and start the containers.

docker compose up -d

Verify that the containers are running.

docker ps

You should see both the Tandoor and PostgreSQL containers running.

Step 7: Configure Nginx as a Reverse Proxy

Install Nginx

Install the Nginx web server.

apt install nginx -y

Create an Nginx Configuration File

Create a new virtual host configuration.

nano /etc/nginx/sites-available/tandoor.conf

Add the following configuration:

server {
    listen 80;
    server_name _;

    client_max_body_size 100M;

    location / {
        proxy_pass http://127.0.0.1:8080;

        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Save and exit the editor.

Enable the Configuration

Enable the newly created site.

ln -s /etc/nginx/sites-available/tandoor.conf /etc/nginx/sites-enabled/

Remove the Default Site

Disable the default Nginx configuration.

rm -f /etc/nginx/sites-enabled/default

Test the Configuration

Verify that the configuration is valid.

nginx -t

Example output:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Reload Nginx

Apply the configuration changes.

systemctl reload nginx

Step 8: Verify the Installation

Open your browser and navigate to:

http://YOUR_SERVER_IP

You should now see the Tandoor Recipes login page.

Step 9: Managing Tandoor Recipes

View Container Logs

Display application logs.

docker compose logs -f web_recipes

Display database logs.

docker compose logs -f db_recipes

Stop the Application

Stop all containers.

docker compose down

Start the Application

Start all containers.

docker compose up -d

Restart the Application

Restart the containers.

docker compose restart

Update Tandoor Recipes

Pull the latest container image.

docker compose pull

Recreate the containers using the updated image.

docker compose up -d

Conclusion

You have successfully installed Tandoor Recipes on Ubuntu 24.04 using Docker Compose, PostgreSQL, and Nginx. The application is now running inside Docker containers and can be accessed directly through your server’s public IP address without requiring a domain name or SSL certificate.

This deployment provides a simple and reliable self-hosted recipe management solution while allowing future upgrades and maintenance through Docker Compose.

Share this Doc

How to Install Tandoor Recipes on Ubuntu 24.04 with Docker Compose

Or copy link

CONTENTS