502 Bad Gateway nginx/1.22.0 (Ubuntu) and secure connection failed

hi, sorry if this has been answered before - i found a thread on github and it said "answered on discord" but didn't find the answer. i've installed postgres and redis separately and configured them and then installed immich in portainer/stacks. i opened port 8080 in ufw and postgres and redis ports but i get Secure Connection Failed - An error occurred during a connection to 192.168.50.187:8080. SSL received a record that exceeded the maximum permissible length. Error code: SSL_ERROR_RX_RECORD_TOO_LONG and when i try through http it's 502 bad gateway. do i have to install nginx because i haven't installed that one yet. version: "2.1" services: immich: image: ghcr.io/imagegenius/immich:latest container_name: immich environment: - PUID=1000 - PGID=1000 - TZ=Etc/UTC - DB_HOSTNAME=192.168.50.187:5432 - DB_USERNAME=immich - DB_PASSWORD=xxx - DB_DATABASE_NAME=immich - REDIS_HOSTNAME=192.168.50.187:6379 - DISABLE_MACHINE_LEANRNING=false #optional - DISABLE_TYPESENSE=false #optional - DB_PORT=5432 - REDIS_PORT=6379 - REDIS_PASSWORD= xxx - CUDA_ACCELERATION=false #optional volumes: - /home/user/docker/immich:/config - /home/user/photos:/photos - /home/user/docker/immich/machine-learning:/config/machine-learning #optional ports: - 8080:8080 restart: unless-stopped
18 Replies
terriblesmell
terriblesmellOP•2y ago
this is in the log [Nest] 2735 - 06/01/2023, 7:31:09 AM LOG [InstanceLoader] DownloadModule dependencies initialized +0ms [Nest] 2735 - 06/01/2023, 7:31:09 AM LOG [InstanceLoader] ConfigHostModule dependencies initialized +1ms [Nest] 2735 - 06/01/2023, 7:31:09 AM LOG [InstanceLoader] DiscoveryModule dependencies initialized +0ms [Nest] 2735 - 06/01/2023, 7:31:09 AM LOG [InstanceLoader] ConfigModule dependencies initialized +7ms [Nest] 2735 - 06/01/2023, 7:31:09 AM LOG [InstanceLoader] ScheduleModule dependencies initialized +0ms [Nest] 2735 - 06/01/2023, 7:31:09 AM LOG [InstanceLoader] BullModule dependencies initialized +0ms [Nest] 2735 - 06/01/2023, 7:31:09 AM LOG [InstanceLoader] BullModule dependencies initialized +0ms [Nest] 2735 - 06/01/2023, 7:31:09 AM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)... Error: getaddrinfo ENOTFOUND 192.168.50.187:5432 at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) [Nest] 2735 - 06/01/2023, 7:31:12 AM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)... Error: getaddrinfo ENOTFOUND 192.168.50.187:5432 at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) [Nest] 2735 - 06/01/2023, 7:31:15 AM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (3)... Error: getaddrinfo ENOTFOUND 192.168.50.187:5432 at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) ā— postgresql.service - PostgreSQL RDBMS Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor pres> Active: active (exited) since Thu 2023-06-01 07:30:42 UTC; 7s ago Process: 23567 ExecStart=/bin/true (code=exited, status=0/SUCCESS) Main PID: 23567 (code=exited, status=0/SUCCESS) CPU: 1ms Jun 01 07:30:42 fenix systemd[1]: Starting PostgreSQL RDBMS... Jun 01 07:30:42 fenix systemd[1]: Finished PostgreSQL RDBMS.
bo0tzz
bo0tzz•2y ago
You're using the imagegenius image which we don't support. You'll need to ask them for help or use the official docker-compose setup
terriblesmell
terriblesmellOP•2y ago
alright i'll just reinstall and try again šŸ™‚ with the correct version ^^ ok so i've reinstalled and get this error now: [Nest] 1 - 06/01/2023, 8:43:47 AM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)... Error: getaddrinfo EAI_AGAIN immich at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) and 500 connect ECONNREFUSED 172.20.0.8:3001
hydaz
hydaz•2y ago
@terriblesmell please continue here: https://github.com/imagegenius/docker-immich
GitHub
GitHub - imagegenius/docker-immich: Monolithic (Single) Docker Cont...
Monolithic (Single) Docker Container for Immich. Contribute to imagegenius/docker-immich development by creating an account on GitHub.
terriblesmell
terriblesmellOP•2y ago
i have reinstalled it with the information on how to from here: https://immich.app/docs/install/docker-compose
Docker Compose [Recommended] | Immich
Docker Compose is the recommended method to run Immich in production. Below are the steps to deploy Immich with Docker Compose.
bo0tzz
bo0tzz•2y ago
Looks like you entered immich as the address of your postgres database, is that correct?
terriblesmell
terriblesmellOP•2y ago
in the .env file or the docker-compose.yml? DB_HOSTNAME is the server adress without the specified port. i uncommented DB_PORT=5432
bo0tzz
bo0tzz•2y ago
Can you post both here?
terriblesmell
terriblesmellOP•2y ago
sure one moment šŸ™‚
bo0tzz
bo0tzz•2y ago
The error says
Error: getaddrinfo EAI_AGAIN immich
Error: getaddrinfo EAI_AGAIN immich
Which indicates the configured database address is immich, but in your .env you have it set to 192.168.50.187, so something is mismatched there šŸ¤” Can you try stopping the whole stack (docker compose down) and then bringing it back up?
terriblesmell
terriblesmellOP•2y ago
i get this error when bringing it up
terriblesmell
terriblesmellOP•2y ago
immich_microservices | [Nest] 1 - 06/01/2023, 9:13:48 AM LOG [NestFactory] Starting Nest application... immich_microservices | [Nest] 1 - 06/01/2023, 9:13:49 AM LOG [InstanceLoader] TypeOrmModule dependencies initialized +64ms immich_microservices | [Nest] 1 - 06/01/2023, 9:13:49 AM LOG [InstanceLoader] BullModule dependencies initialized +0ms immich_microservices | [Nest] 1 - 06/01/2023, 9:13:49 AM LOG [InstanceLoader] ConfigHostModule dependencies initialized +1ms immich_microservices | [Nest] 1 - 06/01/2023, 9:13:49 AM LOG [InstanceLoader] DiscoveryModule dependencies initialized +1ms immich_microservices | [Nest] 1 - 06/01/2023, 9:13:49 AM LOG [InstanceLoader] ConfigModule dependencies initialized +28ms immich_microservices | [Nest] 1 - 06/01/2023, 9:13:49 AM LOG [InstanceLoader] BullModule dependencies initialized +0ms immich_microservices | [Nest] 1 - 06/01/2023, 9:13:49 AM LOG [InstanceLoader] BullModule dependencies initialized +0ms immich_microservices | [Nest] 1 - 06/01/2023, 9:13:49 AM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)... immich_microservices | Error: connect ECONNREFUSED 192.168.50.187:5432 immich_microservices | at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16)
bo0tzz
bo0tzz•2y ago
Alright it's using the correct address now at least Is postgres running on another machine or the same machine? And in docker or natively?
terriblesmell
terriblesmellOP•2y ago
its on the same machine and running natively
bo0tzz
bo0tzz•2y ago
Docker containers can't usually reach the host via the host's IP address. Give some of the stuff in this post a try https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach
Stack Overflow
From inside of a Docker container, how do I connect to the localhos...
I have a Nginx running inside a docker container. I have a MySql running on the host system. I want to connect to the MySql from within my container. MySql is only binding to the localhost device. Is
terriblesmell
terriblesmellOP•2y ago
thanks, i'll give this a try ok, i've got it to work now! running on 1.59.1, it also detects my internal ssd with 2tb and i can share with my wifes account šŸ™‚ is there a way for my wife to add to shared albums? could you point me to a good guide to make immich available via reverse proxy (nginx proxy manager for example)? what would you suggest? or would it be easier with an app like traefik or tailscale? i am running ubuntu server 22.04 on a dedicated machine but having trouble because whenever i point something to my public ip adress it automatically shows my synology nas instead of my ubuntu server. thank you for your help so far! šŸ™‚
Covalent
Covalent•2y ago
I would recommend caddy as it is very easy to use and does tls for you Also for the nas issue, you probably need to tinker with your routing setup on your router Also you can only have one server on a network with any given port exposed, so you'll have to use a reverse proxy to route from one server to another if you want to expose services on both machines with a reverse proxy Sorry if that was a little convoluted, I'm happy to clarify further if you need

Did you find this page helpful?