Giter VIP home page Giter VIP logo

deploy-scripts's Introduction

Deploy scripts

This is a collection of scripts to deploy a production version of ChargeGrid, either locally, or on AWS. You can build production Docker images of all services with these scripts, and deploy those images.

Use locally

Prerequisites

  • Docker (and docker-compose)
  • Leiningen

Build the prerequisite Docker images

$ ./build-services.sh service1 service2 ...

You can invoke it with a list of services that you want to build. If you do not specify any services, it will build all services. The build script expects 2 things:

  1. The git repos of the services you want to build, available at the same level as the deploy-scripts repo
  2. Leiningen

Add the following to your /etc/hosts

127.0.0.1 api.chargegrid.dev cb.chargegrid.dev

This is for Receptionist (api.chargegrid.io) and the Central System websocket entrypoint (cb.chargegrid.io)

Run everything

$ docker-compose up

Deploy to AWS

Using Terraform, you can easily deploy a production version of ChargeGrid on Amazon Web Services.

Prerequisites

  • Docker
  • Leiningen
  • Terraform
  • AWS account
  • AWS CLI

One-time preparations

  • Create an access key/secret key pair on AWS. This can be from an IAM user, as long as that user has at least priviliges for: ECR, EC2 and VPC
  • In the prepare-install-scripts.sh, set the desired domain name
  • Create an Elastic IP on AWS and take note of the Allocation ID
  • In the DNS configuration of your domain, add the following records, pointing to your Elastic IP: cb, api and platform
  • On AWS Elastic Container Registry create repositories with the following names: central-system, transaction-service, log-service, pricing-service, receptionist, charge-box-service
  • In the directory where the deploy-scripts reside, create a file terraform.tfvars with the following:
access_key = "<access-key>"
secret_key = "<secret-key>"
elastic_ip_id = "<allocation id of Elastic IP>"
domain = "<domain name for ChargeGrid>"

This file will is in the .gitignore, so it will not be committed. Your secrets are safe!

Automatically build and deploy everything

$ ./deploy-and-build-all.sh <domain-name>

Run each step manually

$ ./build-services		# Compile all services and build Docker images
$ ./push-to-ecr.sh 		# Tag all Docker images and push to AWS ECR
$ terraform apply		# Provision a machine + all network stuff, install Docker and run ChargeGrid stack

When you're done demoing the coolest electrical chargeing platform in the world, don't forget to get rid of your demo environment again:

$ terraform destroy

deploy-scripts's People

Contributors

dondebonair avatar bramkoot avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

vikashkumartr

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.