mirror of https://github.com/coder/coder.git
chore(examples): Add `login_before_ready` and `startup_script_timeout` (#5880)
This commit is contained in:
parent
90c4d5d28a
commit
a1212014df
|
@ -2,7 +2,7 @@ terraform {
|
|||
required_providers {
|
||||
coder = {
|
||||
source = "coder/coder"
|
||||
version = "0.6.0"
|
||||
version = "0.6.10"
|
||||
}
|
||||
docker = {
|
||||
source = "kreuzwerker/docker"
|
||||
|
@ -58,11 +58,13 @@ provider "coder" {}
|
|||
data "coder_workspace" "me" {}
|
||||
|
||||
resource "coder_agent" "dev" {
|
||||
arch = "amd64"
|
||||
os = "linux"
|
||||
startup_script = <<EOF
|
||||
#!/bin/sh
|
||||
set -x
|
||||
arch = "amd64"
|
||||
os = "linux"
|
||||
|
||||
login_before_ready = false
|
||||
startup_script_timeout = 60
|
||||
startup_script = <<-EOT
|
||||
set -ex
|
||||
# install and start code-server
|
||||
curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3
|
||||
code-server --auth none --port 13337 &
|
||||
|
@ -73,11 +75,11 @@ resource "coder_agent" "dev" {
|
|||
coder dotfiles "$DOTFILES_URI" -y 2>&1 | tee -a ~/.personalize.log
|
||||
fi
|
||||
if [ -x ~/personalize ]; then
|
||||
~/personalize | tee -a ~/.personalize.log
|
||||
~/personalize 2>&1 | tee -a ~/.personalize.log
|
||||
elif [ -f ~/personalize ]; then
|
||||
echo "~/personalize is not executable, skipping..." | tee -a ~/.personalize.log
|
||||
fi
|
||||
EOF
|
||||
EOT
|
||||
}
|
||||
|
||||
resource "coder_app" "code-server" {
|
||||
|
|
|
@ -6,7 +6,7 @@ terraform {
|
|||
}
|
||||
coder = {
|
||||
source = "coder/coder"
|
||||
version = "0.6.6"
|
||||
version = "0.6.10"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -92,15 +92,19 @@ resource "aws_ecs_service" "workspace" {
|
|||
data "coder_workspace" "me" {}
|
||||
|
||||
resource "coder_agent" "coder" {
|
||||
arch = "amd64"
|
||||
auth = "token"
|
||||
os = "linux"
|
||||
dir = "/home/coder"
|
||||
startup_script = <<EOT
|
||||
#!/bin/bash
|
||||
arch = "amd64"
|
||||
auth = "token"
|
||||
os = "linux"
|
||||
dir = "/home/coder"
|
||||
|
||||
login_before_ready = false
|
||||
startup_script_timeout = 180
|
||||
startup_script = <<-EOT
|
||||
set -e
|
||||
|
||||
# install and start code-server
|
||||
curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3 | tee code-server-install.log
|
||||
code-server --auth none --port 13337 | tee code-server-install.log &
|
||||
curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3
|
||||
code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
|
||||
EOT
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ terraform {
|
|||
required_providers {
|
||||
coder = {
|
||||
source = "coder/coder"
|
||||
version = "0.6.6"
|
||||
version = "0.6.10"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,15 +73,18 @@ data "aws_ami" "ubuntu" {
|
|||
}
|
||||
|
||||
resource "coder_agent" "main" {
|
||||
arch = "amd64"
|
||||
auth = "aws-instance-identity"
|
||||
os = "linux"
|
||||
startup_script = <<EOT
|
||||
#!/bin/bash
|
||||
arch = "amd64"
|
||||
auth = "aws-instance-identity"
|
||||
os = "linux"
|
||||
|
||||
login_before_ready = false
|
||||
startup_script_timeout = 180
|
||||
startup_script = <<-EOT
|
||||
set -e
|
||||
|
||||
# install and start code-server
|
||||
curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3 | tee code-server-install.log
|
||||
code-server --auth none --port 13337 | tee code-server-install.log &
|
||||
curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3
|
||||
code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
|
||||
EOT
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ terraform {
|
|||
required_providers {
|
||||
coder = {
|
||||
source = "coder/coder"
|
||||
version = "0.6.6"
|
||||
version = "0.6.10"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,6 +73,8 @@ resource "coder_agent" "main" {
|
|||
arch = "amd64"
|
||||
auth = "aws-instance-identity"
|
||||
os = "windows"
|
||||
|
||||
login_before_ready = false
|
||||
}
|
||||
|
||||
locals {
|
||||
|
|
|
@ -2,7 +2,7 @@ terraform {
|
|||
required_providers {
|
||||
coder = {
|
||||
source = "coder/coder"
|
||||
version = "0.6.6"
|
||||
version = "0.6.10"
|
||||
}
|
||||
azurerm = {
|
||||
source = "hashicorp/azurerm"
|
||||
|
@ -83,6 +83,8 @@ resource "coder_agent" "main" {
|
|||
arch = "amd64"
|
||||
os = "linux"
|
||||
auth = "azure-instance-identity"
|
||||
|
||||
login_before_ready = false
|
||||
}
|
||||
|
||||
locals {
|
||||
|
|
|
@ -2,7 +2,7 @@ terraform {
|
|||
required_providers {
|
||||
coder = {
|
||||
source = "coder/coder"
|
||||
version = "0.6.6"
|
||||
version = "0.6.10"
|
||||
}
|
||||
digitalocean = {
|
||||
source = "digitalocean/digitalocean"
|
||||
|
@ -96,6 +96,8 @@ data "coder_workspace" "me" {}
|
|||
resource "coder_agent" "main" {
|
||||
os = "linux"
|
||||
arch = "amd64"
|
||||
|
||||
login_before_ready = false
|
||||
}
|
||||
|
||||
resource "digitalocean_volume" "home_volume" {
|
||||
|
|
|
@ -2,7 +2,7 @@ terraform {
|
|||
required_providers {
|
||||
coder = {
|
||||
source = "coder/coder"
|
||||
version = "0.6.6"
|
||||
version = "0.6.10"
|
||||
}
|
||||
docker = {
|
||||
source = "kreuzwerker/docker"
|
||||
|
@ -21,9 +21,15 @@ data "coder_workspace" "me" {
|
|||
}
|
||||
|
||||
resource "coder_agent" "main" {
|
||||
arch = data.coder_provisioner.me.arch
|
||||
os = "linux"
|
||||
startup_script = "code-server --auth none"
|
||||
arch = data.coder_provisioner.me.arch
|
||||
os = "linux"
|
||||
|
||||
login_before_ready = false
|
||||
startup_script_timeout = 180
|
||||
startup_script = <<-EOT
|
||||
set -e
|
||||
code-server --auth none >/tmp/code-server.log 2>&1 &
|
||||
EOT
|
||||
|
||||
# These environment variables allow you to make Git commits right away after creating a
|
||||
# workspace. Note that they take precedence over configuration defined in ~/.gitconfig!
|
||||
|
|
|
@ -3,7 +3,7 @@ terraform {
|
|||
required_providers {
|
||||
coder = {
|
||||
source = "coder/coder"
|
||||
version = "0.6.6"
|
||||
version = "0.6.10"
|
||||
}
|
||||
docker = {
|
||||
source = "kreuzwerker/docker"
|
||||
|
@ -22,14 +22,17 @@ data "coder_workspace" "me" {
|
|||
}
|
||||
|
||||
resource "coder_agent" "main" {
|
||||
arch = data.coder_provisioner.me.arch
|
||||
os = "linux"
|
||||
startup_script = <<EOT
|
||||
#!/bin/bash
|
||||
arch = data.coder_provisioner.me.arch
|
||||
os = "linux"
|
||||
|
||||
login_before_ready = false
|
||||
startup_script_timeout = 180
|
||||
startup_script = <<-EOT
|
||||
set -e
|
||||
|
||||
# install and start code-server
|
||||
curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3 | tee code-server-install.log
|
||||
code-server --auth none --port 13337 | tee code-server-install.log &
|
||||
curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3
|
||||
code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
|
||||
EOT
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ terraform {
|
|||
required_providers {
|
||||
coder = {
|
||||
source = "coder/coder"
|
||||
version = "0.6.6"
|
||||
version = "0.6.10"
|
||||
}
|
||||
docker = {
|
||||
source = "kreuzwerker/docker"
|
||||
|
@ -41,9 +41,19 @@ variable "dotfiles_uri" {
|
|||
}
|
||||
|
||||
resource "coder_agent" "main" {
|
||||
arch = data.coder_provisioner.me.arch
|
||||
os = "linux"
|
||||
startup_script = var.dotfiles_uri != "" ? "coder dotfiles -y ${var.dotfiles_uri}" : null
|
||||
arch = data.coder_provisioner.me.arch
|
||||
os = "linux"
|
||||
|
||||
login_before_ready = false
|
||||
startup_script_timeout = 180
|
||||
env = { "DOTFILES_URI" = var.dotfiles_uri != "" ? var.dotfiles_uri : null }
|
||||
startup_script = <<-EOT
|
||||
set -e
|
||||
if [ -n "$DOTFILES_URI" ]; then
|
||||
echo "Installing dotfiles from $DOTFILES_URI"
|
||||
coder dotfiles -y "$DOTFILES_URI"
|
||||
fi
|
||||
EOT
|
||||
}
|
||||
|
||||
resource "docker_volume" "home_volume" {
|
||||
|
|
|
@ -11,7 +11,7 @@ RUN apt-get update \
|
|||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ARG USER=coder
|
||||
RUN useradd --groups sudo --no-create-home ${USER} \
|
||||
RUN useradd --groups sudo --no-create-home --shell /bin/bash ${USER} \
|
||||
&& echo "${USER} ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/${USER} \
|
||||
&& chmod 0440 /etc/sudoers.d/${USER}
|
||||
USER ${USER}
|
||||
|
|
|
@ -2,7 +2,7 @@ terraform {
|
|||
required_providers {
|
||||
coder = {
|
||||
source = "coder/coder"
|
||||
version = "0.6.6"
|
||||
version = "0.6.10"
|
||||
}
|
||||
docker = {
|
||||
source = "kreuzwerker/docker"
|
||||
|
@ -25,14 +25,18 @@ data "coder_workspace" "me" {
|
|||
}
|
||||
|
||||
resource "coder_agent" "main" {
|
||||
arch = data.coder_provisioner.me.arch
|
||||
os = "linux"
|
||||
startup_script = <<EOF
|
||||
#!/bin/sh
|
||||
arch = data.coder_provisioner.me.arch
|
||||
os = "linux"
|
||||
|
||||
login_before_ready = false
|
||||
startup_script_timeout = 180
|
||||
startup_script = <<-EOT
|
||||
set -e
|
||||
|
||||
# install and start code-server
|
||||
curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3
|
||||
code-server --auth none --port 13337
|
||||
EOF
|
||||
code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
|
||||
EOT
|
||||
|
||||
# These environment variables allow you to make Git commits right away after creating a
|
||||
# workspace. Note that they take precedence over configuration defined in ~/.gitconfig!
|
||||
|
|
|
@ -2,7 +2,7 @@ terraform {
|
|||
required_providers {
|
||||
coder = {
|
||||
source = "coder/coder"
|
||||
version = "0.6.6"
|
||||
version = "0.6.10"
|
||||
}
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
@ -46,15 +46,18 @@ resource "google_compute_disk" "root" {
|
|||
}
|
||||
|
||||
resource "coder_agent" "main" {
|
||||
auth = "google-instance-identity"
|
||||
arch = "amd64"
|
||||
os = "linux"
|
||||
startup_script = <<EOT
|
||||
#!/bin/bash
|
||||
auth = "google-instance-identity"
|
||||
arch = "amd64"
|
||||
os = "linux"
|
||||
|
||||
login_before_ready = false
|
||||
startup_script_timeout = 180
|
||||
startup_script = <<-EOT
|
||||
set -e
|
||||
|
||||
# install and start code-server
|
||||
curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3 | tee code-server-install.log
|
||||
code-server --auth none --port 13337 | tee code-server-install.log &
|
||||
curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3
|
||||
code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
|
||||
EOT
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ terraform {
|
|||
required_providers {
|
||||
coder = {
|
||||
source = "coder/coder"
|
||||
version = "0.6.6"
|
||||
version = "0.6.10"
|
||||
}
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
@ -36,15 +36,18 @@ data "coder_workspace" "me" {
|
|||
}
|
||||
|
||||
resource "coder_agent" "main" {
|
||||
auth = "google-instance-identity"
|
||||
arch = "amd64"
|
||||
os = "linux"
|
||||
startup_script = <<EOT
|
||||
#!/bin/bash
|
||||
auth = "google-instance-identity"
|
||||
arch = "amd64"
|
||||
os = "linux"
|
||||
|
||||
login_before_ready = false
|
||||
startup_script_timeout = 180
|
||||
startup_script = <<-EOT
|
||||
set -e
|
||||
|
||||
# install and start code-server
|
||||
curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3 | tee code-server-install.log
|
||||
code-server --auth none --port 13337 | tee code-server-install.log &
|
||||
curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3
|
||||
code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
|
||||
EOT
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ terraform {
|
|||
required_providers {
|
||||
coder = {
|
||||
source = "coder/coder"
|
||||
version = "0.6.6"
|
||||
version = "0.6.10"
|
||||
}
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
@ -49,6 +49,8 @@ resource "coder_agent" "main" {
|
|||
auth = "google-instance-identity"
|
||||
arch = "amd64"
|
||||
os = "windows"
|
||||
|
||||
login_before_ready = false
|
||||
}
|
||||
|
||||
resource "google_compute_instance" "dev" {
|
||||
|
|
|
@ -96,9 +96,8 @@ block of your workspace template:
|
|||
|
||||
```terraform
|
||||
resource "coder_agent" "main" {
|
||||
startup_script = <<EOT
|
||||
#!/bin/bash
|
||||
|
||||
startup_script = <<-EOT
|
||||
set -e
|
||||
# install AWS CLI
|
||||
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
|
||||
unzip awscliv2.zip
|
||||
|
|
|
@ -2,7 +2,7 @@ terraform {
|
|||
required_providers {
|
||||
coder = {
|
||||
source = "coder/coder"
|
||||
version = "0.6.6"
|
||||
version = "0.6.10"
|
||||
}
|
||||
kubernetes = {
|
||||
source = "hashicorp/kubernetes"
|
||||
|
@ -49,10 +49,13 @@ provider "kubernetes" {
|
|||
data "coder_workspace" "me" {}
|
||||
|
||||
resource "coder_agent" "main" {
|
||||
os = "linux"
|
||||
arch = "amd64"
|
||||
startup_script = <<EOT
|
||||
#!/bin/bash
|
||||
os = "linux"
|
||||
arch = "amd64"
|
||||
|
||||
login_before_ready = false
|
||||
startup_script_timeout = 180
|
||||
startup_script = <<-EOT
|
||||
set -e
|
||||
|
||||
# home folder can be empty, so copying default bash settings
|
||||
if [ ! -f ~/.profile ]; then
|
||||
|
@ -63,8 +66,8 @@ resource "coder_agent" "main" {
|
|||
fi
|
||||
|
||||
# install and start code-server
|
||||
curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3 | tee code-server-install.log
|
||||
code-server --auth none --port 13337 | tee code-server-install.log &
|
||||
curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3
|
||||
code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
|
||||
EOT
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue