-
Notifications
You must be signed in to change notification settings - Fork 6
Draft Deployment Guide
NOTE - This is non-authoritative content that describes features that are not yet released/built.
Once you have built some Cards, it's time to share them! This guide describes how to set up the Hub that hosts your Cards, a GitHub repository to hold your data, and a deployment to AWS.
To follow along with this guide, you will need the following installed on your computer:
- The Terraform CLI - this tool provides a way to deploy different pieces of infrastructure to AWS in just a few commands
- Node 10.x is recommended
- Clone the
cardstack-deployrepository
You also need the following cloud resources:
- Create an account on AWS. New accounts on AWS receive some free tier benefits.
- Create a private GitHub repository that will hold your data
If AWS is not available in your region, stay tuned for future guides for deploying to other cloud providers.
TODO
In order to deploy to AWS, you need to have a user profile created that has the correct permissions to create new resources. Follow these steps from the AWS docs to create a user. When you get to the "Set permissions" step, create a group with the following permissions:
// config here
Then, assign the new user to that group. When you are finished, save the keys for the new user to somewhere secure. You will need them later.
In cardstack-deploy there is a file called secrets.tf. Fill it in with the information from when you created the IAM user. Do not ever share this file or commit it, since anyone who has it could use your AWS account, and they could rack up huge bills.
Once you have filled in those details, it's time to do a test run from the command line. In the example below, whatever you put for <my-environment-name> (without the brackets) will be used in the url later.
terraform init
terraform create <my-environment-name>
terraform planThe plan command checks whether you have the correct permissions to deploy the project. If you see errors, double check your secrets.tf file and the information you entered. Once the plan succeeds, it's time to deploy!
terraform apply
This command will send your code up to AWS to be deployed. Be patient, as this can take a while. When it is finished, you will have some new files on your computer that contain the Terraform "state." You should save these files in a secure place, but do not share them, since they contain secrets. You will need this file when you do later deployments.
Now, go to the EC2 dashboard and click on the newly created instance. Follow the URL to see your app!
At this point, you can visit a URL to see your project live on the web! Here's how to customize that URL.
You have two options for setting up the domain to host your application:
- You can configure AWS to use a domain and HTTPS certificate that you already own, using the AWS certificate manager and a Route 53 alias
- Register a new domain name through AWS Route 53 and get an HTTPS certificate for your domain using the AWS certificate manager
An HTTPS domain is required for the Cardstack Hub to work properly.
TODO