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

[DEPLOYMENT] Querying the Database #452

Open
M15071060 opened this issue Jan 16, 2025 · 1 comment
Open

[DEPLOYMENT] Querying the Database #452

M15071060 opened this issue Jan 16, 2025 · 1 comment
Labels
deployment Issues related to deploying AdventureLog

Comments

@M15071060
Copy link

M15071060 commented Jan 16, 2025

Explain your issue

I apologize if this is at all off-topic, but I was unsure how to proceed.

I am running this as a Stack in Portainer, and it seems to be functioning well, however I was looking to test out accessing the database directly and, while able to bind to console and start psql and see the tables from database as adventure, querying any table shows no results. Certainly a step is being missed, but it's unknown what, exactly.

Provide an obfuscated docker-compose.yml

services:
  web:
    #build: ./frontend/
    image: ghcr.io/seanmorley15/adventurelog-frontend:latest
    container_name: adventurelog-frontend
    restart: unless-stopped
    environment:
      - PUBLIC_SERVER_URL=http://server:8000 # Should be the service name of the backend with port 8000, even if you change the port in the backend service
      - ORIGIN=***.dev
      - BODY_SIZE_LIMIT=Infinity
    ports:
      - "8015:3000"
    depends_on:
      - server

  db:
    image: tobi312/rpi-postgresql-postgis:15-3.3-alpine-arm
    container_name: adventurelog-db
    restart: unless-stopped
    environment:
      POSTGRES_DB: database
      POSTGRES_USER: adventure
      POSTGRES_PASSWORD: ***
    volumes:
      - postgres_data:/var/lib/postgresql/data/

  server:
    #build: ./backend/
    image: ghcr.io/seanmorley15/adventurelog-backend:latest
    container_name: adventurelog-backend
    restart: unless-stopped
    environment:
      - PGHOST=db
      - PGDATABASE=database
      - PGUSER=adventure
      - PGPASSWORD=***
      - SECRET_KEY=***
      - DJANGO_ADMIN_USERNAME=admin
      - DJANGO_ADMIN_PASSWORD=admin
      - DJANGO_ADMIN_EMAIL=***
      - PUBLIC_URL=http://localhost:8016 # Match the outward port, used for the creation of image urls
      - CSRF_TRUSTED_ORIGINS=http://localhost:8016,http://localhost:8015 # Comma separated list of trusted origins for CSRF
      - DEBUG=False
      - FRONTEND_URL=***.dev # Used for email generation. This should be the url of the frontend
    ports:
      - "8016:80"
    depends_on:
      - db
    volumes:
      - adventurelog_media:/code/media/

volumes:
  postgres_data:
  adventurelog_media:

Provide any necessary logs from the containers and browser

database-# \conninfo
You are connected to database "database" as user "adventure" on host "db" (address "172.21.0.2") at port "5432".
database-# SELECT * FROM users_customuser
@M15071060 M15071060 added the deployment Issues related to deploying AdventureLog label Jan 16, 2025
@seanmorley15
Copy link
Owner

I just did some testing to try for myself. I see what you are talking about, the issue stems from a permissions issue for security. When I run \z users_customuser to check my permissions for it I get Access privileges being blank. I can run SELECT COUNT(*) FROM users_customuser and it will return the correct count. I would recommend using a tool like DBeaver or I personally use JetBrains DATAGrip to view the schema and manipulate data (although the Django admin site is super helpful for this too)! Let me know if you have any questions - I am not entirely an expert on PSQL commands but I hope this helps clear it up a bit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployment Issues related to deploying AdventureLog
Projects
None yet
Development

No branches or pull requests

2 participants