app-sync.yml playbook for restarts on source or env changes#588
Open
lawso017 wants to merge 1 commit intopgsty:mainfrom
Open
app-sync.yml playbook for restarts on source or env changes#588lawso017 wants to merge 1 commit intopgsty:mainfrom
lawso017 wants to merge 1 commit intopgsty:mainfrom
Conversation
d351d04 to
9690822
Compare
c9639ad to
c7da007
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While managing a supabase app server using the app.yml playbook, I was running into issues where changes in either the deployed source or environment variables didn't trigger a restart of the docker containers.
This app-sync.yml playbook provides restarts on changes with a slightly different approach:
1/ Use rsync to synchronize sources, with the caveat that we do not delete (since containers manage volumes) and we ignore timestamps (since volume timestamps change when containers run). This lets us track changes to deployed source.
2/ Calculate a hash of the .env file before and after it is modified to detect changes.
If 1 or 2 change, then docker compose will restart the containers (unless, of course, they were just started by app_launch).
I've only used this with supabase but wanted to pass it along if you thought the it would be generally useful.