Skip to content

WorldBank-Transport/ram-deployment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RAM Deployment

This repository contains CloudFormation configuration to run a stack of the Rural Accessibility Map on AWS. It spins up:

More information about RAM can be found in the docs.

Requirements

  • nodejs 8 or higher
  • yarn

Installation

$ yarn
$ cp .kes/.env.sample .kes/.env

Before the first deploy

Follow these steps before deploying the first stack:

  • On AWS, manually create the following:
    • A S3 bucket where the CloudFormation configuration will be stored. This bucket can be shared by different stacks.
    • A key pair, which can also be shared by multiple stacks in the same account.
  • Add both to the .kes/config.yml:
    • the S3 bucket under default.bucket
    • the key pair under default.ecs.keyPairName
  • Set the environment variables in .kes/.env

This configuration is shared between different stacks. If you run multiple stacks, you only have to do this once.

Deploying a stack

To deploy a new stack:

  • Add a new stack to .kes/config.yml
    The new stack will inherit all configuration from the default stack. It's possible to override some or all of the configuration.
    ram-my-deployment:
      stackName: ram-another-instance
    
  • run kes deploy
    $ ./node_modules/.bin/kes cf deploy --deployment ram-my-deployment --region us-east-1

Once the deploy finishes (which may take a while), Kes prints information about the stack. This includes IP addresses and the database connection string. Use this connection string to set up the database structure:

$ yarn setup --db postgres://your:own@connection:1234/string

Deleting a stack

Deleting a stack will take all resources down, but keep the S3 bucket that was created by the stack for file storage. It can be manually deleted.

Validating CloudFormation

To validate the CloudFormation configuration without deploying the stack:

./node_modules/.bin/kes cf validate

This will generate the .kes/cloudformation.yml.