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

Build does not work #90

Closed
comfreak89 opened this issue Mar 29, 2022 · 26 comments
Closed

Build does not work #90

comfreak89 opened this issue Mar 29, 2022 · 26 comments

Comments

@comfreak89
Copy link

.env file:

# STAGE
NODE_ENV=development

# Database
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_DATABASE_NAME=immich

# Upload File Config
UPLOAD_LOCATION=/mnt/data/Immich

# JWT SECRET
JWT_SECRET=mNQXf1R6S1m7jwvwW82e

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

UPLOAD_LOCATION exists:

root@docker:~/immich/immich-1.4.0-dev# ls -l /mnt/data/Immich/
total 0
root@docker:~/immich/immich-1.4.0-dev# docker-compose -f ./docker/docker-compose.yml up --build -V
WARNING: The UPLOAD_LOCATION variable is not set. Defaulting to a blank string.
WARNING: The DB_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The DB_USERNAME variable is not set. Defaulting to a blank string.
WARNING: The DB_DATABASE_NAME variable is not set. Defaulting to a blank string.
Building immich_microservices
ERROR: forbidden path outside the build context: ../microservices/Dockerfile ()

I dont know why the warnings appear, altough a .env file exists and the variables are filled:

root@docker:~/immich/immich-1.4.0-dev# ls -la docker/.env
-rw-rw-r-- 1 root root 327 Mar 29 23:44 docker/.env
@Klutronic
Copy link

Not seeing the warnings but I am getting the same error:

Building immich_microservices
ERROR: forbidden path outside the build context: ../microservices/Dockerfile ()

@jrasm91
Copy link
Contributor

jrasm91 commented Mar 29, 2022

Probably need to run the docker-compose command up in the top level directory, instead of inside the docker/ folder.

@comfreak89
Copy link
Author

I did as you can see in my commands. I am not in the docker folder when running the docker-compose command!

@jrasm91
Copy link
Contributor

jrasm91 commented Mar 30, 2022

I did as you can see in my commands. I am not in the docker folder when running the docker-compose command!

Ah, yes I see that now. My bad!

@alextran1502
Copy link
Contributor

alextran1502 commented Mar 30, 2022

@comfreak89 I see that you downloaded the release, it was having a problem. I am about to push out another release to solve that problem. You can check out the main branch in the meantime to run.

@Klutronic Did you also download and use the release version?

Also what platform are you guys running on?

Edit: I found the problem, I am fixing it

@Klutronic
Copy link

Klutronic commented Mar 30, 2022

@alextran1502 I cloned the repo to run it

I am on Ubuntu 20.04.2:

immich$ docker-compose -v
docker-compose version 1.25.0, build unknown
immich$ docker -v
Docker version 20.10.7, build 20.10.7-0ubuntu5~20.04.2

@alextran1502
Copy link
Contributor

Did you install docker with snap? Maybe related to #67

@comfreak89
Copy link
Author

comfreak89 commented Mar 30, 2022

Hi,

I tried 1.4.0-7-dev and a direct clone of the repository now. Same issue.

Direct clone:

root@docker:~/immich/immich# docker-compose -f ./docker/docker-compose.yml up --build -V
WARNING: The UPLOAD_LOCATION variable is not set. Defaulting to a blank string.
WARNING: The DB_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The DB_USERNAME variable is not set. Defaulting to a blank string.
WARNING: The DB_DATABASE_NAME variable is not set. Defaulting to a blank string.
Building immich_microservices
ERROR: forbidden path outside the build context: ../microservices/Dockerfile ()

1.4.0-7-dev:

root@docker:~/immich/immich-1.4.0-7-dev# docker-compose -f ./docker/docker-compose.yml up --build -V
WARNING: The UPLOAD_LOCATION variable is not set. Defaulting to a blank string.
WARNING: The DB_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The DB_USERNAME variable is not set. Defaulting to a blank string.
WARNING: The DB_DATABASE_NAME variable is not set. Defaulting to a blank string.
Building immich_microservices
ERROR: forbidden path outside the build context: ../microservices/Dockerfile ()

I am still corious why it says, that the variables in the .env are not set, althout it is available:

Direct clone:

