fix: download fleet and make version configurable
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter 2023-06-17 12:03:11 +02:00
parent b81e97116f
commit 5141952553
Signed by: prskr
GPG key ID: C1DB5D2E8DB512F9
2 changed files with 20 additions and 9 deletions

View file

@ -55,7 +55,7 @@ write_files:
[Service]
User=${username}
ExecStart=/usr/local/bin/fleet launch workspace --version 1.19.111 -- --auth=accept-everyone --enableSmartMode --workspacePort 3500
ExecStart=/usr/local/bin/fleet launch workspace --version ${fleet_version} -- --auth=accept-everyone --enableSmartMode --workspacePort 3500
Restart=always
RestartSec=10
TimeoutStopSec=90
@ -111,6 +111,7 @@ runcmd:
- systemctl enable --now code-server@${username}
%{ endif }
%{ if remote_ide_setup == "fleet" ~}
- curl -LSs "https://download.jetbrains.com/product?code=FLL&release.type=preview&release.type=eap&platform=linux_x64" --output /usr/local/bin/fleet && chmod +x /usr/local/bin/fleet
- systemctl enable --now fleet
%{ endif }
- chown -R ${username}:${username} /home/${username}

View file

@ -177,6 +177,15 @@ data "coder_parameter" "volume_size" {
}
}
data "coder_parameter" "fleet_version" {
name = "fleet_version"
display_name = "Fleet version"
description = "Which version of Fleet should be installed?"
default = "1.19.111"
type = "string"
mutable = true
}
data "coder_parameter" "remote_ide" {
name = "install_remote_ide"
description = "Which remote IDE should be installed"
@ -247,7 +256,7 @@ resource "coder_app" "fleet" {
count = data.coder_parameter.remote_ide.value == "fleet" ? 1 : 0
agent_id = coder_agent.dev.id
slug = "fleet"
icon = "/icon/code.svg"
icon = "https://www.jetbrains.com/_assets/www/fleet/inc/overview-content/img/fleet-logo.65f4a04c59fc3ba93bb5e181050891c5.png"
url = "http://localhost:3500"
subdomain = var.use_subdomain
}
@ -272,13 +281,14 @@ resource "hcloud_server" "root" {
ssh_keys = [hcloud_ssh_key.root.id]
user_data = templatefile("cloud-config.yaml.tftpl", {
username = data.coder_workspace.me.owner
volume_path = "/dev/disk/by-id/scsi-0HC_Volume_${hcloud_volume.root.id}"
init_script = base64encode(coder_agent.dev.init_script)
coder_agent_token = coder_agent.dev.token
remote_ide_setup = data.coder_parameter.remote_ide.value
install_podman_setup = data.coder_parameter.install_podman.value
user_shell = data.coder_parameter.user_shell.value
username = data.coder_workspace.me.owner
volume_path = "/dev/disk/by-id/scsi-0HC_Volume_${hcloud_volume.root.id}"
init_script = base64encode(coder_agent.dev.init_script)
coder_agent_token = coder_agent.dev.token
remote_ide_setup = data.coder_parameter.remote_ide.value
fleet_version = data.coder_parameter.fleet_version.value
install_podman_setup = data.coder_parameter.install_podman.value
user_shell = data.coder_parameter.user_shell.value
})
dynamic "network" {