How to deploy stateful applications?
vitormarkis
HOBBYOP

2 years ago

I have a stateful Node application.

In my old pipeline, during the build process, I used to hit a POST endpoint that saved all the state to the database.

When the process restarted, it would retrieve and restore the state from the database.

I use Docker, and it seems to handle building and deploying automatically. How can I modify the pipeline to include the state-saving part as well?

3 Replies

brody
EMPLOYEE

2 years ago

What's stopping you from hitting the same POST endpoint?


vitormarkis
HOBBYOP

2 years ago

I integrated my project with GitHub, which created a GitHub Action pipeline that automatically reads from Docker, builds, and deploys.

Cool, but I need to hit the POST endpoint after a successful Docker build. So, I need a way to edit this pipeline to include the HTTP request.


brody
EMPLOYEE

2 years ago

Perhaps you are overthinking it a tad? I don't know your stack, but would it not be as simple as running a curl command in your start command -

curl -X POST [your endpoint] && [your original start command]

The start command is only going to be ran if the build succeeded and if the curl command fails then your deployment will not be switched over provided you use a readiness type health check.


Loading...