DEV Community


Stop deployment

kostjapalovic profile image Kostja ・2 min read

I am working on Appliku, which is building, and deployment automation SaaS.

Read the story:

It is built with Django and heavily uses Celery.

One of the most important parts that I want to improve is the build/deployment process. More specifically being able to manage running build/deploy jobs.

What problems I see right now:

  • Deployments run as long as they want
  • There is no way to stop/cancel the deployment
  • If the app has a push-to-deploy setting On then several deployments will be running at the same time and this can exhaust the server's resources and lead to errors due to concurrent deployments
  • I want to disable the "Deploy Now" button while there are deployments in the queue
  • by the way, I want deployments to be in the queue with only one running
  • If a deployment is stuck or taking a significant amount of time to complete this will effectively block the user from deploying the next version of the code which might have fixes for the underlying problem.

With all said, it boils done one thing right now: I need a way to stop a deployment job.

How Appliku runs the build/deployment process?

There is a Celery task, that connects to the server using the Paramiko library.

The actual code of the function is this:

What I want to do is to somehow pass the signal from the dashboard to stop this. The function will have to kill the command running and close the connection, mark the deployment as canceled.
Also, it must have timeouts in case if any of the stages are stuck for any reason.

I use Redis cache to store the abort flag for deployment.

Now I only need to add the "Abort Deployment" button in the interface of

Discussion (0)

Editor guide