root@docker:~/immich/immich# ls -la docker/.env
-rw-r--r-- 1 root root 376 Mar 30 14:13 docker/.env
root@docker:~/immich/immich-1.4.0-7-dev# cat docker/.env
# STAGE
NODE_ENV=development

# Database
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_DATABASE_NAME=immich

# Upload File Config
UPLOAD_LOCATION=/mnt/data/Immich

# JWT SECRET
JWT_SECRET=ganXupoCQdV9rcTiM0DSxDmwP5vCB4UIfeUjhogzr1EpDloucvq2UAQd1bfk

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

1.4.0-7-dev:

root@docker:~/immich/immich-1.4.0-7-dev# ls -la docker/.env
-rw-r--r-- 1 root root 376 Mar 30 14:12 docker/.env
root@docker:~/immich/immich# cat docker/.env
# STAGE
NODE_ENV=development

# Database
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_DATABASE_NAME=immich

# Upload File Config
UPLOAD_LOCATION=/mnt/data/Immich

# JWT SECRET
JWT_SECRET=ganXupoCQdV9rcTiM0DSxDmwP5vCB4UIfeUjhogzr1EpDloucvq2UAQd1bfk

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

No, I installed docker via apt. Snap is not available.

root@docker:~/immich/immich/docker# apt list --installed | grep docker

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

docker-ce-cli/focal,now 5:20.10.12~3-0~ubuntu-focal amd64 [installed,upgradable to: 5:20.10.14~3-0~ubuntu-focal]
docker-ce-rootless-extras/focal,now 5:20.10.12~3-0~ubuntu-focal amd64 [installed,upgradable to: 5:20.10.14~3-0~ubuntu-focal]
docker-ce/focal,now 5:20.10.12~3-0~ubuntu-focal amd64 [installed,upgradable to: 5:20.10.14~3-0~ubuntu-focal]
docker-compose/focal,now 1.25.0-1 all [installed]
docker-scan-plugin/focal,now 0.12.0~ubuntu-focal amd64 [installed,upgradable to: 0.17.0~ubuntu-focal]
python3-docker/focal,now 4.1.0-1 all [installed,automatic]
python3-dockerpty/focal,now 0.4.1-2 all [installed,automatic]
root@docker:~/immich/immich/docker# snap list

Command 'snap' not found, but can be installed with:

apt install snapd

In my case, the host is a LXC Container on the newest Proxmox version:

root@docker:~/immich/immich/docker# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.4 LTS
Release:        20.04
Codename:       focal
root@docker:~/immich/immich/docker# uname -r
5.13.19-4-pve
root@docker:~/immich/immich-1.4.0-7-dev# docker-compose -v
docker-compose version 1.25.5, build 8a1c60f6
root@docker:~/immich/immich-1.4.0-7-dev# docker -v
Docker version 20.10.12, build e91ed57

@alextran1502
Copy link
Contributor

@jrasm91 can you try to run this in a VM instead of LXC. I've had problems running Docker in LXC.

Please take a look at the Known Issue with PromoxVM in the last section of Readme file

@Klutronic
Copy link

@alextran1502 I installed Docker with APT

@alextran1502
Copy link
Contributor

@Klutronic Are you running this on a VM/LXC or your desktop environment?

@Klutronic
Copy link

@alextran1502 It's on a physical machine. I can try in a fresh VM if you like.

@alextran1502
Copy link
Contributor

@Klutronic Then there shouldn't be any problem. Hmm, this is strange. Can you try to reclone the repo and run it again?

Can you also share your docker-compose and .env file?

@Klutronic
Copy link

Klutronic commented Mar 30, 2022

.env

# Database
DB_USERNAME=immich
DB_PASSWORD=immich
DB_DATABASE_NAME=immich

# Upload File Config
UPLOAD_LOCATION=/home/<redacted>/docker/immich/backup

# JWT SECRET
JWT_SECRET=<redacted>

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

docker-compose.yml

version: "3.7"

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:

I re-cloned and got the same error message with the warnings for the variables not being present.

However, I DO NOT get the variable warnings if I run the docker-compose command from the ../docker folder

@alextran1502
Copy link
Contributor

@Klutronic Is there a reason you changed the version from 3.8 to 3.7?

