strongloop / strong-pm

deployer for node applications
http://strong-pm.io
Other
1k stars 71 forks source link

deploy is removing storage #377

Closed louisl closed 7 years ago

louisl commented 7 years ago

I have storage folders in /var/lib/strong-pm/svc/1/work/current/client/storage. Can I stop that getting wiped when deploying a new version?

I've tried adding /client/storage export-ignore to .gitattributes as I would do in other deployment programs but it still gets wiped.

louisl commented 7 years ago

My fix for this was to create a symbolic link.

After a successful deploy, remove the storage folder and replace with a new symbolic link.

cd /var/lib/strong-pm/svc/[Service ID]/work/current/server
sudo rm -R storage
ln -s /var/lib/strong-pm/svc/[Service ID]/work/shared/storage /var/lib/strong-pm/svc/[Service ID]/work/current/server/storage
chown -R strong-pm:strong-pm /var/lib/strong-pm/svc/[Service ID]/work/current/server/storage

It would be nice if there's a way to do this automatically after a deploy is successful?

sam-github commented 7 years ago

Your app writes data to it's CWD, and after re-deploy, hopes that data is still there in the same place?

That's not a pattern that will be sucessful for long, if you do that with any cloud or container based systems, they will get a new file system environment as pm does.

I'm puzzled as to how export-ignore is helping in other deployment programs, it controls whether files comitted in git are exported when git archive is used, how is this relevant? I haven't bumped into this usage before if you could point me towards some info I'd appreciate it.

I believe you could find a way to do this post-deploy by putting the script in a package post-install script, maybe mkdir -p ../storage; ln -fs ../storage .? Untested of course, but I think something that would do the trick.

sam-github commented 7 years ago

The package life-cycle scripts should be sufficient for this task, and if not, honestly, we won't have time to implement this, though you could PR something that has docs+tests+code, or just fork and hack it in.

louisl commented 7 years ago

@sam-github

I'm puzzled as to how export-ignore is helping in other deployment programs, it controls whether files comitted in git are exported when git archive is used, how is this relevant? I haven't bumped into this usage before if you could point me towards some info I'd appreciate it.

I know this is old but I've just came back to an old job where I needed to do this.

The general thing is after delpoy capistrano changes 'current' (public dir) symlink to the new version then add symlinks in 'current' set in the deploy config. I use this to share logs, uploads and common config files between deployments.

FYI http://capistranorb.com/documentation/advanced-features/ignoring/