Skip to content
Permalink
Browse files
Fix runner AMI so it (#16)
- Update to the latest runner version
- Install the vector.toml config file
- Install stop-runner-if-no-job in to correct path
- Don't enable actions.runner service at boot (do it slightly later in
  user data)
  • Loading branch information
ashb committed Apr 23, 2021
1 parent 4ff4feb commit 86bb0483c0071729a3c5674d8aa3651c666f6ff1
Showing 5 changed files with 17 additions and 7 deletions.
@@ -17,16 +17,17 @@
# specific language governing permissions and limitations
# under the License.

export DEBIAN_FRONTEND=noninteractive

debconf-set-selections <<EOF
iptables-persistent iptables-persistent/autosave_done boolean true
iptables-persistent iptables-persistent/autosave_v4 boolean false
iptables-persistent iptables-persistent/autosave_v6 boolean false
EOF

export DEBIAN_FRONTEND=noninteractive

apt-get update
apt-get install -y --no-install-recommends \
apt-get install -yq --no-install-recommends -o Dpkg::Options::="--force-confold" \
awscli \
build-essential \
docker.io \
@@ -18,10 +18,12 @@

set -eu -o pipefail

mkdir /etc/iptables/
mkdir /etc/iptables/ /etc/vector

install --owner root --mode=0644 --target-directory "/etc/systemd/system/" "/tmp/etc-systemd-system/"*
install --owner root --mode=0755 --target-directory "/usr/local/sbin" "/tmp/usr-local-sbin/"*
install --owner root --mode=0755 --target-directory "/usr/local/bin" "/tmp/usr-local-bin/"*
install --owner root --mode=0644 --target-directory "/etc/iptables" "/tmp/etc-iptables/"*
install --owner root --mode=0644 --target-directory "/etc/cron.d" "/tmp/etc-cron.d/"*
install --owner root --mode=0644 --target-directory "/etc/sudoers.d" "/tmp/etc-sudoers.d/"*
install --owner root --mode=0644 --target-directory "/etc/vector/" "/tmp/etc-vector/"*
@@ -39,4 +39,7 @@ install --owner root --mode 0755 /tmp/runner-supervisor /opt/runner-supervisor/b

systemctl enable iptables.service
systemctl enable vector.service
systemctl enable actions.runner.service

# We don't enable actions.runner.service here, but instead in the user-data
# script, as otherwise it would happen to early, before we have had a chance to
# drop the AWS_DEFAULT_REGION in to /etc/environment
@@ -89,7 +89,7 @@ build {
# in to place with the approriate permissions via install-files.sh provisioner step
provisioner "shell" {
inline = [
"mkdir -p /tmp/etc-systemd-system /tmp/usr-local-sbin /tmp/etc-sudoers.d /tmp/etc-iptables /tmp/etc-cron.d"
"mkdir -p /tmp/etc-systemd-system /tmp/usr-local-sbin /tmp/usr-local-bin /tmp/etc-sudoers.d /tmp/etc-iptables /tmp/etc-cron.d /tmp/etc-vector"
]
}
provisioner "file" {
@@ -105,7 +105,7 @@ build {
source = "./files/runner-cleanup-workdir.sh"
}
provisioner "file" {
destination = "/tmp/usr-local-sbin/stop-runner-if-no-job.sh"
destination = "/tmp/usr-local-bin/stop-runner-if-no-job.sh"
source = "./files/stop-runner-if-no-job.sh"
}
provisioner "file" {
@@ -132,6 +132,10 @@ build {
destination = "/tmp/runner-supervisor"
source = "./files/runner-supervisor.py"
}
provisioner "file" {
destination = "/tmp/etc-vector/vector.toml"
source = "./files/vector.toml"
}
provisioner "shell" {
scripts = [
"./files/install-files.sh",
@@ -20,6 +20,6 @@ ami_name = "airflow-runner-ami"
aws_region = "eu-central-1"
subnet_id = "subnet-72ed3c0e"
packer_role_arn = "arn:aws:iam::827901512104:role/packer-role"
runner_version = "2.277.1-airflow3"
runner_version = "2.278.0-airflow2"
kms_key_arn = "arn:aws:kms:eu-central-1:827901512104:key/48a58710-7ac6-4f88-995f-758a6a450faa"
session_manager_instance_profile_name = "packer_ssm_instance_profile"

0 comments on commit 86bb048

Please sign in to comment.