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

[#171] Remove Nginx config post-deployment to prevent configuration reuse across environments #172

Conversation

placek
Copy link
Contributor

@placek placek commented Feb 14, 2024

There is a bug in the prepare-config.sh script (#171) that caused an incident (#174).

The result of the incident was that the beta environment had the BasicAuth turned on, therefore preventing users from reaching application.

The reason behind that behaviour was the reusage of the configuration files responsible for setting up the BasicAuth. Those files were generated during a previous deployments on internal environments (i.e. dev, test and staging) and futher used because the script was unaware of pre-existance of those files during their generation.

List of changes:

  1. The modification was made in the scripts/govtool/prepare-config.sh script, where a command to remove the Nginx configuration directory ($nginx_config_dir) has been added. This change ensures that the Nginx configuration is not shared between executions of the deployment scripts on different environments, which was a actual reason behind the incident.

…euse across environments

Summary:
To enhance and fix our deployment script's reliability and ensure
environment-specific configurations are not mistakenly reused locally, this
commit introduces a critical update to the script responsible for
preparing configurations, including the Nginx setup. Recognizing the
need for distinct configurations across different deployment
environments, we've implemented a change to automatically remove the
Nginx configuration directory once the deployment script has executed.
This action prevents potential conflicts and misconfigurations when
deploying to multiple environments by ensuring that each deployment
starts with a clean slate regarding Nginx setup.

The change has been introduced after an incident[^1] occurred during
efforts on #97, where mutliple deployments on multiple environments had
to be performed avoiding the GitHub Action workflow, since they were not
yet introduced to the repository.

The problem is irrelevant on the GitHub workflows since they are
executed in isolation on containerized environment.

Technical Details:
The modification was made in the scripts/govtool/prepare-config.sh
script, where a command to remove the Nginx configuration directory
($nginx_config_dir) has been added. This line is strategically placed
before the creation of new configuration directories and files, ensuring
that any pre-existing Nginx configuration is cleared out before
generating new ones. This approach guarantees that configurations from a
previous deployment do not linger and affect subsequent deployments to
different environments. The logic specifically targets the scenario
where the deployment script is run multiple times locally across various
environments, addressing a previously overlooked aspect of our
deployment process. This change is part of our ongoing efforts to refine
our deployment practices, ensuring they are robust, clean, and tailored
to the specific requirements of each environment.
The change has no impact on GitHub workflow since the execution od the
deployment there is performed in isolation with no cached nor reused
file system storage.
Additionally the documentation note has been added to deployment
instructions to keep track of what actually happens during the deploy
process and how does this impact the target environments.

By incorporating this update, we mitigate the risk of configuration
leakage between environments, a critical aspect of maintaining the
integrity and isolation of our deployment processes. This change
underscores our commitment to continuous improvement in our deployment
strategies, ensuring they align with best practices and the unique
demands of our infrastructure.

[^1]: #174
@placek placek force-pushed the 171-enhance-deployment-script-for-conditional-generation-of-basicauth-configuration-files branch from d95e495 to cb346bc Compare February 14, 2024 12:36
@placek placek marked this pull request as ready for review February 14, 2024 12:52
@placek placek merged commit 1298853 into develop Feb 14, 2024
@placek placek deleted the 171-enhance-deployment-script-for-conditional-generation-of-basicauth-configuration-files branch February 15, 2024 13:53
MSzalowski pushed a commit that referenced this pull request Feb 15, 2024
…pt-for-conditional-generation-of-basicauth-configuration-files

[#171] Remove Nginx config post-deployment to prevent configuration reuse across environments
pmbinapps pushed a commit that referenced this pull request Feb 16, 2024
…pt-for-conditional-generation-of-basicauth-configuration-files

[#171] Remove Nginx config post-deployment to prevent configuration reuse across environments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance deployment script for conditional generation of BasicAuth configuration files
2 participants