2023-06-13 20:14:36 +00:00
|
|
|
#cloud-config
|
|
|
|
users:
|
|
|
|
- name: ${username}
|
|
|
|
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
|
|
|
|
groups: sudo
|
2023-06-15 20:06:52 +00:00
|
|
|
shell: ${user_shell}
|
2023-06-13 20:14:36 +00:00
|
|
|
packages:
|
|
|
|
- zsh
|
|
|
|
- git
|
2023-12-22 15:45:10 +00:00
|
|
|
- git-lfs
|
2023-06-14 06:32:05 +00:00
|
|
|
- git-delta
|
|
|
|
- difftastic
|
2023-06-13 20:14:36 +00:00
|
|
|
- curl
|
|
|
|
- jq
|
2023-06-14 06:32:05 +00:00
|
|
|
- htop
|
|
|
|
- exa
|
|
|
|
- ripgrep
|
|
|
|
- bat
|
|
|
|
- fzf
|
|
|
|
- dnf-plugins-core
|
2023-06-16 06:37:57 +00:00
|
|
|
- icu
|
2023-06-16 13:20:01 +00:00
|
|
|
- neovim
|
2023-12-22 15:45:10 +00:00
|
|
|
- clang15
|
|
|
|
- llvm15
|
|
|
|
- libbpf-devel
|
2023-06-14 06:32:05 +00:00
|
|
|
%{ if install_podman_setup ~}
|
2023-06-13 20:14:36 +00:00
|
|
|
- podman
|
2023-06-14 06:32:05 +00:00
|
|
|
- podman-docker
|
|
|
|
- docker-compose
|
2023-06-15 16:12:00 +00:00
|
|
|
- skopeo
|
|
|
|
- buildah
|
2023-06-14 06:32:05 +00:00
|
|
|
%{ endif ~}
|
2023-06-13 20:14:36 +00:00
|
|
|
mounts:
|
|
|
|
- [
|
|
|
|
"${volume_path}",
|
|
|
|
"/home/${username}",
|
|
|
|
ext4,
|
2023-06-15 16:45:40 +00:00
|
|
|
"discard,rw,suid,exec,auto,async",
|
2023-06-13 20:14:36 +00:00
|
|
|
]
|
|
|
|
write_files:
|
|
|
|
- path: /opt/coder/init
|
|
|
|
permissions: "0755"
|
|
|
|
encoding: b64
|
|
|
|
content: ${init_script}
|
2023-12-21 15:14:23 +00:00
|
|
|
- path: /etc/systemd/system/coder-agent.service
|
2023-06-17 09:42:23 +00:00
|
|
|
permissions: "0644"
|
|
|
|
content: |
|
|
|
|
[Unit]
|
2023-12-21 15:14:23 +00:00
|
|
|
Description=Coder Agent
|
2023-06-17 09:42:23 +00:00
|
|
|
After=network-online.target
|
|
|
|
Wants=network-online.target
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
User=${username}
|
2023-12-21 15:14:23 +00:00
|
|
|
ExecStart=/opt/coder/init
|
|
|
|
Environment=CODER_AGENT_TOKEN=${coder_agent_token}
|
2023-06-17 09:42:23 +00:00
|
|
|
Restart=always
|
|
|
|
RestartSec=10
|
|
|
|
TimeoutStopSec=90
|
|
|
|
KillMode=process
|
|
|
|
|
2023-12-21 15:14:23 +00:00
|
|
|
OOMScoreAdjust=-900
|
|
|
|
SyslogIdentifier=coder-agent
|
2023-06-17 09:42:23 +00:00
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|
2023-12-21 15:14:23 +00:00
|
|
|
%{ if install_podman_setup ~}
|
|
|
|
- path: /etc/profile.d/podman.sh
|
|
|
|
permissions: "0644"
|
|
|
|
content: |
|
|
|
|
export DOCKER_HOST=unix:///run/user/$UID/podman/podman.sock
|
2023-06-14 06:32:05 +00:00
|
|
|
%{ endif ~}
|
2023-12-21 15:14:23 +00:00
|
|
|
%{ if remote_ide_setup == "fleet" ~}
|
|
|
|
- path: /etc/systemd/system/fleet.service
|
2023-06-13 20:14:36 +00:00
|
|
|
permissions: "0644"
|
|
|
|
content: |
|
|
|
|
[Unit]
|
2023-12-21 15:14:23 +00:00
|
|
|
Description=Fleet
|
2023-06-13 20:14:36 +00:00
|
|
|
After=network-online.target
|
|
|
|
Wants=network-online.target
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
User=${username}
|
2023-12-21 15:14:23 +00:00
|
|
|
ExecStart=/usr/local/bin/fleet launch workspace --version ${fleet_version} -- --auth=accept-everyone --enableSmartMode --workspacePort 3500
|
2023-06-13 20:14:36 +00:00
|
|
|
Restart=always
|
|
|
|
RestartSec=10
|
|
|
|
TimeoutStopSec=90
|
|
|
|
KillMode=process
|
|
|
|
|
2023-12-21 15:14:23 +00:00
|
|
|
SyslogIdentifier=fleet
|
2023-06-13 20:14:36 +00:00
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|
2023-12-21 15:14:23 +00:00
|
|
|
%{ endif ~}
|
2023-06-17 09:42:23 +00:00
|
|
|
%{ if remote_ide_setup == "code_server" ~}
|
2023-06-13 20:14:36 +00:00
|
|
|
- path: /home/${username}/.config/code-server/config.yaml
|
|
|
|
permissions: "0644"
|
|
|
|
content: |
|
|
|
|
bind-addr: 127.0.0.1:8080
|
|
|
|
auth: none
|
|
|
|
cert: false
|
|
|
|
%{ endif ~}
|
|
|
|
runcmd:
|
2023-12-22 15:45:10 +00:00
|
|
|
- ln -s /usr/lib64/llvm15/bin/llc /usr/bin/
|
|
|
|
- ln -s /usr/lib64/llvm15/bin/clang-15 /usr/bin/clang
|
2023-06-14 06:32:05 +00:00
|
|
|
- chown -R ${username}:${username} /home/${username}
|
2023-06-15 17:03:07 +00:00
|
|
|
- systemctl enable --now coder-agent
|
2023-06-16 06:37:57 +00:00
|
|
|
%{ if install_podman_setup ~}
|
2023-06-14 06:32:05 +00:00
|
|
|
- loginctl enable-linger ${username}
|
|
|
|
- mkdir -p /home/${username}/.config/systemd/user/sockets.target.wants
|
|
|
|
- ln -sf /usr/lib/systemd/system/podman.socket /home/${username}/.config/systemd/user/sockets.target.wants/
|
2023-06-15 16:55:20 +00:00
|
|
|
- chown -R ${username}:${username} /home/${username}
|
2023-06-14 06:32:05 +00:00
|
|
|
- sudo -u ${username} DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus" systemctl --user start podman
|
|
|
|
%{ endif ~}
|
2023-06-17 09:42:23 +00:00
|
|
|
%{ if remote_ide_setup == "code_server" ~}
|
2023-10-10 19:10:00 +00:00
|
|
|
- curl -fsSL https://code-server.dev/install.sh | sh
|
2023-06-13 20:14:36 +00:00
|
|
|
- systemctl enable --now code-server@${username}
|
2023-06-17 09:42:23 +00:00
|
|
|
%{ endif }
|
|
|
|
%{ if remote_ide_setup == "fleet" ~}
|
2023-10-10 19:10:00 +00:00
|
|
|
- curl -LSs "https://download.jetbrains.com/product?code=FLL&release.type=preview&release.type=eap&platform=$([ $(uname -m) = 'aarch64' ] && echo linux_aarch64 || echo linux_x64)" --output /usr/local/bin/fleet && chmod +x /usr/local/bin/fleet
|
2023-06-17 09:42:23 +00:00
|
|
|
- systemctl enable --now fleet
|
2023-06-13 20:14:36 +00:00
|
|
|
%{ endif }
|
2023-10-10 19:10:00 +00:00
|
|
|
- chown -R ${username}:${username} /home/${username}
|
|
|
|
- sh -c "$(curl -fsLS get.chezmoi.io)"
|