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(server): add env to define the path of build-lock.json #10810

Closed
wants to merge 1 commit into from

Conversation

martabal
Copy link
Member

@martabal martabal commented Jul 3, 2024

This PR adds an env to define the path of build-lock.json

@github-actions github-actions bot added documentation Improvements or additions to documentation 🗄️server labels Jul 3, 2024
Copy link
Contributor

@jrasm91 jrasm91 left a comment

Choose a reason for hiding this comment

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

Is there a reason why you can't just read this from the CWD?

@martabal
Copy link
Member Author

martabal commented Jul 3, 2024

Is there a reason why you can't just read this from the CWD?

Yes, we don't use relative path, only absolute paths

@@ -34,6 +34,7 @@ export const geodataDatePath = join(GEODATA_ROOT_PATH, 'geodata-date.txt');
export const geodataAdmin1Path = join(GEODATA_ROOT_PATH, 'admin1CodesASCII.txt');
export const geodataAdmin2Path = join(GEODATA_ROOT_PATH, 'admin2Codes.txt');
export const geodataCities500Path = join(GEODATA_ROOT_PATH, citiesFile);
export const lockfilePath = process.env.IMMICH_BUILD_LOCK_PATH || './build-lock.json';
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this should just always use env, same as the other build-metadata stuff, with the base-image Dockerfile setting this particular one?

Copy link
Member Author

Choose a reason for hiding this comment

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

IMO, it would be great to group www/, build-lock.json and geodata/ into one folder and specify its path with an env. But I don't know if that would limit other packages like the Immich package from the AUR.

Copy link
Contributor

Choose a reason for hiding this comment

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

I kind of really rate having separate env for every file that we read from disk. I'd be perfectly happy with bundling all these files into a single, folder and having a single env for it. Something like IMMICH_BUILD_FILES or something.

Copy link
Member Author

Choose a reason for hiding this comment

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

I would be really happy too. Are you ok to have all these files/folders to /usr/src/resources ?
We would have:

  • /usr/src/resources/www
  • /usr/src/resources/geodata
  • /usr/src/resources/build-lock.json

Copy link
Contributor

Choose a reason for hiding this comment

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

Yup

@@ -51,6 +51,7 @@ Regardless of filesystem, it is not recommended to use a network share for your
| `CPU_CORES` | Amount of cores available to the immich server | auto-detected cpu core count | server | |
| `IMMICH_API_METRICS_PORT` | Port for the OTEL metrics | `8081` | server | api |
| `IMMICH_MICROSERVICES_METRICS_PORT` | Port for the OTEL metrics | `8082` | server | microservices |
| `IMMICH_BUILD_LOCK_PATH` | Path of build-lock.json | `./build-lock.json` | server | api |
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we documented the other build metadata env vars right?

Copy link
Member

Choose a reason for hiding this comment

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

(As in, I don't think we need to document this one either)

Copy link
Member Author

Choose a reason for hiding this comment

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

What do you mean by 'build metadata env'? We documented IMMICH_WEB_ROOT and IMMICH_REVERSE_GEOCODING_ROOT

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to or should document build env related stuff on this page, which should just be user facing env settings.

@jrasm91
Copy link
Contributor

jrasm91 commented Jul 3, 2024

Is there a reason why you can't just read this from the CWD?

Yes, we don't use relative path, only absolute paths

What are you going to set it to?

@martabal
Copy link
Member Author

martabal commented Jul 3, 2024

What are you going to set it to?

Probably /app/immich/server/build-lock.json

@@ -51,6 +51,7 @@ Regardless of filesystem, it is not recommended to use a network share for your
| `CPU_CORES` | Amount of cores available to the immich server | auto-detected cpu core count | server | |
| `IMMICH_API_METRICS_PORT` | Port for the OTEL metrics | `8081` | server | api |
| `IMMICH_MICROSERVICES_METRICS_PORT` | Port for the OTEL metrics | `8082` | server | microservices |
| `IMMICH_BUILD_LOCK_PATH` | Path of build-lock.json | `./build-lock.json` | server | api |
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to or should document build env related stuff on this page, which should just be user facing env settings.

@@ -34,6 +34,7 @@ export const geodataDatePath = join(GEODATA_ROOT_PATH, 'geodata-date.txt');
export const geodataAdmin1Path = join(GEODATA_ROOT_PATH, 'admin1CodesASCII.txt');
export const geodataAdmin2Path = join(GEODATA_ROOT_PATH, 'admin2Codes.txt');
export const geodataCities500Path = join(GEODATA_ROOT_PATH, citiesFile);
export const lockfilePath = process.env.IMMICH_BUILD_LOCK_PATH || './build-lock.json';
Copy link
Contributor

Choose a reason for hiding this comment

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

I kind of really rate having separate env for every file that we read from disk. I'd be perfectly happy with bundling all these files into a single, folder and having a single env for it. Something like IMMICH_BUILD_FILES or something.

@alextran1502
Copy link
Contributor

Hello, have you tested this in the production build?

@martabal
Copy link
Member Author

martabal commented Jul 3, 2024

Hello, have you tested this in the production build?

Hi! I built the base-image locally and ran the production build. It's running fine.

root@d98d644d1c6e:/usr/src/resources# ls -la
total 24
drwxr-xr-x 1 root root 4096 Jul  3 20:19 .
drwxr-xr-x 1 root root 4096 Jul  3 20:11 ..
-rw-r--r-- 1 root root  694 Jun 30 13:08 build-lock.json
drwxr-xr-x 2 root root 4096 Jul  3 20:13 geodata
drwxr-xr-x 3 root root 4096 Jul  3 20:19 www

@martabal martabal force-pushed the feat/add-env-for-build-lock-path branch from b13ef06 to c0309cd Compare July 3, 2024 20:41
@jrasm91
Copy link
Contributor

jrasm91 commented Jul 8, 2024

Closing in favor of #10958.

@jrasm91 jrasm91 closed this Jul 8, 2024
@jrasm91 jrasm91 deleted the feat/add-env-for-build-lock-path branch July 8, 2024 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation 🗄️server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants