AWS Infrastructure Setup

Introduction

This page is meant to guide you through the infrastructure setup process for the Google Cloud Platform (GCP). Command line usage experience is highly recommended.

 

Prerequisites

AWS Account Created
SendGrid account setup
Import the provided SendGrid template (or customize to your liking!)
A private git repository (holds your fork of the userwise_self_hosted repository)

 

Instructions

Pre-Infrastructure Setup

Provide the UserWise team with your AWS Account Identifier & a Username (or the full ARN itself)

These should correspond to your AWS IAM information. We use the Account Identifier & Username to construct the ARN, which is added to our AWS IAM policy, which allows you to assume the self-hosted-dep-access-role. This enables temporary access to our base container image repository & our helm chart repository.

 

Run the following commands:
git clone --bare git@github.com:UserWise/userwise_self_hosted.git cd userwise_self_hosted.git git push --mirror git@github.com:<your_username>/userwise_self_hosted.git cd .. && rm -rf userwise_self_hosted.git git clone git@github.com:<your_username>/userwise_self_hosted.git cd userwise_self_hosted git remote add upstream git@github.com:UserWise/userwise_self_hosted.git git remote set-url --push upstream DISABLE # if you want to fetch updates, you can run these commands together: git fetch upstream git rebase upstream/main

 

Install all necessary software dependencies: ./bin/install_dependencies
  • atlas (Atlas MongoDb CLI)

  • aws (v2+ AWS CLI)

  • helm (K8S-Powered Helm CLI Tool)

  • jq (JSON CLI Tool)

  • kubectl (Kubernetes Controller CLI Tool)

  • terraform (Hashicorp’s Terraform Infrastructure Automation CLI Tool)

  • homebrew (MacOS Package Installer) MacOS Client Only

 

Infrastructure Setup

Open the infra.tfvars.json file, and update any necessary infrastructure configuration

Any changes made to this will be applied when you run ./bin/terraform apply.

Use caution when accepting infrastructure changes from ./bin/terraform apply. Some changes can cause resources to be deleted! Resources that can be saved from accidental termination are appropriately configured on startup.

 

In addition to infra.tfvars.json, you must provide some secrets on each deploy: mongo_atlas_private_key, mongo_password, & psql_password
Run ./bin/terraform apply -target=module.aws_required.module.vpc
Run ./bin/terraform plan
Run ./bin/terraform apply

 

 

Deployment

 

Post-Deployment

./bin/kubectl exec -it deploy/userwise-app-frontend -- /bin/sh rails c irb > company = Company.create(name: "My Company Name") irb > User.create(email: "myemail@ourdomain.com", password: "mypassword", confirmed_at: DateTime.now.utc, company: company)

 

Powered by UserWise