Automatically build and host pretty much any website
Until your business is at the scale you need to distribute dynamic operations like statics with a CDN, stuff like openstack or kubernetes is overkill.
This gives you similar ease of orchestration with the supposition you are working with one or a few Hypervisors. You'd be surprised how well this works for 99% of business purposes. Even business units at giant corporations can do just fine with this approach.
- Write a configuration file (Config::Simple format) in $DOMAIN/provision.conf which tells us:
- What IPs/Gw/Resolvers to use for said domain
- How big the disk oughtta be
- What base image to use
- What packages to install
- Email address to send root's mail to
- Write $DOMAIN/users.yaml describing the users to create. See cloud-init's documentation for examples.
- Ensure tarball backups to restore (if they exist) are in the directory as data.tar.gz.
- Run
bin/provision $DOMAIN
- It is the responsibility of data.tar.gz to have a Makefile in the TLD which sets up all relevant dependencies, loads up DBs, etc as the default target.
- To set up new sites, have a skeleton site generator to build a blank site tarball.
This all works behind the scenes due to:
- Terraform's libvirt provider mounting a bogus cdrom with network setup and cloud-config
- libvirt's virtual networking allowing us to talk to this HV.
- Spinning off an atd job to actually do the setup when cloud-config is done.
You'll need to have the user running this set up with at least one working authorized SSH key so we can add more. Aside from that, clone this in /opt where the user can see it.
DO NOT USE ROOT TO RUN THIS! Make sure that the user is in the qemu/kvm group (depending on running env) so you can talk to libvirt instead.
From there the host should "Just Work"TM.
See example.test/ for example usage.
All the relevant resources will be stored in /vms on the HV.