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

Volume mounts with postgres for self-hosting #60

Closed
jedahan opened this issue Oct 6, 2023 · 3 comments
Closed

Volume mounts with postgres for self-hosting #60

jedahan opened this issue Oct 6, 2023 · 3 comments

Comments

@jedahan
Copy link

jedahan commented Oct 6, 2023

I had to swap the volume mount to a named volume for it to work for me:

diff --git a/docker-compose.prod-remote.yml b/docker-compose.prod-remote.yml
index 7987194..dcc5432 100644
--- a/docker-compose.prod-remote.yml
+++ b/docker-compose.prod-remote.yml
@@ -3,10 +3,11 @@ services:
   db:
     image: postgres
     volumes:
-      - ./tmp/db:/var/lib/postgresql/data
+      - postgres-data:/var/lib/postgresql/data
     ports:
       - "5432:5432"
     restart: unless-stopped
+    platform: linux/amd64
     environment:
       - POSTGRES_PASSWORD=${DATABASE_PASSWORD}
       - POSTGRES_USER=${DATABASE_USER}
@@ -22,6 +23,7 @@ services:
     depends_on:
       - db
     restart: unless-stopped
+    platform: linux/amd64
     environment:
       - RAILS_ENV=production
       - RACK_ENV=production
@@ -35,3 +37,7 @@ services:
       - INIT_USER_EMAIL=${INIT_USER_EMAIL}
       - INIT_USER_PASSWORD=${INIT_USER_PASSWORD}
       - FORCE_SSL_PROD=${FORCE_SSL_PROD}
+
+volumes:
+  postgres-data:
+
@jedahan jedahan changed the title Volume mounts with pstgres for self-hosting Volume mounts with postgres for self-hosting Oct 6, 2023
@shafy
Copy link
Owner

shafy commented Oct 6, 2023

Interesting. This might be a Linux thing? What kind of error were you getting?

@jedahan
Copy link
Author

jedahan commented Oct 6, 2023

Error was:

/usr/bin/chown: changing ownership of '/var/lib/postgresql/data': Operation not permitted

I am on macOS, using podman machine's default linux distro (fedora 38). Hope that helps.

@shafy
Copy link
Owner

shafy commented Oct 6, 2023

Yes, looks like with podman you need to use a named volume (see relevant Docker docs here). Going to close this issue since it's a configuration detail.

@shafy shafy closed this as completed Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants