@@ -53,3 +53,48 @@ To increase developer productivity it is highly recommended to make use of the
53will compile and refresh itself showing you the latest possible syntax or type errors
53will compile and refresh itself showing you the latest possible syntax or type errors
54as well as any other ghc warnings whenever files within their respective directories
54as well as any other ghc warnings whenever files within their respective directories
55are saved and updated.
55are saved and updated.
59+In this section we will demonstrate how to deploy your Obelisk app to an Amazon EC2 instance.
61+First create a new EC2 instance:
63+1. Launch a NixOS 17.09 EC2 instance (we recommend [this AMI](https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#LaunchInstanceWizard:ami=ami-40bee63a))
64+1. In the instance configuration wizard ensure that your instance has at least 1GB RAM and 10GB disk space.
65+1. When prompted save your AWS private key (`~/myaws.pem`) somewhere safe. We'll need it later during deployment.
66+1. Go to "Security Groups", select your instance's security group and under "Inbound" tab add a new rule for HTTP port 80.
68+At this stage your instance should be booting and become accessible shortly. Note down the hostname of your instance. It should look like this:
71+INSTANCE_HOSTNAME=ec2-??-??-??-??.ca-central-1.compute.amazonaws.com
74+Now go to your Obelisk project directory (`~/code/myapp`), and initialize a deployment config (`~/code/myapp-deploy`):
78+ob deploy init --ssh-key ~/myaws.pem --hostname ${INSTANCE_HOSTNAME} ~/code/myapp-deploy
81+Then go to that created deployment configuration directory, and initiate the deployment:
84+cd ~/code/myapp-deploy
88+`ob deploy push` will locally build your app and then transfer it, along with all the Nix package dependencies, via ssh to the EC2 instance. It will also configure Nginx so that the public port 80 proxies to the running app.
90+At this point you are done. Your app will be accessible at `http://${HOSTNAME}`!
92+### Deploying an updated version
94+If you'd like to deploy an updated version (with new commits) of your Obelisk app: simply go to the configuration directory, update the source thunk and push:
97+cd ~/code/myapp-deploy