/maglev

Safe, smooth, reliable, magnet-powered deployments.

Primary LanguageTypeScript

🚄 Maglev

Safe, smooth, reliable, magnet-powered deployments.

🚄 Maglev is an automated tool for regularly deploying code. It looks at the most recent green source branch builds in Codeship, compares them to the current slug on Heroku, and finds the best available code to deploy. After the deploy is started, it will post a message in Slack with a list of all of the commits it is deploying.

Emergency Brake

If you'd like to stop the deploy train from running, you can set the TRAIN_IS_RUNNING environment variable to anything other than true. Any other value, and the train will not run.

Contributing

Installation

To get started contributing:

brew install yarn
yarn install
yarn test
yarn dev:run

Environment

The following environment variables are expected to be set for yarn dev:run to work:

  • For CircleCI: CIRCLECI_TOKEN
  • For Codeship: CODESHIP_USERNAME, CODESHIP_PASSWORD, CODESHIP_ORGANIZATION_ID, CODESHIP_PROJECT_ID
  • For Heroku: HEROKU_ACCESS_TOKEN, HEROKU_APP_NAME
  • For Github: GITHUB_OWNER, GITHUB_REPO, GITHUB_ACCESS_TOKEN
  • For Slack: SLACK_API_TOKEN
  • Other: SOURCE_BRANCH, TRAIN_IS_RUNNING

Technologies

🚄 Maglev is built using Typescript and fp-ts.

Typescript

TypeScript in 5 Minutes is a great introduction to Typescript and the Handbook, starting with Basic Types provides a great reference.

fp-ts

fp-ts is a fantastic library for using a more functional approach in Typescript:

The goal of fp-ts is to empower developers to write pure FP apps and libraries built atop higher order abstractions. It includes the most popular data types, type classes, and abstractions from languages like Haskell, PureScript, and Scala.

[via Core Concepts]

A great place to get started with fp-ts is in Dave Taylor's Exploring fp-ts series:

Another excellent series to build good understanding is Giulio Canti's Getting Started with fp-ts, which begins with a look at Eq. Giulio is the author of fp-ts and does a great job of explaining what is going on under the hood.

Third-Party APIs

Currently, 🚄 Maglev uses the following services to coordinate deploys:

  • Codeship, for identifying which commits have successfully passed CI;
  • Github, for doing comparisons across commits and grabbing the code to be deployed;
  • Heroku, as the destination for all deploys; and
  • Slack, as the destination for all notifications.