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.