Coder Social home page Coder Social logo

internetarchive / cicd Goto Github PK

View Code? Open in Web Editor NEW
10.0 18.0 0.0 65 KB

build & test using github registry; deploy to nomad clusters

Home Page: https://internetarchive.github.io/cicd

License: GNU Affero General Public License v3.0

build test deploy cicd nomad github-registry docker-images

cicd's Introduction

CI/CD - Continuous Integration & Deployment

build & test using github registry; deploy to nomad clusters, using GitHub Actions reusable workflows

(workflows syntax)


Example usage & setup

  1. Copy the yaml below into your github repo with a Dockerfile - (any name, cicd.yml, etc.) in a subdir from the top: .github/workflows/:
on: push
jobs:
  cicd:
    uses: internetarchive/cicd/.github/workflows/cicd.yml@main
  1. If you want to deploy to a nomad cluster add a NOMAD_TOKEN secret:
on: push
jobs:
  cicd:
    uses: internetarchive/cicd/.github/workflows/cicd.yml@main
    secrets:
      NOMAD_TOKEN: ${{ secrets.NOMAD_TOKEN }}

For each repo you use this with, add aGitHub Secret with name: NOMAD_TOKEN, getting the value from a nomad cluster admin (for archive.org: tracey, brenton, robK, etc.)

If not an archive.org repo, update these two arguments to the nomad cluster wildcard DNS domain and API URL you can add BASE_DOMAIN and NOMAD_ADDR to your yaml:

on: push
jobs:
  cicd:
    uses: internetarchive/cicd/.github/workflows/cicd.yml@main
    with:
      BASE_DOMAIN: 'example.com'
      NOMAD_ADDR: 'https://nomad.example.com:4646'
    secrets:
      NOMAD_TOKEN: ${{ secrets.NOMAD_TOKEN }}

You can then find your Actions tab in your repo and you should see the build, (optional test), and deploy fire off.

The logs will show you the webapp URL for your deployed project.


Optional production cluster (archive.org repos only)

To deploy to the archive.org "high availability" production cluster, you simply need to:

  • Add another GitHub Secret named NOMAD_TOKEN_PROD, getting the value from a nomad cluster admin (for archive.org: tracey, robK, brenton etc.)
  • Add this to your yaml (above):
on: push
jobs:
  cicd:
    uses: internetarchive/cicd/.github/workflows/cicd.yml@main
    secrets:
      NOMAD_TOKEN_PROD: ${{ secrets.NOMAD_TOKEN_PROD }}
  • push a branch named production for your repo

Customize your deploy

You can send various NOMAD_VAR_* variables into the [deploy] phase, options listed here:

You can see explanations for the various options here:

on: push
jobs:
  cicd:
    uses: internetarchive/cicd/.github/workflows/cicd.yml@main
    with:
      NOMAD_VAR_MEMORY: 1000
    secrets:
      NOMAD_TOKEN: ${{ secrets.NOMAD_TOKEN }}

Multi arch builds (eg: for mac ARM)

If you want to build for linux/x86 and mac ARM you can add PLATFORMS:

on: push
jobs:
  cicd:
    uses: internetarchive/cicd/.github/workflows/cicd.yml@main
    with:
      PLATFORMS: 'linux/amd64, linux/arm64'

Want a more custom pipeline?

You can setup arbitrary jobs, custom tests, and more.

See this nice example which splits out the same [build] and [deploy] steps used normally, into explicit jobs, dependent on other test jobs, etc.


Interact with / debug your deploy

You can see more information on how to ssh in to your running deployment, inspect logs, get detailed status information, and even "hot copy" updated files into a running deploy (and more) at:


Interesting in linting code?

Check out https://github.com/internetarchive/dyno

cicd's People

Contributors

traceypooh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

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.