dokku / ci-docker-image

A Docker Image meant for use with CI/CD pipelines
MIT License
36 stars 25 forks source link

feature request :) ability to destroy db #115

Closed MortenHusted closed 1 month ago

MortenHusted commented 5 months ago

Description of problem

As per discussed in dokku forum on slack we're looking into cloning our "master"/staging database so that we can have a bit better database integrity.

In the the ci-predeploy-script we can add logic to clone the master database and link the new review-app to this cloned version, but we don't have an automated solution to destroying the database on destruction of the review-app

would that be possible to implement?

josegonzalez commented 5 months ago

I think adding something here would work:

https://github.com/dokku/ci-docker-image/blob/master/bin/dokku-deploy#L56-L60

Basically adding something into that if statement after the destroy (and before the exit 0) that looks like the following:

if [ -f "bin/ci-post-review-app-destroy" ]; then
  log-info "Executing bin/ci-post-review-app-destroy script"
  chmod +x bin/ci-post-review-app-destroy
  APP_NAME="$REVIEW_APP_NAME" IS_REVIEW_APP="true" SSH_REMOTE="$ssh_remote" bin/ci-post-review-app-destroy
fi

Mind making a PR to that repo with the change?

MortenHusted commented 4 months ago

yup :) will try and see if I can implement a solution this or next week