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

GUACAMOLE-374: Generalize Docker image to automatically map environment variables to properties. #979

Merged
merged 6 commits into from
Apr 26, 2024

Conversation

mike-jumper
Copy link
Contributor

@mike-jumper mike-jumper commented Apr 23, 2024

This change strips away much of the manual mapping of environment variables to properties, instead relying on automatic mapping of properties using enable-environment-properties. *_FILE environment variables are also automatically mapped.

Additionally:

  • The structure of the startup process of the Docker image has been split across multiple scripts for maintainability and extensibility.
  • The log level can now be set with a convenient log-level property that maps to the LOG_LEVEL environment variable.
  • REMOTE_IP_VALVE_* environment variables have been renamed to align with the attributes being configured.
  • The default GUACAMOLE_HOME is now transient and randomly generated to allow users to use the familiar /etc/guacamole location for their configuration template without potential collisions. Users can even use /etc/guacamole directly without overriding GUACAMOLE_HOME and rely on the image to combine what they've provided with anything the image has configured via environment variables.

As of these changes, there are only two mappings that must be manually maintained (and then only when a new extension is introduced):

  1. A mapping of environment variable prefixes to their corresponding extension .jar files. This is handled by guacamole-docker/build.d/010-map-guacamole-extensions.sh.
  2. A mapping of environment variable prefixes to their corresponding driver .jar files (ie: JDBC drivers). This is handled by guacamole-docker/build.d/020-download-drivers.sh.

Both of the above mappings/scripts organize things within a directory hierarchy that allows the entrypoint to easily link extensions, drivers, etc. into place based on which environment variables are set. Once the extensions are in place, everything else is implicit via enable-environment-properties.

In cases where environment variables are changing names, compatibility with the old naming is maintained with guacamole-docker/entrypoint.d/000-migrate-legacy-variables.sh. Old variables are automatically migrated to the new ones and a warning regarding deprecation is logged.

@mike-jumper
Copy link
Contributor Author

I believe this rewrite maintains parity with the features of the existing image, except that fewer sanity checks are performed. This revised process instead relies on the webapp itself to appropriately log errors related to configuration.

Copy link
Contributor

@necouchman necouchman left a comment

Choose a reason for hiding this comment

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

A couple of initial comments while I work through the rest of the changes...

Dockerfile Show resolved Hide resolved
Copy link
Contributor

@necouchman necouchman left a comment

Choose a reason for hiding this comment

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

A couple more minor things, but looks pretty good otherwise.

@jmuehlner Anything from you on this one?

guacamole-docker/entrypoint.d/700-configure-features.sh Outdated Show resolved Hide resolved
guacamole-docker/entrypoint.d/700-configure-features.sh Outdated Show resolved Hide resolved
@jmuehlner
Copy link
Contributor

A couple more minor things, but looks pretty good otherwise.

@jmuehlner Anything from you on this one?

Nope, seems like a reasonable change. If you're good with it, so am I.

@necouchman necouchman merged commit d6ff746 into apache:main Apr 26, 2024
1 check passed
@mike-jumper mike-jumper deleted the generalize-docker branch April 26, 2024 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants