Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to setup Tandoor on Raspi 3b+ #3105

Open
0utl4w opened this issue Apr 11, 2024 · 11 comments
Open

Unable to setup Tandoor on Raspi 3b+ #3105

0utl4w opened this issue Apr 11, 2024 · 11 comments
Labels
setup issue possibly or definitely an issue with the user setup

Comments

@0utl4w
Copy link

0utl4w commented Apr 11, 2024

Issue

I had a running tandoor instance but because I haven't been home for a year I decided to set it up clean from scratch. I don't know what I am doing wrong but the result is always the same: when trying to open it in the browser I get the error, that the server cannot be reached. I spent way to many hours to figure it out by myself, but I couldn't.

I changed ports to 100 because on 80 another app is exposed.

Tandoor Version

latest

OS Version

DietPi v9.2.1

Setup

Docker / Docker-Compose

Reverse Proxy

No reverse proxy

Other

No response

Environment file

# random secret key, use for example `base64 /dev/urandom | head -c50` to generate one
SECRET_KEY=*secret_key*

# add only a database password if you want to run with the default postgres, otherwise change settings accordingly
DB_ENGINE=django.db.backends.postgresql
POSTGRES_HOST=db_recipes
POSTGRES_DB=djangodb
POSTGRES_PORT=5432
POSTGRES_USER=djangouser
POSTGRES_PASSWORD=*password*
DEBUG=0
SQL_DEBUG=0
ALLOWED_HOSTS=*
TZ=Europe/Berlin

Docker-Compose file

version: "3"
services:
  db_recipes:
    image: postgres:16-alpine
    container_name: db_recipes
    restart: always
    volumes:
      - ./postgresql:/var/lib/postgresql/data
    env_file:
      - ./.env

  web_recipes:
    image: vabene1111/recipes:latest
    container_name: web_recipes
    restart: always
    env_file:
      - ./.env
    volumes:
      - staticfiles:/opt/recipes/staticfiles
      # Do not make this a bind mount, see https://docs.tandoor.dev/install/docker/#volumes-vs-bind-mounts
      - nginx_config:/opt/recipes/nginx/conf.d
      - ./mediafiles:/opt/recipes/mediafiles
    depends_on:
      - db_recipes

  nginx_recipes:
    image: nginx:mainline-alpine
    container_name: nginx_recipes
    restart: always
    ports:
      - 100:100
    env_file:
      - ./.env
    depends_on:
      - web_recipes
    volumes:
      # Do not make this a bind mount, see https://docs.tandoor.dev/install/docker/#volumes-vs-bind-mounts
      - nginx_config:/etc/nginx/conf.d:ro
      - staticfiles:/static:ro
      - ./mediafiles:/media:ro

volumes:
  nginx_config:
  staticfiles:

Relevant logs

Attaching to nginx_recipes, web_recipes, db_recipes
nginx_recipes    | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
nginx_recipes    | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
nginx_recipes    | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
nginx_recipes    | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist
nginx_recipes    | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
nginx_recipes    | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
nginx_recipes    | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
nginx_recipes    | /docker-entrypoint.sh: Configuration complete; ready for start up
nginx_recipes    | 2024/04/11 18:38:58 [notice] 1#1: using the "epoll" event method
nginx_recipes    | 2024/04/11 18:38:58 [notice] 1#1: nginx/1.25.4
nginx_recipes    | 2024/04/11 18:38:58 [notice] 1#1: built by gcc 12.2.1 20220924 (Alpine 12.2.1_git20220924-r10)
nginx_recipes    | 2024/04/11 18:38:58 [notice] 1#1: OS: Linux 6.1.21-v8+
nginx_recipes    | 2024/04/11 18:38:58 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
nginx_recipes    | 2024/04/11 18:38:58 [notice] 1#1: start worker processes
nginx_recipes    | 2024/04/11 18:38:58 [notice] 1#1: start worker process 20
nginx_recipes    | 2024/04/11 18:38:58 [notice] 1#1: start worker process 21
nginx_recipes    | 2024/04/11 18:38:58 [notice] 1#1: start worker process 22
nginx_recipes    | 2024/04/11 18:38:58 [notice] 1#1: start worker process 23
db_recipes       |
db_recipes       | PostgreSQL Database directory appears to contain a database; Skipping initialization
db_recipes       |
db_recipes       | 2024-04-11 18:38:56.768 CEST [1] LOG:  starting PostgreSQL 16.2 on aarch64-unknown-linux-musl, compiled by gcc (Alpine 13.2.1_git20231014) 13.2.1 20231014, 64-bit
db_recipes       | 2024-04-11 18:38:56.769 CEST [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
db_recipes       | 2024-04-11 18:38:56.769 CEST [1] LOG:  listening on IPv6 address "::", port 5432
db_recipes       | 2024-04-11 18:38:56.799 CEST [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_recipes       | 2024-04-11 18:38:56.838 CEST [25] LOG:  database system was shut down at 2024-04-11 18:35:03 CEST
db_recipes       | 2024-04-11 18:38:56.891 CEST [1] LOG:  database system is ready to accept connections
db_recipes       | 2024-04-11 18:43:56.934 CEST [23] LOG:  checkpoint starting: time
db_recipes       | 2024-04-11 18:43:56.986 CEST [23] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.008 s, sync=0.012 s, total=0.054 s; sync files=2, longest=0.006 s, average=0.006 s; distance=0 kB, estimate=0 kB; lsn=0/1E32740, redo lsn=0/1E32708
web_recipes      | Checking configuration...
web_recipes      | Waiting for database to be ready...
web_recipes      | Database is ready
web_recipes      | Migrating database
web_recipes      | Operations to perform:
web_recipes      |   Apply all migrations: account, admin, auth, authtoken, contenttypes, cookbook, oauth2_provider, sessions, sites, socialaccount
web_recipes      | Running migrations:
web_recipes      |   No migrations to apply.
web_recipes      | Generating static files
web_recipes      | js-reverse file written to /opt/recipes/cookbook/static/django_js_reverse
web_recipes      |
web_recipes      | 575 static files copied to '/opt/recipes/staticfiles', 1491 post-processed.
web_recipes      | Done
web_recipes      | [2024-04-11 18:40:05 +0200] [1] [INFO] Starting gunicorn 21.2.0
web_recipes      | [2024-04-11 18:40:05 +0200] [1] [INFO] Listening at: http://[::]:8080 (1)
web_recipes      | [2024-04-11 18:40:05 +0200] [1] [INFO] Using worker: gthread
web_recipes      | [2024-04-11 18:40:05 +0200] [16] [INFO] Booting worker with pid: 16
web_recipes      | [2024-04-11 18:40:05 +0200] [17] [INFO] Booting worker with pid: 17
web_recipes      | [2024-04-11 18:40:05 +0200] [18] [INFO] Booting worker with pid: 18
@0utl4w 0utl4w added the setup issue possibly or definitely an issue with the user setup label Apr 11, 2024
@smilerz
Copy link
Collaborator

smilerz commented Apr 11, 2024

nginx listens on port 80

  nginx_recipes:
    ports:
      - 100:80

@0utl4w
Copy link
Author

0utl4w commented Apr 11, 2024

Thank you so much! It's the simple things... now I'm annoyed by myself!

@0utl4w
Copy link
Author

0utl4w commented Apr 11, 2024

@smilerz one more question, I made a full backup of my postgres DB of my old installation. When I restore the backup.sql now with the new installation (postgres 16, tandoor 1.5.17) it doesn't work. Do you see a way to make it work?

@smilerz
Copy link
Collaborator

smilerz commented Apr 11, 2024

what do they logs say?

@0utl4w
Copy link
Author

0utl4w commented Apr 11, 2024

That is at the start of the log:

SET
SET
SET
ERROR: role "postgres" cannot be dropped because some objects depend on it
DETAIL: owner of database template1
owner of database postgres
229 objects in database postgres
ERROR: role "postgres" already exists
ALTER ROLE

Maybe I created the backup with different user then I want to import it?

@smilerz
Copy link
Collaborator

smilerz commented Apr 11, 2024

Delete the database from the new postgres server and try importing again before starting the tandoor container.

@0utl4w
Copy link
Author

0utl4w commented Apr 11, 2024

Sorry for maybe stupid questions already, you mean drop the database? How and which one?

grafik

@smilerz
Copy link
Collaborator

smilerz commented Apr 11, 2024

Your backup should only be of the tandoor db (which, by default, is djangodb).

if you restored all databases from the old version of postgres, then delete all of the contents of postgresql and follow the instructions for import from here.

@0utl4w
Copy link
Author

0utl4w commented Apr 15, 2024

@smilerz I cannot make it work. Thanks already for your help.

I followed the instruction you linked above. In addition I found an issue that helped as well 2947.

So I managed to import my db backup into the new postgres db and after starting the web container again it seems that all migrations went without error. But then when I open the tandoor website it wants me to create a new superuser and a space and then there are no recipes anymore...

I also attached my backup-sql because I think on my old setup I used postgres as user and not djangouser.

Thanks again!

db_recipes_logs.txt
restore_postgres_db.txt
web_recipes_logs.txt

@smilerz
Copy link
Collaborator

smilerz commented Apr 15, 2024

You backed up and restored databases postgres and template1 but have tandoor configured to connect to djangodb

@0utl4w
Copy link
Author

0utl4w commented Apr 15, 2024

@smilerz I don't know how to thank you! I thought I was a clever guy and changed in .env in my previous setup the entries to
POSTGRES_DB=postgres
POSTGRES_USER=postgres

Of course I forgot that... but your last hint saved my ass! Thank you so much! Small donation is on its way!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
setup issue possibly or definitely an issue with the user setup
Projects
None yet
Development

No branches or pull requests

2 participants