Skip to content

Draft Deployment Guide

Jen Weber edited this page Aug 13, 2019 · 3 revisions

NOTE - This is non-authoritative content that describes features that are not yet released/built.


Deploying a new Cardstack Hub

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.

Prerequisites

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-deploy repository

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.

Create a private GitHub repository

TODO

Configuring AWS permissions

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.

Preparing for a Terraform deployment

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 plan

The 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.

See your project in action!

Now, go to the EC2 dashboard and click on the newly created instance. Follow the URL to see your app!

Make a nice URL

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:

An HTTPS domain is required for the Cardstack Hub to work properly.

Debugging tips

TODO

Clone this wiki locally