TandoorRecipes / recipes

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

Docker postgresql "invalid value" #2687

Closed languagemaniac closed 10 months ago

languagemaniac commented 11 months ago

Issue

Hi, after a while of not using tandoor, I tried to access the site but it wouldn't load.

So I checked the logs and found this on the database docker container

PostgreSQL Database directory appears to contain a database; Skipping initialization 2023-10-09 06:26:07.894 GMT [1] LOG: invalid value for parameter "log_timezone": "UTC" 2023-10-09 06:26:07.895 GMT [1] LOG: invalid value for parameter "TimeZone": "UTC" 2023-10-09 06:26:07.895 GMT [1] FATAL: configuration file "/var/lib/postgresql/data/postgresql.conf" contains errors

I checked /var/lib/postgresql/data/postgresql.conf but It doesn't exist. I searched the postgresql.conf file (the one that's inside the tandoor folder where I have the docker-compose.yml file etc.) And I did find the tags "log_timezone" and "TimeZone", they were set to UTC, so tried changing it to UTC+1 and restarted the container.

However, I still get the same error.

I think I need some help to get it back running.

Tandoor Version

Sorry don't remember, can't access.

OS Version

Raspberry pi OS 64bit (debian 11)

Setup

Docker / Docker-Compose

Reverse Proxy

No reverse proxy

Other

No response

Environment file

# only set this to true when testing/debugging # when unset: 1 (true) - dont unset this, just for development DEBUG=0 SQL_DEBUG=0 DEBUG_TOOLBAR=0 # Gunicorn log level for debugging (default value is "info" when unset) # (see https://docs.gunicorn.org/en/stable/settings.html#loglevel for available settings) # GUNICORN_LOG_LEVEL="debug" # HTTP port to bind to # TANDOOR_PORT=8080 # hosts the application can run under e.g. recipes.mydomain.com,cooking.mydomain.com,...ALLOWED_HOSTS=* # random secret key, use for example `base64 /dev/urandom | head -c50` to generate one # ---------------------------- REQUIRED ------------------------- SECRET_KEY= # --------------------------------------------------------------- # your default timezone See https://timezonedb.com/time-zones for a list of timezones TIMEZONE=Europe/Berlin # add only a database password if you want to run with the default postgres, otherwise change settings accordingly DB_ENGINE=django.db.backends.postgresql # DB_OPTIONS= {} # e.g. {"sslmode":"require"} to enable ssl POSTGRES_HOST=db_recipes POSTGRES_PORT=5432 POSTGRES_USER=djangouser # ---------------------------- REQUIRED ------------------------- POSTGRES_PASSWORD=# --------------------------------------------------------------- POSTGRES_DB=djangodb

# database connection string, when used overrides other database settings.
# format might vary depending on backend
# DATABASE_URL = engine://username:password@host:port/dbname

# the default value for the user preference 'fractions' (enable/disable fraction support)
# default: disabled=0
FRACTION_PREF_DEFAULT=0

# the default value for the user preference 'comments' (enable/disable commenting system)
# default comments enabled=1
COMMENT_PREF_DEFAULT=1

# Users can set a amount of time after which the shopping list is refreshed when they are in viewing mode
# This is the minimum interval users can set. Setting this to low will allow users to refresh very frequently which
# might cause high load on the server. (Technically they can obviously refresh as often as they want with their own scripts)
SHOPPING_MIN_AUTOSYNC_INTERVAL=5

# Default for user setting sticky navbar
# STICKY_NAV_PREF_DEFAULT=1

# If base URL is something other than just / (you are serving a subfolder in your proxy for instance http://recipe_app/recipes/)
# Be sure to not have a trailing slash: e.g. '/recipes' instead of '/recipes/'
# SCRIPT_NAME=/recipes

# If staticfiles are stored at a different location uncomment and change accordingly, MUST END IN /
# this is not required if you are just using a subfolder
# This can either be a relative path from the applications base path or the url of an external host
# STATIC_URL=/static/

# If mediafiles are stored at a different location uncomment and change accordingly, MUST END IN /
# this is not required if you are just using a subfolder
# This can either be a relative path from the applications base path or the url of an external host
# MEDIA_URL=/media/

