TandoorRecipes / recipes

Application for managing recipes, planning meals, building shopping lists and much much more!
https://docs.tandoor.dev
Other
5.54k stars 583 forks source link

Error uploading recipes, timeouts & failures loading pages #3275

Closed mlabuhn closed 2 months ago

mlabuhn commented 2 months ago

Tandoor Version

1.5.19

Setup

Kubernetes

Reverse Proxy

Others (please state below)

Other

nginx ingress controller

Bug description

I am in the process of migrating applications from my Docker Swarm setup to a Kubernetes cluster in my home lab.

Tandoor recipes worked beautifully when running as a Docker stack, but is exhibiting strange behaviour in Kubernetes:

The Kubernetes configuration is as close as I can get to the Docker Swarm version, which does not have any of these problems; I am attaching abbreviated & sanitised versions of both for reference, along with the logs of the gunicorn pod. I am omitting the PostgreSQL setup, because that uses an external chart and appears to be working fine.

I have tried adjusting the amount of memory and CPU, tweaked the gunicorn start parameters, verified network connectivity from the pods and numerous other things, all of which turned out to be dead ends. I really don't know what else to try, so would appreciate some help figuring this out.

Relevant logs

[2024-08-28 11:42:13 +0000] [1] [DEBUG] Current configuration:
  access_log_format: %(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"
  accesslog: -
  backlog: 2048
  bind: ['0.0.0.0:9000']
  ca_certs: None
  capture_output: False
  cert_reqs: 0
  certfile: None
  chdir: /opt/recipes
  check_config: False
  child_exit: <function ChildExit.child_exit at 0x7f21d6badf80>
  ciphers: None
  config: /etc/gunicorn.conf.py
  daemon: False
  default_proc_name: recipes.wgsi
  disable_redirect_access_to_syslog: False
  do_handshake_on_connect: False
  dogstatsd_tags: 
  enable_stdio_inheritance: False
  errorlog: -
  forwarded_allow_ips: ['*']
  graceful_timeout: 30
  group: 0
  initgroups: False
  keepalive: 2
  keyfile: None
  limit_request_field_size: 8190
  limit_request_fields: 100
  limit_request_line: 4094
  logconfig: None
  logconfig_dict: {}
  logger_class: gunicorn.glogging.Logger
  loglevel: DEBUG
  max_requests: 0
  max_requests_jitter: 0
  nworkers_changed: <function NumWorkersChanged.nworkers_changed at 0x7f21d6bae200>
  on_exit: <function OnExit.on_exit at 0x7f21d6bae340>
  on_reload: <function OnReload.on_reload at 0x7f21d6bad300>
  on_starting: <function OnStarting.on_starting at 0x7f21d6bad1c0>
  paste: None
  pidfile: None
  post_fork: <function Postfork.post_fork at 0x7f21d6bad760>
  post_request: <function PostRequest.post_request at 0x7f21d6bade40>
  post_worker_init: <function PostWorkerInit.post_worker_init at 0x7f21d6bad8a0>
  pre_exec: <function PreExec.pre_exec at 0x7f21d6badc60>
  pre_fork: <function Prefork.pre_fork at 0x7f21d6bad620>
  pre_request: <function PreRequest.pre_request at 0x7f21d6badda0>
  preload_app: False
  print_config: False
  proc_name: None
  proxy_allow_ips: ['*']
  proxy_protocol: False
  pythonpath: None
  raw_env: []
  raw_paste_global_conf: []
  reload: False
  reload_engine: auto
  reload_extra_files: []
  reuse_port: False
  secure_scheme_headers: {'X-FORWARDED-PROTOCOL': 'ssl', 'X-FORWARDED-PROTO': 'https', 'X-FORWARDED-SSL': 'on'}
  sendfile: None
  spew: False
  ssl_version: 2
  statsd_host: None
  statsd_prefix: 
  strip_header_spaces: False
  suppress_ragged_eofs: True
  syslog: False
  syslog_addr: udp://localhost:514
  syslog_facility: user
  syslog_prefix: None
  threads: 1
  timeout: 120
  tmp_upload_dir: None
  umask: 0
  user: 0
  when_ready: <function WhenReady.when_ready at 0x7f21d6bad440>
  worker_abort: <function WorkerAbort.worker_abort at 0x7f21d6badb20>
  worker_class: sync
  worker_connections: 1000
  worker_exit: <function WorkerExit.worker_exit at 0x7f21d6bae0c0>
  worker_int: <function WorkerInt.worker_int at 0x7f21d6bad9e0>
  worker_tmp_dir: /dev/shm
  workers: 2
  wsgi_app: None
[2024-08-28 11:42:13 +0000] [1] [INFO] Starting gunicorn 22.0.0
[2024-08-28 11:42:13 +0000] [1] [DEBUG] Arbiter booted
[2024-08-28 11:42:13 +0000] [1] [INFO] Listening at: http://0.0.0.0:9000 (1)
[2024-08-28 11:42:13 +0000] [1] [INFO] Using worker: sync
[2024-08-28 11:42:13 +0000] [6] [INFO] Booting worker with pid: 6
[2024-08-28 11:42:13 +0000] [7] [INFO] Booting worker with pid: 7
[2024-08-28 11:42:13 +0000] [1] [DEBUG] 2 workers
[2024-08-28 11:56:13 +0000] [7] [DEBUG] GET /view/recipe/4
10.244.2.223 - - [28/Aug/2024:11:56:14 +0000] "GET /view/recipe/4 HTTP/1.0" 200 23896 "https://recipes.fqdn.com/data/import/url" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:56:14 +0000] [6] [DEBUG] GET /api/recipe/4/
[2024-08-28 11:56:15 +0000] [7] [DEBUG] GET /service-worker.js
10.244.2.223 - - [28/Aug/2024:11:56:15 +0000] "GET /service-worker.js HTTP/1.0" 200 39291 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
10.244.2.223 - - [28/Aug/2024:11:56:15 +0000] "GET /api/recipe/4/ HTTP/1.0" 200 21770 "https://recipes.fqdn.com/view/recipe/4" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:56:15 +0000] [6] [DEBUG] GET /api/recipe/4/related/
[2024-08-28 11:56:15 +0000] [7] [DEBUG] GET /api/meal-plan/
10.244.2.223 - - [28/Aug/2024:11:56:15 +0000] "GET /api/meal-plan/?from_date=2024-08-28&to_date=2024-08-28 HTTP/1.0" 200 2 "https://recipes.fqdn.com/view/recipe/4" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:56:15 +0000] [7] [DEBUG] GET /api/user-preference/1/
10.244.2.223 - - [28/Aug/2024:11:56:15 +0000] "GET /api/user-preference/1/ HTTP/1.0" 200 656 "https://recipes.fqdn.com/view/recipe/4" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
10.244.2.223 - - [28/Aug/2024:11:56:15 +0000] "GET /api/recipe/4/related/?levels=2&format=json HTTP/1.0" 200 2 "https://recipes.fqdn.com/view/recipe/4" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:56:15 +0000] [6] [DEBUG] GET /api/recipe/4/
10.244.2.223 - - [28/Aug/2024:11:56:15 +0000] "GET /api/recipe/4/ HTTP/1.0" 200 21770 "https://recipes.fqdn.com/view/recipe/4" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:56:28 +0000] [6] [DEBUG] GET /edit/recipe/4/
10.244.2.223 - - [28/Aug/2024:11:56:28 +0000] "GET /edit/recipe/4/ HTTP/1.0" 302 0 "https://recipes.fqdn.com/view/recipe/4" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:56:28 +0000] [7] [DEBUG] GET /edit/recipe/internal/4/
10.244.2.223 - - [28/Aug/2024:11:56:28 +0000] "GET /edit/recipe/internal/4/ HTTP/1.0" 200 22318 "https://recipes.fqdn.com/view/recipe/4" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:56:29 +0000] [7] [DEBUG] GET /api/recipe/4/
[2024-08-28 11:56:29 +0000] [6] [DEBUG] GET /api/unit/
10.244.2.223 - - [28/Aug/2024:11:56:29 +0000] "GET /api/unit/?query=&page=1&page_size=25 HTTP/1.0" 200 1319 "https://recipes.fqdn.com/edit/recipe/internal/4/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:56:29 +0000] [6] [DEBUG] GET /api/keyword/
10.244.2.223 - - [28/Aug/2024:11:56:29 +0000] "GET /api/keyword/?query=&page=1&page_size=25 HTTP/1.0" 200 711 "https://recipes.fqdn.com/edit/recipe/internal/4/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:56:29 +0000] [6] [DEBUG] GET /api/user-file/
10.244.2.223 - - [28/Aug/2024:11:56:29 +0000] "GET /api/user-file/?query=%5Bobject+Object%5D HTTP/1.0" 200 2 "https://recipes.fqdn.com/edit/recipe/internal/4/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:56:29 +0000] [6] [DEBUG] GET /api/recipe/
10.244.2.223 - - [28/Aug/2024:11:56:29 +0000] "GET /api/recipe/?query=&page=1&page_size=25 HTTP/1.0" 200 739 "https://recipes.fqdn.com/edit/recipe/internal/4/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:56:29 +0000] [6] [DEBUG] GET /api/space/1/
10.244.2.223 - - [28/Aug/2024:11:56:29 +0000] "GET /api/space/1/ HTTP/1.0" 200 524 "https://recipes.fqdn.com/edit/recipe/internal/4/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:56:29 +0000] [6] [DEBUG] GET /service-worker.js
10.244.2.223 - - [28/Aug/2024:11:56:29 +0000] "GET /service-worker.js HTTP/1.0" 200 39291 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
10.244.2.223 - - [28/Aug/2024:11:56:29 +0000] "GET /api/recipe/4/ HTTP/1.0" 200 21770 "https://recipes.fqdn.com/edit/recipe/internal/4/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:56:29 +0000] [7] [DEBUG] GET /api/user/
10.244.2.223 - - [28/Aug/2024:11:56:29 +0000] "GET /api/user/ HTTP/1.0" 200 83 "https://recipes.fqdn.com/edit/recipe/internal/4/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:56:29 +0000] [6] [DEBUG] GET /api/food/
10.244.2.223 - - [28/Aug/2024:11:56:29 +0000] "GET /api/food/?query=&page=1&page_size=25 HTTP/1.0" 200 8777 "https://recipes.fqdn.com/edit/recipe/internal/4/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:57:27 +0000] [7] [DEBUG] GET /delete/recipe/4/
  self = cls(**initkwargs)
/opt/recipes/venv/lib/python3.12/site-packages/django/views/generic/base.py:97: DeleteViewCustomDeleteWarning: DeleteView uses FormMixin to handle POST requests. As a consequence, any custom deletion logic in RecipeDelete.delete() handler should be moved to form_valid().
10.244.2.223 - - [28/Aug/2024:11:57:27 +0000] "GET /delete/recipe/4/ HTTP/1.0" 200 22729 "https://recipes.fqdn.com/edit/recipe/internal/4/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:57:28 +0000] [7] [DEBUG] GET /service-worker.js
10.244.2.223 - - [28/Aug/2024:11:57:29 +0000] "GET /service-worker.js HTTP/1.0" 200 39291 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:57:29 +0000] [7] [DEBUG] POST /delete/recipe/4/
10.244.2.223 - - [28/Aug/2024:11:57:29 +0000] "POST /delete/recipe/4/ HTTP/1.0" 302 0 "https://recipes.fqdn.com/delete/recipe/4/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
10.244.2.223 - - [28/Aug/2024:11:57:29 +0000] "GET / HTTP/1.0" 302 0 "https://recipes.fqdn.com/delete/recipe/4/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
10.244.2.223 - - [28/Aug/2024:11:57:29 +0000] "GET /search/ HTTP/1.0" 200 22316 "https://recipes.fqdn.com/delete/recipe/4/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:57:30 +0000] [7] [DEBUG] GET /service-worker.js
[2024-08-28 11:57:30 +0000] [6] [DEBUG] GET /api/meal-plan/
10.244.2.223 - - [28/Aug/2024:11:57:30 +0000] "GET /service-worker.js HTTP/1.0" 200 39291 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:57:30 +0000] [7] [DEBUG] GET /api/custom-filter/
  paginator = self.django_paginator_class(queryset, page_size)
/opt/recipes/venv/lib/python3.12/site-packages/rest_framework/pagination.py:200: UnorderedObjectListWarning: Pagination may yield inconsistent results with an unordered object_list: <class 'cookbook.models.CustomFilter'> QuerySet.
10.244.2.223 - - [28/Aug/2024:11:57:30 +0000] "GET /api/meal-plan/?from_date=2024-08-28&to_date=2024-08-28 HTTP/1.0" 200 2 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:57:30 +0000] [6] [DEBUG] GET /api/keyword/
10.244.2.223 - - [28/Aug/2024:11:57:30 +0000] "GET /api/custom-filter/?page=1&page_size=50&simple=1 HTTP/1.0" 200 52 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:57:30 +0000] [7] [DEBUG] GET /api/food/
10.244.2.223 - - [28/Aug/2024:11:57:30 +0000] "GET /api/keyword/?query=&root=0&page=1&page_size=50&simple=1 HTTP/1.0" 200 711 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:57:30 +0000] [6] [DEBUG] GET /api/recipe-book/
10.244.2.223 - - [28/Aug/2024:11:57:30 +0000] "GET /api/recipe-book/ HTTP/1.0" 200 2 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:57:30 +0000] [6] [DEBUG] GET /api/user-preference/1/
10.244.2.223 - - [28/Aug/2024:11:57:30 +0000] "GET /api/food/?query=&root=0&page=1&page_size=50&simple=1 HTTP/1.0" 200 927 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:57:30 +0000] [7] [DEBUG] GET /api/space/1/
10.244.2.223 - - [28/Aug/2024:11:57:30 +0000] "GET /api/user-preference/1/ HTTP/1.0" 200 656 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:57:30 +0000] [6] [DEBUG] GET /api/meal-plan/
10.244.2.223 - - [28/Aug/2024:11:57:30 +0000] "GET /api/space/1/ HTTP/1.0" 200 524 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
10.244.2.223 - - [28/Aug/2024:11:57:30 +0000] "GET /api/meal-plan/?from_date=2024-08-28&to_date=2024-08-28 HTTP/1.0" 200 2 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:57:30 +0000] [7] [DEBUG] GET /api/recipe/
10.244.2.223 - - [28/Aug/2024:11:57:31 +0000] "GET /api/recipe/?query=&internal=false&random=false&new=true&page=1&page_size=25&include_children=true&num_recent=5 HTTP/1.0" 200 52 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:57:32 +0000] [7] [DEBUG] GET /data/import/url
10.244.2.223 - - [28/Aug/2024:11:57:32 +0000] "GET /data/import/url HTTP/1.0" 200 22559 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:57:32 +0000] [6] [DEBUG] GET /api/space/1/
10.244.2.223 - - [28/Aug/2024:11:57:32 +0000] "GET /api/space/1/ HTTP/1.0" 200 524 "https://recipes.fqdn.com/data/import/url" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:57:33 +0000] [7] [DEBUG] GET /service-worker.js
10.244.2.223 - - [28/Aug/2024:11:57:33 +0000] "GET /service-worker.js HTTP/1.0" 200 39291 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:57:35 +0000] [6] [DEBUG] POST /api/recipe-from-source/
10.244.2.223 - - [28/Aug/2024:11:57:35 +0000] "POST /api/recipe-from-source/ HTTP/1.0" 200 6268 "https://recipes.fqdn.com/data/import/url" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:57:39 +0000] [6] [DEBUG] POST /api/recipe/
10.244.2.223 - - [28/Aug/2024:11:57:40 +0000] "POST /api/recipe/ HTTP/1.0" 201 21770 "https://recipes.fqdn.com/data/import/url" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 11:57:40 +0000] [6] [DEBUG] PUT /api/recipe/5/image/
[2024-08-28 11:58:40 +0000] [7] [DEBUG] PUT /api/recipe/5/image/
[2024-08-28 11:59:40 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:6)
[2024-08-28 11:59:40 +0000] [6] [INFO] Worker exiting (pid: 6)
[2024-08-28 11:59:41 +0000] [29] [INFO] Booting worker with pid: 29
[2024-08-28 11:59:42 +0000] [29] [DEBUG] PUT /api/recipe/5/image/
[2024-08-28 12:00:41 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:7)
[2024-08-28 12:00:41 +0000] [7] [INFO] Worker exiting (pid: 7)
[2024-08-28 12:00:41 +0000] [31] [INFO] Booting worker with pid: 31
[2024-08-28 12:01:42 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:29)
[2024-08-28 12:01:42 +0000] [29] [INFO] Worker exiting (pid: 29)
[2024-08-28 12:01:43 +0000] [33] [INFO] Booting worker with pid: 33
10.244.2.223 - - [28/Aug/2024:12:02:03 +0000] "GET / HTTP/1.0" 302 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
10.244.2.223 - - [28/Aug/2024:12:02:04 +0000] "GET /search/ HTTP/1.0" 302 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
10.244.2.223 - - [28/Aug/2024:12:02:04 +0000] "GET /accounts/login/?next=/search/ HTTP/1.0" 200 7747 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:04 +0000] [31] [DEBUG] GET /service-worker.js
10.244.2.223 - - [28/Aug/2024:12:02:04 +0000] "GET /service-worker.js HTTP/1.0" 200 39291 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:04 +0000] [33] [DEBUG] GET /offline/
10.244.2.223 - - [28/Aug/2024:12:02:04 +0000] "GET /offline/ HTTP/1.0" 200 16309 "https://recipes.fqdn.com/service-worker.js" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:05 +0000] [31] [DEBUG] POST /accounts/login/
10.244.2.223 - - [28/Aug/2024:12:02:06 +0000] "POST /accounts/login/ HTTP/1.0" 302 0 "https://recipes.fqdn.com/accounts/login/?next=/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
10.244.2.223 - - [28/Aug/2024:12:02:06 +0000] "GET /search/ HTTP/1.0" 200 22867 "https://recipes.fqdn.com/accounts/login/?next=/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:06 +0000] [33] [DEBUG] GET /service-worker.js
10.244.2.223 - - [28/Aug/2024:12:02:06 +0000] "GET /service-worker.js HTTP/1.0" 200 39291 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:07 +0000] [31] [DEBUG] GET /api/custom-filter/
[2024-08-28 12:02:07 +0000] [33] [DEBUG] GET /api/meal-plan/
  paginator = self.django_paginator_class(queryset, page_size)