Can you try commenting out the immich_microservices section to see if it makes any difference?

@comfreak89
Copy link
Author

....yeaaahhh...okay...it works in a Proxmox VM with CPU flag "host"...

...just wondering: it worked in that LXC container before for me...

@comfreak89
Copy link
Author

comfreak89 commented Mar 30, 2022

@Klutronic Is there a reason you changed the version from 3.8 to 3.7?

Can you try commenting out the immich_microservices section to see if it makes any difference?

I also tried that. No difference in the LXC Container despite that it tries to build the immich_server:

root@docker:~/immich/immich# docker-compose -f ./docker/docker-compose.yml up --build -V --force-recreate
WARNING: The UPLOAD_LOCATION variable is not set. Defaulting to a blank string.
WARNING: The DB_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The DB_USERNAME variable is not set. Defaulting to a blank string.
WARNING: The DB_DATABASE_NAME variable is not set. Defaulting to a blank string.
Creating network "docker_immich_network" with the default driver
Creating volume "docker_pgdata" with default driver
Building immich_server
ERROR: forbidden path outside the build context: ../server/Dockerfile ()

@alextran1502
Copy link
Contributor

@comfreak89 Yeah, so it would probably be a problem with LXC then. Strange!

@Klutronic
Copy link

@alextran1502 Yes, I am not on a version of docker-compose that supports 3.8 so I went down to 3.7.

After commenting out the immich_microservices:

sudo docker-compose -f ./docker/docker-compose.yml up --build -V
WARNING: The UPLOAD_LOCATION variable is not set. Defaulting to a blank string.
WARNING: The DB_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The DB_USERNAME variable is not set. Defaulting to a blank string.
WARNING: The DB_DATABASE_NAME variable is not set. Defaulting to a blank string.
Building immich_server
ERROR: forbidden path outside the build context: ../server/Dockerfile ()

@comfreak89
Copy link
Author

comfreak89 commented Mar 30, 2022

So, I managed it to get it working. I have practicly no knowledge about writing docker files or docker-compose.yml files. Although, these were my steps to get it working in a Proxmox LXC Container AND VM with the same config/command!

Change the docker/docker-compose.yml file to:

version: "3.8"

services:
  immich_server:
    image: immich-server:1.4.0
    build:
      context: ../server
      dockerfile: 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: 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:

Basicly, what I have changed is the path to the Dockerfile

dockerfile: ../server/Dockerfile => dockerfile: Dockerfile
dockerfile: ../microservices/Dockerfile => dockerfile: Dockerfile

Now docker is fine with the context.

To get rid of the WARNINGS, add the path to the .env file in the docker-compose command as follows:

docker-compose --env-file ./docker/.env -f ./docker/docker-compose.yml up --build -V

@alextran1502: As this solution works for me also in a VM, maybe this one is a more compatible/complete solution for other systems?

@alextran1502
Copy link
Contributor

@comfreak89 Yes, I think your proposal is better. I will add them in future updates.

@Klutronic Can you try the solution proposed by @comfreak89 above?

@Klutronic
Copy link

@alextran1502 It seems to be up and running but I am getting the following error when I try to go to the site:

{"statusCode":404,"message":"Cannot GET /","error":"Not Found"}

@comfreak89
Copy link
Author

Great!

The error is absolutely correct - there is no WebUI right now. You have to create a user with the curl command and from there on you can use the mobile app.

Change IP, email and password to your needs:

curl --location --request POST 'http://your-server-ip:2283/auth/signUp' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "[email protected]",
    "password": "password"
}'

@alextran1502
Copy link
Contributor

@Klutronic You will need the mobile app (since this application is for mobile's media file backup), there is no web interface just yet

@Klutronic
Copy link

Ahhhhhh, OK! I created the user already so I am good to go! Thanks guys, I really appreciate the help!

@alextran1502
Copy link
Contributor

Thanks, @comfreak89 and @Klutronic for improving the project :) cheers!

alextran1502 added a commit that referenced this issue Apr 2, 2022

Verified

This commit was signed with the committer’s verified signature.
macmv Neil Macneale V
…ockercompose file in issue #90
alextran1502 added a commit that referenced this issue Apr 2, 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

4 participants