cmc/cleberg.net

My personal web garden & blog.

clone: git clone https://gitbay.org/cmc/cleberg.net.git

main: content/blog/2025-01-23-self-hosting-tandoor.org · raw

  1#+date:        [2025-01-23 Thu 20:44:45]
  2#+title:       Self-Hosting Guide: Tandoor
  3#+description: Self-hosting Tandoor, an open-source recipe manager.
  4#+slug:        self-hosting-tandoor
  5#+filetags:    :linux:self-hosting:
  6
  7* Overview
  8
  9[[https://tandoor.dev/][Tandoor]] is a smart recipe manager web application that allows you to:
 10- Store your recipes
 11- Search for recipes and ingredients
 12- Share recipes with a link and permission system
 13- Put recipes and ingredients into a shopping list
 14- Plan your meals with a built-in calendar
 15- Calculate nutritional values
 16- Import recipes from websites and apps
 17- Load existing recipes
 18
 19* Installation
 20
 21[[https://docs.tandoor.dev/][The Tandoor docs]] contain all of the relevant information needed to get start
 22with the self-hosting process.
 23
 24This tutorial will use Docker Compose and Nginx on Ubuntu 24.04.1.
 25
 26** Docker Compose
 27
 28On your machine, create a directory for Tandoor and copy down the =.env= and
 29=docker-compose.yml= templates:
 30
 31#+begin_src shell
 32mkdir ~/tandoor cd ~/tandoor wget
 33https://raw.githubusercontent.com/vabene1111/recipes/develop/.env.template -O .env wget
 34# Plain version of docker-compose.yml
 35https://raw.githubusercontent.com/vabene1111/recipes/develop/docs/install/docker/plain/docker-compose.yml
 36#+end_src
 37
 38Within these files, customize as needed.
 39- =.env=
 40  - Add a =SECRET_KEY=
 41  - Define the =ALLOWED_HOSTS=
 42  - Set the =POSTGRES_PASSWORD=
 43- =docker-compose.yml=
 44  - Update the =ports= since Nginx on my host is already using port 80 (e.g.
 45    =8087:80=)
 46
 47Once you've updated and saved the files, you can launch the container.
 48
 49#+begin_src shell
 50sudo docker compose up -d
 51#+end_src
 52
 53The application is now available at =localhost:8087= or =ip_address:8087= if
 54accessing via a different machine. If accessing via a different machine,
 55remember to allow port =8087= through any existing firewalls.
 56
 57** Nginx Reverse Proxy
 58
 59Now that Tandoor is available locally, let's connect it to the Nginx web server
 60running on the host machine.
 61
 62#+begin_quote
 63Note: I use Nginx configuration files within the =conf.d= directory, but you may
 64need to use the =sites-available= directory, depending on your installation of
 65Nginx.
 66#+end_quote
 67
 68#+begin_src shell
 69cd /etc/nginx/conf.d/
 70sudo nano recipes.conf
 71#+end_src
 72
 73Within this file, define your website configuration. The example below is my
 74default configuration and utilizes a wildcard certificate for =*.example.com=
 75that covers all of my subdomains. If you don't have a wildcard certificate, you
 76will need to generate an SSL certificate for your domain.
 77
 78#+begin_src config
 79server {
 80        listen                  443 ssl;
 81        listen                  [::]:443 ssl;
 82        http2                   on;
 83        server_name             recipes.example.com;
 84
 85        # SSL
 86        ssl_certificate         /etc/letsencrypt/live/example.com/fullchain.pem;
 87        ssl_certificate_key     /etc/letsencrypt/live/example.com/privkey.pem;
 88        ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
 89
 90        # reverse proxy
 91        location / {
 92                proxy_pass         http://localhost:8087/;
 93                proxy_set_header   Host $http_host;
 94                proxy_set_header   X-Forwarded-Proto $scheme;
 95                proxy_redirect http://127.0.0.1:8080 https://recipes.example.com;
 96        }
 97
 98        location /media/ {
 99                root   /media/;
100                index  index.html index.htm;
101        }
102}
103
104# HTTP redirect
105server {
106        listen      80;
107        listen      [::]:80;
108        server_name recipes.example.com;
109        include     custom.d/letsencrypt.conf;
110
111        if ($host ~ ^[^.]+\.example\.com$) {
112                return 301 https://$host$request_uri;
113        }
114}
115#+end_src
116
117Save and close the configuration file and then restart the web server.
118
119#+begin_src shell
120sudo systemctl restart nginx.service
121#+end_src
122
123The app is now available on your custom domain!
124
125** Screenshots
126
127#+caption: Login
128#+attr_html: :alt Tandoor login page.
129[[https://img.cleberg.net/blog/20250123-self-hosting-tandoor/login.webp]]
130
131#+caption: Recipes
132#+attr_html: :alt Tandoor options to search for recipes.
133[[https://img.cleberg.net/blog/20250123-self-hosting-tandoor/recipes.webp]]
134
135#+caption: Meal Plan
136#+attr_html: :alt Calendar view to define meal plans.
137[[https://img.cleberg.net/blog/20250123-self-hosting-tandoor/mealplan.webp]]
138
139#+caption: Shopping Lists
140#+attr_html: :alt Page to create or search for shopping lists.
141[[https://img.cleberg.net/blog/20250123-self-hosting-tandoor/shopping.webp]]
142
143#+caption: Cook Book
144#+attr_html: :alt Page to create a visual-style cookbook.
145[[https://img.cleberg.net/blog/20250123-self-hosting-tandoor/cookbook.webp]]
146
147#+caption: Import
148#+attr_html: :alt Options to import recipes from other pages and auto-populate images, keywords, steps, and a description.
149[[https://img.cleberg.net/blog/20250123-self-hosting-tandoor/import.webp]]
150
151#+caption: Administration Panel
152#+attr_html: :alt Django administration options for the web app.
153[[https://img.cleberg.net/blog/20250123-self-hosting-tandoor/admin.webp]]