/opt/recipes/venv/lib/python3.12/site-packages/rest_framework/pagination.py:200: UnorderedObjectListWarning: Pagination may yield inconsistent results with an unordered object_list: <class 'cookbook.models.CustomFilter'> QuerySet.
10.244.2.223 - - [28/Aug/2024:12:02:07 +0000] "GET /api/meal-plan/?from_date=2024-08-28&to_date=2024-08-28 HTTP/1.0" 200 2 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:07 +0000] [33] [DEBUG] GET /api/keyword/
10.244.2.223 - - [28/Aug/2024:12:02:07 +0000] "GET /api/custom-filter/?page=1&page_size=50&simple=1 HTTP/1.0" 200 52 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:07 +0000] [31] [DEBUG] GET /api/food/
10.244.2.223 - - [28/Aug/2024:12:02:07 +0000] "GET /api/food/?query=&root=0&page=1&page_size=50&simple=1 HTTP/1.0" 200 927 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:07 +0000] [31] [DEBUG] GET /api/recipe-book/
10.244.2.223 - - [28/Aug/2024:12:02:07 +0000] "GET /api/recipe-book/ HTTP/1.0" 200 2 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:07 +0000] [31] [DEBUG] GET /api/user-preference/None/
Not Found: /api/user-preference/None/
WARNING:django.request:Not Found: /api/user-preference/None/
10.244.2.223 - - [28/Aug/2024:12:02:07 +0000] "GET /api/user-preference/None/ HTTP/1.0" 404 23 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:07 +0000] [31] [DEBUG] GET /api/space/1/
10.244.2.223 - - [28/Aug/2024:12:02:07 +0000] "GET /api/space/1/ HTTP/1.0" 200 524 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:07 +0000] [31] [DEBUG] GET /api/meal-plan/
10.244.2.223 - - [28/Aug/2024:12:02:07 +0000] "GET /api/meal-plan/?from_date=2024-08-28&to_date=2024-08-28 HTTP/1.0" 200 2 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:07 +0000] [31] [DEBUG] GET /api/recipe/
10.244.2.223 - - [28/Aug/2024:12:02:07 +0000] "GET /api/keyword/?query=&root=0&page=1&page_size=50&simple=1 HTTP/1.0" 200 711 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
10.244.2.223 - - [28/Aug/2024:12:02:07 +0000] "GET /api/recipe/?query=&internal=false&random=false&new=true&page=1&page_size=25&include_children=true&num_recent=5 HTTP/1.0" 200 750 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:07 +0000] [33] [DEBUG] GET /api/user-preference/1/
10.244.2.223 - - [28/Aug/2024:12:02:07 +0000] "GET /api/user-preference/1/ HTTP/1.0" 200 656 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:07 +0000] [33] [DEBUG] GET /service-worker.js
10.244.2.223 - - [28/Aug/2024:12:02:07 +0000] "GET /service-worker.js HTTP/1.0" 200 39291 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:10 +0000] [33] [DEBUG] GET /edit/recipe/5/
10.244.2.223 - - [28/Aug/2024:12:02:10 +0000] "GET /edit/recipe/5/ HTTP/1.0" 302 0 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:10 +0000] [33] [DEBUG] GET /edit/recipe/internal/5/
10.244.2.223 - - [28/Aug/2024:12:02:10 +0000] "GET /edit/recipe/internal/5/ HTTP/1.0" 200 22318 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:11 +0000] [31] [DEBUG] GET /api/recipe/5/
[2024-08-28 12:02:11 +0000] [33] [DEBUG] GET /api/unit/
10.244.2.223 - - [28/Aug/2024:12:02:11 +0000] "GET /api/unit/?query=&page=1&page_size=25 HTTP/1.0" 200 1319 "https://recipes.fqdn.com/edit/recipe/internal/5/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:11 +0000] [33] [DEBUG] GET /api/keyword/
10.244.2.223 - - [28/Aug/2024:12:02:11 +0000] "GET /api/keyword/?query=&page=1&page_size=25 HTTP/1.0" 200 711 "https://recipes.fqdn.com/edit/recipe/internal/5/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:11 +0000] [33] [DEBUG] GET /api/user-file/
10.244.2.223 - - [28/Aug/2024:12:02:11 +0000] "GET /api/user-file/?query=%5Bobject+Object%5D HTTP/1.0" 200 2 "https://recipes.fqdn.com/edit/recipe/internal/5/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:11 +0000] [33] [DEBUG] GET /api/recipe/
10.244.2.223 - - [28/Aug/2024:12:02:11 +0000] "GET /api/recipe/?query=&page=1&page_size=25 HTTP/1.0" 200 739 "https://recipes.fqdn.com/edit/recipe/internal/5/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:11 +0000] [33] [DEBUG] GET /api/space/1/
10.244.2.223 - - [28/Aug/2024:12:02:11 +0000] "GET /api/space/1/ HTTP/1.0" 200 524 "https://recipes.fqdn.com/edit/recipe/internal/5/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
10.244.2.223 - - [28/Aug/2024:12:02:11 +0000] "GET /api/recipe/5/ HTTP/1.0" 200 21770 "https://recipes.fqdn.com/edit/recipe/internal/5/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:11 +0000] [31] [DEBUG] GET /service-worker.js
10.244.2.223 - - [28/Aug/2024:12:02:11 +0000] "GET /service-worker.js HTTP/1.0" 200 39291 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:12 +0000] [33] [DEBUG] GET /api/user/
10.244.2.223 - - [28/Aug/2024:12:02:12 +0000] "GET /api/user/ HTTP/1.0" 200 83 "https://recipes.fqdn.com/edit/recipe/internal/5/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:12 +0000] [31] [DEBUG] GET /api/food/
10.244.2.223 - - [28/Aug/2024:12:02:12 +0000] "GET /api/food/?query=&page=1&page_size=25 HTTP/1.0" 200 8777 "https://recipes.fqdn.com/edit/recipe/internal/5/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:14 +0000] [31] [DEBUG] GET /delete/recipe/5/
  self = cls(**initkwargs)
/opt/recipes/venv/lib/python3.12/site-packages/django/views/generic/base.py:97: DeleteViewCustomDeleteWarning: DeleteView uses FormMixin to handle POST requests. As a consequence, any custom deletion logic in RecipeDelete.delete() handler should be moved to form_valid().
10.244.2.223 - - [28/Aug/2024:12:02:14 +0000] "GET /delete/recipe/5/ HTTP/1.0" 200 22245 "https://recipes.fqdn.com/edit/recipe/internal/5/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:15 +0000] [31] [DEBUG] GET /service-worker.js
10.244.2.223 - - [28/Aug/2024:12:02:15 +0000] "GET /service-worker.js HTTP/1.0" 200 39291 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:15 +0000] [33] [DEBUG] POST /delete/recipe/5/
  self = cls(**initkwargs)
/opt/recipes/venv/lib/python3.12/site-packages/django/views/generic/base.py:97: DeleteViewCustomDeleteWarning: DeleteView uses FormMixin to handle POST requests. As a consequence, any custom deletion logic in RecipeDelete.delete() handler should be moved to form_valid().
10.244.2.223 - - [28/Aug/2024:12:02:15 +0000] "POST /delete/recipe/5/ HTTP/1.0" 302 0 "https://recipes.fqdn.com/delete/recipe/5/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
10.244.2.223 - - [28/Aug/2024:12:02:15 +0000] "GET / HTTP/1.0" 302 0 "https://recipes.fqdn.com/delete/recipe/5/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
10.244.2.223 - - [28/Aug/2024:12:02:15 +0000] "GET /search/ HTTP/1.0" 200 22316 "https://recipes.fqdn.com/delete/recipe/5/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:16 +0000] [31] [DEBUG] GET /api/custom-filter/
[2024-08-28 12:02:16 +0000] [33] [DEBUG] GET /api/meal-plan/
10.244.2.223 - - [28/Aug/2024:12:02:16 +0000] "GET /api/meal-plan/?from_date=2024-08-28&to_date=2024-08-28 HTTP/1.0" 200 2 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:16 +0000] [33] [DEBUG] GET /api/keyword/
10.244.2.223 - - [28/Aug/2024:12:02:16 +0000] "GET /api/custom-filter/?page=1&page_size=50&simple=1 HTTP/1.0" 200 52 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:16 +0000] [31] [DEBUG] GET /api/food/
10.244.2.223 - - [28/Aug/2024:12:02:16 +0000] "GET /api/keyword/?query=&root=0&page=1&page_size=50&simple=1 HTTP/1.0" 200 711 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:16 +0000] [33] [DEBUG] GET /api/recipe-book/
10.244.2.223 - - [28/Aug/2024:12:02:16 +0000] "GET /api/recipe-book/ HTTP/1.0" 200 2 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:16 +0000] [33] [DEBUG] GET /api/user-preference/1/
10.244.2.223 - - [28/Aug/2024:12:02:16 +0000] "GET /api/food/?query=&root=0&page=1&page_size=50&simple=1 HTTP/1.0" 200 927 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:16 +0000] [31] [DEBUG] GET /api/space/1/
10.244.2.223 - - [28/Aug/2024:12:02:16 +0000] "GET /api/user-preference/1/ HTTP/1.0" 200 656 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:16 +0000] [33] [DEBUG] GET /api/meal-plan/
10.244.2.223 - - [28/Aug/2024:12:02:16 +0000] "GET /api/space/1/ HTTP/1.0" 200 524 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:16 +0000] [31] [DEBUG] GET /service-worker.js
10.244.2.223 - - [28/Aug/2024:12:02:16 +0000] "GET /api/meal-plan/?from_date=2024-08-28&to_date=2024-08-28 HTTP/1.0" 200 2 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
10.244.2.223 - - [28/Aug/2024:12:02:16 +0000] "GET /service-worker.js HTTP/1.0" 200 39291 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:16 +0000] [31] [DEBUG] GET /api/recipe/
10.244.2.223 - - [28/Aug/2024:12:02:16 +0000] "GET /api/recipe/?query=&internal=false&random=false&new=true&page=1&page_size=25&include_children=true&num_recent=5 HTTP/1.0" 200 52 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:18 +0000] [31] [DEBUG] GET /data/import/url
10.244.2.223 - - [28/Aug/2024:12:02:18 +0000] "GET /data/import/url HTTP/1.0" 200 22559 "https://recipes.fqdn.com/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:18 +0000] [33] [DEBUG] GET /api/space/1/
10.244.2.223 - - [28/Aug/2024:12:02:18 +0000] "GET /api/space/1/ HTTP/1.0" 200 524 "https://recipes.fqdn.com/data/import/url" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:19 +0000] [31] [DEBUG] GET /service-worker.js
10.244.2.223 - - [28/Aug/2024:12:02:19 +0000] "GET /service-worker.js HTTP/1.0" 200 39291 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:19 +0000] [31] [DEBUG] POST /api/recipe-from-source/
10.244.2.223 - - [28/Aug/2024:12:02:20 +0000] "POST /api/recipe-from-source/ HTTP/1.0" 200 6268 "https://recipes.fqdn.com/data/import/url" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:26 +0000] [33] [DEBUG] POST /api/recipe/
10.244.2.223 - - [28/Aug/2024:12:02:27 +0000] "POST /api/recipe/ HTTP/1.0" 201 21785 "https://recipes.fqdn.com/data/import/url" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:02:27 +0000] [33] [DEBUG] PUT /api/recipe/6/image/
[2024-08-28 12:03:27 +0000] [31] [DEBUG] PUT /api/recipe/6/image/
[2024-08-28 12:04:27 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:33)
[2024-08-28 12:04:27 +0000] [33] [INFO] Worker exiting (pid: 33)
[2024-08-28 12:04:27 +0000] [35] [INFO] Booting worker with pid: 35
[2024-08-28 12:04:29 +0000] [35] [DEBUG] PUT /api/recipe/6/image/
[2024-08-28 12:05:27 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:31)
[2024-08-28 12:05:27 +0000] [31] [INFO] Worker exiting (pid: 31)
[2024-08-28 12:05:28 +0000] [37] [INFO] Booting worker with pid: 37
[2024-08-28 12:05:29 +0000] [37] [DEBUG] GET /settings/
10.244.2.223 - - [28/Aug/2024:12:05:29 +0000] "GET /settings/ HTTP/1.0" 200 23217 "https://recipes.fqdn.com/data/import/url" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
[2024-08-28 12:05:31 +0000] [37] [DEBUG] GET /service-worker.js
10.244.2.223 - - [28/Aug/2024:12:05:31 +0000] "GET /service-worker.js HTTP/1.0" 200 39291 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
smilerz commented 2 months ago