# Serve mediafiles directly using gunicorn. Basically everyone recommends not doing this. Please use any of the examples
# provided that include an additional nxginx container to handle media file serving.
# If you know what you are doing turn this back on (1) to serve media files using djangos serve() method.
# when unset: 1 (true) - this is temporary until an appropriate amount of time has passed for everyone to migrate
GUNICORN_MEDIA=0

# GUNICORN SERVER RELATED SETTINGS (see https://docs.gunicorn.org/en/stable/design.html#how-many-workers for recommended settings)
# GUNICORN_WORKERS=1
# GUNICORN_THREADS=1

# S3 Media settings: store mediafiles in s3 or any compatible storage backend (e.g. minio)
# as long as S3_ACCESS_KEY is not set S3 features are disabled
# S3_ACCESS_KEY=
# S3_SECRET_ACCESS_KEY=
# S3_BUCKET_NAME=
# S3_REGION_NAME= # default none, set your region might be required
# S3_QUERYSTRING_AUTH=1 # default true, set to 0 to serve media from a public bucket without signed urls
# S3_QUERYSTRING_EXPIRE=3600 # number of seconds querystring are valid for
# S3_ENDPOINT_URL= # when using a custom endpoint like minio
# S3_CUSTOM_DOMAIN= # when using a CDN/proxy to S3 (see https://github.com/TandoorRecipes/recipes/issues/1943)

# Email Settings, see https://docs.djangoproject.com/en/3.2/ref/settings/#email-host
# Required for email confirmation and password reset (automatically activates if host is set)
# EMAIL_HOST=
# EMAIL_PORT=
# EMAIL_HOST_USER=
# EMAIL_HOST_PASSWORD=
# EMAIL_USE_TLS=0
# EMAIL_USE_SSL=0
# email sender address (default 'webmaster@localhost')
# DEFAULT_FROM_EMAIL=
# prefix used for account related emails (default "[Tandoor Recipes] ")
# ACCOUNT_EMAIL_SUBJECT_PREFIX=

# allow authentication via the REMOTE-USER header (can be used for e.g. authelia).
# ATTENTION: Leave off if you don't know what you are doing! Enabling this without proper configuration will enable anybody
# to login with any username!
# See docs for additional information: https://docs.tandoor.dev/features/authentication/#reverse-proxy-authentication
# when unset: 0 (false)
REMOTE_USER_AUTH=0

# Default settings for spaces, apply per space and can be changed in the admin view
# SPACE_DEFAULT_MAX_RECIPES=0 # 0=unlimited recipes
# SPACE_DEFAULT_MAX_USERS=0 # 0=unlimited users per space
# SPACE_DEFAULT_MAX_FILES=0 # Maximum file storage for space in MB. 0 for unlimited, -1 to disable file upload.
# SPACE_DEFAULT_ALLOW_SHARING=1 # Allow users to share recipes with public links

# allow people to create accounts on your application instance (without an invite link)
# when unset: 0 (false)
# ENABLE_SIGNUP=0

# If signup is enabled you might want to add a captcha to it to prevent spam
# HCAPTCHA_SITEKEY=
# HCAPTCHA_SECRET=

# if signup is enabled you might want to provide urls to data protection policies or terms and conditions
# TERMS_URL=
# PRIVACY_URL=
# IMPRINT_URL=

# enable serving of prometheus metrics under the /metrics path
# ATTENTION: view is not secured (as per the prometheus default way) so make sure to secure it
# trough your web server (or leave it open of you dont care if the stats are exposed)
# ENABLE_METRICS=0

# allows you to setup OAuth providers
# see docs for more information https://docs.tandoor.dev/features/authentication/
# SOCIAL_PROVIDERS = allauth.socialaccount.providers.github, allauth.socialaccount.providers.nextcloud,

# Should a newly created user from a social provider get assigned to the default space and given permission by default ?
# ATTENTION: This feature might be deprecated in favor of a space join and public viewing system in the future
# default 0 (false), when 1 (true) users will be assigned space and group
# SOCIAL_DEFAULT_ACCESS = 1

