Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: update lima example to use --with-terraform arg #5655

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 7 additions & 18 deletions examples/lima/coder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,16 @@ provision:
# See: https://github.com/lima-vm/lima/issues/528
chown ${LIMA_CIDATA_USER} /var/run/docker.sock
chmod og+rwx /var/run/docker.sock
- mode: system
script: |
#!/bin/bash
set -eux -o pipefail
command -v terraform >/dev/null 2>&1 && exit 0
DEBIAN_FRONTEND=noninteractive apt-get install -qqy unzip
rm -fv /tmp/terraform.zip || true
wget -qO /tmp/terraform.zip "https://releases.hashicorp.com/terraform/1.3.0/terraform_1.3.0_linux_$(dpkg --print-architecture).zip"
unzip /tmp/terraform.zip -d /usr/local/bin/
chmod +x /usr/local/bin/terraform
rm -fv /tmp/terraform.zip || true
Comment on lines -68 to -78
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review: no longer required

- mode: system
script: |
#!/bin/bash
set -eux -o pipefail
command -v coder >/dev/null 2>&1 && exit 0
export DEBIAN_FRONTEND=noninteractive
export HOME=/root
curl -fsSL https://coder.com/install.sh | sh
# Using install.sh --with-terraform requires unzip to be available.
apt-get install -qqy unzip
curl -fsSL https://coder.com/install.sh | sh -s -- --with-terraform
# Ensure Coder has permissions on /var/run/docker.socket
usermod -aG docker coder
# Ensure coder listens on all interfaces
Expand All @@ -93,10 +84,8 @@ provision:
# Ensure coder starts on boot
systemctl enable coder
systemctl start coder
# Wait for Coder to have downloaded Terraform
timeout 60s bash -c 'until /var/cache/coder/terraform version >/dev/null 2>&1; do sleep 1; done'
# Coder restarts after downloading Terraform, wait for it to become available
timeout 60s bash -c 'until nc -z localhost 3000 > /dev/null 2>&1; do sleep 1; done'
# Wait for Terraform to be installed
timeout 60s bash -c 'until /usr/local/bin/terraform version >/dev/null 2>&1; do sleep 1; done'
Comment on lines +87 to +88
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review: terraform path updated

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer required at all, right? It should be installed by the time install.sh finishes.

Copy link
Member Author

@johnstcn johnstcn Jan 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking here is that if terraform installation fails for some reason, it will be more obvious to the end-user.

Edit: thinking more about it, any errors with Terraform installation should show up in the cloud-init log and be surfaced by install.sh, so this probably doesn't add much value.

- mode: user
script: |
#!/bin/bash
Expand Down Expand Up @@ -141,10 +130,10 @@ message: |
All Done! Your Coder instance is accessible at http://localhost:3000

Username: "[email protected]"
Password: Run `LIMA_INSTANCE=coder lima cat /home/${USER}.linux/.config/coderv2/password` 🤫
Password: Run `LIMA_INSTANCE={{.Instance.Name}} lima cat /home/${USER}.linux/.config/coderv2/password` 🤫
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Get started creating your own template now:
------
limactl shell coder
limactl shell {{.Instance.Name}}
cd && coder templates init
------