Assumes:
- Server has a full LAMP stack
- Server has virtualhost cli tool installed to the
PATH. - Server has the
create-databse.shscript installed to thePATH(to be uploaded here) - Server has a disk mounted at
/datawhere sites/files will live - Client and server both use folder structure,
example.com/(web|sql). eg: -
- /data/Sites/example.com/web (web root)
-
- /data/Sites/example.com/sql (database backups)
- On the client, this script is executed in the
/data/Sites/example.comdirectory. -
- Script assumes current working directory is the sub/domain of the site.
-
- Script assumes
web/andsql/subdirectories in the current working directory
- Script assumes
Other Notes:
- Server is a single AWS EC2 instance
- My dev server lives at 34.236.35.23
- Sites are set up as subdomains of
dev.unhingedweb.com(e.g.example.dev.unhingedweb.com) - All remote commands are executed via SSH.
- All files live on the
/datamount for persistant, cheap AWS storage
Script actions
- Creates a virtual host on server.
- Removes default web folder.
-
virtualhosttool creates website on/var/www
-
- I need sites be on
/dataof persistence and budget
- I need sites be on
- Create web and sql folders on
/data - Soft link web root to original
var/wwwlocation - Upload (
rsync) files to server - If database backup exists on client's machine, find the newest one and upload it.
- Create database on server by executing a
create-database.shscript on the server.