P
Postiz•3mo ago
Support

HTTP 502 on Synology NAS with Docker/Reverse Proxy

@Klaus Just created a ticket
Question: I have installed Postiz using Docker Compose on a Synology NAS with Reverse Proxy. The following errors occur: (1) When registering a new user, I get "Unhandled Error: 502) (2) When clicking on "Sign in with Google", visually it seems a reload/refresh of the website may take place, but the screen does not change. (3) When trying to sign in with a non-existing account, the spinning wheel on the sign-in button keeps spinning indefinitely.
Attempted: * I made sure the Synology Firewall does not block the Docker IP range used by Postiz * I changed port 5000 to 5043 with no change in behaviour
Working On: Docker on a Synology DS923 (using Portainer)
Take it from here @Mod 🔥
20 Replies
xcons
xcons•3mo ago
Hey @Klaus , sorry that you're having issues. Could you see if there are errors in your docker logs please? You would normally issues in your logs if you are getting a HTTP 502.
Support
SupportOP•3mo ago
@Mod 🔥 please help @Klaus
Klaus
Klaus•2mo ago
Of course, apologies for not including them before. They all follow this pattern: ERR ts=1729516147.5200381 logger=http.log.error msg=dial tcp 127.0.0.1:3000: connect: connection refused request={"remote_ip":"192.168.208.1","remote_port":"46030","client_ip":"192.168.208.1","proto":"HTTP/1.1","method":"GET","host":"postiz.XXX","uri":"/api/auth/oauth/GOOGLE","headers":{"Pragma":["no-cache"],"Priority":["u=3, i"],"Connection":["close"],"Accept":["application/json"],"Accept-Language":["en-GB,en;q=0.9"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0.1 Safari/605.1.15"],"Referer":["https://postiz.XXX/auth/login"],"Content-Type":["application/json"],"Sec-Fetch-Mode":["cors"],"Sec-Fetch-Dest":["empty"],"X-Forwarded-For":["172.225.6.72"],"Sec-Fetch-Site":["same-origin"],"Cache-Control":["no-cache"],"Accept-Encoding":["gzip, deflate, br"],"X-Real-Ip":["172.225.6.72"],"X-Forwarded-Proto":["https"]}} duration=0.000611542 status=502 err_id=0u5z6s66d err_trace=reverseproxy.statusError (reverseproxy.go:1267) Just discovered that I get an earlier error when running the docker compose file: [Nest] 130 - 10/23/2024, 8:38:57 AM ERROR [PrismaClientInitializationError: Can't reach database server at postiz-postgres:5437 Please make sure your database server is running at postiz-postgres:5437.] Backend failed to start on port 3000 Below follows the composer file (adapted from the postiz docs): services: postiz: image: ghcr.io/gitroomhq/postiz-app:latest container_name: postiz restart: always environment: # You must change these. Replace postiz.your-server.com with your DNS name - what your web browser sees. MAIN_URL: "https://postiz.SERVER.COM" FRONTEND_URL: "https://postiz.SERVER.COM" NEXT_PUBLIC_BACKEND_URL: "https://postiz.SERVER.COM/api" JWT_SECRET: "placeholder" DATABASE_URL: "postgresql://XXX:YYY@postiz-postgres:5437/postiz-db-local" REDIS_URL: "redis://postiz-redis:6379" BACKEND_INTERNAL_URL: "http://localhost:3000" IS_GENERAL: "true" # Required for self-hosting. STORAGE_PROVIDER: "local" UPLOAD_DIRECTORY: "/uploads" NEXT_PUBLIC_UPLOAD_DIRECTORY: "/uploads" volumes: - /volume1/docker/postiz/config:/config/ - /volume1/docker/postiz/uploads:/uploads/ ports: - 5000:5000 networks: - postiz-network depends_on: postiz-postgres: condition: service_healthy postiz-redis: condition: service_healthy postiz-postgres: image: postgres:14.5 container_name: postiz-postgres restart: always environment: POSTGRES_PASSWORD: YYY POSTGRES_USER: XXX POSTGRES_DB: postiz-db-local volumes: - /volume1/docker/postiz/postgres:/var/lib/postgresql/data ports: - 5437:5432 networks: - postiz-network healthcheck: test: pg_isready -U postiz-user -d postiz-db-local interval: 10s timeout: 3s retries: 3 postiz-redis: image: redis:7.2 container_name: postiz-redis restart: always ports: - 6379:6379 healthcheck: test: redis-cli ping interval: 10s timeout: 3s retries: 3 volumes: - /volume1/docker/postiz/data:/data networks: - postiz-network As an additional note: I changed to 5437:5432 because of a bind error. Could that error be related to using localhost in BACKEND_INTERNAL_URL: "http://localhost:3000/", in that localhost might refer back to the wrong service? Hi @Support/@xcons, thanks so much for your initial help. I was hoping that providing more information might help resolve the issue -- I hope it wasn't counterproductive! 🙂
zapoqx
zapoqx•2mo ago
I realize I'm jumping on another ticket, but given its the same Issue I'm running across, I'm seeing the exact same error for the reason is failing to start on port 3000.
zapoqx
zapoqx•2mo ago
further checking, found this error
zapoqx
zapoqx•2mo ago
happens right after the localhost:4200 happens and is successful, I believe that is where it should show the localhost:3000 as well, but it doesn't happen.
Klaus
Klaus•2mo ago
Thanks @zapoqx, this is slightly "above my paygrade", as they say. When the message suggests running a command to resolve the issue, did you find that to be the solution? If so, where/how would I need to run it? Thanks!
zapoqx
zapoqx•2mo ago
unfortunately not. I think the problem stems with Prisma itself as I found a number of sites that complain specifically about being unable to connect to progresql on specifically port 5432. And given it cannot connect which causes port 3000 to fail... to me it seems like it would be nice to not have Caddy be discretly involved or at least the option to choose something not Prisma just to see if connecting works. I've tried many commands, but it doesn't appear like my commands would work because they are just activating at the time Caddy makes port 4200 and port 3000 available. Unfortunately with the command seeing to run, that looks like a bash script command which I would need to know IF there is anything else to put in the command line interface. Unfortunately, my code reading skills only go so far as my code writing skills kinda jump ship.
xcons
xcons•2mo ago
Hey folks, do you still need help here? Any particular reason you're using port 4200/3000? How are you trying to install? Also on a Synology?
zapoqx
zapoqx•2mo ago
Response continued from other ticket with the port 3000 issue. I just want a better way to not deal with Caddy. My complaint there is that under normal means (having QA experience) is that I would like to eliminated all other issues, but I can't eliminate Caddy if it is built-in to the container so I can't change any settings. I don't know if it is an issue, and if I change that port for the port 3000, it isn't gonna change how it launches and wanting port 3000 so I can't tell if its just an issue with port 3000 or something.
xcons
xcons•2mo ago
I'm confused, why is the internal Caddy an issue? Let's go back to basics, can you explain your setup?
zapoqx
zapoqx•2mo ago
Hey @Klaus we figured it out. The doc should be updated, but for you, take out the ports in the postgres and redis container and make sure the databaseurl goes to port 5432 and you'll be good.
xcons
xcons•2mo ago
Yeah, let us know @Klaus if you still need help, I think we can fix this one for you easily now 🙂
Fenohery
Fenohery•2mo ago
Hey there, i got the same error 502 I have installed postiz with Coolify.
xcons
xcons•2mo ago
@Fenohery , can you create a separate thread for your coolify problem please The 502 might not be related
Fenohery
Fenohery•2mo ago
Thanks for your reply @xcons
Klaus
Klaus•3w ago
Hi all, thanks so much and apologies for not checking in earlier. I can now register a user (registering same email a second time returns “email already exists”). But the login still does not work, it simply returns back to the login page. The one and only log entry for Postgres is FATAL: role "postiz-user" does not exist
xcons
xcons•3w ago
Okay, that doens't sound good, can you show me a screenshot where you're getting that message? It sounds like the backend isn't able to connect to the database.
Klaus
Klaus•3w ago
I had to change the postgres healthcheck to reflect the actual user name — sorry about that. But it still doesn’t work. Sending the postgres log below. “The files belonging to this database system will be owned by user "postgres". This user must also own the server process.” Does this need to be reflected in the compose file? I also noticed the log time is one hour out. Could that create any issues?
xcons
xcons•3w ago
No the timezone isn't likely to cause issues I've not seen that error on postgres before, did you change the user postgres is running as, or just the connection username? It might be cleaner to delete your postgres database volume and restart - if you don't mind resetting your postiz installation and losing any existing state

Did you find this page helpful?