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

Standardize docker & docker compose configs with improved docs #340

Merged
merged 11 commits into from
May 21, 2024

Conversation

delano
Copy link
Collaborator

@delano delano commented May 21, 2024

This pull request includes several changes to improve the configuration and documentation of the app:

  • Improve the docker-compose configuration documentation by providing additional context and renaming sections for clarity. The documentation now explains how to mount the local directory into the app container during development to simplify running code changes without rebuilding the image each time. Minor configuration values were also consolidated for consistency.

  • Add Docker Hub to automated image builds, allowing for easier deployment and versioning of the app.

  • Synchronize static assets for easier host access by copying the public/web assets directory into /mnt/public on container startup if it exists. This allows for simpler host access to static files, as they will be available at consistent paths both inside and outside the container.

  • Clarify the Dockerfile layers by explicitly documenting the separate base, environment, and application layers through the use of intermediate build stages. Detailed comments are added above each layer to explain its purpose and how it builds upon the previous layer.

  • Update the Dockerfile to ensure that the app configuration file exists by copying the default configuration file if it is missing. This provides sane defaults on the initial run and allows customization via a local config file.

  • Update the docker image name reference in the readme to reflect the latest changes.

  • Fix the pre-commit hook for issue numbers by adding the necessary configuration.

These changes aim to improve the consistency, documentation, and ease of use of the app.

Standardize naming of environment variables used to configure the app across Dockerfile and usage instructions. References to ONETIMESECRET_ were replaced with the generic REDIS_ and SECRET to avoid overspecifying the app name in the configs. This makes the environment configuration more consistent and reusable for deploying variations of the web app.

The diff updates:

- References to ONETIMESECRET_REDIS_URL and ONETIMESECRET_SECRET in the Dockerfile
- References to ONETIMESECRET_REDIS_URL, ONETIMESECRET_SSL, ONETIMESECRET_HOST, and ONETIMESECRET_SECRET in the usage instructions

To use the more generic names REDIS_URL, REDIS, HOST, and SECRET, which is clearer since these vars configure common services like Redis rather than being specific to OneTimeSecret. This avoid too tightly coupling the environment configuration to a particular app implementation.
The docker-compose documentation was updated with additional context and
renamed some sections for clarity. Mounting the local directory into the
app container during development was explained further to simplify
running code changes without rebuilding the image each time. Minor
configuration values were also consolidated for consistency. These
changes aim to improve understanding of the documentation and local
development workflow.
Uses the application's ONETIME_DEBUG environment variable that when set
to true or 1 will enable shell debugging output by setting the -x flag.
This allows visibility into the container startup process and any
commands executed to help with debugging issues.

Signed-off-by: delano <delano@onetimesecret.com>
This change copies the public/web assets directory into /mnt/public on
container startup if that directory exists. This allows for simpler host
access to static files, as they will be available at consistent paths
both inside and outside the container. The /mnt/public directory is
intended to map directly to /var/www/public on the host for easy web
server configuration.
Explicitly documents the (existing) separate base, environment, and
application layers through the use of intermediate build stages. Added
detailed multilined comments above each layer to explain its purpose and
how it builds upon the previous layer. This structure and addition of
thorough comments improves understandability and maintainability of the
Dockerfile over time.
Copy default configuration file if missing to provide sane defaults on
initial run. Uses `--no-clobber` to prevent overwriting any custom
configuration. This ensures new containers start with reasonable
settings defined in the example and allows customizing via local config
file.
Signed-off-by: delano <delano@onetimesecret.com>
@delano delano added documentation Issues or pull requests related to documentation. tech debt Addressing future rework costs due to quick, suboptimal solutions taken previously. maintenance Issues or tasks related to maintenance of the project. labels May 21, 2024
@delano delano self-assigned this May 21, 2024
@delano delano added the dx Developer experience working with the project. label May 21, 2024
@delano delano linked an issue May 21, 2024 that may be closed by this pull request
@delano delano marked this pull request as ready for review May 21, 2024 00:12
delano and others added 2 commits May 20, 2024 17:15
This change updates the Ruby versions tested in CI to the latest stable
3.1, 3.2 and 3.3 series. Testing on older unsupported versions provides
little value, and keeping CI configuration updated makes potential
issues easier to reproduce. The specific versions changed are:

- Replace 3.1.4 with 3.1
- Replace 3.2.0 with 3.2
- Add 3.3

No functionality changes, only Ruby version updates for CI.
@delano delano merged commit 05d2549 into develop May 21, 2024
5 checks passed
@delano delano deleted the 339-update-docker-compose-config branch May 21, 2024 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Issues or pull requests related to documentation. dx Developer experience working with the project. maintenance Issues or tasks related to maintenance of the project. tech debt Addressing future rework costs due to quick, suboptimal solutions taken previously.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Update docker compose config
1 participant