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

Docker postgres fix #9041

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

SchrodingersGat
Copy link
Member

@SchrodingersGat SchrodingersGat commented Feb 6, 2025

Update target versions of alpine and postgresql for our docker image.

Notes

  • The latest available alpine image from microsoft (which we need to run the devcontainer) is alpine:3.20
  • This supports up to postgres:16

TODO

  • Update base image for devcontainer
  • Build devcontainer as part of docker CI step
  • Add documentation for postgresl version support in docker
  • Add documentation for postgres database version upgrade - https://github.com/pgautoupgrade/docker-pgautoupgrade
  • Test that changing docker-compose file (postgres:<x> tag) does not destroy database

- Move from alpine 3.19 to alpine 3.21
- Move from postgres13_client to postgres17_client
- Move from postgres:13 to postgres:16
- Move from redis:7.0 to redis:7-alpine
@SchrodingersGat SchrodingersGat added CI CI / unit testing ecosystem dependency Relates to a project dependency docker Docker / docker-compose setup Relates to the InvenTree setup / installation process labels Feb 6, 2025
@SchrodingersGat SchrodingersGat added this to the 1.0.0 milestone Feb 6, 2025
Copy link

netlify bot commented Feb 6, 2025

Deploy Preview for inventree-web-pui-preview canceled.

Name Link
🔨 Latest commit f8ce4f3
🔍 Latest deploy log https://app.netlify.com/sites/inventree-web-pui-preview/deploys/67ab12ad287d0f000859ef72

Copy link

codecov bot commented Feb 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.63%. Comparing base (8493e5a) to head (f8ce4f3).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9041      +/-   ##
==========================================
+ Coverage   85.55%   85.63%   +0.07%     
==========================================
  Files        1177     1177              
  Lines       52041    52041              
  Branches     2120     2120              
==========================================
+ Hits        44523    44563      +40     
+ Misses       6984     6928      -56     
- Partials      534      550      +16     
Flag Coverage Δ
backend 87.35% <ø> (+<0.01%) ⬆️
migrations 42.88% <ø> (+<0.01%) ⬆️
pui 69.59% <ø> (+0.36%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@matmair
Copy link
Member

matmair commented Feb 6, 2025

Last time we tried to bump it to 15 we ran into dependency issues fast, this has to be tested thoroughly

Copy link
Contributor

@wolflu05 wolflu05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. But as @matmair said we have to test this properly, so that we don't have the same problem as last time (actually not sure what it was the last time).

@SchrodingersGat
Copy link
Member Author

@SchrodingersGat
Copy link
Member Author

I believe that the issue is that we cannot force a change in the database image (e.g. postgres:13 -> postgres:16) - without the user performing a database migration.

However, we can update the inventree image to a newer version of the postgresql-client libs, which are backwards compatible.

Nominally we can change the docker-compose file, as anyone who has setup their docker stack has already downloaded and captured that file.

What we should do as part of this PR is provide an instruction for how to update from postgres:13 to postgres:16 (if users want to).

@matmair
Copy link
Member

matmair commented Feb 6, 2025

We also need to ensure that just switching out the docker-compose does not fry the database completely

@SchrodingersGat SchrodingersGat added the breaking Indicates a major update or change which breaks compatibility label Feb 8, 2025
Copy link
Member

@matmair matmair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH I do not understand most changes here

src/backend/requirements.in Outdated Show resolved Hide resolved
contrib/container/Dockerfile Outdated Show resolved Hide resolved
- Debian based (python3.11-bookworm)
- Install essential system packages
- Bump postgresql image from 13 to 15
- Store psql data in the dev/psql directory
- Install required frontend packages
@SchrodingersGat
Copy link
Member Author

SchrodingersGat commented Feb 11, 2025

To deal with the incompatibility between alpine:3.21 and the microsoft devcontainer setup, I have moved the devcontainer to a debian/bookworm image.

This has the added advantage that now our devcontainer setup can be used to run playwrigiht tests for the frontend "out of the box" - making the development path a lot smoother.

This is somewhat of a "regression" as the two docker setups used to be split in a similar fashion.


Note: Additionally, the dev container now builds and runs on M MacBooks too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Indicates a major update or change which breaks compatibility CI CI / unit testing ecosystem dependency Relates to a project dependency docker Docker / docker-compose setup Relates to the InvenTree setup / installation process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Docker] Update postgres version Update target version of postgresql
3 participants