I was deploying two different applications to one machine and I was using releases_to_keep which was deleting old releases. I had been deploying the two apps at the same time regularly so I wasn't having any issues until I deployed only one of the apps a number of times in one day. This resulted in releases_to_keep deleting the current release folder for the other app - oops.
So I figured that the best way to solve this was to add a release_subdir so that app release folders are completely independent. By adding release_subdir: 'myapp' to your options the release folder changes from releases/20150101120000 to releases/myapp/20150101120000.
Now when I deploy an app, to the same machine as another app that used grunt-ssh-deploy, the clean up won't affect the other app(s).
I also changed the code to use path.join rather than having to worry about slashes.
I was deploying two different applications to one machine and I was using
releases_to_keep
which was deleting old releases. I had been deploying the two apps at the same time regularly so I wasn't having any issues until I deployed only one of the apps a number of times in one day. This resulted in releases_to_keep deleting the current release folder for the other app - oops.So I figured that the best way to solve this was to add a
release_subdir
so that app release folders are completely independent. By addingrelease_subdir: 'myapp'
to your options the release folder changes fromreleases/20150101120000
toreleases/myapp/20150101120000
.Now when I deploy an app, to the same machine as another app that used grunt-ssh-deploy, the clean up won't affect the other app(s).
I also changed the code to use
path.join
rather than having to worry about slashes.