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

[BUG] can't launch with docker compose #92

Closed
fuji246 opened this issue Mar 30, 2022 · 9 comments
Closed

[BUG] can't launch with docker compose #92

fuji246 opened this issue Mar 30, 2022 · 9 comments

Comments

@fuji246
Copy link

fuji246 commented Mar 30, 2022

Describe the bug
A clear and concise description of what the bug is.

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
Recreating immich_redis    ... done
Recreating immich_postgres ... done
Recreating docker_immich_server_1 ... 
Recreating docker_immich_microservices_1 ... 

ERROR: for docker_immich_microservices_1  UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)

ERROR: for docker_immich_server_1  UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)

ERROR: for immich_microservices  UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)

ERROR: for immich_server  UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)
ERROR: An HTTP request took too long to complete. Retry with --verbose to obtain debug information.
If you encounter this issue regularly because of slow network conditions, consider setting COMPOSE_HTTP_TIMEOUT to a higher value (current value: 60).

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

only changed UPLOAD_LOCATION in ".env", then run "docker-compose -f ./docker/docker-compose.yml up --build -V"

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]

macOS

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@fuji246 fuji246 added the bug label Mar 30, 2022
@DB-Vincent
Copy link

Hi, did you fill in the DB_DATABASE_NAME property? You'll also have to fill in the JWT_SECRET and ENABLE_MAPBOX (optionally also the MAPBOX_KEY) properties!

@alextran1502
Copy link
Contributor

Do you have an M1 or Intel Mac?

Does this problem persist when you run docker-compose command again?

Can you share your .env file?

@fuji246
Copy link
Author

fuji246 commented Mar 30, 2022

I'm using Intel Mac. It persists.

# Database
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_DATABASE_NAME=

# Upload File Config
UPLOAD_LOCATION=/Users/xxx/work/playground/immich/Photos

# JWT SECRET
JWT_SECRET=

# MAPBOX
## ENABLE_MAPBOX is either true of false -> if true, you have to provide MAPBOX_KEY
ENABLE_MAPBOX= 
MAPBOX_KEY=

@alextran1502
Copy link
Contributor

Ok, you need to set DB_DATABASE_NAME, also JWT_SECRET and ENABLE_MAPBOX to false if you don't use that feature.

After you do that if the problem still persists, can you comment out the immich_microservices section in docker-compose file?

This whole section below:

  immich_microservices:
    image: immich-microservices:1.4.0
    build:
      context: ../microservices
      dockerfile: ../microservices/Dockerfile
    entrypoint: ["/bin/sh", "./entrypoint.sh"]
    expose:
      - "3001"
    volumes:
      - ../microservices:/usr/src/app
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /usr/src/app/node_modules
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    depends_on:
      - database
    networks:
      - immich_network

Let me know how it goes.

@fuji246
Copy link
Author

fuji246 commented Mar 30, 2022

not working for me,

$ cat ./docker/.env
# Database
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_DATABASE_NAME=immich

# Upload File Config
UPLOAD_LOCATION=/Users/jeromy/work/playground/immich/Photos

# JWT SECRET
JWT_SECRET=false

# MAPBOX
## ENABLE_MAPBOX is either true of false -> if true, you have to provide MAPBOX_KEY
ENABLE_MAPBOX=false 
MAPBOX_KEY=
$ cat ./docker/docker-compose.yml
version: "3.8"

services:
  immich_server:
    image: immich-server:1.4.0
    build:
      context: ../server
      dockerfile: ../server/Dockerfile
    entrypoint: ["/bin/sh", "./entrypoint.sh"]
    expose:
      - "3000"
    volumes:
      - ../server:/usr/src/app
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /usr/src/app/node_modules
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    depends_on:
      - redis
      - database
    networks:
      - immich_network

        #  immich_microservices:
        #    image: immich-microservices:1.4.0
        #    build:
        #      context: ../microservices
        #      dockerfile: ../microservices/Dockerfile
        #    entrypoint: ["/bin/sh", "./entrypoint.sh"]
        #    expose:
        #      - "3001"
        #    volumes:
        #      - ../microservices:/usr/src/app
        #      - ${UPLOAD_LOCATION}:/usr/src/app/upload
        #      - /usr/src/app/node_modules
        #    env_file:
        #      - .env
        #    environment:
        #      - NODE_ENV=production
        #    depends_on:
        #      - database
        #    networks:
        #      - immich_network


  redis:
    container_name: immich_redis
    image: redis:6.2
    networks:
      - immich_network

  database:
    container_name: immich_postgres
    image: postgres:14
    env_file:
      - .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
    ports:
      - 5432:5432
    networks:
      - immich_network

  nginx:
    container_name: proxy_nginx
    image: nginx:latest
    volumes:
      - ./settings/nginx-conf:/etc/nginx/conf.d
    ports:
      - 2283:80
      - 2284:443
    logging:
      driver: none
    networks:
      - immich_network
    depends_on:
      - immich_server

  # immich_tf_fastapi:
  #   container_name: immich_tf_fastapi
  #   image: tensor_flow_fastapi:1.0.0
  #   restart: always
  #   command: uvicorn app.main:app --proxy-headers --host 0.0.0.0 --port 8000 --reload
  #   build:
  #     context: ../machine_learning
  #     target: cpu
  #     dockerfile: ../machine_learning/Dockerfile
  #   volumes:
  #     - ../machine_learning/app:/code/app
  #     - ${UPLOAD_LOCATION}:/code/app/upload
  #   ports:
  #     - 2285:8000
  #   expose:
  #     - "8000"
  #   depends_on:
  #     - database
  #   networks:
  #     - immich_network