Kubernetes install isn't supported, there is a user contributed guide online or you can attempt to get help from someone on Discord.

mlabuhn commented 2 months ago

Files did not attach for some reason, so adding them as comments.

docker-compose.yaml

version: "3.8"
services:
  db_recipes:
    image: postgres:12-alpine
    deploy:
      replicas: 1
      restart_policy:
        condition: any
    volumes:
      - tandoor_postgres12:/var/lib/postgresql/data
    environment:
      POSTGRES_DB:        ${POSTGRES_DB}
      POSTGRES_USER:      ${POSTGRES_USER}
      POSTGRES_PASSWORD:  ${POSTGRES_PASSWORD}
    healthcheck:
      test: ["CMD-SHELL", "pg_isready", "-d", "$${POSTGRES_DB}"]
      interval: 30s
      timeout: 60s
      retries: 5
      start_period: 80s

  web_recipes:
    image: vabene1111/recipes:1.5.14
    environment:
      DEBUG: ${DEBUG}
      SQL_DEBUG: ${SQL_DEBUG}
      TANDOOR_PORT: ${TANDOOR_PORT}
      ALLOWED_HOSTS: ${ALLOWED_HOSTS}
      SECRET_KEY: ${SECRET_KEY}
      TIMEZONE: ${TIMEZONE}
      DB_ENGINE: ${DB_ENGINE}
      POSTGRES_HOST: ${POSTGRES_HOST}
      POSTGRES_PORT: ${POSTGRES_PORT}
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: ${POSTGRES_DB}
      FRACTION_PREF_DEFAULT: ${FRACTION_PREF_DEFAULT}
      COMMENT_PREF_DEFAULT: ${COMMENT_PREF_DEFAULT}
      SHOPPING_MIN_AUTOSYNC_INTERVAL: ${SHOPPING_MIN_AUTOSYNC_INTERVAL}
      GUNICORN_MEDIA: ${GUNICORN_MEDIA}
      EMAIL_HOST: ${EMAIL_HOST}
      EMAIL_PORT: ${EMAIL_PORT}
      EMAIL_USE_TLS: ${EMAIL_USE_TLS}
      DEFAULT_FROM_EMAIL: ${DEFAULT_FROM_EMAIL}
      ACCOUNT_EMAIL_SUBJECT_PREFIX: ${ACCOUNT_EMAIL_SUBJECT_PREFIX}
      REVERSE_PROXY_AUTH: ${REVERSE_PROXY_AUTH}
    deploy:
      replicas: 1
      restart_policy:
        condition: any
    volumes:
      - tandoor_static:/opt/recipes/staticfiles
      - tandoor_media:/opt/recipes/mediafiles
      - tandoor_nginx:/opt/recipes/nginx/conf.d
    depends_on:
      - db_recipes
    healthcheck:
      test: wget --no-verbose --tries=1 --spider http://localhost:$${TANDOOR_PORT} || exit 1
      interval: 60s
      retries: 5
      start_period: 20s
      timeout: 10s

  nginx_recipes:
    image: nginx:mainline-alpine
    ports:
      - 8080:80
    environment:
      ALLOWED_HOSTS: ${ALLOWED_HOSTS}
      TIMEZONE: ${TIMEZONE}
    depends_on:
      - web_recipes
    deploy:
      replicas: 1
      restart_policy:
        condition: any
    volumes:
      - tandoor_nginx:/etc/nginx/conf.d:ro
      - tandoor_static:/static:ro
      - tandoor_media:/media:ro

volumes:
  tandoor_postgres12:
  tandoor_static:
  tandoor_media:
  tandoor_nginx:

Kubernetes configuration

apiVersion: v1
kind: ConfigMap
metadata:
  name: recipes
data:
  nginx-config: |-
    user  nginx;
    worker_processes  auto;

    error_log  /var/log/nginx/error.log notice;
    pid        /var/run/nginx.pid;

    events {
      worker_connections 1024;
    }

    http {
      include mime.types;
      server {
        listen 80;
        listen [::]:80 ipv6only=on;
        server_name _;

        client_max_body_size 128M;

        # serve static files
        location /static/ {
          alias /static/;
        }
        # serve media files
        location /media/ {
          alias /media/;
        }

        # pass requests for dynamic content to gunicorn
        location / {
          proxy_set_header Host $http_host;
          proxy_pass http://recipes:9000;

          error_page 502 /errors/http502.html;
        }

        location /errors/ {
          alias /etc/nginx/conf.d/errorpages/;
          internal;
        }

      }
    }
  gunicorn-config: |-
    bind                              = ['0.0.0.0:9000']
    accesslog                         = '-'
    errorlog                          = '-'
    loglevel                          = 'DEBUG'
    chdir                             = '/opt/recipes'
    default_proc_name                 = 'recipes.wgsi'
    forwarded_allow_ips               = '*'
    proxy_allow_ips                   = '*'
    secure_scheme_headers             = {'X-FORWARDED-PROTOCOL': 'ssl', 'X-FORWARDED-PROTO': 'https', 'X-FORWARDED-SSL': 'on'}
    threads                           = 1
    timeout                           = 120
    worker_tmp_dir                    = '/dev/shm'
    workers                           = 2
    wgsi_app                          = 'recipes.wsgi'
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: recipes-env
data:
  POSTGRES_PORT: "5432"
  DEBUG: "1"
  ALLOWED_HOSTS: "*"
  GUNICORN_MEDIA: "0"
  EMAIL_HOST: "mailserver.fqdn.com"
  EMAIL_PORT: "587"
  EMAIL_USE_TLS: "1"
  DEFAULT_FROM_EMAIL: "admin@fqdn.com"
  ACCOUNT_EMAIL_SUBJECT_PREFIX: "[Tandoor Recipes]"
  TZ: "UTC"
  POSTGRES_DB: "tandoor"
  POSTGRES_USER: "tandoor"
  POSTGRES_HOST: recipes-postgresql
  POSTGRES_PORT: "5432"
  DB_ENGINE: "django.db.backends.postgresql"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: recipes-media
spec:
  resources:
    requests:
      storage: 200Mi
  accessModes:
    - ReadWriteOnce
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: recipes-static
spec:
  resources:
    requests:
      storage: 200Mi
  accessModes:
    - ReadWriteOnce
---
apiVersion: v1
kind: Service
metadata:
  name: recipes
spec:
  type: ClusterIP
  ports:
  - port: 80
    targetPort: http
    protocol: TCP
    name: http
  - port: 9000
    targetPort: 9000
    protocol: TCP
    name: gunicorn
  selector:
    app.kubernetes.io/name: recipes
    app.kubernetes.io/instance: recipes
  sessionAffinity: None
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: recipes
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  strategy:
    type: Recreate
  template:
    spec:
      serviceAccountName: recipes
      initContainers:
        - name: init-chmod-data
          envFrom:
          - configMapRef:
              name: recipes-env
          env:
            - name: SECRET_KEY
              valueFrom:
                secretKeyRef:
                  name: recipes
                  key: secret-key
            - name: POSTGRES_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: recipes-postgresql
                  key: password
          image: "vabene1111/recipes:1.5.19"
          imagePullPolicy: Always
          resources:
            requests:
              cpu: 250m
              memory: 64Mi
          command:
          - sh
          - -c
          - |
            set -e
            source venv/bin/activate
            echo "Updating database"
            python manage.py migrate
            python manage.py collectstatic_js_reverse
            python manage.py collectstatic --noinput
            echo "Setting media file attributes"
            chown -R 65534:65534 /opt/recipes/mediafiles
            find /opt/recipes/mediafiles -type d | xargs -r chmod 755
            find /opt/recipes/mediafiles -type f | xargs -r chmod 644
            echo "Done"
          securityContext:
            runAsUser: 0
          volumeMounts:
          - mountPath: /opt/recipes/mediafiles
            name: media
            # mount as subPath due to lost+found on ext4 pvc
            subPath: files
          - mountPath: /opt/recipes/staticfiles
            name: static
            # mount as subPath due to lost+found on ext4 pvc
            subPath: files
      containers:
        - name: recipes-nginx
          image: nginx:latest
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 80
              protocol: TCP
              name: http
          resources:
            limits:
              cpu: 250m
              memory: 64Mi
            requests:
              cpu: 5m
              memory: 64Mi
          volumeMounts:
            - mountPath: /media
              name: media
              # mount as subPath due to lost+found on ext4 pvc
              subPath: files
              readOnly: true
            - mountPath: /static
              name: static
              # mount as subPath due to lost+found on ext4 pvc
              subPath: files
              readOnly: true
            - name: config
              mountPath: /etc/nginx/nginx.conf
              subPath: nginx-config
              readOnly: true
        - name: recipes
          image: "vabene1111/recipes:1.5.19"
          imagePullPolicy: IfNotPresent
          command: ["/opt/recipes/venv/bin/gunicorn"]
          args: ["-c", "/etc/gunicorn.conf.py", "recipes.wsgi"]
          envFrom:
            - configMapRef:
                name: recipes-env
          env:
            - name: SECRET_KEY
              valueFrom:
                secretKeyRef:
                  name: recipes
                  key: secret-key
            - name: POSTGRES_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: recipes-postgresql
                  key: password
          volumeMounts:
            - mountPath: /opt/recipes/mediafiles
              name: media
              # mount as subPath due to lost+found on ext4 pvc
              subPath: files
            - mountPath: /opt/recipes/staticfiles
              name: static
              # mount as subPath due to lost+found on ext4 pvc
              subPath: files
            - mountPath: /etc/gunicorn.conf.py
              name: config
              subPath: gunicorn-config
              readOnly: true
          readinessProbe:
            httpGet:
              path: /
              port: 9000
              scheme: HTTP
            initialDelaySeconds: 600
            timeoutSeconds: 10
            successThreshold: 1
            failureThreshold: 10
            periodSeconds: 10
          livenessProbe:
            httpGet:
              path: /
              port: 9000
              scheme: HTTP
            initialDelaySeconds: 600
            timeoutSeconds: 25
            successThreshold: 1
            failureThreshold: 10 
            periodSeconds: 10
          resources:
            limits:
              cpu: 1000m
              memory: 1Gi
            requests:
              cpu: 5m
              memory: 32Mi
          securityContext:
            runAsUser: 0
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
        - name: media
          persistentVolumeClaim:
            claimName: recipes-media
        - name: static
          persistentVolumeClaim:
            claimName: recipes-static
        - name: config
          configMap:
            name: recipes
---
# Source: recipes/templates/ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: recipes
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-production
    kubernetes.io/ingress.class: nginx
spec:
  ingressClassName: nginx
  tls:
    - hosts:
        - "recipes.fqdn.com"
      secretName: recipes-cert
  rules:
    - host: "recipes.fqdn.com"
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: recipes
                port:
                  number: 80
          - path: /media
            pathType: Prefix
            backend:
              service:
                name: recipes
                port:
                  number: 80
          - path: /static
            pathType: Prefix
            backend:
              service:
                name: recipes
                port:
                  number: 80