Skip to content

Commit

Permalink
fix(examples): Upgrading ubuntu example to 22.04 (philips-labs#2250)
Browse files Browse the repository at this point in the history
* fix(examples): adding iptables to ubuntu example
* fix(examples): adding export to .profile
* chore: bump ubuntu example to latest LTS, 22.04 philips-labs#2103
  • Loading branch information
tobiasehlert committed Aug 15, 2022
1 parent 9f7d32d commit d4b7650
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion examples/ubuntu/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module "runners" {
ami_owners = ["099720109477"] # Canonical's Amazon account ID

ami_filter = {
name = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
name = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"]
}

# Custom build AMI, no custom userdata needed.
Expand Down
15 changes: 8 additions & 7 deletions examples/ubuntu/templates/user-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ ${pre_install}
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y \
awscli \
jq \
build-essential \
curl \
wget \
git \
iptables \
jq \
uidmap \
build-essential \
unzip
unzip \
wget

user_name=ubuntu
user_id=$(id -ru $user_name)
Expand Down Expand Up @@ -43,16 +44,16 @@ WantedBy=default.target
EOF

echo export XDG_RUNTIME_DIR=/run/user/$user_id >>/home/$user_name/.profile
echo export XDG_RUNTIME_DIR=/run/user/$user_id >>/home/$user_name/.bashrc

systemctl daemon-reload
systemctl enable user@UID.service
systemctl start user@UID.service

curl -fsSL https://get.docker.com/rootless >>/opt/rootless.sh && chmod 755 /opt/rootless.sh
su -l $user_name -c /opt/rootless.sh
echo export DOCKER_HOST=unix:///run/user/$user_id/docker.sock >>/home/$user_name/.profile
echo export PATH=/home/$user_name/bin:$PATH >>/home/$user_name/.profile
echo export DOCKER_HOST=unix:///run/user/$user_id/docker.sock >>/home/$user_name/.bashrc
echo export PATH=/home/$user_name/bin:$PATH >>/home/$user_name/.bashrc

# Run docker service by default
loginctl enable-linger $user_name
Expand Down

0 comments on commit d4b7650

Please sign in to comment.