[Help] 502 Bad Gateway #597

Closed
opened 2026-02-04 21:28:22 +03:00 by OVERLORD · 6 comments
Owner

Originally created by @threehappypenguins on GitHub (Jan 19, 2023).

I have an Odroid HC2 (armv7l), OMV installed (Debian Bullseye), and also running Nextcloud. Because Nextcloud runs on port 8080, I stopped Nextcloud containers for the time being in order to try out Immich. Using Portainer, I added a new stack called immich, with the following docker compose:

version: "3.8"

services:
  immich-server:
    container_name: immich_server
    image: altran1502/immich-server:release
    entrypoint: ["/bin/sh", "./start-server.sh"]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
    env_file:
      - stack.env
    environment:
      - NODE_ENV=production
    depends_on:
      - redis
      - database
    restart: always

  immich-microservices:
    container_name: immich_microservices
    image: altran1502/immich-server:release
    entrypoint: ["/bin/sh", "./start-microservices.sh"]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
    env_file:
      - stack.env
    environment:
      - NODE_ENV=production
    depends_on:
      - redis
      - database
    restart: always

  immich-web:
    container_name: immich_web
    image: altran1502/immich-web:release
    entrypoint: ["/bin/sh", "./entrypoint.sh"]
    env_file:
      - stack.env
    environment:
      # Rename these values for svelte public interface
      - PUBLIC_IMMICH_SERVER_URL=${IMMICH_SERVER_URL}
    restart: always

  redis:
    container_name: immich_redis
    image: redis:6.2
    restart: always

  database:
    container_name: immich_postgres
    image: postgres:14
    env_file:
      - stack.env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      PG_DATA: /var/lib/postgresql/data
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: always

  immich-proxy:
    container_name: immich_proxy
    image: altran1502/immich-proxy:release
    environment:
      # Make sure these values get passed through from the env file
      - IMMICH_SERVER_URL
      - IMMICH_WEB_URL
    ports:
      - 2283:8080
    logging:
      driver: none
    depends_on:
      - immich-server
    restart: always

volumes:
  pgdata:

for the .env (advanced) section, I have:

###################################################################################
# Database
###################################################################################

DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_DATABASE_NAME=immich

# Optional Database settings:
# DB_PORT=5432

###################################################################################
# Redis
###################################################################################

REDIS_HOSTNAME=immich_redis

# Optional Redis settings:
# REDIS_PORT=6379
# REDIS_DBINDEX=0
# REDIS_PASSWORD=
# REDIS_SOCKET=

###################################################################################
# Upload File Location
#
# This is the location where uploaded files are stored.
###################################################################################

UPLOAD_LOCATION=/srv/dev-disk-by-uuid-088953ed-6887-487c-bd44-d5f86dc93383/PHS/Test

###################################################################################
# JWT SECRET
#
# This JWT_SECRET is used to sign the authentication keys for user login
# You should set it to a long randomly generated value
# You can use this command to generate one: openssl rand -base64 128
###################################################################################

JWT_SECRET=mybiglongsecret

###################################################################################
# Reverse Geocoding
#
# Reverse geocoding is done locally which has a small impact on memory usage
# This memory usage can be altered by changing the REVERSE_GEOCODING_PRECISION variable
# This ranges from 0-3 with 3 being the most precise
# 3 - Cities > 500 population: ~200MB RAM
# 2 - Cities > 1000 population: ~150MB RAM
# 1 - Cities > 5000 population: ~80MB RAM
# 0 - Cities > 15000 population: ~40MB RAM
####################################################################################

# DISABLE_REVERSE_GEOCODING=false
# REVERSE_GEOCODING_PRECISION=3

####################################################################################
# WEB - Optional
#
# Custom message on the login page, should be written in HTML form.
# For example:
# PUBLIC_LOGIN_PAGE_MESSAGE="This is a demo instance of Immich.<br><br>Email: <i>demo@demo.de</i><br>Password: <i>demo</i>"
####################################################################################

PUBLIC_LOGIN_PAGE_MESSAGE="Media"

####################################################################################
# Alternative Service Addresses - Optional
#
# This is an advanced feature for users who may be running their immich services on different hosts.
# It will not change which address or port that services bind to within their containers, but it will change where other services look for their peers.
# Note: immich-microservices is bound to 3002, but no references are made
####################################################################################

IMMICH_WEB_URL=http://192.168.1.38:3000
IMMICH_SERVER_URL=http://192.168.1.38:3001

When I go to 192.168.1.38:2283 I get 502 Bad Gateway. If I go to check the logs for the different containers, it looks fairly normal to me, except when I try to check the immich_proxy container, the logs won't show and I get Failure: Unable to retrieve logs. If I try to check the logs via command line (docker container logs <containerid>), I get Error response from daemon: configured logging driver does not support reading.

Poking around in nginx, I went to /etc/nginx/sites-enabled and see openmediavault-webgui but nothing about immich. Is there supposed to be an Immich conf file there?

How can I figure out what is causing the 502 Bad Gateway?

Originally created by @threehappypenguins on GitHub (Jan 19, 2023). I have an Odroid HC2 (armv7l), OMV installed (Debian Bullseye), and also running Nextcloud. Because Nextcloud runs on port 8080, I stopped Nextcloud containers for the time being in order to try out Immich. Using Portainer, I added a new stack called _immich_, with the following docker compose: ``` version: "3.8" services: immich-server: container_name: immich_server image: altran1502/immich-server:release entrypoint: ["/bin/sh", "./start-server.sh"] volumes: - ${UPLOAD_LOCATION}:/usr/src/app/upload env_file: - stack.env environment: - NODE_ENV=production depends_on: - redis - database restart: always immich-microservices: container_name: immich_microservices image: altran1502/immich-server:release entrypoint: ["/bin/sh", "./start-microservices.sh"] volumes: - ${UPLOAD_LOCATION}:/usr/src/app/upload env_file: - stack.env environment: - NODE_ENV=production depends_on: - redis - database restart: always immich-web: container_name: immich_web image: altran1502/immich-web:release entrypoint: ["/bin/sh", "./entrypoint.sh"] env_file: - stack.env environment: # Rename these values for svelte public interface - PUBLIC_IMMICH_SERVER_URL=${IMMICH_SERVER_URL} restart: always redis: container_name: immich_redis image: redis:6.2 restart: always database: container_name: immich_postgres image: postgres:14 env_file: - stack.env environment: POSTGRES_PASSWORD: ${DB_PASSWORD} POSTGRES_USER: ${DB_USERNAME} POSTGRES_DB: ${DB_DATABASE_NAME} PG_DATA: /var/lib/postgresql/data volumes: - pgdata:/var/lib/postgresql/data restart: always immich-proxy: container_name: immich_proxy image: altran1502/immich-proxy:release environment: # Make sure these values get passed through from the env file - IMMICH_SERVER_URL - IMMICH_WEB_URL ports: - 2283:8080 logging: driver: none depends_on: - immich-server restart: always volumes: pgdata: ``` for the .env (advanced) section, I have: ``` ################################################################################### # Database ################################################################################### DB_HOSTNAME=immich_postgres DB_USERNAME=postgres DB_PASSWORD=postgres DB_DATABASE_NAME=immich # Optional Database settings: # DB_PORT=5432 ################################################################################### # Redis ################################################################################### REDIS_HOSTNAME=immich_redis # Optional Redis settings: # REDIS_PORT=6379 # REDIS_DBINDEX=0 # REDIS_PASSWORD= # REDIS_SOCKET= ################################################################################### # Upload File Location # # This is the location where uploaded files are stored. ################################################################################### UPLOAD_LOCATION=/srv/dev-disk-by-uuid-088953ed-6887-487c-bd44-d5f86dc93383/PHS/Test ################################################################################### # JWT SECRET # # This JWT_SECRET is used to sign the authentication keys for user login # You should set it to a long randomly generated value # You can use this command to generate one: openssl rand -base64 128 ################################################################################### JWT_SECRET=mybiglongsecret ################################################################################### # Reverse Geocoding # # Reverse geocoding is done locally which has a small impact on memory usage # This memory usage can be altered by changing the REVERSE_GEOCODING_PRECISION variable # This ranges from 0-3 with 3 being the most precise # 3 - Cities > 500 population: ~200MB RAM # 2 - Cities > 1000 population: ~150MB RAM # 1 - Cities > 5000 population: ~80MB RAM # 0 - Cities > 15000 population: ~40MB RAM #################################################################################### # DISABLE_REVERSE_GEOCODING=false # REVERSE_GEOCODING_PRECISION=3 #################################################################################### # WEB - Optional # # Custom message on the login page, should be written in HTML form. # For example: # PUBLIC_LOGIN_PAGE_MESSAGE="This is a demo instance of Immich.<br><br>Email: <i>demo@demo.de</i><br>Password: <i>demo</i>" #################################################################################### PUBLIC_LOGIN_PAGE_MESSAGE="Media" #################################################################################### # Alternative Service Addresses - Optional # # This is an advanced feature for users who may be running their immich services on different hosts. # It will not change which address or port that services bind to within their containers, but it will change where other services look for their peers. # Note: immich-microservices is bound to 3002, but no references are made #################################################################################### IMMICH_WEB_URL=http://192.168.1.38:3000 IMMICH_SERVER_URL=http://192.168.1.38:3001 ``` When I go to 192.168.1.38:2283 I get 502 Bad Gateway. If I go to check the logs for the different containers, it looks fairly normal to me, except when I try to check the immich_proxy container, the logs won't show and I get `Failure: Unable to retrieve logs`. If I try to check the logs via command line (`docker container logs <containerid>`), I get `Error response from daemon: configured logging driver does not support reading`. Poking around in nginx, I went to `/etc/nginx/sites-enabled` and see `openmediavault-webgui` but nothing about immich. Is there supposed to be an Immich conf file there? How can I figure out what is causing the 502 Bad Gateway?
Author
Owner

@alextran1502 commented on GitHub (Jan 19, 2023):

Please keep these line in the .env file as default

IMMICH_WEB_URL=http://immich-web:3000
IMMICH_SERVER_URL=http://immich-server:3001
IMMICH_MACHINE_LEARNING_URL=http://immich-machine-learning:3003
@alextran1502 commented on GitHub (Jan 19, 2023): Please keep these line in the `.env` file as default ```bash IMMICH_WEB_URL=http://immich-web:3000 IMMICH_SERVER_URL=http://immich-server:3001 IMMICH_MACHINE_LEARNING_URL=http://immich-machine-learning:3003 ```
Author
Owner

@threehappypenguins commented on GitHub (Jan 19, 2023):

Hallelujah, it works! I misunderstood the instructions. Also, I didn't need to change port 8080 to something else. 2283:8080 works just fine alongside with Nextcloud running. I'm very excited to try this out. I have a ton of photos and videos from over the years, and four kids including a 20-month-old. Thanks for all your hard work!!!

@threehappypenguins commented on GitHub (Jan 19, 2023): Hallelujah, it works! I misunderstood the instructions. Also, I didn't need to change port 8080 to something else. 2283:8080 works just fine alongside with Nextcloud running. I'm very excited to try this out. I have a ton of photos and videos from over the years, and four kids including a 20-month-old. Thanks for all your hard work!!!
Author
Owner

@alextran1502 commented on GitHub (Jan 19, 2023):

Cheer! I am glad it is working! Enjoy

@alextran1502 commented on GitHub (Jan 19, 2023): Cheer! I am glad it is working! Enjoy
Author
Owner

@zwpride commented on GitHub (Apr 14, 2023):

amzing!!!!!!!!!!!!!!!!

@zwpride commented on GitHub (Apr 14, 2023): amzing!!!!!!!!!!!!!!!!
Author
Owner

@RussQuan commented on GitHub (May 29, 2023):

I have the same issue 🥲
My error log, please help 🥲

docker logs immich_proxy
2023/05/29 05:35:04 [error] 39#39: *62 connect() failed (113: No route to host) while connecting to upstream, client: 10.155.215.2, server: , request: "GET / HTTP/1.1", upstream: "http://172.18.0.4:3000/", host: "192.168.1.156:2283"
2023/05/29 05:35:07 [error] 39#39: *62 connect() failed (113: No route to host) while connecting to upstream, client: 10.155.215.2, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://172.18.0.4:3000/favicon.ico", host: "192.168.1.156:2283", referrer: "http://192.168.1.156:2283/"
2023/05/29 05:17:59 [error] 37#37: *45 connect() failed (111: Connection refused) while connecting to upstream, client: 10.155.215.2, server: , request: "GET / HTTP/1.1", upstream: "http://172.18.0.4:3000/", host: "192.168.1.156:2283"

It seems like keeps restarting
image

@RussQuan commented on GitHub (May 29, 2023): I have the same issue 🥲 My error log, please help 🥲 ``` docker logs immich_proxy ``` ``` 2023/05/29 05:35:04 [error] 39#39: *62 connect() failed (113: No route to host) while connecting to upstream, client: 10.155.215.2, server: , request: "GET / HTTP/1.1", upstream: "http://172.18.0.4:3000/", host: "192.168.1.156:2283" 2023/05/29 05:35:07 [error] 39#39: *62 connect() failed (113: No route to host) while connecting to upstream, client: 10.155.215.2, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://172.18.0.4:3000/favicon.ico", host: "192.168.1.156:2283", referrer: "http://192.168.1.156:2283/" 2023/05/29 05:17:59 [error] 37#37: *45 connect() failed (111: Connection refused) while connecting to upstream, client: 10.155.215.2, server: , request: "GET / HTTP/1.1", upstream: "http://172.18.0.4:3000/", host: "192.168.1.156:2283" ``` It seems like keeps restarting <img width="1249" alt="image" src="https://github.com/immich-app/immich/assets/38601123/d6113e6b-bbca-48d8-9313-f200c14be0e4">
Author
Owner

@alextran1502 commented on GitHub (May 29, 2023):

@RussQuan please open an issue with the requested info. You probably have your environment setup incorrectly

@alextran1502 commented on GitHub (May 29, 2023): @RussQuan please open an issue with the requested info. You probably have your environment setup incorrectly
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#597