Server: Decoupled maintenance procedure #447
Merged
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.
Configuration examples
Default behavior (all in one)
By default, Ayon runs setup, server and mainenance in the single container.
If no
AYON_RUN_
environment variable it is an equivalent toWhen the container starts, setup is executed to ensure the database is up to date,
then the server is started and Maintenance procedure is scheduled as its background process.
This is perfectly fine for small, non-scaled deployments.
Separate containers
Maintenance procedure can run scheduled in a separate container.
This way an additional container
maintenance
is started. This container lives indefinitelyand executes maintenance procedure on times specified in the server settings.
This configuration is useful for scaled deployments, where multiple server containers are running.
But since the maintenance container lives indefinitely, it is not recommended for kubernetes-based
deployments where you pay for the resources you use.
Cron-based maintenance
You may also execute the maintenance procedure using cron. This is useful for deployments
where you have a dedicated server or a VM. In this scenario, server settings cannot be used for
scheduling the maintenance period.
Instead you use cron to execute the following command:
To schedule the task, create
/etc/cron.d/ayon
with the following content:Separating setup
For scaled deployments, it is not desirable to run setup on every server container.
Instead, you can run setup in a separate container and then start the server containers.
This is tricky to do with docker-compose, but it can be achieved in kubernetes or a shell script.
The following script demonstrates an upgrade procedure of a stack with separate containers.