# if SOCIAL_DEFAULT_ACCESS is used, which group should be added
# SOCIAL_DEFAULT_GROUP=guest

# Django session cookie settings. Can be changed to allow a single django application to authenticate several applications
# when running under the same database
# SESSION_COOKIE_DOMAIN=.example.com
# SESSION_COOKIE_NAME=sessionid # use this only to not interfere with non unified django applications under the same top level domain

# by default SORT_TREE_BY_NAME is disabled this will store all Keywords and Food in the order they are created
# enabling this setting makes saving new keywords and foods very slow, which doesn't matter in most usecases.
# however, when doing large imports of recipes that will create new objects, can increase total run time by 10-15x
# Keywords and Food can be manually sorted by name in Admin
# This value can also be temporarily changed in Admin, it will revert the next time the application is started
# This will be fixed/changed in the future by changing the implementation or finding a better workaround for sorting
# SORT_TREE_BY_NAME=0
# LDAP authentication
# default 0 (false), when 1 (true) list of allowed users will be fetched from LDAP server
#LDAP_AUTH=
#AUTH_LDAP_SERVER_URI=
#AUTH_LDAP_BIND_DN=
#AUTH_LDAP_BIND_PASSWORD=
#AUTH_LDAP_USER_SEARCH_BASE_DN=
#AUTH_LDAP_TLS_CACERTFILE=
#AUTH_LDAP_START_TLS=

# Enables exporting PDF (see export docs)
# Disabled by default, uncomment to enable
# ENABLE_PDF_EXPORT=1

# Recipe exports are cached for a certain time by default, adjust time if needed
# EXPORT_FILE_CACHE_DURATION=600

Docker-Compose file

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

  web_recipes:
    restart: always
    image: vabene1111/recipes
    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
    restart: always
    ports:
      - 9000:80
    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

PostgreSQL Database directory appears to contain a database; Skipping initialization                                                                                            2023-10-09 06:26:07.894 GMT [1] LOG:  invalid value for parameter "log_timezone": "UTC" 2023-10-09 06:26:07.895 GMT [1] LOG:  invalid value for parameter "TimeZone": "UTC"     2023-10-09 06:26:07.895 GMT [1] FATAL:  configuration file "/var/lib/postgresql/data/postgresql.conf" contains errors
smilerz commented 11 months ago

list of valid tz identifiers can be found here. TZ is the tag that the postgress container accepts to set timezone

languagemaniac commented 11 months ago

list of valid tz identifiers can be found here. TZ is the tag that the postgress container accepts to set timezone

So I changed it from UTC to ES but I still get

2023-10-09 19:30:29.795 GMT [1] LOG: invalid value for parameter "log_timezone": "UTC" 2023-10-09 19:30:29.796 GMT [1] LOG: invalid value for parameter "TimeZone": "UTC" 2023-10-09 19:30:29.796 GMT [1] FATAL: configuration file "/var/lib/postgresql/data/postgresql.conf" contains errors

The file "/var/lib/postgresql/data/postgresql.conf" doesn't exist anyways. I'm changing it from the postgresql folder's postgresql.conf file and restarting the container. But still get the error. It's strange because I didn't set it to UTC in the first place, just ran the container and just imported/exported recipes, nothing else.

smilerz commented 11 months ago

the correct format is Europe/Madrid, any changes you make to a container are going to be lost on reboot - add the values to the env file or compose file.

languagemaniac commented 11 months ago

Looks like the issue is not on the .env or the .yml file, but rather on the posgresql container. I don't understand. I removed all of it, created the env file and the yml file again, removed the existing docker volumes for tandoor, and re-downloaded it all and it's the same thing.

Looks like the issue might be on the postrgresql docker container itself. Don't know how to fix that.

smilerz commented 11 months ago

you should have a folder in your home directory (or maybe ~/.docker) called postgress or db_recipes - is there a postgress.conf there?

languagemaniac commented 11 months ago

nope, the only way I managed to change the error was by running an interactive shell on the postgresql container, by typing "docker exec -it 35b535d86414 /bin/sh" and then navigating to /var/lib/postgresql/data, and editing the postgresql.conf file with vi, because for some reason it doesn't let me use nano.

