2022-07-18 22:44:09 +00:00
terraform {
required_providers {
coder = {
2023-09-26 02:23:42 +00:00
source = " coder/coder "
2022-07-18 22:44:09 +00:00
}
docker = {
source = " kreuzwerker/docker "
2023-08-26 22:22:28 +00:00
version = " ~> 3.0.0 "
2022-07-18 22:44:09 +00:00
}
}
}
2023-01-17 14:20:48 +00:00
locals {
2023-12-01 11:16:49 +00:00
// These are cluster service addresses mapped to Tailscale nodes. Ask Dean or
// Kyle for help.
2023-01-17 14:20:48 +00:00
docker_host = {
2023-12-01 11:16:49 +00:00
" " = " tcp://dogfood-ts-cdr-dev.tailscale.svc.cluster.local:2375 "
" us-pittsburgh " = " tcp://dogfood-ts-cdr-dev.tailscale.svc.cluster.local:2375 "
" eu-helsinki " = " tcp://reinhard-hel-cdr-dev.tailscale.svc.cluster.local:2375 "
" ap-sydney " = " tcp://hildegard-sydney-cdr-dev.tailscale.svc.cluster.local:2375 "
" sa-saopaulo " = " tcp://oberstein-sao-cdr-dev.tailscale.svc.cluster.local:2375 "
2024-03-15 13:33:43 +00:00
" za-jnb " = " tcp://greenhill-jnb-cdr-dev.tailscale.svc.cluster.local:2375 "
2023-01-17 14:20:48 +00:00
}
2023-10-03 05:55:25 +00:00
2024-02-01 06:33:02 +00:00
repo_base_dir = data . coder_parameter . repo_base_dir . value == " ~ " ? " /home/coder " : replace ( data . coder_parameter . repo_base_dir . value , " /^~ \\ // " , " /home/coder/ " )
2024-02-02 12:21:34 +00:00
repo_dir = replace ( module . git - clone . repo_dir , " /^~ \\ // " , " /home/coder/ " )
2024-01-05 20:25:51 +00:00
container_name = " coder- ${ data . coder_workspace . me . owner } - ${ lower ( data . coder_workspace . me . name ) } "
2023-01-17 14:20:48 +00:00
}
2022-07-18 22:44:09 +00:00
2024-01-27 01:45:07 +00:00
data " coder_parameter " " repo_base_dir " {
2023-05-13 12:42:10 +00:00
type = " string "
2024-01-27 01:45:07 +00:00
name = " Coder Repository Base Directory "
default = " ~ "
description = " The directory specified will be created (if missing) and [coder/coder](https://github.com/coder/coder) will be automatically cloned into [base directory]/coder 🪄. "
2023-05-13 12:42:10 +00:00
mutable = true
}
2024-01-31 14:27:11 +00:00
data " coder_parameter " " image_type " {
type = " string "
name = " Coder Image "
default = " codercom/oss-dogfood:latest "
description = " The Docker image used to run your workspace. Choose between nix and non-nix images. "
option {
icon = " /icon/coder.svg "
2024-01-31 14:36:01 +00:00
name = " Dogfood (Default) "
2024-01-31 14:27:11 +00:00
value = " codercom/oss-dogfood:latest "
}
option {
2024-02-01 19:27:41 +00:00
icon = " /icon/nix.svg "
2024-01-31 14:36:01 +00:00
name = " Dogfood Nix (Experimental) "
2024-01-31 14:27:11 +00:00
value = " codercom/oss-dogfood-nix:latest "
}
}
2023-05-13 12:42:10 +00:00
data " coder_parameter " " region " {
2023-08-26 22:22:28 +00:00
type = " string "
name = " Region "
icon = " /emojis/1f30e.png "
default = " us-pittsburgh "
2023-05-13 12:42:10 +00:00
option {
icon = " /emojis/1f1fa-1f1f8.png "
name = " Pittsburgh "
value = " us-pittsburgh "
}
option {
icon = " /emojis/1f1eb-1f1ee.png "
name = " Helsinki "
value = " eu-helsinki "
}
option {
icon = " /emojis/1f1e6-1f1fa.png "
name = " Sydney "
value = " ap-sydney "
}
option {
icon = " /emojis/1f1e7-1f1f7.png "
name = " São Paulo "
value = " sa-saopaulo "
}
2024-03-06 18:54:26 +00:00
option {
icon = " /emojis/1f1ff-1f1e6.png "
name = " Johannesburg "
value = " za-jnb "
}
2023-09-13 14:49:36 +00:00
}
2022-07-18 22:44:09 +00:00
provider " docker " {
2023-05-13 12:42:10 +00:00
host = lookup ( local . docker_host , data . coder_parameter . region . value )
2022-07-18 22:44:09 +00:00
}
2023-01-17 14:20:48 +00:00
provider " coder " { }
2022-07-18 22:44:09 +00:00
2023-10-12 07:30:00 +00:00
data " coder_external_auth " " github " {
2023-05-13 12:42:10 +00:00
id = " github "
}
2023-01-17 14:20:48 +00:00
data " coder_workspace " " me " { }
2022-07-18 22:44:09 +00:00
2023-10-10 22:46:47 +00:00
module " slackme " {
2024-01-24 01:33:25 +00:00
source = " registry.coder.com/modules/slackme/coder "
2024-01-27 01:45:07 +00:00
version = " 1.0.2 "
2023-10-10 22:46:47 +00:00
agent_id = coder_agent . dev . id
auth_provider_id = " slack "
}
chore(dogfood): use coder modules in dogfood (#9890)
updates dogfood to use coder modules
---
<details open="true"><summary>Generated summary (powered by <a href="https://app.graphite.dev">Graphite</a>)</summary>
> # TL;DR
> This pull request removes the `dotfiles_url` and `jetbrains_ide` parameters, and the related code from the `main.tf` file. It also adds several new modules for `dotfiles`, `git-clone`, `personalize`, `code-server`, `jetbrains_gateway`, `vscode`, and `filebrowser`. The `startup_script` has been updated to remove the installation and launch of `filebrowser` and the `dotfiles` related code.
>
> # What changed
> - Removed `dotfiles_url` and `jetbrains_ide` parameters.
> - Removed related code for `dotfiles_url` and `jetbrains_ide`.
> - Added new modules for `dotfiles`, `git-clone`, `personalize`, `code-server`, `jetbrains_gateway`, `vscode`, and `filebrowser`.
> - Updated `startup_script` to remove the installation and launch of `filebrowser` and the `dotfiles` related code.
>
> # How to test
> 1. Go to https://dev.coder.com/templates/coder/versions/dazzling_hugle0 and create a new workspace or change your dogfood workspace version to `dazzling_hugle0` .
> 2. Verify that the new modules are working as expected.
>
> # Why make this change
> The `dotfiles_url` and `jetbrains_ide` parameters and related code were removed to simplify the configuration and make it easier to manage. The new modules were added to provide additional functionality and improve the overall user experience. The `startup_script` was updated to reflect these changes.
</details>
2023-09-30 19:22:14 +00:00
module " dotfiles " {
2024-01-24 01:33:25 +00:00
source = " registry.coder.com/modules/dotfiles/coder "
2024-05-13 06:51:47 +00:00
version = " 1.0.14 "
chore(dogfood): use coder modules in dogfood (#9890)
updates dogfood to use coder modules
---
<details open="true"><summary>Generated summary (powered by <a href="https://app.graphite.dev">Graphite</a>)</summary>
> # TL;DR
> This pull request removes the `dotfiles_url` and `jetbrains_ide` parameters, and the related code from the `main.tf` file. It also adds several new modules for `dotfiles`, `git-clone`, `personalize`, `code-server`, `jetbrains_gateway`, `vscode`, and `filebrowser`. The `startup_script` has been updated to remove the installation and launch of `filebrowser` and the `dotfiles` related code.
>
> # What changed
> - Removed `dotfiles_url` and `jetbrains_ide` parameters.
> - Removed related code for `dotfiles_url` and `jetbrains_ide`.
> - Added new modules for `dotfiles`, `git-clone`, `personalize`, `code-server`, `jetbrains_gateway`, `vscode`, and `filebrowser`.
> - Updated `startup_script` to remove the installation and launch of `filebrowser` and the `dotfiles` related code.
>
> # How to test
> 1. Go to https://dev.coder.com/templates/coder/versions/dazzling_hugle0 and create a new workspace or change your dogfood workspace version to `dazzling_hugle0` .
> 2. Verify that the new modules are working as expected.
>
> # Why make this change
> The `dotfiles_url` and `jetbrains_ide` parameters and related code were removed to simplify the configuration and make it easier to manage. The new modules were added to provide additional functionality and improve the overall user experience. The `startup_script` was updated to reflect these changes.
</details>
2023-09-30 19:22:14 +00:00
agent_id = coder_agent . dev . id
}
module " git-clone " {
2024-01-24 01:33:25 +00:00
source = " registry.coder.com/modules/git-clone/coder "
2024-05-13 06:51:47 +00:00
version = " 1.0.12 "
chore(dogfood): use coder modules in dogfood (#9890)
updates dogfood to use coder modules
---
<details open="true"><summary>Generated summary (powered by <a href="https://app.graphite.dev">Graphite</a>)</summary>
> # TL;DR
> This pull request removes the `dotfiles_url` and `jetbrains_ide` parameters, and the related code from the `main.tf` file. It also adds several new modules for `dotfiles`, `git-clone`, `personalize`, `code-server`, `jetbrains_gateway`, `vscode`, and `filebrowser`. The `startup_script` has been updated to remove the installation and launch of `filebrowser` and the `dotfiles` related code.
>
> # What changed
> - Removed `dotfiles_url` and `jetbrains_ide` parameters.
> - Removed related code for `dotfiles_url` and `jetbrains_ide`.
> - Added new modules for `dotfiles`, `git-clone`, `personalize`, `code-server`, `jetbrains_gateway`, `vscode`, and `filebrowser`.
> - Updated `startup_script` to remove the installation and launch of `filebrowser` and the `dotfiles` related code.
>
> # How to test
> 1. Go to https://dev.coder.com/templates/coder/versions/dazzling_hugle0 and create a new workspace or change your dogfood workspace version to `dazzling_hugle0` .
> 2. Verify that the new modules are working as expected.
>
> # Why make this change
> The `dotfiles_url` and `jetbrains_ide` parameters and related code were removed to simplify the configuration and make it easier to manage. The new modules were added to provide additional functionality and improve the overall user experience. The `startup_script` was updated to reflect these changes.
</details>
2023-09-30 19:22:14 +00:00
agent_id = coder_agent . dev . id
url = " https://github.com/coder/coder "
2024-01-27 07:02:10 +00:00
base_dir = local . repo_base_dir
chore(dogfood): use coder modules in dogfood (#9890)
updates dogfood to use coder modules
---
<details open="true"><summary>Generated summary (powered by <a href="https://app.graphite.dev">Graphite</a>)</summary>
> # TL;DR
> This pull request removes the `dotfiles_url` and `jetbrains_ide` parameters, and the related code from the `main.tf` file. It also adds several new modules for `dotfiles`, `git-clone`, `personalize`, `code-server`, `jetbrains_gateway`, `vscode`, and `filebrowser`. The `startup_script` has been updated to remove the installation and launch of `filebrowser` and the `dotfiles` related code.
>
> # What changed
> - Removed `dotfiles_url` and `jetbrains_ide` parameters.
> - Removed related code for `dotfiles_url` and `jetbrains_ide`.
> - Added new modules for `dotfiles`, `git-clone`, `personalize`, `code-server`, `jetbrains_gateway`, `vscode`, and `filebrowser`.
> - Updated `startup_script` to remove the installation and launch of `filebrowser` and the `dotfiles` related code.
>
> # How to test
> 1. Go to https://dev.coder.com/templates/coder/versions/dazzling_hugle0 and create a new workspace or change your dogfood workspace version to `dazzling_hugle0` .
> 2. Verify that the new modules are working as expected.
>
> # Why make this change
> The `dotfiles_url` and `jetbrains_ide` parameters and related code were removed to simplify the configuration and make it easier to manage. The new modules were added to provide additional functionality and improve the overall user experience. The `startup_script` was updated to reflect these changes.
</details>
2023-09-30 19:22:14 +00:00
}
module " personalize " {
2024-01-24 01:33:25 +00:00
source = " registry.coder.com/modules/personalize/coder "
2024-01-27 01:45:07 +00:00
version = " 1.0.2 "
chore(dogfood): use coder modules in dogfood (#9890)
updates dogfood to use coder modules
---
<details open="true"><summary>Generated summary (powered by <a href="https://app.graphite.dev">Graphite</a>)</summary>
> # TL;DR
> This pull request removes the `dotfiles_url` and `jetbrains_ide` parameters, and the related code from the `main.tf` file. It also adds several new modules for `dotfiles`, `git-clone`, `personalize`, `code-server`, `jetbrains_gateway`, `vscode`, and `filebrowser`. The `startup_script` has been updated to remove the installation and launch of `filebrowser` and the `dotfiles` related code.
>
> # What changed
> - Removed `dotfiles_url` and `jetbrains_ide` parameters.
> - Removed related code for `dotfiles_url` and `jetbrains_ide`.
> - Added new modules for `dotfiles`, `git-clone`, `personalize`, `code-server`, `jetbrains_gateway`, `vscode`, and `filebrowser`.
> - Updated `startup_script` to remove the installation and launch of `filebrowser` and the `dotfiles` related code.
>
> # How to test
> 1. Go to https://dev.coder.com/templates/coder/versions/dazzling_hugle0 and create a new workspace or change your dogfood workspace version to `dazzling_hugle0` .
> 2. Verify that the new modules are working as expected.
>
> # Why make this change
> The `dotfiles_url` and `jetbrains_ide` parameters and related code were removed to simplify the configuration and make it easier to manage. The new modules were added to provide additional functionality and improve the overall user experience. The `startup_script` was updated to reflect these changes.
</details>
2023-09-30 19:22:14 +00:00
agent_id = coder_agent . dev . id
}
module " code-server " {
2024-05-13 06:51:47 +00:00
source = " registry.coder.com/modules/code-server/coder "
version = " 1.0.14 "
agent_id = coder_agent . dev . id
folder = local . repo_dir
auto_install_extensions = true
chore(dogfood): use coder modules in dogfood (#9890)
updates dogfood to use coder modules
---
<details open="true"><summary>Generated summary (powered by <a href="https://app.graphite.dev">Graphite</a>)</summary>
> # TL;DR
> This pull request removes the `dotfiles_url` and `jetbrains_ide` parameters, and the related code from the `main.tf` file. It also adds several new modules for `dotfiles`, `git-clone`, `personalize`, `code-server`, `jetbrains_gateway`, `vscode`, and `filebrowser`. The `startup_script` has been updated to remove the installation and launch of `filebrowser` and the `dotfiles` related code.
>
> # What changed
> - Removed `dotfiles_url` and `jetbrains_ide` parameters.
> - Removed related code for `dotfiles_url` and `jetbrains_ide`.
> - Added new modules for `dotfiles`, `git-clone`, `personalize`, `code-server`, `jetbrains_gateway`, `vscode`, and `filebrowser`.
> - Updated `startup_script` to remove the installation and launch of `filebrowser` and the `dotfiles` related code.
>
> # How to test
> 1. Go to https://dev.coder.com/templates/coder/versions/dazzling_hugle0 and create a new workspace or change your dogfood workspace version to `dazzling_hugle0` .
> 2. Verify that the new modules are working as expected.
>
> # Why make this change
> The `dotfiles_url` and `jetbrains_ide` parameters and related code were removed to simplify the configuration and make it easier to manage. The new modules were added to provide additional functionality and improve the overall user experience. The `startup_script` was updated to reflect these changes.
</details>
2023-09-30 19:22:14 +00:00
}
module " jetbrains_gateway " {
2024-01-24 01:33:25 +00:00
source = " registry.coder.com/modules/jetbrains-gateway/coder "
2024-05-13 06:51:47 +00:00
version = " 1.0.13 "
2023-10-03 07:11:58 +00:00
agent_id = coder_agent . dev . id
2023-12-08 01:14:37 +00:00
agent_name = " dev "
2023-10-03 07:11:58 +00:00
folder = local . repo_dir
jetbrains_ides = [ " GO " , " WS " ]
default = " GO "
2024-05-13 06:51:47 +00:00
latest = true
chore(dogfood): use coder modules in dogfood (#9890)
updates dogfood to use coder modules
---
<details open="true"><summary>Generated summary (powered by <a href="https://app.graphite.dev">Graphite</a>)</summary>
> # TL;DR
> This pull request removes the `dotfiles_url` and `jetbrains_ide` parameters, and the related code from the `main.tf` file. It also adds several new modules for `dotfiles`, `git-clone`, `personalize`, `code-server`, `jetbrains_gateway`, `vscode`, and `filebrowser`. The `startup_script` has been updated to remove the installation and launch of `filebrowser` and the `dotfiles` related code.
>
> # What changed
> - Removed `dotfiles_url` and `jetbrains_ide` parameters.
> - Removed related code for `dotfiles_url` and `jetbrains_ide`.
> - Added new modules for `dotfiles`, `git-clone`, `personalize`, `code-server`, `jetbrains_gateway`, `vscode`, and `filebrowser`.
> - Updated `startup_script` to remove the installation and launch of `filebrowser` and the `dotfiles` related code.
>
> # How to test
> 1. Go to https://dev.coder.com/templates/coder/versions/dazzling_hugle0 and create a new workspace or change your dogfood workspace version to `dazzling_hugle0` .
> 2. Verify that the new modules are working as expected.
>
> # Why make this change
> The `dotfiles_url` and `jetbrains_ide` parameters and related code were removed to simplify the configuration and make it easier to manage. The new modules were added to provide additional functionality and improve the overall user experience. The `startup_script` was updated to reflect these changes.
</details>
2023-09-30 19:22:14 +00:00
}
module " filebrowser " {
2024-01-24 01:33:25 +00:00
source = " registry.coder.com/modules/filebrowser/coder "
2024-03-19 20:54:16 +00:00
version = " 1.0.8 "
chore(dogfood): use coder modules in dogfood (#9890)
updates dogfood to use coder modules
---
<details open="true"><summary>Generated summary (powered by <a href="https://app.graphite.dev">Graphite</a>)</summary>
> # TL;DR
> This pull request removes the `dotfiles_url` and `jetbrains_ide` parameters, and the related code from the `main.tf` file. It also adds several new modules for `dotfiles`, `git-clone`, `personalize`, `code-server`, `jetbrains_gateway`, `vscode`, and `filebrowser`. The `startup_script` has been updated to remove the installation and launch of `filebrowser` and the `dotfiles` related code.
>
> # What changed
> - Removed `dotfiles_url` and `jetbrains_ide` parameters.
> - Removed related code for `dotfiles_url` and `jetbrains_ide`.
> - Added new modules for `dotfiles`, `git-clone`, `personalize`, `code-server`, `jetbrains_gateway`, `vscode`, and `filebrowser`.
> - Updated `startup_script` to remove the installation and launch of `filebrowser` and the `dotfiles` related code.
>
> # How to test
> 1. Go to https://dev.coder.com/templates/coder/versions/dazzling_hugle0 and create a new workspace or change your dogfood workspace version to `dazzling_hugle0` .
> 2. Verify that the new modules are working as expected.
>
> # Why make this change
> The `dotfiles_url` and `jetbrains_ide` parameters and related code were removed to simplify the configuration and make it easier to manage. The new modules were added to provide additional functionality and improve the overall user experience. The `startup_script` was updated to reflect these changes.
</details>
2023-09-30 19:22:14 +00:00
agent_id = coder_agent . dev . id
}
module " coder-login " {
2024-01-24 01:33:25 +00:00
source = " registry.coder.com/modules/coder-login/coder "
2024-01-27 01:45:07 +00:00
version = " 1.0.2 "
chore(dogfood): use coder modules in dogfood (#9890)
updates dogfood to use coder modules
---
<details open="true"><summary>Generated summary (powered by <a href="https://app.graphite.dev">Graphite</a>)</summary>
> # TL;DR
> This pull request removes the `dotfiles_url` and `jetbrains_ide` parameters, and the related code from the `main.tf` file. It also adds several new modules for `dotfiles`, `git-clone`, `personalize`, `code-server`, `jetbrains_gateway`, `vscode`, and `filebrowser`. The `startup_script` has been updated to remove the installation and launch of `filebrowser` and the `dotfiles` related code.
>
> # What changed
> - Removed `dotfiles_url` and `jetbrains_ide` parameters.
> - Removed related code for `dotfiles_url` and `jetbrains_ide`.
> - Added new modules for `dotfiles`, `git-clone`, `personalize`, `code-server`, `jetbrains_gateway`, `vscode`, and `filebrowser`.
> - Updated `startup_script` to remove the installation and launch of `filebrowser` and the `dotfiles` related code.
>
> # How to test
> 1. Go to https://dev.coder.com/templates/coder/versions/dazzling_hugle0 and create a new workspace or change your dogfood workspace version to `dazzling_hugle0` .
> 2. Verify that the new modules are working as expected.
>
> # Why make this change
> The `dotfiles_url` and `jetbrains_ide` parameters and related code were removed to simplify the configuration and make it easier to manage. The new modules were added to provide additional functionality and improve the overall user experience. The `startup_script` was updated to reflect these changes.
</details>
2023-09-30 19:22:14 +00:00
agent_id = coder_agent . dev . id
}
2022-08-02 20:20:54 +00:00
resource " coder_agent " " dev " {
2023-01-27 21:01:48 +00:00
arch = " amd64 "
os = " linux "
2024-01-27 01:45:07 +00:00
dir = local . repo_dir
2023-05-13 12:42:10 +00:00
env = {
OIDC_TOKEN : data . coder_workspace . me . owner_oidc_access_token ,
}
2023-06-06 08:58:07 +00:00
startup_script_behavior = " blocking "
2023-05-13 12:42:10 +00:00
2023-06-20 09:16:57 +00:00
# The following metadata blocks are optional. They are used to display
# information about your workspace in the dashboard. You can remove them
# if you don't want to display any information.
2023-05-13 12:42:10 +00:00
metadata {
display_name = " CPU Usage "
2023-06-20 09:16:57 +00:00
key = " 0_cpu_usage "
script = " coder stat cpu "
2023-05-19 12:15:48 +00:00
interval = 10
2023-05-13 12:42:10 +00:00
timeout = 1
}
metadata {
2023-05-19 12:15:48 +00:00
display_name = " RAM Usage "
2023-06-20 09:16:57 +00:00
key = " 1_ram_usage "
script = " coder stat mem "
2023-05-19 12:15:48 +00:00
interval = 10
2023-05-13 12:42:10 +00:00
timeout = 1
}
metadata {
2023-05-19 12:15:48 +00:00
display_name = " CPU Usage (Host) "
2023-06-20 09:16:57 +00:00
key = " 2_cpu_usage_host "
script = " coder stat cpu --host "
2023-05-19 12:15:48 +00:00
interval = 10
2023-05-13 12:42:10 +00:00
timeout = 1
}
metadata {
2023-06-20 09:16:57 +00:00
display_name = " RAM Usage (Host) "
key = " 3_ram_usage_host "
script = " coder stat mem --host "
interval = 10
timeout = 1
}
metadata {
display_name = " Swap Usage (Host) "
key = " 4_swap_usage_host "
2023-05-13 12:42:10 +00:00
script = < < EOT
2023-10-09 15:57:57 +00:00
#!/bin/bash
2023-06-20 09:16:57 +00:00
echo " $ (free -b | awk '/^Swap/ { printf( " % . 1 f / % . 1 f " , $ 3/1024.0/1024.0/1024.0, $ 2/1024.0/1024.0/1024.0) }') GiB "
EOT
2023-05-19 12:15:48 +00:00
interval = 10
2023-05-13 12:42:10 +00:00
timeout = 1
}
2023-05-19 12:15:48 +00:00
metadata {
display_name = " Load Average (Host) "
2023-06-20 09:16:57 +00:00
key = " 5_load_host "
2023-05-19 12:15:48 +00:00
# get load avg scaled by number of cores
script = < < EOT
2023-10-09 15:57:57 +00:00
#!/bin/bash
2023-05-19 12:15:48 +00:00
echo " `cat /proc/loadavg | awk '{ print $ 1 }'` `nproc` " | awk ' { printf " %0.2f " , $ 1 / $ 2 } '
EOT
2023-06-20 09:16:57 +00:00
interval = 60
2023-05-19 12:15:48 +00:00
timeout = 1
}
metadata {
display_name = " Disk Usage (Host) "
2023-06-20 09:16:57 +00:00
key = " 6_disk_host "
script = " coder stat disk --path / "
2023-05-19 12:15:48 +00:00
interval = 600
2023-06-20 09:16:57 +00:00
timeout = 10
2023-05-19 12:15:48 +00:00
}
2023-05-13 12:42:10 +00:00
metadata {
display_name = " Word of the Day "
2023-06-20 09:16:57 +00:00
key = " 7_word "
2023-05-13 12:42:10 +00:00
script = < < EOT
2023-10-09 15:57:57 +00:00
#!/bin/bash
2023-05-19 12:15:48 +00:00
curl - o - - - silent https : //www.merriam-webster.com/word-of-the-day 2>&1 | awk ' $0 ~ "Word of the Day: [A-z]+" { print $5; exit }'
EOT
interval = 86400
2023-05-13 12:42:10 +00:00
timeout = 5
}
2024-02-12 14:29:41 +00:00
startup_script = < < - EOT
chore(dogfood): use coder modules in dogfood (#9890)
updates dogfood to use coder modules
---
<details open="true"><summary>Generated summary (powered by <a href="https://app.graphite.dev">Graphite</a>)</summary>
> # TL;DR
> This pull request removes the `dotfiles_url` and `jetbrains_ide` parameters, and the related code from the `main.tf` file. It also adds several new modules for `dotfiles`, `git-clone`, `personalize`, `code-server`, `jetbrains_gateway`, `vscode`, and `filebrowser`. The `startup_script` has been updated to remove the installation and launch of `filebrowser` and the `dotfiles` related code.
>
> # What changed
> - Removed `dotfiles_url` and `jetbrains_ide` parameters.
> - Removed related code for `dotfiles_url` and `jetbrains_ide`.
> - Added new modules for `dotfiles`, `git-clone`, `personalize`, `code-server`, `jetbrains_gateway`, `vscode`, and `filebrowser`.
> - Updated `startup_script` to remove the installation and launch of `filebrowser` and the `dotfiles` related code.
>
> # How to test
> 1. Go to https://dev.coder.com/templates/coder/versions/dazzling_hugle0 and create a new workspace or change your dogfood workspace version to `dazzling_hugle0` .
> 2. Verify that the new modules are working as expected.
>
> # Why make this change
> The `dotfiles_url` and `jetbrains_ide` parameters and related code were removed to simplify the configuration and make it easier to manage. The new modules were added to provide additional functionality and improve the overall user experience. The `startup_script` was updated to reflect these changes.
</details>
2023-09-30 19:22:14 +00:00
set - eux - o pipefail
2024-02-07 17:16:18 +00:00
# Allow synchronization between scripts.
trap ' touch / tmp / . coder - startup - script . done ' EXIT
2024-01-05 20:25:51 +00:00
# Start Docker service
2022-07-18 22:44:09 +00:00
sudo service docker start
2024-01-31 14:27:11 +00:00
# Install playwright dependencies
# We want to use the playwright version from site/package.json
2024-01-31 15:01:22 +00:00
# Check if the directory exists At workspace creation as the coder_script runs in parallel so clone might not exist yet.
while ! [ [ - f " ${ local . repo_dir } /site/package.json " ] ] ; do
sleep 1
done
2024-01-31 14:27:11 +00:00
cd " ${ local . repo_dir } /site " && pnpm install && pnpm playwright : install
2024-01-31 15:01:22 +00:00
EOT
2022-07-18 22:44:09 +00:00
}
resource " docker_volume " " home_volume " {
2022-11-09 14:18:19 +00:00
name = " coder- ${ data . coder_workspace . me . id } -home "
# Protect the volume from being deleted due to changes in attributes.
2022-10-24 19:59:27 +00:00
lifecycle {
ignore_changes = all
}
2022-11-09 14:18:19 +00:00
# Add labels in Docker to keep track of orphan resources.
labels {
label = " coder.owner "
value = data . coder_workspace . me . owner
}
labels {
label = " coder.owner_id "
value = data . coder_workspace . me . owner_id
}
labels {
label = " coder.workspace_id "
value = data . coder_workspace . me . id
}
# This field becomes outdated if the workspace is renamed but can
# be useful for debugging or cleaning out dangling volumes.
labels {
label = " coder.workspace_name_at_creation "
value = data . coder_workspace . me . name
}
2022-07-18 22:44:09 +00:00
}
2022-10-20 03:06:57 +00:00
data " docker_registry_image " " dogfood " {
2024-01-31 14:27:11 +00:00
name = data . coder_parameter . image_type . value
2022-09-05 19:23:52 +00:00
}
2022-09-04 21:06:36 +00:00
resource " docker_image " " dogfood " {
2024-01-31 14:27:11 +00:00
name = " ${ data . coder_parameter . image_type . value } @ ${ data . docker_registry_image . dogfood . sha256_digest } "
2022-10-20 03:06:57 +00:00
pull_triggers = [
2023-12-05 09:02:57 +00:00
data . docker_registry_image . dogfood . sha256_digest ,
sha1 ( join ( " " , [ for f in fileset ( path . module , " files/* " ) : filesha1 ( f ) ] ) ) ,
filesha1 ( " Dockerfile " ) ,
2024-01-31 14:27:11 +00:00
filesha1 ( " Dockerfile.nix " ) ,
2022-10-20 03:06:57 +00:00
]
keep_locally = true
2022-09-04 21:06:36 +00:00
}
2022-08-09 23:40:12 +00:00
2022-07-18 22:44:09 +00:00
resource " docker_container " " workspace " {
count = data . coder_workspace . me . start_count
2022-09-04 21:06:36 +00:00
image = docker_image . dogfood . name
2022-11-08 16:52:19 +00:00
name = local . container_name
2022-07-18 22:44:09 +00:00
# Hostname makes the shell more user friendly: coder@my-workspace:~$
2023-05-13 12:42:10 +00:00
hostname = data . coder_workspace . me . name
# Use the docker gateway if the access URL is 127.0.0.1
2023-04-25 04:58:09 +00:00
entrypoint = [ " sh " , " -c " , coder_agent . dev . init_script ]
2022-07-18 22:44:09 +00:00
# CPU limits are unnecessary since Docker will load balance automatically
2023-07-11 20:24:29 +00:00
memory = data . coder_workspace . me . owner == " code-asher " ? 65536 : 32768
2022-07-18 22:44:09 +00:00
runtime = " sysbox-runc "
2022-12-09 11:00:39 +00:00
env = [
2022-12-07 21:59:32 +00:00
" CODER_AGENT_TOKEN= ${ coder_agent . dev . token } " ,
2023-10-03 22:34:29 +00:00
" USE_CAP_NET_ADMIN=true " ,
2022-12-07 21:59:32 +00:00
]
2022-07-18 22:44:09 +00:00
host {
host = " host.docker.internal "
ip = " host-gateway "
}
volumes {
container_path = " /home/coder/ "
volume_name = docker_volume . home_volume . name
read_only = false
}
2023-10-03 22:34:29 +00:00
capabilities {
add = [ " CAP_NET_ADMIN " , " CAP_SYS_NICE " ]
}
2022-11-09 14:18:19 +00:00
# Add labels in Docker to keep track of orphan resources.
labels {
label = " coder.owner "
value = data . coder_workspace . me . owner
}
labels {
label = " coder.owner_id "
value = data . coder_workspace . me . owner_id
}
labels {
label = " coder.workspace_id "
value = data . coder_workspace . me . id
}
labels {
label = " coder.workspace_name "
value = data . coder_workspace . me . name
}
2022-07-18 22:44:09 +00:00
}
2022-08-09 23:40:12 +00:00
resource " coder_metadata " " container_info " {
2022-09-04 21:06:36 +00:00
count = data . coder_workspace . me . start_count
2022-08-09 23:40:12 +00:00
resource_id = docker_container . workspace [ 0 ] . id
item {
2022-09-04 21:06:36 +00:00
key = " memory "
2022-08-09 23:40:12 +00:00
value = docker_container . workspace [ 0 ] . memory
}
item {
2022-09-04 21:06:36 +00:00
key = " runtime "
2022-08-09 23:40:12 +00:00
value = docker_container . workspace [ 0 ] . runtime
}
2023-08-26 22:22:28 +00:00
item {
key = " region "
value = data . coder_parameter . region . option [ index ( data . coder_parameter . region . option . * . value , data . coder_parameter . region . value ) ] . name
}
2022-08-09 23:40:12 +00:00
}