networks:
  immich_network:
volumes:
  pgdata:

@alextran1502
Copy link
Contributor

alextran1502 commented Mar 30, 2022

Probably similar to this? Compose error "HTTP request took too long to complete"

Can you restart your docker desktop program and try again?

@fuji246
Copy link
Author

fuji246 commented Mar 31, 2022

immich_postgres         | 2022-03-30 22:25:52.186 UTC [51] FATAL:  database "immich" does not exist
immich_server_1         | [Nest] 51  - 03/30/2022, 10:25:52 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (9)...
immich_server_1         | error: database "immich" does not exist
immich_server_1         |     at Parser.parseErrorMessage (/usr/src/app/node_modules/pg-protocol/dist/parser.js:287:98)
immich_server_1         |     at Parser.handlePacket (/usr/src/app/node_modules/pg-protocol/dist/parser.js:126:29)
immich_server_1         |     at Parser.parse (/usr/src/app/node_modules/pg-protocol/dist/parser.js:39:38)
immich_server_1         |     at Socket.<anonymous> (/usr/src/app/node_modules/pg-protocol/dist/index.js:11:42)
immich_server_1         |     at Socket.emit (node:events:526:28)
immich_server_1         |     at addChunk (node:internal/streams/readable:315:12)
immich_server_1         |     at readableAddChunk (node:internal/streams/readable:289:9)
immich_server_1         |     at Socket.Readable.push (node:internal/streams/readable:228:10)
immich_server_1         |     at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
immich_server_1         | [Nest] 51  - 03/30/2022, 10:25:52 PM   ERROR [ExceptionHandler] database "immich" does not exist
immich_server_1         | error: database "immich" does not exist
immich_server_1         |     at Parser.parseErrorMessage (/usr/src/app/node_modules/pg-protocol/dist/parser.js:287:98)
immich_server_1         |     at Parser.handlePacket (/usr/src/app/node_modules/pg-protocol/dist/parser.js:126:29)
immich_server_1         |     at Parser.parse (/usr/src/app/node_modules/pg-protocol/dist/parser.js:39:38)
immich_server_1         |     at Socket.<anonymous> (/usr/src/app/node_modules/pg-protocol/dist/index.js:11:42)
immich_server_1         |     at Socket.emit (node:events:526:28)
immich_server_1         |     at addChunk (node:internal/streams/readable:315:12)
immich_server_1         |     at readableAddChunk (node:internal/streams/readable:289:9)
immich_server_1         |     at Socket.Readable.push (node:internal/streams/readable:228:10)
immich_server_1         |     at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
docker_immich_server_1 exited with code 1
^CGracefully stopping... (press Ctrl+C again to force)
Killing proxy_nginx                                   ... done
Killing immich_postgres                               ... done
Killing immich_redis                                  ... done
ERROR: 2

@alextran1502
Copy link
Contributor

Ah, probably because the first run you didn't specify the database name so it didn't create the database.

You can remove the database volume so it can recreate with

docker volume rm docker_pgdata

Then run the docker-compose command again

@fuji246
Copy link
Author

fuji246 commented Mar 31, 2022

works now, thanks! Would be better if the .env.example can be updated with default settings so that it can run without any changes, the only mandatory one should be UPLOAD_LOCATION, others can have default values.

# Database
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_DATABASE_NAME=immich

# Upload File Config
UPLOAD_LOCATION=/Users/jeromy/work/playground/immich/Photos

# JWT SECRET
JWT_SECRET=false

# MAPBOX
## ENABLE_MAPBOX is either true of false -> if true, you have to provide MAPBOX_KEY
ENABLE_MAPBOX=false 
MAPBOX_KEY=

@fuji246 fuji246 closed this as completed Mar 31, 2022
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

3 participants