Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,37 @@ cloud_final_modules:
hostname: ${hostname}
users:
- name: ${linux_user}
sudo: ALL=(ALL) NOPASSWD:ALL
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
groups: sudo
shell: /bin/bash
write_files:
- path: /opt/coder/init
permissions: "0755"
encoding: b64
content: ${init_script}
- path: /etc/systemd/system/coder-agent.service
permissions: "0644"
content: |
[Unit]
Description=Coder Agent
After=network-online.target
Wants=network-online.target

[Service]
User=${linux_user}
ExecStart=/opt/coder/init
Restart=always
RestartSec=10
TimeoutStopSec=90
KillMode=process

OOMScoreAdjust=-900
SyslogIdentifier=coder-agent

[Install]
WantedBy=multi-user.target
runcmd:
- mkdir -p /home/${linux_user}
- chown ${linux_user}:${linux_user} /home/${linux_user}
- systemctl enable coder-agent
- systemctl start coder-agent
Comment on lines +39 to +40

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
- systemctl enable coder-agent
- systemctl start coder-agent
- systemctl enable coder-agent --now

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(^ Seems like I'll want to edit the other templates to do this as well)

Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
sudo -u '${linux_user}' sh -c '${init_script}'
# sudo -u '${linux_user}' sh -c '${init_script}'
Comment on lines 1 to +2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i think you can just delete the file

16 changes: 3 additions & 13 deletions registry/coder/templates/aws-linux/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -232,19 +232,9 @@ data "cloudinit_config" "user_data" {
content_type = "text/cloud-config"

content = templatefile("${path.module}/cloud-init/cloud-config.yaml.tftpl", {
hostname = local.hostname
linux_user = local.linux_user
})
}

part {
filename = "userdata.sh"
content_type = "text/x-shellscript"

content = templatefile("${path.module}/cloud-init/userdata.sh.tftpl", {
linux_user = local.linux_user

init_script = try(coder_agent.dev[0].init_script, "")
hostname = local.hostname
linux_user = local.linux_user
init_script = base64encode(try(coder_agent.dev[0].init_script, ""))
})
}
}
Expand Down
Loading