Skip to content

Add auto update script#15

Merged
Molkobain merged 3 commits intomasterfrom
feature/add-auto-update-script
Dec 22, 2025
Merged

Add auto update script#15
Molkobain merged 3 commits intomasterfrom
feature/add-auto-update-script

Conversation

@Molkobain
Copy link
Copy Markdown
Contributor

@Molkobain Molkobain commented Dec 19, 2025

Base information

Question Answer
Related to a SourceForge thread / Another PR / Combodo ticket? No
Type of change? Enhancement

Objective (enhancement)

Ease update of the Docker environment by automatically

  • Retrieving sources files
  • Deploying new/updated default conf. files
  • Copying new env. variables from .env to .env.local
  • Rebuilding / restarting containers

Ultimatly it should also work for non technical people who downloaded a zip from this repo instead of cloning it. The code is ready but it's commented until we make the repo public.

Why not use a token to connect to the private repo?
Because people who can make a token have a GitHub account, which mean they are propably a technical person, which can clone it. The zip method is made for functional people who don't necessarily have a GitHub account.

Proposed solution (bug and enhancement)

  • Add a auto-update.sh script at the root of the project
  • When executing the script it checks what kind of installation it is:
    • Git clone: It pull latest changes from the remote
    • Simple folder: It retrieves the latest release on GitHub
  • Then it updates the .env.local file with variables from .env that are not already in it
  • Then it deploys default configuration files to $CONF_FOLDER
  • Then it optionnally rebuilds / restarts the containers
guillaume@PC-GUILLAUME:/docker_environment$ ./auto-update.sh
You are about to update the Docker Environment located at '/docker_environment'.
Environment variables loaded from .env.local.
Do you want to proceed? (y/n) [y] 

+------------------------------+
| Step 1/4 Update source files |
+------------------------------+
Git clone detected, updating it via git pull...
Already up to date.
Update complete.

+--------------------------------------------------------------+
| Step 2/4 Synchronize .env.local with new variables from .env |
+--------------------------------------------------------------+
Looking for variables that are not already in .env.local...
Added FOO_VAR to .env.local
Added BAR_VAR to .env.local
Synchronization complete.

+---------------------------------------------+
| Step 3/4 Deploy default configuration files |
+---------------------------------------------+
Copying files from 'build/default_configuration' to ./conf
Deployment complete.

+-----------------------------------------+
| Step 4/4 Rebuild and restart containers |
+-----------------------------------------+
Do you want to rebuild and restart the Docker containers now? (y/n) [y] n
Rebuild and restart skipped. Please remember to manually rebuild and restart your Docker containers to apply the updates.

Update and deployment successful!

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have tested all changes I made on an iTop instance
  • Would a unit test be relevant and have I added it?
  • Is the PR clear and detailed enough so anyone can understand without digging in the code?

Checklist of things to do before PR is ready to merge

  • Check with the team what should be added / fixed before making the repo public
  • Convince Denis to make this repo public 😁

@Molkobain Molkobain self-assigned this Dec 19, 2025
@Molkobain Molkobain added the enhancement New feature or request label Dec 19, 2025
Copy link
Copy Markdown
Collaborator

@bdalsass bdalsass left a comment

Choose a reason for hiding this comment

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

Great ! But i don't understand the modifications on addons/docker_scripts script files.

@Molkobain
Copy link
Copy Markdown
Contributor Author

Molkobain commented Dec 22, 2025

Great ! But i don't understand the modifications on addons/docker_scripts script files.

Files were not executable on my environment, so I added the x flag, but I can revert it as I'm not using it after all.

@Molkobain Molkobain merged commit fe2abe1 into master Dec 22, 2025
@Molkobain Molkobain deleted the feature/add-auto-update-script branch December 22, 2025 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants