All Projects → ItinerisLtd → tiller

ItinerisLtd / tiller

Licence: other
Deploy Trellis, Bedrock and Sage via AWS CodeBuild

Programming Languages

Dockerfile
14818 projects
shell
77523 projects

Projects that are alternatives of or similar to tiller

tiller-circleci-orb
Deploy Trellis, Bedrock and Sage(optional) via CircleCI
Stars: ✭ 13 (-31.58%)
Mutual labels:  deployment, trellis
atlassian-kubernetes
All things Atlassian and Kubernetes
Stars: ✭ 30 (+57.89%)
Mutual labels:  deployment
fastify-boilerplate
fastify boilerplate for building RESTful APIs ⏰ Includes design (APIs), deploy(Application), and monitoring(Application).
Stars: ✭ 27 (+42.11%)
Mutual labels:  deployment
sagemaker-studio-image-build-cli
CLI for building Docker images in SageMaker Studio using AWS CodeBuild.
Stars: ✭ 31 (+63.16%)
Mutual labels:  codebuild
Django-on-Docker-with-Heroku-and-OpenCV
Deploy Django on Docker to Heroku and include OpenCV
Stars: ✭ 24 (+26.32%)
Mutual labels:  deployment
deploy-docker-swarm-using-terraform-ansible
No description or website provided.
Stars: ✭ 20 (+5.26%)
Mutual labels:  deployment
deployer
A small deployment script for ARK Chains, that lets you create your own blockchain in minutes
Stars: ✭ 50 (+163.16%)
Mutual labels:  deployment
init ec2
init EC2 cluster, for free-password-login(ubuntu and root). for hostname, for hosts file.
Stars: ✭ 11 (-42.11%)
Mutual labels:  deployment
DMIA ProductionML 2021 Spring
Репозиторий направления Production ML, весна 2021
Stars: ✭ 42 (+121.05%)
Mutual labels:  deployment
pfa
Portable Format for Analytics
Stars: ✭ 28 (+47.37%)
Mutual labels:  deployment
ByteTrack
ByteTrack: Multi-Object Tracking by Associating Every Detection Box
Stars: ✭ 1,991 (+10378.95%)
Mutual labels:  deployment
django-nixos
NixOS/NixOps configuration for Django
Stars: ✭ 21 (+10.53%)
Mutual labels:  deployment
tensorflow flask
tensorflow model deployment in flask REST API
Stars: ✭ 26 (+36.84%)
Mutual labels:  deployment
terraform-github-repository-webhooks
Terraform module to provision webhooks on a set of GitHub repositories
Stars: ✭ 20 (+5.26%)
Mutual labels:  codebuild
trellis-backup-during-deploy
Backup WordPress database during Trellis deploys
Stars: ✭ 23 (+21.05%)
Mutual labels:  trellis
jekyll-deploy-action
🪂 A Github Action to deploy the Jekyll site conveniently for GitHub Pages.
Stars: ✭ 162 (+752.63%)
Mutual labels:  deployment
go-gin-web-server
Deploy Go Gin on Render
Stars: ✭ 23 (+21.05%)
Mutual labels:  deployment
elixir cluster
Distributed Elixir Cluster on Render with libcluster and Mix Releases
Stars: ✭ 15 (-21.05%)
Mutual labels:  deployment
slipway
Compact binary for integrating Nelson with your CI
Stars: ✭ 15 (-21.05%)
Mutual labels:  deployment
sre.surmon.me
💻 SRE service for Surmon.me blog.
Stars: ✭ 34 (+78.95%)
Mutual labels:  deployment

[Deprecated] Use ItinerisLtd/tiller-circleci-orb instead.


Tiller

Deploy Trellis, Bedrock and Sage via AWS CodeBuild.

Requirements

What's in the box?

Set Up

You need a robot user for deployment. In this example, we will use a GitHub machine user account as our robot. For simplicity, this robot uses the same SSH key pair to access both GitHub private repos and the web server.

GitHub

  1. Sign up a machine user on GitHub
  2. Grant mybot read access to all necessary private repos
  3. Generate a SSH key pair
    • ssh-keygen -t ed25519 -C "mybot-$(date)"
    • It must use a passphrase
  4. Upload the public key to Github

Trellis

  1. Add the SSH key to web server
    # group_vars/<env>/users.yml
    users:
      - name: "{{ web_user }}"
        groups:
          - "{{ web_group }}"
        keys:
          - https://github.com/human.keys
          - https://github.com/mybot.keys # <-- This line
      - name: "{{ admin_user }}"
        groups:
          - sudo
        keys:
          - https://github.com/human.keys
  2. Re-provision ansible-playbook server.yml -e env=<env> --tags users

buildspec.yml

Tiller comes with 2 different buildspec.yml examples. They are expecting different Trellis and Bedrock structures.

Use buildspec.yml if your directory structure follow the official documents:

example.com/      # → Root folder for the project
├── .git/         # → Only one git repo
├── trellis/      # → Your clone of roots/trellis, directory name must be `trellis`
└── site/         # → A Bedrock-based WordPress site, directory name doesn't matter

buildspec.itineris.yml do extra steps for itineris-specific project setup.

At Itineris, we use a opinionated project structure:

  • separate Trellis and Bedrock as 2 different git repo
  • name the Bedrock-based WordPress site directory more creatively, i.e: bedrock
  • extra deploy command parameter for our SSH bastion host, i.e: -e bastion_user=$BASTION_USER
example.com/      # → Root folder for the project
├── bedrock/      # → A Bedrock-based WordPress site, directory name must be `bedrock`
│   └── .git/     # Bedrock git repo
└── trellis/      # → Clone of roots/trellis, directory name must be `trellis`
    └── .git/     # Trellis git repo

See: roots/trellis#883 (comment)

To install:

  • Option A: Use the buildspec.yml in the source code root directory

    1. Copy and commit the .yml file to project root
    2. Review the .yml file, change if necessary
    3. Enter the .yml file name on AWS web console
  • Option B: Insert build commands via AWS web console

    1. Copy and paste the .yml file to AWS web console
    2. Review the commands, change if needed

AWS CodeBuild

Docker Image

Use itinerisltd/tiller. See below.

Environment Variables

Name Value Type
PRIVATE_KEY /ssm/the-private-key Parameter Store
PRIVATE_KEY_PASSPHRASE /ssm/the-passphrase Parameter Store
SITE_ENV production Plaintext
SITE_KEY example.com Plaintext
BASTION_USER mybot Plaintext buildspec.itineris.yml only, omit BASTION_USER for Kinsta
TRELLIS_REPO [email protected]:xxx/yyy.git Plaintext buildspec.itineris.yml only
PRIVATE_KEY & PRIVATE_KEY_PASSPHRASE

Encrypt PRIVATE_KEY and PRIVATE_KEY_PASSPHRASE with AWS Systems Manager Parameter Store and AWS KMS. Never save them in plaintext!

PRIVATE_KEY needs line break characters(\n) For example:

➜ cat ~/.ssh/mybot
-----BEGIN OPENSSH PRIVATE KEY-----
aaa
bbb
ccc
-----END OPENSSH PRIVATE KEY-----

Then, save PRIVATE_KEY as:

-----BEGIN OPENSSH PRIVATE KEY-----\naaa\nbbb\nccc\n-----END OPENSSH PRIVATE KEY-----

SITE_ENV & SITE_KEY

They are used to build the final deploy command:

# ansible-playbook deploy.yml -e env=$SITE_ENV -e site=$SITE_KEY -vvvv
➜ ansible-playbook deploy.yml -e env=production -e site=example.com -vvvv

Examples

Docker Image

Tiller comes with a docker image to run Trellis deployment:

This is sufficient for deploying a default Trellis, Bedrock and Sage project. You can build your own docker image if necessary:

# Modify `Dockerfile`

# Build the image without caches
# Not using caches because we want latest packages to be installed
➜ docker build --no-cache --compress --tag tiller .

# Tag the image
➜ docker tag tiller itinerisltd/tiller:2018.5.18.2
➜ docker tag tiller itinerisltd/tiller:latest

# Push the image
➜ docker push itinerisltd/tiller:2018.5.18.2
➜ docker push itinerisltd/tiller:latest

FAQ

Is it a must to use all Trellis, Bedrock and Sage?

No, you don't need all of them. Only Trellis is required.

Is it a must to use AWS CodeBuild?

No. You can use the docker image without AWS CodeBuild.

Is it a must to use GitHub?

No.

Can I use multiple SSH key pairs?

Yes.

phases:
  pre_build:
    commands:
      - echo "$PRIVATE_KEY" > $HOME/.ssh/id_rsa
      - echo "$PRIVATE_KEY_SECOND" > $HOME/.ssh/id_rsa_second
      - chmod 600 $HOME/.ssh/id_rsa*
      - expect-ssh-add.sh id_rsa $PRIVATE_KEY_PASSPHRASE
      - expect-ssh-add.sh id_rsa_second $PRIVATE_KEY_PASSPHRASE_SECOND

What does S3 bucket cache?

By default only yarn packages are cached. It speeds up the build by 20~60 seconds. This is optional and you can add more cache.paths.

Author Information

Tiller is a Itineris Limited project created by Tang Rufus.

Special thanks to the Roots team whose Trellis make this project possible.

Full list of contributors can be found here.

Feedback

Please provide feedback! We want to make this library useful in as many projects as possible. Please submit an issue and point out what you do and don't like, or fork the project and make suggestions. No issue is too small.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].