User Packer to build a pre-built AMI with everything we need (#15)
authorMike Hewitt <hmike96@vt.edu>
Thu, 22 Apr 2021 10:41:02 +0000 (06:41 -0400)
committerGitHub <noreply@github.com>
Thu, 22 Apr 2021 10:41:02 +0000 (11:41 +0100)
commit4ff4feb24e5efbb1938fe4f0a9265fe73c6c2fb2
tree39a70a6c11f80082215ec3828dc00a54fe01a885
parent1328951fdc2ed8baaf2b9818e948e6564b2fe71b
User Packer to build a pre-built AMI with everything we need (#15)

* initial packer and tf

* packer added files a scripts from Ashs repo

* add new folder structure and terraform

* updateing packer files

* added dependencies file permission and apt source repos

* bootstrap and user data

* prepare packer provisioners and set up all files to be executed

* update tinder

* terraform to create packer roles, starting to fill in packer variables

* packer roles added aws backends, terraform reformed and added iam roles as well as autoscaling cloudwatch alarm and policy

* fixed iam role and removed policy attatchments

* first run of packer_roles, terraform add gitignore for terraform

* update packer code from results of validate

* update runner max size of asg

* packer updated to run and terraform roles for packer updated

* Apply suggestions from code review

* Update for pre-commit checks

Add licenses, and remove trailing whitespace

* archieve lambda before upload

* remove terraform for ci infra

* Make the packer build produce a working image.

Summary of changes:

- Files need to be copied to a "staging" folder and then moved in place
- Use the built-in upload ability of the shell provisioner
- Have shell provisioner run scripts with sudo, rather than using sudo
  10s of times in the scripts
- Don't set up tmpfs mounts in the AMI -- these have to happen at
  instance boot time, not AMI creation
- Preseed the install options for iptables-persistent so that it
  installs without asking questions or replacing the rules we already
  placed.
- Install the runner-supervisor script from local file, not S3.

Co-authored-by: Ash Berlin-Taylor <ash_github@firemirror.com>
23 files changed:
.gitignore
github-runner-ami/packer/files/actions-runner-ec2-reporting.sh [new file with mode: 0644]
github-runner-ami/packer/files/actions.runner-supervisor.service [new file with mode: 0644]
github-runner-ami/packer/files/actions.runner.service [new file with mode: 0644]
github-runner-ami/packer/files/cloudwatch-metrics-github-runners [new file with mode: 0644]
github-runner-ami/packer/files/docker-compose.sh [new file with mode: 0644]
github-runner-ami/packer/files/install-dependencies.sh [new file with mode: 0644]
github-runner-ami/packer/files/install-files.sh [new file with mode: 0644]
github-runner-ami/packer/files/mounts_setup.sh [new file with mode: 0644]
github-runner-ami/packer/files/rules.v4 [new file with mode: 0644]
github-runner-ami/packer/files/runner [new file with mode: 0644]
github-runner-ami/packer/files/runner-cleanup-workdir.sh [new file with mode: 0644]
github-runner-ami/packer/files/runner-supervisor.py [moved from scripts/runner-supervisor.py with 100% similarity]
github-runner-ami/packer/files/runner_bootstrap.sh [new file with mode: 0644]
github-runner-ami/packer/files/source-list-additions.sh [new file with mode: 0644]
github-runner-ami/packer/files/stop-runner-if-no-job.sh [new file with mode: 0644]
github-runner-ami/packer/files/timber.key [new file with mode: 0644]
github-runner-ami/packer/files/vector.toml [new file with mode: 0644]
github-runner-ami/packer/ubuntu2004.pkr.hcl [new file with mode: 0644]
github-runner-ami/packer/vars/variables.pkrvars.hcl [new file with mode: 0644]
terraform/packer_roles/.terraform.lock.hcl [new file with mode: 0644]
terraform/packer_roles/main.tf [new file with mode: 0644]
terraform/packer_roles/output.tf [new file with mode: 0644]