diff --git a/.github/fly-wsproxies/paris-coder.toml b/.github/fly-wsproxies/paris-coder.toml new file mode 100644 index 0000000000000..53ff4ab6b16f1 --- /dev/null +++ b/.github/fly-wsproxies/paris-coder.toml @@ -0,0 +1,26 @@ +app = "paris-coder" +primary_region = "cdg" + +[experimental] + entrypoint = ["/opt/coder", "wsproxy", "server"] + auto_rollback = true + +[build] + image = "ghcr.io/coder/coder-preview:main" + +[env] + CODER_ACCESS_URL = "https://paris-coder.fly.dev" + CODER_HTTP_ADDRESS = "0.0.0.0:3000" + CODER_PRIMARY_ACCESS_URL = "https://dev.coder.com" + +[http_service] + internal_port = 3000 + force_https = true + auto_stop_machines = true + auto_start_machines = true + min_machines_running = 0 + +[[vm]] + cpu_kind = "shared" + cpus = 1 + memory_mb = 512 diff --git a/.github/fly-wsproxies/sao-paulo-coder.toml b/.github/fly-wsproxies/sao-paulo-coder.toml new file mode 100644 index 0000000000000..0a93c9790c8e7 --- /dev/null +++ b/.github/fly-wsproxies/sao-paulo-coder.toml @@ -0,0 +1,26 @@ +app = "sao-paulo-coder" +primary_region = "gru" + +[experimental] + entrypoint = ["/opt/coder", "wsproxy", "server"] + auto_rollback = true + +[build] + image = "ghcr.io/coder/coder-preview:main" + +[env] + CODER_ACCESS_URL = "https://sao-paulo-coder.fly.dev" + CODER_HTTP_ADDRESS = "0.0.0.0:3000" + CODER_PRIMARY_ACCESS_URL = "https://dev.coder.com" + +[http_service] + internal_port = 3000 + force_https = true + auto_stop_machines = true + auto_start_machines = true + min_machines_running = 0 + +[[vm]] + cpu_kind = "shared" + cpus = 1 + memory_mb = 512 diff --git a/.github/fly-wsproxies/sydney-coder.toml b/.github/fly-wsproxies/sydney-coder.toml new file mode 100644 index 0000000000000..24436958b2ad5 --- /dev/null +++ b/.github/fly-wsproxies/sydney-coder.toml @@ -0,0 +1,26 @@ +app = "sydney-coder" +primary_region = "syd" + +[experimental] + entrypoint = ["/opt/coder", "wsproxy", "server"] + auto_rollback = true + +[build] + image = "ghcr.io/coder/coder-preview:main" + +[env] + CODER_ACCESS_URL = "https://sydney-coder.fly.dev" + CODER_HTTP_ADDRESS = "0.0.0.0:3000" + CODER_PRIMARY_ACCESS_URL = "https://dev.coder.com" + +[http_service] + internal_port = 3000 + force_https = true + auto_stop_machines = true + auto_start_machines = true + min_machines_running = 0 + +[[vm]] + cpu_kind = "shared" + cpus = 1 + memory_mb = 512 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9c5af0ab813c5..bfd37e27767ab 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -639,6 +639,8 @@ jobs: runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }} env: DOCKER_CLI_EXPERIMENTAL: "enabled" + outputs: + IMAGE: ghcr.io/coder/coder-preview:${{ steps.build-docker.outputs.tag }} steps: - name: Checkout uses: actions/checkout@v4 @@ -677,6 +679,7 @@ jobs: build/coder_"$version"_linux_amd64.{tar.gz,deb} - name: Build and Push Linux amd64 Docker Image + id: build-docker run: | set -euxo pipefail version="$(./scripts/version.sh)" @@ -694,6 +697,9 @@ jobs: docker tag "ghcr.io/coder/coder-preview:$tag" ghcr.io/coder/coder-preview:main docker push ghcr.io/coder/coder-preview:main + # Store the tag in an output variable so we can use it in other jobs + echo "tag=$tag" >> $GITHUB_OUTPUT + - name: Prune old images uses: vlaurin/action-ghcr-prune@v0.5.0 with: @@ -774,6 +780,31 @@ jobs: kubectl --namespace coder rollout restart deployment/coder kubectl --namespace coder rollout status deployment/coder + deploy-wsproxies: + runs-on: ubuntu-latest + needs: build + if: github.ref == 'refs/heads/main' && !github.event.pull_request.head.repo.fork + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup flyctl + uses: superfly/flyctl-actions/setup-flyctl@master + + - name: Deploy workspace proxies + run: | + flyctl deploy --image "$IMAGE" --app paris-coder --config ./.github/fly-wsproxies/paris-coder.toml --env "CODER_PROXY_SESSION_TOKEN=$TOKEN_PARIS" --yes + flyctl deploy --image "$IMAGE" --app sydney-coder --config ./.github/fly-wsproxies/sydney-coder.toml --env "CODER_PROXY_SESSION_TOKEN=$TOKEN_SYDNEY" --yes + 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 + env: + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} + IMAGE: ${{ needs.build.outputs.IMAGE }} + TOKEN_PARIS: ${{ secrets.FLY_PARIS_CODER_PROXY_SESSION_TOKEN }} + TOKEN_SYDNEY: ${{ secrets.FLY_SYDNEY_CODER_PROXY_SESSION_TOKEN }} + TOKEN_SAO_PAULO: ${{ secrets.FLY_SAO_PAULO_CODER_PROXY_SESSION_TOKEN }} + deploy-legacy-proxies: name: "deploy-legacy-proxies" runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-16vcpu-ubuntu-2204' || 'ubuntu-latest' }}