Closed victorhooi closed 1 month ago
Hmm, looking at the postgres logs, I see this:
❯ docker logs inventree-db
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /var/lib/postgresql/data/pgdb ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
syncing data to disk ... ok
Success. You can now start the database server using:
pg_ctl -D /var/lib/postgresql/data/pgdb -l logfile start
waiting for server to start....2024-09-10 05:53:53.672 UTC [49] LOG: starting PostgreSQL 13.16 (Debian 13.16-1.pgdg120+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
2024-09-10 05:53:53.674 UTC [49] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-09-10 05:53:53.680 UTC [50] LOG: database system was shut down at 2024-09-10 05:53:53 UTC
2024-09-10 05:53:53.684 UTC [49] LOG: database system is ready to accept connections
done
server started
CREATE DATABASE
/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
2024-09-10 05:53:53.990 UTC [49] LOG: received fast shutdown request
waiting for server to shut down....2024-09-10 05:53:53.992 UTC [49] LOG: aborting any active transactions
2024-09-10 05:53:53.993 UTC [49] LOG: background worker "logical replication launcher" (PID 56) exited with exit code 1
2024-09-10 05:53:53.993 UTC [51] LOG: shutting down
2024-09-10 05:53:54.003 UTC [49] LOG: database system is shut down
done
server stopped
PostgreSQL init process complete; ready for start up.
2024-09-10 05:53:54.103 UTC [1] LOG: starting PostgreSQL 13.16 (Debian 13.16-1.pgdg120+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
2024-09-10 05:53:54.103 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2024-09-10 05:53:54.103 UTC [1] LOG: listening on IPv6 address "::", port 5432
2024-09-10 05:53:54.104 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-09-10 05:53:54.108 UTC [64] LOG: database system was shut down at 2024-09-10 05:53:53 UTC
2024-09-10 05:53:54.111 UTC [1] LOG: database system is ready to accept connections
2024-09-10 05:53:54.552 UTC [71] ERROR: relation "django_content_type" does not exist at character 106
2024-09-10 05:53:54.552 UTC [71] STATEMENT: SELECT "django_content_type"."id", "django_content_type"."app_label", "django_content_type"."model" FROM "django_content_type"
2024-09-10 05:53:54.564 UTC [71] ERROR: relation "common_inventreesetting" does not exist at character 112
2024-09-10 05:53:54.564 UTC [71] STATEMENT: SELECT "common_inventreesetting"."id", "common_inventreesetting"."value", "common_inventreesetting"."key" FROM "common_inventreesetting" WHERE UPPER("common_inventreesetting"."key"::text) = UPPER('CURRENCY_CODES') ORDER BY "common_inventreesetting"."id" ASC LIMIT 1
2024-09-10 05:53:54.581 UTC [71] ERROR: relation "common_inventreesetting" does not exist at character 112
2024-09-10 05:53:54.581 UTC [71] STATEMENT: SELECT "common_inventreesetting"."id", "common_inventreesetting"."value", "common_inventreesetting"."key" FROM "common_inventreesetting" WHERE UPPER("common_inventreesetting"."key"::text) = UPPER('CURRENCY_CODES') ORDER BY "common_inventreesetting"."id" ASC LIMIT 1
2024-09-10 05:53:54.581 UTC [71] ERROR: relation "common_inventreesetting" does not exist at character 112
2024-09-10 05:53:54.581 UTC [71] STATEMENT: SELECT "common_inventreesetting"."id", "common_inventreesetting"."value", "common_inventreesetting"."key" FROM "common_inventreesetting" WHERE UPPER("common_inventreesetting"."key"::text) = UPPER('CURRENCY_CODES') ORDER BY "common_inventreesetting"."id" ASC LIMIT 1
2024-09-10 05:53:54.583 UTC [71] ERROR: relation "common_inventreesetting" does not exist at character 112
2024-09-10 05:53:54.583 UTC [71] STATEMENT: SELECT "common_inventreesetting"."id", "common_inventreesetting"."value", "common_inventreesetting"."key" FROM "common_inventreesetting" WHERE UPPER("common_inventreesetting"."key"::text) = UPPER('CURRENCY_CODES') ORDER BY "common_inventreesetting"."id" ASC LIMIT 1
2024-09-10 05:53:54.583 UTC [71] ERROR: relation "common_inventreesetting" does not exist at character 112
2024-09-10 05:53:54.583 UTC [71] STATEMENT: SELECT "common_inventreesetting"."id", "common_inventreesetting"."value", "common_inventreesetting"."key" FROM "common_inventreesetting" WHERE UPPER("common_inventreesetting"."key"::text) = UPPER('CURRENCY_CODES') ORDER BY "common_inventreesetting"."id" ASC LIMIT 1
2024-09-10 05:53:54.584 UTC [71] ERROR: relation "common_inventreesetting" does not exist at character 112
2024-09-10 05:53:54.584 UTC [71] STATEMENT: SELECT "common_inventreesetting"."id", "common_inventreesetting"."value", "common_inventreesetting"."key" FROM "common_inventreesetting" WHERE UPPER("common_inventreesetting"."key"::text) = UPPER('CURRENCY_CODES') ORDER BY "common_inventreesetting"."id" ASC LIMIT 1
2024-09-10 05:53:54.586 UTC [71] ERROR: relation "common_inventreesetting" does not exist at character 112
I recommend reading the docs https://docs.inventree.org/en/stable/start/docker_install/#initial-database-setup
I performed both initial database setup and a update database on a fresh install. My server container was starting fine but the worker was restarting with the same error messages. I was able to fix it by adjusting the command in the docker-compose file for the worker container.
Config from the most recent main branch
# InvenTree/contrib/container/docker-compose.yml
inventree-worker:
# If you wish to specify a particular InvenTree version, do so here
image: inventree/inventree:${INVENTREE_TAG:-stable}
container_name: inventree-worker
command: invoke int.worker
depends_on:
- inventree-server
env_file:
- .env
volumes:
# Data volume must map to /home/inventree/data
- ${INVENTREE_EXT_VOLUME}:/home/inventree/data:z
restart: unless-stopped
Fixed command
# InvenTree/contrib/container/docker-compose.yml
inventree-worker:
# If you wish to specify a particular InvenTree version, do so here
image: inventree/inventree:${INVENTREE_TAG:-stable}
container_name: inventree-worker
command: invoke worker
depends_on:
- inventree-server
env_file:
- .env
volumes:
# Data volume must map to /home/inventree/data
- ${INVENTREE_EXT_VOLUME}:/home/inventree/data:z
restart: unless-stopped
Ah good catch. @matmair would you be on board with reverting just the worker
command as there will be many existing setups which will be affected by this change
@victorhooi this has now been fixed in #8126 - please update and check
Deployment Method
Steps to Reproduce
Describe the problem*
I am trying to deploy InvenTree locally using the provided Docker compose file at:
https://github.com/inventree/InvenTree/blob/master/contrib/container/docker-compose.yml
I have placed the following three files in a single directory:
I then run:
(At first, I got hit with a gotcha around the Caddyfile - it wasn't mentioned this was needed - and when Docker compose tried to spin everything up, it hit this error:
(It seems at least one other person hit this - https://github.com/inventree/InvenTree/discussions/7401 - it might be worth documenting it - or figuring out why the Docker compose file doesn't fail gracefully here?)
Anyway, clearing that error - the next issue is that
inventree-server
andinventree-worker
are both crashing.(container logs output is below under "Relevant log output").
Steps to Reproduce
cd
to that directorydocker compose pull
docker compose up -d
to see the status of the InvenTree containers. Notice that
inventree-serverand
inventree-worker` are crashingdocker logs inventree-server
to see the issuedpcRelevant log output