Skip to content

Commit b212bd4

Browse files
chore: deploy workspace proxies on fly.io (#10983)
Co-authored-by: Dean Sheather <dean@deansheather.com>
1 parent dbadae5 commit b212bd4

File tree

4 files changed

+109
-0
lines changed

4 files changed

+109
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
app = "paris-coder"
2+
primary_region = "cdg"
3+
4+
[experimental]
5+
entrypoint = ["/opt/coder", "wsproxy", "server"]
6+
auto_rollback = true
7+
8+
[build]
9+
image = "ghcr.io/coder/coder-preview:main"
10+
11+
[env]
12+
CODER_ACCESS_URL = "https://paris-coder.fly.dev"
13+
CODER_HTTP_ADDRESS = "0.0.0.0:3000"
14+
CODER_PRIMARY_ACCESS_URL = "https://dev.coder.com"
15+
16+
[http_service]
17+
internal_port = 3000
18+
force_https = true
19+
auto_stop_machines = true
20+
auto_start_machines = true
21+
min_machines_running = 0
22+
23+
[[vm]]
24+
cpu_kind = "shared"
25+
cpus = 1
26+
memory_mb = 512
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
app = "sao-paulo-coder"
2+
primary_region = "gru"
3+
4+
[experimental]
5+
entrypoint = ["/opt/coder", "wsproxy", "server"]
6+
auto_rollback = true
7+
8+
[build]
9+
image = "ghcr.io/coder/coder-preview:main"
10+
11+
[env]
12+
CODER_ACCESS_URL = "https://sao-paulo-coder.fly.dev"
13+
CODER_HTTP_ADDRESS = "0.0.0.0:3000"
14+
CODER_PRIMARY_ACCESS_URL = "https://dev.coder.com"
15+
16+
[http_service]
17+
internal_port = 3000
18+
force_https = true
19+
auto_stop_machines = true
20+
auto_start_machines = true
21+
min_machines_running = 0
22+
23+
[[vm]]
24+
cpu_kind = "shared"
25+
cpus = 1
26+
memory_mb = 512
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
app = "sydney-coder"
2+
primary_region = "syd"
3+
4+
[experimental]
5+
entrypoint = ["/opt/coder", "wsproxy", "server"]
6+
auto_rollback = true
7+
8+
[build]
9+
image = "ghcr.io/coder/coder-preview:main"
10+
11+
[env]
12+
CODER_ACCESS_URL = "https://sydney-coder.fly.dev"
13+
CODER_HTTP_ADDRESS = "0.0.0.0:3000"
14+
CODER_PRIMARY_ACCESS_URL = "https://dev.coder.com"
15+
16+
[http_service]
17+
internal_port = 3000
18+
force_https = true
19+
auto_stop_machines = true
20+
auto_start_machines = true
21+
min_machines_running = 0
22+
23+
[[vm]]
24+
cpu_kind = "shared"
25+
cpus = 1
26+
memory_mb = 512

.github/workflows/ci.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,8 @@ jobs:
639639
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
640640
env:
641641
DOCKER_CLI_EXPERIMENTAL: "enabled"
642+
outputs:
643+
IMAGE: ghcr.io/coder/coder-preview:${{ steps.build-docker.outputs.tag }}
642644
steps:
643645
- name: Checkout
644646
uses: actions/checkout@v4
@@ -677,6 +679,7 @@ jobs:
677679
build/coder_"$version"_linux_amd64.{tar.gz,deb}
678680
679681
- name: Build and Push Linux amd64 Docker Image
682+
id: build-docker
680683
run: |
681684
set -euxo pipefail
682685
version="$(./scripts/version.sh)"
@@ -694,6 +697,9 @@ jobs:
694697
docker tag "ghcr.io/coder/coder-preview:$tag" ghcr.io/coder/coder-preview:main
695698
docker push ghcr.io/coder/coder-preview:main
696699
700+
# Store the tag in an output variable so we can use it in other jobs
701+
echo "tag=$tag" >> $GITHUB_OUTPUT
702+
697703
- name: Prune old images
698704
uses: vlaurin/action-ghcr-prune@v0.5.0
699705
with:
@@ -774,6 +780,31 @@ jobs:
774780
kubectl --namespace coder rollout restart deployment/coder
775781
kubectl --namespace coder rollout status deployment/coder
776782
783+
deploy-wsproxies:
784+
runs-on: ubuntu-latest
785+
needs: build
786+
if: github.ref == 'refs/heads/main' && !github.event.pull_request.head.repo.fork
787+
steps:
788+
- name: Checkout
789+
uses: actions/checkout@v4
790+
with:
791+
fetch-depth: 0
792+
793+
- name: Setup flyctl
794+
uses: superfly/flyctl-actions/setup-flyctl@master
795+
796+
- name: Deploy workspace proxies
797+
run: |
798+
flyctl deploy --image "$IMAGE" --app paris-coder --config ./.github/fly-wsproxies/paris-coder.toml --env "CODER_PROXY_SESSION_TOKEN=$TOKEN_PARIS" --yes
799+
flyctl deploy --image "$IMAGE" --app sydney-coder --config ./.github/fly-wsproxies/sydney-coder.toml --env "CODER_PROXY_SESSION_TOKEN=$TOKEN_SYDNEY" --yes
800+
flyctl deploy --image "$IMAGE" --app sao-paulo-coder --config ./.github/fly-wsproxies/sao-paulo-coder.toml --env "CODER_PROXY_SESSION_TOKEN=$TOKEN_SAO_PAULO" --yes
801+
env:
802+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
803+
IMAGE: ${{ needs.build.outputs.IMAGE }}
804+
TOKEN_PARIS: ${{ secrets.FLY_PARIS_CODER_PROXY_SESSION_TOKEN }}
805+
TOKEN_SYDNEY: ${{ secrets.FLY_SYDNEY_CODER_PROXY_SESSION_TOKEN }}
806+
TOKEN_SAO_PAULO: ${{ secrets.FLY_SAO_PAULO_CODER_PROXY_SESSION_TOKEN }}
807+
777808
deploy-legacy-proxies:
778809
name: "deploy-legacy-proxies"
779810
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-16vcpu-ubuntu-2204' || 'ubuntu-latest' }}

0 commit comments

Comments
 (0)