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

Datadir automatic sync and reload the application #75

Open
edevosc2c opened this issue Nov 28, 2023 · 1 comment
Open

Datadir automatic sync and reload the application #75

edevosc2c opened this issue Nov 28, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@edevosc2c
Copy link
Member

edevosc2c commented Nov 28, 2023

Goal

Automatically restart or reload the config of all the geOrchestra applications when there is a new commit in the geOrchestra datadir. Allows for easier management of the datadir in test environements.

Implementation

This feature should be configurable, either enabled or disabled. But by default disabled.

Implement kubernetes/git-sync (or a similar well maintained tool) as a replacement for the existing git clone of the datadir that happens here: https://github.com/georchestra/helm-georchestra/blob/main/templates/_bootstrap-georchestra-datadir.tpl

The sidecar run before the start of the application. You can utilize the new feature in Kubernetes that allows to run containers before the app and have them keeping running as a sidecar: https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/#pod-sidecar-containers. If the feature is disabled then do not run it as a sidecar but have it ran as a one shot initcontainer.

For every sync, if the sidecar detects a new commit pulled, then it sends a SIGHUP to the compatible applications to reload their config (geoserver and more?). Or it restarts the incompatible applications using the Kubernetes API. git-sync can execute commands after the sync, but I'm unsure whenever it triggers the command on every sync or on new commits.

The sync could be triggered by a webhook (HTTP) but not essential at first, it's ok to have a fixed periodic sync. git-sync can receive "force sync" through --sync-on-signal.


Previous thoughts

From the discussion in #74, I found that kubernetes/git-sync allows to periodically sync a git repository and execute commands after the sync.

Maybe we could run this program as a sidecar container for all the geOrchestra components and have it automatically sync the datadir to the latest state so that all the geOrchestra components stay up to date with the datadir.

This script has the benefit of executing commands after the sync so we could send a sighup to the main container of the application in order to tell it to reload.
Note this will require shareProcessNamespace: true for that: https://stackoverflow.com/a/68917547

Ideally, this should be configurable so that this functionality is only enabled in the test/dev environment and not in production.

@edevosc2c edevosc2c added the enhancement New feature or request label Nov 28, 2023
@edevosc2c
Copy link
Member Author

edevosc2c commented Jul 10, 2024

If the app does not allow reloading the conf from a SIGHUP then we might need to use k8s service account and restart the deployment using the k8s API.

@jemacchi jemacchi self-assigned this Dec 13, 2024
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

No branches or pull requests

2 participants