Assumes:
- Server has a full LAMP stack
- Server has virtualhost cli tool installed to the
PATH
. - Server has the
create-databse.sh
script installed to thePATH
(to be uploaded here) - Server has a disk mounted at
/data
where 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.com
directory. -
- 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
/data
mount for persistant, cheap AWS storage
Script actions
- Creates a virtual host on server.
- Removes default web folder.
-
virtualhost
tool creates website on/var/www
-
- I need sites be on
/data
of persistence and budget
- I need sites be on
- Create web and sql folders on
/data
- Soft link web root to original
var/www
location - 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.sh
script on the server.