How to deploy new instances of the same application (on 1 server) automatically?

Posted by Intru on Server Fault See other posts from Server Fault or by Intru
Published on 2012-11-17T16:51:35Z Indexed on 2012/11/17 17:03 UTC
Read the original article Hit count: 149

I'm working on a SaaS application where each customer runs its own version of the application. All the application instances currently run on a single server. This works quite well for us (we need less resources in total). The application doesn't use a lot of resources, so even a small VPS would be overkill (and more expensive).

Adding a new customer is currently quite a bit of work:

  • Create a user that is allowed to ssh
  • Create a new MySQL database and user
  • Create a virtual host for the application
  • Log in with the new user, do a git checkout of the application (in the right location)
  • Create tables in the new database, and add some init data
  • Add some cron jobs
  • Create a first user that can log in
  • Add this new instance to capistrano

What would be the best way to automate these tasks? Are the applications that can (given proper configuration) do this? Ideally this should be usable for a sales-person (so something web-based).

I could write a (bash) script that does most of these tasks, and then maybe add a small web-based wrapper where someone could provider the domain/default user information. Of course, this would also require a delete-script, since some customers will eventually leave, which means that you need a list of all existing customers/instances.

© Server Fault or respective owner

Related posts about deployment

Related posts about multiple-domains