1

There's a web application that needs to be deployed on a remote server. There's a scp access to this server, no working shell though, so can't just ssh there.

The question that appeared was how to deploy the application there? Deploy, as run a prepared script that does some tasks like updating DB-schema, restarting the server, clearing caches, etc?

One thing that came to my mind was to copy all the files via scp, then ping some URL on the destination machine (like http://production.site.com/deploy - or any random characters there) that would fire a deployment script out there. This would require to have probably some IP-based limitations, just so not everyone entering this url fires up the deploy script (to avoid possible DOS attacks).

Another way would be to put a simple check in destination machine's cron and fire it like every 1 minute. In this case the deployment process would look like this:

  • we copy whole application to production server, then copy a specific file, like deploy.it also
  • cron job checks if deploy.it exists and deploy.lock doesn't. If so, it creates a lock file (deploy.lock) and starts a deployment script.
  • after a deployment script finishes running, both deploy.it and deploy.lock are deleted.

What do you think about those 2 ideas? Any more ideas about it too? I'd like to find the best (as most secure for possible screws-up and from any way od DOSing the production server) way to deploy it...

2 Answers 2

1

We do something similar to your first suggestion

We zip everything up, copy it across and then ping a password protected website that is only internally accessible to unzip over the top of the old site. We run sql scripts after the zip copy but before the unzip.

Either way you have suggested sounds like they will work but as you mentioned, if you have an externally accessable deploy url, you better make very sure it's secure enough.

0

Your first idea involve that the user account for the webserver have suficient privileges to do the deployment task, and that the web server is not chrooted. If these requirements are meet i think it's pretty good idea if the script gets deleted upon completion.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .