Docker - Confused on Env #35

Closed
opened 2023-11-14 03:31:42 +08:00 by ItIsSeven · 3 comments
ItIsSeven commented 2023-11-14 03:31:42 +08:00 (Migrated from github.com)

How can I disable the Network & Speedtest sections if my LookingGlass is only for one host.
I tried to set env variables in the docker-compose.yml file as the readme says, but using this doesn't work:

LG_BLOCK_NETWORK: 'false';
LG_BLOCK_SPEEDTEST: 'false';

Also confused on if I set this as true: ENABLE_CUSTOM_BLOCK, where should the files go when using Docker, which directory?

How can I disable the Network & Speedtest sections if my LookingGlass is only for one host. I tried to set env variables in the `docker-compose.yml` file as the readme says, but using this doesn't work: `LG_BLOCK_NETWORK: 'false';` `LG_BLOCK_SPEEDTEST: 'false';` Also confused on if I set this as true: `ENABLE_CUSTOM_BLOCK`, where should the files go when using Docker, which directory?
dqos commented 2023-11-21 22:27:23 +08:00 (Migrated from github.com)

The Docker part still needs some more love, but as you can see in the config.php not all options are moved to environment variables, still hardcoded. If you want to run this in Docker I would recommend you to edit the config file. For the custom block you will need to mount the files.

A fast fix would be not to use Docker, spin up a VM and follow the instructions, do a git pull and enjoy 😄

The Docker part still needs some more love, but as you can see in the `config.php` not all options are moved to environment variables, still hardcoded. If you want to run this in Docker I would recommend you to edit the config file. For the custom block you will need to mount the files. A fast fix would be not to use Docker, spin up a VM and follow the instructions, do a git pull and enjoy 😄
ItIsSeven commented 2023-12-02 04:36:32 +08:00 (Migrated from github.com)

Hey, wouldn't it be appropriate this issue stays open till this is resolved, as it seems important for Docker users for those other Environment variables to be editable, thanks.

cc: @evanebb

Hey, wouldn't it be appropriate this issue stays open till this is resolved, as it seems important for Docker users for those other Environment variables to be editable, thanks. cc: @evanebb
evanebb commented 2023-12-03 05:10:52 +08:00 (Migrated from github.com)

I've added environment variables to disable these blocks in the Docker container config file in https://github.com/hybula/lookingglass/pull/37. These are:

DISABLE_BLOCK_NETWORK
DISABLE_BLOCK_LOOKINGGLASS
DISABLE_BLOCK_SPEEDTEST

Also see the updated docker-compose.yml in my PR for reference.

To your second question, I'm not completely familiar with how the custom block works, but it seems that if the ENABLE_CUSTOM_BLOCK environment variable is passed it'll include a few different paths: 979b1e081e/docker/php-fpm/src/config.php (L32-L40)

So you can either provide these files through a bind mount in the docker-compose.yml, which can be done by adding something like the following to the service definition for the PHP-FPM container:

volumes:
  - /host/path/to/custom.html.php:/var/www/html/custom.html.php
  - /host/path/to/custom.post.php:/var/www/html/custom.post.php
  - /host/path/to/custom.header.php:/var/www/html/custom.header.php
  - /host/path/to/custom.footer.php:/var/www/html/custom.footer.php

(make sure to replace the /host/path/to/ bit with the actual path at which the files are located on the host)

Another way is to bake them into the container image itself, simply by placing the custom.html.php, custom.post.php, custom.header.php and/or custom.footer.php in the root of the cloned repository and rebuilding the container image; the .dockerignore file/COPY statements for the Dockerfile aren't very strict, so they'll just be copied into the final container image.

I've additionally added some robuster checks for the custom block files in my PR, so that you won't get include errors in case you don't want/need to supply all of the custom files.

I've added environment variables to disable these blocks in the Docker container config file in https://github.com/hybula/lookingglass/pull/37. These are: ``` DISABLE_BLOCK_NETWORK DISABLE_BLOCK_LOOKINGGLASS DISABLE_BLOCK_SPEEDTEST ``` Also see the updated `docker-compose.yml` in my PR for reference. To your second question, I'm not completely familiar with how the custom block works, but it seems that if the `ENABLE_CUSTOM_BLOCK` environment variable is passed it'll include a few different paths: https://github.com/hybula/lookingglass/blob/979b1e081eb8042c843e91ff834f7c7e39ba06f1/docker/php-fpm/src/config.php#L32-L40 So you can either provide these files through a [bind mount](https://docs.docker.com/storage/bind-mounts/) in the `docker-compose.yml`, which can be done by adding something like the following to the service definition for the PHP-FPM container: ``` volumes: - /host/path/to/custom.html.php:/var/www/html/custom.html.php - /host/path/to/custom.post.php:/var/www/html/custom.post.php - /host/path/to/custom.header.php:/var/www/html/custom.header.php - /host/path/to/custom.footer.php:/var/www/html/custom.footer.php ``` (make sure to replace the `/host/path/to/` bit with the actual path at which the files are located on the host) Another way is to bake them into the container image itself, simply by placing the `custom.html.php`, `custom.post.php`, `custom.header.php` and/or `custom.footer.php` in the root of the cloned repository and rebuilding the container image; the `.dockerignore` file/`COPY` statements for the Dockerfile aren't very strict, so they'll just be copied into the final container image. I've additionally added some robuster checks for the custom block files in my PR, so that you won't get include errors in case you don't want/need to supply all of the custom files.
Sign in to join this conversation.
No Milestone
No project
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: malhuda/lookingglass#35
No description provided.