a month ago
I'm currently working on a deployment where, after the service has been deployed and is running, I want to run another container with a custom command.
My example would be a service that does not support adding Terms-of-service and Imprint interactively, instead I need to feed it the contents via a file that needs to be created during deployment.
Another example would be a GitLab deployment: Each time the GitLab service has been deployed and is running (healthcheck succeeds) another container is run that ensures (idempotently) that key users and repositories are created.
I imagine this working like cron-jobs, but instead of running on a schedule these jobs run on certain events. I think there are a number of useful events:
Post-Deploy: Deployment of a service has finished
Healthcheck-Success: Healthcheck of a service turns positive
Healthcheck-Fail: Healthcheck of a service turns negative
Pre-Destroy: Container is about to be destroyed (useful for backup, alerting, shutting down related services, etc)
...there's probably many more
Is there something like this available and I don't know about it? Would this be a viable features for others as well?
3 Replies
a month ago
oops
a month ago
my bad on the docker compose thing, that won't work on railway. i know railway has deployment webhooks for events like deployment.success, but i'm not 100% sure on the best way to trigger follow-up commands from those webhooks. has anyone here actually implemented post-deploy automation using railway's webhooks + cli/api? would love to know what works
a month ago
Ok, so I think I need to go in 2 directions here: My specific usecase versus the general availability of such a feature.
In my case: I'm looking to create a template for HedgeDoc where it's possible for other users to set their own imprint and TOS themselves. My best idea would be to use variables for that and inject those into files into the service during deployment. As far as I see webhooks only work when being set up per project, not per template. So this would at least be very complicated for others to set up.
In the general case: Webhooks could be a solution, probably with some container that listens for them and then triggers a cron container via Railway API.
Regardless of what this is for, I have a feeling that this could be a first-citizen feature that would be very useful for others as well.