Whatever I change there, DOES have an effect on the error message. I changed the TimeZone and log_timezone tags, that said "UTC0" for "Europe/Madrid" but that made it run into a perpetual reboot. Checked the log and said that Europe/Madrid wasn't valid (which confirmed me that I edited the right file), but I couldn't edit the file again (because the container wouldn't stop restarting) so had to run the "docker-compose down" command and re-download with "docker-compose up -d"

I have access to the folder again and I can modify the file, but I'm unsure about what to type in there, but this is definitely the file to edit

smilerz commented 11 months ago

/var/lib/postgresql/data is mapped to ./postgresql - I don't know where that is on your system, but it should be in home or wherever you are running the docker commands.

The postgresql.conf shortnames for timezone are located here.

languagemaniac commented 11 months ago

Oh, ok, my postgresql folder that I accessed before, I made changes to the postgresql.conf file before, but didn't appear to made any difference because I saw the same error message. It needed rebooting and checking the logs back after the editing.

however, whatever I do, it just doesn't work. Now I get this error message:

2023-10-24 18:40:51.958 UTC [31] ERROR: invalid value for parameter "TimeZone": "UTC" 2023-10-24 18:40:51.958 UTC [31] STATEMENT: SET TIME ZONE 'UTC'

I tried setting the following values for TimeZone: CET (got that from the link you gave me), Default, UTC, UTC1, UTC0. none of them work, different error message for whatever I put there

Anyways, if I delete the whole thing, and re-download, and the error persists, that probably means the image has something wrong. Several months ago, I downloaded tandoor recipes, via docker-compose, with the env file, the exact same way I'm doing now, on the same system, and on another system, and it didn't have any issues and didn't have to edit any postgresql.conf file to make it work.

languagemaniac commented 11 months ago

/var/lib/postgresql/data is mapped to ./postgresql - I don't know where that is on your system, but it should be in home or wherever you are running the docker commands.

The postgresql.conf shortnames for timezone are located here.

do you have tandoor running on your system? Could you tell me what does your TimeZone tag say?

smilerz commented 11 months ago

log_timezone = 'UTC' timezone = 'UTC'

languagemaniac commented 11 months ago

log_timezone = 'UTC' timezone = 'UTC'

Interesting, so somehow even though I have the same thing, my file says that it's invalid, even after downloading it again several times. Doesn't make much sense, specially knowing that it worked before. As far as I know, updating / upgrading apt can't break an specific docker container right? I have automatic updates on my pi enabled. Can't think of anything else, everything else seems to be working fine

smilerz commented 11 months ago

I hate randomly trying things, but.... you can try deleting (or renaming) postgresql.conf and copy postgresql.auto.conf to postgresql.conf and restart the container. If that doesn't resolve it, try deleting the container (but not data on disk) and rebuilding it.

languagemaniac commented 11 months ago

I hate randomly trying things, but.... you can try deleting (or renaming) postgresql.conf and copy postgresql.auto.conf to postgresql.conf and restart the container. If that doesn't resolve it, try deleting the container (but not data on disk) and rebuilding it.

Tried that, still get

2023-10-26 16:04:26.577 UTC [363] ERROR: invalid value for parameter "TimeZone": "UTC" 2023-10-26 16:04:26.577 UTC [363] STATEMENT: SET TIME ZONE 'UTC'

Is it possible that the image is somehow wrong?

smilerz commented 11 months ago

can you reshare your compose file and env please? Also, you don't happen to be on Mac are you? Does the error occur on postgresql startup? or is it related to tandoor starting up?

languagemaniac commented 11 months ago

can you reshare your compose file and env please? Also, you don't happen to be on Mac are you? Does the error occur on postgresql startup? or is it related to tandoor starting up?

It's on a raspberry pi 3b+, with raspberry pi os 64 bit installed.

I'd say it happens on postgresql startup since when i reboot the postgresql container alone and then check logs it's already indicating the error.

The docker-compose file:

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

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

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

volumes:
  nginx_config:
  staticfiles:

The env file:

# only set this to true when testing/debugging
# when unset: 1 (true) - dont unset this, just for development
DEBUG=0
SQL_DEBUG=0
DEBUG_TOOLBAR=0
# Gunicorn log level for debugging (default value is "info" when unset)
# (see https://docs.gunicorn.org/en/stable/settings.html#loglevel for available settings)
# GUNICORN_LOG_LEVEL="debug"

# HTTP port to bind to
# TANDOOR_PORT=8080

# hosts the application can run under e.g. recipes.mydomain.com,cooking.mydomain.com,...
ALLOWED_HOSTS=*

# Cross Site Request Forgery protection
# (https://docs.djangoproject.com/en/4.2/ref/settings/#std-setting-CSRF_TRUSTED_ORIGINS)
# CSRF_TRUSTED_ORIGINS = []

# Cross Origin Resource Sharing
# (https://github.com/adamchainz/django-cors-header)
# CORS_ALLOW_ALL_ORIGINS = True

# random secret key, use for example `base64 /dev/urandom | head -c50` to generate one
# ---------------------------- AT LEAST ONE REQUIRED -------------------------
SECRET_KEY=password 1
SECRET_KEY_FILE=password 2
# ---------------------------------------------------------------

# your default timezone See https://timezonedb.com/time-zones for a list of timezones
TIMEZONE=Europe/Berlin

# add only a database password if you want to run with the default postgres, otherwise change settings accordingly
DB_ENGINE=django.db.backends.postgresql
# DB_OPTIONS= {} # e.g. {"sslmode":"require"} to enable ssl
POSTGRES_HOST=db_recipes
POSTGRES_PORT=5432
POSTGRES_USER=djangouser
# ---------------------------- AT LEAST ONE REQUIRED -------------------------
POSTGRES_PASSWORD=password
POSTGRES_PASSWORD_FILE=
# ---------------------------------------------------------------
POSTGRES_DB=djangodb

# database connection string, when used overrides other database settings.
# format might vary depending on backend
# DATABASE_URL = engine://username:password@host:port/dbname

# the default value for the user preference 'fractions' (enable/disable fraction support)
# default: disabled=0
FRACTION_PREF_DEFAULT=0

# the default value for the user preference 'comments' (enable/disable commenting system)
# default comments enabled=1
COMMENT_PREF_DEFAULT=1

# Users can set a amount of time after which the shopping list is refreshed when they are in viewing mode
# This is the minimum interval users can set. Setting this to low will allow users to refresh very frequently which
# might cause high load on the server. (Technically they can obviously refresh as often as they want with their own scripts)
SHOPPING_MIN_AUTOSYNC_INTERVAL=5

# Default for user setting sticky navbar
# STICKY_NAV_PREF_DEFAULT=1

# If base URL is something other than just / (you are serving a subfolder in your proxy for instance http://recipe_app/recipes/)
# Be sure to not have a trailing slash: e.g. '/recipes' instead of '/recipes/'
# SCRIPT_NAME=/recipes

# If staticfiles are stored at a different location uncomment and change accordingly, MUST END IN /
# this is not required if you are just using a subfolder
# This can either be a relative path from the applications base path or the url of an external host
# STATIC_URL=/static/

# If mediafiles are stored at a different location uncomment and change accordingly, MUST END IN /
# this is not required if you are just using a subfolder
# This can either be a relative path from the applications base path or the url of an external host
# MEDIA_URL=/media/

# Serve mediafiles directly using gunicorn. Basically everyone recommends not doing this. Please use any of the examples
# provided that include an additional nxginx container to handle media file serving.
# If you know what you are doing turn this back on (1) to serve media files using djangos serve() method.
# when unset: 1 (true) - this is temporary until an appropriate amount of time has passed for everyone to migrate
GUNICORN_MEDIA=0

# GUNICORN SERVER RELATED SETTINGS (see https://docs.gunicorn.org/en/stable/design.html#how-many-workers for recommended settings)
# GUNICORN_WORKERS=1
# GUNICORN_THREADS=1

# S3 Media settings: store mediafiles in s3 or any compatible storage backend (e.g. minio)
# as long as S3_ACCESS_KEY is not set S3 features are disabled
# S3_ACCESS_KEY=
# S3_SECRET_ACCESS_KEY=
# S3_BUCKET_NAME=
# S3_REGION_NAME= # default none, set your region might be required
# S3_QUERYSTRING_AUTH=1 # default true, set to 0 to serve media from a public bucket without signed urls
# S3_QUERYSTRING_EXPIRE=3600 # number of seconds querystring are valid for
# S3_ENDPOINT_URL= # when using a custom endpoint like minio
# S3_CUSTOM_DOMAIN= # when using a CDN/proxy to S3 (see https://github.com/TandoorRecipes/recipes/issues/1943)

# Email Settings, see https://docs.djangoproject.com/en/3.2/ref/settings/#email-host
# Required for email confirmation and password reset (automatically activates if host is set)
# EMAIL_HOST=
# EMAIL_PORT=
# EMAIL_HOST_USER=
# EMAIL_HOST_PASSWORD=
# EMAIL_USE_TLS=0
# EMAIL_USE_SSL=0
# email sender address (default 'webmaster@localhost')
# DEFAULT_FROM_EMAIL=
# prefix used for account related emails (default "[Tandoor Recipes] ")
# ACCOUNT_EMAIL_SUBJECT_PREFIX=

# allow authentication via the REMOTE-USER header (can be used for e.g. authelia).
# ATTENTION: Leave off if you don't know what you are doing! Enabling this without proper configuration will enable anybody
#   to login with any username!
# See docs for additional information: https://docs.tandoor.dev/features/authentication/#reverse-proxy-authentication
# when unset: 0 (false)
REMOTE_USER_AUTH=0

# Default settings for spaces, apply per space and can be changed in the admin view
# SPACE_DEFAULT_MAX_RECIPES=0 # 0=unlimited recipes
# SPACE_DEFAULT_MAX_USERS=0 # 0=unlimited users per space
# SPACE_DEFAULT_MAX_FILES=0 # Maximum file storage for space in MB. 0 for unlimited, -1 to disable file upload.
# SPACE_DEFAULT_ALLOW_SHARING=1 # Allow users to share recipes with public links

# allow people to create local accounts on your application instance (without an invite link)
# social accounts will always be able to sign up
# when unset: 0 (false)
# ENABLE_SIGNUP=0

# If signup is enabled you might want to add a captcha to it to prevent spam
# HCAPTCHA_SITEKEY=
# HCAPTCHA_SECRET=

# if signup is enabled you might want to provide urls to data protection policies or terms and conditions
# TERMS_URL=
# PRIVACY_URL=
# IMPRINT_URL=

# enable serving of prometheus metrics under the /metrics path
# ATTENTION: view is not secured (as per the prometheus default way) so make sure to secure it
# trough your web server (or leave it open of you dont care if the stats are exposed)
# ENABLE_METRICS=0

# allows you to setup OAuth providers
# see docs for more information https://docs.tandoor.dev/features/authentication/
# SOCIAL_PROVIDERS = allauth.socialaccount.providers.github, allauth.socialaccount.providers.nextcloud,

# Should a newly created user from a social provider get assigned to the default space and given permission by default ?
# ATTENTION: This feature might be deprecated in favor of a space join and public viewing system in the future
# default 0 (false), when 1 (true) users will be assigned space and group
# SOCIAL_DEFAULT_ACCESS = 1

# if SOCIAL_DEFAULT_ACCESS is used, which group should be added
# SOCIAL_DEFAULT_GROUP=guest

# Django session cookie settings. Can be changed to allow a single django application to authenticate several applications
# when running under the same database
# SESSION_COOKIE_DOMAIN=.example.com
# SESSION_COOKIE_NAME=sessionid # use this only to not interfere with non unified django applications under the same top level domain

# by default SORT_TREE_BY_NAME is disabled this will store all Keywords and Food in the order they are created
# enabling this setting makes saving new keywords and foods very slow, which doesn't matter in most usecases.
# however, when doing large imports of recipes that will create new objects, can increase total run time by 10-15x
# Keywords and Food can be manually sorted by name in Admin
# This value can also be temporarily changed in Admin, it will revert the next time the application is started
# This will be fixed/changed in the future by changing the implementation or finding a better workaround for sorting
# SORT_TREE_BY_NAME=0
# LDAP authentication
# default 0 (false), when 1 (true) list of allowed users will be fetched from LDAP server
#LDAP_AUTH=
#AUTH_LDAP_SERVER_URI=
#AUTH_LDAP_BIND_DN=
#AUTH_LDAP_BIND_PASSWORD=
#AUTH_LDAP_USER_SEARCH_BASE_DN=
#AUTH_LDAP_TLS_CACERTFILE=
#AUTH_LDAP_START_TLS=

# Enables exporting PDF (see export docs)
# Disabled by default, uncomment to enable
# ENABLE_PDF_EXPORT=1

# Recipe exports are cached for a certain time by default, adjust time if needed
# EXPORT_FILE_CACHE_DURATION=600
smilerz commented 11 months ago

does this work? docker exec -it db_recipes psql -c "ALTER DATABASE db_recipes SET timezone TO 'UTC';"

one thing you can try is rename the db_recipes folder and let the container rebuild from scratch and see if the error persists.

languagemaniac commented 10 months ago

does this work? docker exec -it db_recipes psql -c "ALTER DATABASE db_recipes SET timezone TO 'UTC';"

one thing you can try is rename the db_recipes folder and let the container rebuild from scratch and see if the error persists.

The command outputs this error

psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: role "root" does not exist

I tried renaming the postgresql folder and it created another one but the error persists. Or is it another folder that I need to rename?

smilerz commented 10 months ago

I should have tested it first, sorry: docker exec -it db_recipes psql -U djangouser -d djangodb -c "ALTER DATABASE djangodb SET timezone TO 'UTC';"

After renaming the folder postgres and recreating the container did you confirm that the folder was recreated? do you still get this specific error? 2023-10-09 19:30:29.796 GMT [1] FATAL: configuration file "/var/lib/postgresql/data/postgresql.conf" contains errors

smilerz commented 10 months ago

I just noticed something - this line is case sensitive ERROR: invalid value for parameter "TimeZone": "UTC" timezone is the correct parameter

languagemaniac commented 10 months ago

I just noticed something - this line is case sensitive ERROR: invalid value for parameter "TimeZone": "UTC" timezone is the correct parameter

I tried the comand you sent me, and it outputs

ERROR: invalid value for parameter "TimeZone": "UTC"

And the parameter in postgresql.conf is "timezone" without uppercase letters, yet the error says "TimeZone"

I did verify that the folder was recreated. In fact, since I created this issue I have recreated everything, deleted the whole tandoor folder, containers, rebooted... I think everything has been rebuilt at this point.

When i created this issue it also gave me error on log_timezone parameter. At some point it started only indicating "TimeZone" error, even though log_timezone and timezone are set to the exact same value, which by default is 'UTC0' by the way, but changing either one of them or the two of them to 'UTC' or other values changes nothing unfortunately.

I don't get the "contains errors" anymore now.

Maybe i should mention that when i check the logs for postgresql container, not only do I get the "TimeZone" error once, but many times, like crazy, the same error being displayed over and over again until at some point it stops, lasts about 10 seconds just measured it.

smilerz commented 10 months ago

If you are getting errors on a new postgres container I honestly have no idea. You'll need to ask for help from the maintainers if that image.

languagemaniac commented 10 months ago

If you are getting errors on a new postgres container I honestly have no idea. You'll need to ask for help from the maintainers if that image.

That's what I was thinking from the beginning... Do you know how could I get In touch with them? The only thing i could think about was creating an issue here.

smilerz commented 10 months ago

https://hub.docker.com/_/postgres

languagemaniac commented 10 months ago

Fixed it! I deleted the postgresql folder, changed the postgresql version tag on the yml file (I used 16.0-bullseye) and I got it working. Can't believe it lmao but it's finally fixed. I am glad I kept a backup file of the recipes so I can just load it again and have it all back. Closing this now, I hope it is useful to someone