Skip to content

Commit cabad4e

Browse files
committed
Merge branch 'main' into coder-feature-stages
2 parents e5f361c + d22ac1c commit cabad4e

File tree

668 files changed

+26862
-14675
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

668 files changed

+26862
-14675
lines changed

.devcontainer/devcontainer.json

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,82 @@
11
{
22
"name": "Development environments on your infrastructure",
33
"image": "codercom/oss-dogfood:latest",
4-
54
"features": {
6-
// See all possible options here https://github.com/devcontainers/features/tree/main/src/docker-in-docker
75
"ghcr.io/devcontainers/features/docker-in-docker:2": {
86
"moby": "false"
7+
},
8+
"ghcr.io/coder/devcontainer-features/code-server:1": {
9+
"auth": "none",
10+
"port": 13337
11+
},
12+
"./filebrowser": {
13+
"folder": "${containerWorkspaceFolder}"
914
}
1015
},
1116
// SYS_PTRACE to enable go debugging
1217
"runArgs": ["--cap-add=SYS_PTRACE"],
1318
"customizations": {
1419
"vscode": {
1520
"extensions": ["biomejs.biome"]
21+
},
22+
"coder": {
23+
"apps": [
24+
{
25+
"slug": "cursor",
26+
"displayName": "Cursor Desktop",
27+
"url": "cursor://coder.coder-remote/openDevContainer?owner=${localEnv:CODER_WORKSPACE_OWNER_NAME}&workspace=${localEnv:CODER_WORKSPACE_NAME}&agent=${localEnv:CODER_WORKSPACE_PARENT_AGENT_NAME}&url=${localEnv:CODER_URL}&token=$SESSION_TOKEN&devContainerName=${localEnv:CONTAINER_ID}&devContainerFolder=${containerWorkspaceFolder}",
28+
"external": true,
29+
"icon": "/icon/cursor.svg",
30+
"order": 1
31+
},
32+
{
33+
"slug": "windsurf",
34+
"displayName": "Windsurf Editor",
35+
"url": "windsurf://coder.coder-remote/openDevContainer?owner=${localEnv:CODER_WORKSPACE_OWNER_NAME}&workspace=${localEnv:CODER_WORKSPACE_NAME}&agent=${localEnv:CODER_WORKSPACE_PARENT_AGENT_NAME}&url=${localEnv:CODER_URL}&token=$SESSION_TOKEN&devContainerName=${localEnv:CONTAINER_ID}&devContainerFolder=${containerWorkspaceFolder}",
36+
"external": true,
37+
"icon": "/icon/windsurf.svg",
38+
"order": 4
39+
},
40+
{
41+
"slug": "zed",
42+
"displayName": "Zed Editor",
43+
"url": "zed://ssh/${localEnv:CODER_WORKSPACE_AGENT_NAME}.${localEnv:CODER_WORKSPACE_NAME}.${localEnv:CODER_WORKSPACE_OWNER_NAME}.coder${containerWorkspaceFolder}",
44+
"external": true,
45+
"icon": "/icon/zed.svg",
46+
"order": 5
47+
},
48+
// Reproduce `code-server` app here from the code-server
49+
// feature so that we can set the correct folder and order.
50+
// Currently, the order cannot be specified via option because
51+
// we parse it as a number whereas variable interpolation
52+
// results in a string. Additionally we set health check which
53+
// is not yet set in the feature.
54+
{
55+
"slug": "code-server",
56+
"displayName": "code-server",
57+
"url": "http://${localEnv:FEATURE_CODE_SERVER_OPTION_HOST:127.0.0.1}:${localEnv:FEATURE_CODE_SERVER_OPTION_PORT:8080}/?folder=${containerWorkspaceFolder}",
58+
"openIn": "${localEnv:FEATURE_CODE_SERVER_OPTION_APPOPENIN:slim-window}",
59+
"share": "${localEnv:FEATURE_CODE_SERVER_OPTION_APPSHARE:owner}",
60+
"icon": "/icon/code.svg",
61+
"group": "${localEnv:FEATURE_CODE_SERVER_OPTION_APPGROUP:Web Editors}",
62+
"order": 3,
63+
"healthCheck": {
64+
"url": "http://${localEnv:FEATURE_CODE_SERVER_OPTION_HOST:127.0.0.1}:${localEnv:FEATURE_CODE_SERVER_OPTION_PORT:8080}/healthz",
65+
"interval": 5,
66+
"threshold": 2
67+
}
68+
}
69+
]
1670
}
17-
}
71+
},
72+
"mounts": [
73+
// Add a volume for the Coder home directory to persist shell history,
74+
// and speed up dotfiles init and/or personalization.
75+
"source=coder-coder-devcontainer-home,target=/home/coder,type=volume",
76+
// Mount the entire home because conditional mounts are not supported.
77+
// See: https://github.com/devcontainers/spec/issues/132
78+
"source=${localEnv:HOME},target=/mnt/home/coder,type=bind,readonly"
79+
],
80+
"postCreateCommand": ["./.devcontainer/scripts/post_create.sh"],
81+
"postStartCommand": ["./.devcontainer/scripts/post_start.sh"]
1882
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"id": "filebrowser",
3+
"version": "0.0.1",
4+
"name": "File Browser",
5+
"description": "A web-based file browser for your development container",
6+
"options": {
7+
"port": {
8+
"type": "string",
9+
"default": "13339",
10+
"description": "The port to run filebrowser on"
11+
},
12+
"folder": {
13+
"type": "string",
14+
"default": "",
15+
"description": "The root directory for filebrowser to serve"
16+
},
17+
"baseUrl": {
18+
"type": "string",
19+
"default": "",
20+
"description": "The base URL for filebrowser (e.g., /filebrowser)"
21+
}
22+
},
23+
"entrypoint": "/usr/local/bin/filebrowser-entrypoint",
24+
"dependsOn": {
25+
"ghcr.io/devcontainers/features/common-utils:2": {}
26+
},
27+
"customizations": {
28+
"coder": {
29+
"apps": [
30+
{
31+
"slug": "filebrowser",
32+
"displayName": "File Browser",
33+
"url": "http://localhost:${localEnv:FEATURE_FILEBROWSER_OPTION_PORT:13339}",
34+
"icon": "/icon/filebrowser.svg",
35+
"order": 3,
36+
"subdomain": true,
37+
"healthcheck": {
38+
"url": "http://localhost:${localEnv:FEATURE_FILEBROWSER_OPTION_PORT:13339}/health",
39+
"interval": 5,
40+
"threshold": 2
41+
}
42+
}
43+
]
44+
}
45+
}
46+
}

.devcontainer/filebrowser/install.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
BOLD='\033[0;1m'
6+
7+
printf "%sInstalling filebrowser\n\n" "${BOLD}"
8+
9+
# Check if filebrowser is installed.
10+
if ! command -v filebrowser &>/dev/null; then
11+
curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash
12+
fi
13+
14+
# Create entrypoint.
15+
cat >/usr/local/bin/filebrowser-entrypoint <<EOF
16+
#!/usr/bin/env bash
17+
18+
PORT="${PORT}"
19+
FOLDER="${FOLDER:-}"
20+
FOLDER="\${FOLDER:-\$(pwd)}"
21+
BASEURL="${BASEURL:-}"
22+
LOG_PATH=/tmp/filebrowser.log
23+
export FB_DATABASE="\${HOME}/.filebrowser.db"
24+
25+
printf "🛠️ Configuring filebrowser\n\n"
26+
27+
# Check if filebrowser db exists.
28+
if [[ ! -f "\${FB_DATABASE}" ]]; then
29+
filebrowser config init >>\${LOG_PATH} 2>&1
30+
filebrowser users add admin "" --perm.admin=true --viewMode=mosaic >>\${LOG_PATH} 2>&1
31+
fi
32+
33+
filebrowser config set --baseurl=\${BASEURL} --port=\${PORT} --auth.method=noauth --root=\${FOLDER} >>\${LOG_PATH} 2>&1
34+
35+
printf "👷 Starting filebrowser...\n\n"
36+
37+
printf "📂 Serving \${FOLDER} at http://localhost:\${PORT}\n\n"
38+
39+
filebrowser >>\${LOG_PATH} 2>&1 &
40+
41+
printf "📝 Logs at \${LOG_PATH}\n\n"
42+
EOF
43+
44+
chmod +x /usr/local/bin/filebrowser-entrypoint
45+
46+
printf "🥳 Installation complete!\n\n"

.devcontainer/scripts/post_create.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/sh
2+
3+
install_devcontainer_cli() {
4+
npm install -g @devcontainers/cli
5+
}
6+
7+
install_ssh_config() {
8+
echo "🔑 Installing SSH configuration..."
9+
rsync -a /mnt/home/coder/.ssh/ ~/.ssh/
10+
chmod 0700 ~/.ssh
11+
}
12+
13+
install_git_config() {
14+
echo "📂 Installing Git configuration..."
15+
if [ -f /mnt/home/coder/git/config ]; then
16+
rsync -a /mnt/home/coder/git/ ~/.config/git/
17+
elif [ -d /mnt/home/coder/.gitconfig ]; then
18+
rsync -a /mnt/home/coder/.gitconfig ~/.gitconfig
19+
else
20+
echo "⚠️ Git configuration directory not found."
21+
fi
22+
}
23+
24+
install_dotfiles() {
25+
if [ ! -d /mnt/home/coder/.config/coderv2/dotfiles ]; then
26+
echo "⚠️ Dotfiles directory not found."
27+
return
28+
fi
29+
30+
cd /mnt/home/coder/.config/coderv2/dotfiles || return
31+
for script in install.sh install bootstrap.sh bootstrap script/bootstrap setup.sh setup script/setup; do
32+
if [ -x $script ]; then
33+
echo "📦 Installing dotfiles..."
34+
./$script || {
35+
echo "❌ Error running $script. Please check the script for issues."
36+
return
37+
}
38+
echo "✅ Dotfiles installed successfully."
39+
return
40+
fi
41+
done
42+
echo "⚠️ No install script found in dotfiles directory."
43+
}
44+
45+
personalize() {
46+
# Allow script to continue as Coder dogfood utilizes a hack to
47+
# synchronize startup script execution.
48+
touch /tmp/.coder-startup-script.done
49+
50+
if [ -x /mnt/home/coder/personalize ]; then
51+
echo "🎨 Personalizing environment..."
52+
/mnt/home/coder/personalize
53+
fi
54+
}
55+
56+
install_devcontainer_cli
57+
install_ssh_config
58+
install_dotfiles
59+
personalize

.devcontainer/scripts/post_start.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
# Start Docker service if not already running.
4+
sudo service docker start

.github/.linkspector.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ ignorePatterns:
2424
- pattern: "mutagen.io"
2525
- pattern: "docs.github.com"
2626
- pattern: "claude.ai"
27+
- pattern: "splunk.com"
2728
aliveStatusCodes:
2829
- 200
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: "Download Embedded Postgres Cache"
2+
description: |
3+
Downloads the embedded postgres cache and outputs today's cache key.
4+
A PR job can use a cache if it was created by its base branch, its current
5+
branch, or the default branch.
6+
https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache
7+
outputs:
8+
cache-key:
9+
description: "Today's cache key"
10+
value: ${{ steps.vars.outputs.cache-key }}
11+
inputs:
12+
key-prefix:
13+
description: "Prefix for the cache key"
14+
required: true
15+
cache-path:
16+
description: "Path to the cache directory"
17+
required: true
18+
runs:
19+
using: "composite"
20+
steps:
21+
- name: Get date values and cache key
22+
id: vars
23+
shell: bash
24+
run: |
25+
export YEAR_MONTH=$(date +'%Y-%m')
26+
export PREV_YEAR_MONTH=$(date -d 'last month' +'%Y-%m')
27+
export DAY=$(date +'%d')
28+
echo "year-month=$YEAR_MONTH" >> $GITHUB_OUTPUT
29+
echo "prev-year-month=$PREV_YEAR_MONTH" >> $GITHUB_OUTPUT
30+
echo "cache-key=${{ inputs.key-prefix }}-${YEAR_MONTH}-${DAY}" >> $GITHUB_OUTPUT
31+
32+
# By default, depot keeps caches for 14 days. This is plenty for embedded
33+
# postgres, which changes infrequently.
34+
# https://depot.dev/docs/github-actions/overview#cache-retention-policy
35+
- name: Download embedded Postgres cache
36+
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
37+
with:
38+
path: ${{ inputs.cache-path }}
39+
key: ${{ steps.vars.outputs.cache-key }}
40+
# > If there are multiple partial matches for a restore key, the action returns the most recently created cache.
41+
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
42+
# The second restore key allows non-main branches to use the cache from the previous month.
43+
# This prevents PRs from rebuilding the cache on the first day of the month.
44+
# It also makes sure that once a month, the cache is fully reset.
45+
restore-keys: |
46+
${{ inputs.key-prefix }}-${{ steps.vars.outputs.year-month }}-
47+
${{ github.ref != 'refs/heads/main' && format('{0}-{1}-', inputs.key-prefix, steps.vars.outputs.prev-year-month) || '' }}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: "Upload Embedded Postgres Cache"
2+
description: Uploads the embedded Postgres cache. This only runs on the main branch.
3+
inputs:
4+
cache-key:
5+
description: "Cache key"
6+
required: true
7+
cache-path:
8+
description: "Path to the cache directory"
9+
required: true
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Upload Embedded Postgres cache
14+
if: ${{ github.ref == 'refs/heads/main' }}
15+
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
16+
with:
17+
path: ${{ inputs.cache-path }}
18+
key: ${{ inputs.cache-key }}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: "Setup Embedded Postgres Cache Paths"
2+
description: Sets up a path for cached embedded postgres binaries.
3+
outputs:
4+
embedded-pg-cache:
5+
description: "Value of EMBEDDED_PG_CACHE_DIR"
6+
value: ${{ steps.paths.outputs.embedded-pg-cache }}
7+
cached-dirs:
8+
description: "directories that should be cached between CI runs"
9+
value: ${{ steps.paths.outputs.cached-dirs }}
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Override Go paths
14+
id: paths
15+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
16+
with:
17+
script: |
18+
const path = require('path');
19+
20+
// RUNNER_TEMP should be backed by a RAM disk on Windows if
21+
// coder/setup-ramdisk-action was used
22+
const runnerTemp = process.env.RUNNER_TEMP;
23+
const embeddedPgCacheDir = path.join(runnerTemp, 'embedded-pg-cache');
24+
core.exportVariable('EMBEDDED_PG_CACHE_DIR', embeddedPgCacheDir);
25+
core.setOutput('embedded-pg-cache', embeddedPgCacheDir);
26+
const cachedDirs = `${embeddedPgCacheDir}`;
27+
core.setOutput('cached-dirs', cachedDirs);
28+
29+
- name: Create directories
30+
shell: bash
31+
run: |
32+
set -e
33+
mkdir -p "$EMBEDDED_PG_CACHE_DIR"

.github/actions/setup-tf/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ runs:
77
- name: Install Terraform
88
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
99
with:
10-
terraform_version: 1.11.4
10+
terraform_version: 1.12.2
1111
terraform_wrapper: false

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy