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

feat: Upgrade devcontainer setup #14419

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Zer0x00
Copy link

@Zer0x00 Zer0x00 commented Dec 1, 2024

Upgrades the devcontainer implementation with the following changes:

  • Prepares the dev environment fully with all the needed tools and SDKs
  • Starts all the immich docker containers directly with the devcontainer
  • installs & sets all VSCode extensions and settings from https://immich.app/docs/developer/setup/#vscode
  • Included a workaround to run amd64 binaries for aarch64/arm64 machines like an Apple Silicon Mac

To start the immich docker containers there must be an .env file available but I didn't like failing the start of the devcontainer. Instead if the .env file isn't found under the .devcontainer folder it will copy the example.env from the docker folder and use that instead. Unfortunately the .env file must be existing in the .devcontainer folder - I couldn't find a way to use the .env file from the docker folder.

Copy link
Member

@bo0tzz bo0tzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome, I've been wanting a setup like it for a long time. Thank you very much!

Can you also add some instructions to the developer documentation on how to use this?

@mcarbonne since you added the original devcontainer bits, do you have any feedback on this PR?

.devcontainer/devcontainer.json Show resolved Hide resolved
.devcontainer/scripts/onCreateCommand.sh Outdated Show resolved Hide resolved
.devcontainer/devcontainer.json Outdated Show resolved Hide resolved
"initializeCommand": "bash .devcontainer/scripts/initializeCommand.sh",
"onCreateCommand": "bash .devcontainer/scripts/onCreateCommand.sh",
"overrideCommand": true,
"workspaceFolder": "/immich",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for compatibility with github codespaces this needs to be /workspaces/immich?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it, seems not to be a requirement.

@bo0tzz
Copy link
Member

bo0tzz commented Dec 1, 2024

When running this in codespaces I get the following error

2024-12-01 11:09:52.087Z: can't set healthcheck.start_interval as feature require Docker Engine v25 or later
2024-12-01 11:09:52.090Z: Stop: Run: docker compose --project-name immich-dev -f /var/lib/docker/codespacemount/workspace/immich/.devcontainer/docker-compose.yml -f /var/lib/docker/codespacemount/workspace/immich/docker/docker-compose.dev.yml -f /var/lib/docker/codespacemount/.persistedshare/docker-compose.codespaces.yml -f /var/lib/docker/codespacemount/.persistedshare/docker-compose/docker-compose.devcontainer.build-1733051096983.yml -f /var/lib/docker/codespacemount/.persistedshare/docker-compose/docker-compose.devcontainer.containerFeatures-1733051372652-aaef61db-ffe0-42ff-a242-e6d49cb8333f.yml up -d
2024-12-01 11:09:52.091Z: {"outcome":"error","message":"Command failed: docker compose --project-name immich-dev -f /var/lib/docker/codespacemount/workspace/immich/.devcontainer/docker-compose.yml -f /var/lib/docker/codespacemount/workspace/immich/docker/docker-compose.dev.yml -f /var/lib/docker/codespacemount/.persistedshare/docker-compose.codespaces.yml -f /var/lib/docker/codespacemount/.persistedshare/docker-compose/docker-compose.devcontainer.build-1733051096983.yml -f /var/lib/docker/codespacemount/.persistedshare/docker-compose/docker-compose.devcontainer.containerFeatures-1733051372652-aaef61db-ffe0-42ff-a242-e6d49cb8333f.yml up -d","description":"An error occurred starting Docker Compose up."}
2024-12-01 11:09:52.091Z: Error: Command failed: docker compose --project-name immich-dev -f /var/lib/docker/codespacemount/workspace/immich/.devcontainer/docker-compose.yml -f /var/lib/docker/codespacemount/workspace/immich/docker/docker-compose.dev.yml -f /var/lib/docker/codespacemount/.persistedshare/docker-compose.codespaces.yml -f /var/lib/docker/codespacemount/.persistedshare/docker-compose/docker-compose.devcontainer.build-1733051096983.yml -f /var/lib/docker/codespacemount/.persistedshare/docker-compose/docker-compose.devcontainer.containerFeatures-1733051372652-aaef61db-ffe0-42ff-a242-e6d49cb8333f.yml up -d
2024-12-01 11:09:52.092Z:     at ltA (/.codespaces/agent/bin/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:430:3355)
2024-12-01 11:09:52.092Z:     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2024-12-01 11:09:52.092Z:     at async ctA (/.codespaces/agent/bin/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:410:3506)
2024-12-01 11:09:52.093Z:     at async YtA (/.codespaces/agent/bin/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:482:3944)
2024-12-01 11:09:52.093Z:     at async eB (/.codespaces/agent/bin/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:482:4886)
2024-12-01 11:09:52.093Z:     at async prA (/.codespaces/agent/bin/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:663:200)
2024-12-01 11:09:52.094Z:     at async drA (/.codespaces/agent/bin/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:662:14706)
2024-12-01 11:09:52.099Z: devcontainer process exited with exit code 1

which suggests that codespaces is running an outdated docker version, but I can't figure out which version or why. Of course this can be 'fixed' by removing the healthcheck, but I'd rather it run an up to date docker engine. Do you have any insight into that?

@Zer0x00 Zer0x00 force-pushed the feat/upgrade_devcontainer branch from 8dc3103 to 64cfb2a Compare December 1, 2024 18:56
@Zer0x00
Copy link
Author

Zer0x00 commented Dec 1, 2024

I focused the devcontainer on local development, didn't test with codespaces until now since I'm not using it at all.
Even though removing the offending line spawned the containers successfully the web container returned a 500 server error - I'm not sure why. Tried to use docker-outside-of-docker instead but there I had some other problems. Maybe someone else can work on letting this run on GitHub codespaces, I'm too unexperienced with it and unfortunately don't have time to look into it.

@zackpollard zackpollard requested a review from bo0tzz December 10, 2024 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants