Skip to content

Commit 34234ae

Browse files
Fix everything (#411)
* Upgrade workspace * Moving backend to Fly.io + Caddy * disabling failing shit * work ? * On-demand TLS * `chmod +x` * x86_64 * Cloud mode * Use cloud mode * no updater for cloud * fix code * enable cloud mode properly * Fix Caddy path * Delete `apps/android` * Restructure Rust * fix build * fix config existence check for cloud * Migrate from deprecated Caddy directive * Get rid of SST cause it's too broken * Drop flat routing + more npm updates * reintroduce flat routing * Parallel Routing in stable * make happy * bring CI back * fix docs & wip fixing web * a
1 parent 9fb6f84 commit 34234ae

File tree

129 files changed

+2769
-7578
lines changed

Some content is hidden

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

129 files changed

+2769
-7578
lines changed

.github/workflows/cd.yaml

Lines changed: 60 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -44,58 +44,58 @@ jobs:
4444
- name: Setup Rust toolchain
4545
run: rustup toolchain install stable --profile minimal
4646

47-
- name: Install Rust target for 'aarch64-unknown-linux-musl'
48-
run: rustup target add aarch64-unknown-linux-musl
47+
- name: Install Rust target for 'x86_64-unknown-linux-musl'
48+
run: rustup target add x86_64-unknown-linux-musl
4949

5050
- name: Build & upload binary
5151
run: |
5252
pnpm i -g wrangler
5353
export HASH=$(git rev-parse HEAD)
5454
55-
cargo zigbuild --release --target aarch64-unknown-linux-musl -p mattrax
55+
cargo zigbuild --release --target x86_64-unknown-linux-musl -p mattrax
5656
57-
wrangler r2 object put "static/mattrax/$HASH/aarch64-unknown-linux" --file=target/aarch64-unknown-linux-musl/release/mattrax --cache-control "public, max-age=31536000, immutable"
57+
wrangler r2 object put "static/mattrax/$HASH/x86_64-unknown-linux" --file=target/x86_64-unknown-linux-musl/release/mattrax --cache-control "public, max-age=31536000, immutable"
5858
echo "$HASH" | wrangler r2 object put "static/nightly" --pipe
5959
60-
sst:
61-
name: SST
62-
runs-on: ubuntu-latest
63-
# This is required to workaround the lack of wildcard for OIDC scope
64-
# https://github.com/Azure/azure-workload-identity/issues/373
65-
#
66-
# I swear to god Microsoft have never tried anything they have built.
67-
environment: production
68-
concurrency:
69-
group: production
70-
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
71-
steps:
72-
- name: Git clone the repository
73-
uses: actions/checkout@v4
74-
75-
- name: Configure AWS credentials
76-
uses: aws-actions/configure-aws-credentials@v4
77-
with:
78-
role-to-assume: "arn:aws:iam::101829795063:role/mattrax-gh-actions"
79-
aws-region: us-east-1
80-
role-session-name: mattrax-sst-workflow
81-
82-
- uses: pnpm/action-setup@v4
83-
with:
84-
version: latest
85-
86-
- name: Install SST
87-
run: curl -fsSL https://ion.sst.dev/install | bash
88-
89-
- run: cd infra && sst deploy --stage brendonovich
90-
env:
91-
ARM_USE_OIDC: true
92-
ARM_CLIENT_ID: a17b56f1-0b10-4029-9a89-7f703d3573f8
93-
ARM_TENANT_ID: 22d6679c-fc23-425a-b69b-e5e604dd80db
94-
AZURE_SUBSCRIPTION_ID: 22d6679c-fc23-425a-b69b-e5e604dd80db
95-
OAUTH_CLIENT_ID: kXdvzkEgiN11CNTRL
96-
OAUTH_CLIENT_SECRET: ${{ secrets.TAILSCALE_OAUTH_SECRET }}
97-
98-
build-web:
60+
# sst:
61+
# name: SST
62+
# runs-on: ubuntu-latest
63+
# # This is required to workaround the lack of wildcard for OIDC scope
64+
# # https://github.com/Azure/azure-workload-identity/issues/373
65+
# #
66+
# # I swear to god Microsoft have never tried anything they have built.
67+
# environment: production
68+
# concurrency:
69+
# group: production
70+
# if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
71+
# steps:
72+
# - name: Git clone the repository
73+
# uses: actions/checkout@v4
74+
75+
# - name: Configure AWS credentials
76+
# uses: aws-actions/configure-aws-credentials@v4
77+
# with:
78+
# role-to-assume: "arn:aws:iam::101829795063:role/mattrax-gh-actions"
79+
# aws-region: us-east-1
80+
# role-session-name: mattrax-sst-workflow
81+
82+
# - uses: pnpm/action-setup@v4
83+
# with:
84+
# version: latest
85+
86+
# - name: Install SST
87+
# run: curl -fsSL https://ion.sst.dev/install | bash
88+
89+
# - run: cd infra && sst deploy --stage brendonovich
90+
# env:
91+
# ARM_USE_OIDC: true
92+
# ARM_CLIENT_ID: a17b56f1-0b10-4029-9a89-7f703d3573f8
93+
# ARM_TENANT_ID: 22d6679c-fc23-425a-b69b-e5e604dd80db
94+
# AZURE_SUBSCRIPTION_ID: 22d6679c-fc23-425a-b69b-e5e604dd80db
95+
# OAUTH_CLIENT_ID: kXdvzkEgiN11CNTRL
96+
# OAUTH_CLIENT_SECRET: ${{ secrets.TAILSCALE_OAUTH_SECRET }}
97+
98+
build-js:
9999
strategy:
100100
matrix:
101101
projects:
@@ -131,7 +131,7 @@ jobs:
131131
deploy-mattrax:
132132
name: Deploy Mattrax
133133
runs-on: ubuntu-latest
134-
needs: [build-mattrax, sst]
134+
needs: [build-mattrax] # TODO: sst
135135
concurrency:
136136
group: mattrax
137137
environment:
@@ -141,36 +141,22 @@ jobs:
141141
- name: Git clone the repository
142142
uses: actions/checkout@v4
143143

144-
- uses: pnpm/action-setup@v4
145-
with:
146-
version: latest
147-
148-
- name: Configure AWS credentials
149-
uses: aws-actions/configure-aws-credentials@v4
150-
with:
151-
role-to-assume: "arn:aws:iam::101829795063:role/mattrax-gh-actions"
152-
aws-region: us-east-1
153-
role-session-name: mattrax-sst-workflow
154-
155-
- name: Install SST
156-
run: curl -fsSL https://ion.sst.dev/install | bash
157-
158-
- name: Set SST envs
144+
- name: Install Flyctl
145+
uses: superfly/flyctl-actions/[email protected]
146+
147+
- name: Download binary
148+
working-directory: ./infra/cloud
159149
run: |
160-
cd infra && sst secret list --stage brendonovich | grep "MDM_INTERNAL_SECRET" >> $GITHUB_ENV
150+
wget -O mattrax "https://static.mattrax.app/mattrax/$(git rev-parse HEAD)/x86_64-unknown-linux"
151+
chmod +x mattrax
152+
153+
- name: Deploy to Fly
154+
run: flyctl deploy --wait-timeout 2m
155+
working-directory: ./infra/cloud
161156
env:
162-
ARM_USE_OIDC: true
163-
ARM_CLIENT_ID: a17b56f1-0b10-4029-9a89-7f703d3573f8
164-
ARM_TENANT_ID: 22d6679c-fc23-425a-b69b-e5e604dd80db
165-
AZURE_SUBSCRIPTION_ID: 22d6679c-fc23-425a-b69b-e5e604dd80db
166-
OAUTH_CLIENT_ID: kXdvzkEgiN11CNTRL
167-
OAUTH_CLIENT_SECRET: ${{ secrets.TAILSCALE_OAUTH_SECRET }}
168-
169-
- name: Deploy Mattrax
170-
run: |
171-
curl -v "https://mdm.mattrax.app/internal/redeploy?secret=${{ env.MDM_INTERNAL_SECRET }}"
157+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
172158

173-
deploy-web:
159+
deploy-js:
174160
strategy:
175161
matrix:
176162
projects:
@@ -180,11 +166,11 @@ jobs:
180166
name: Deploy ${{ matrix.projects.name }}
181167
runs-on: ubuntu-latest
182168
needs:
183-
- sst
169+
# - sst # TODO
184170
# This will wait for *all* projects to build, not just the one we care about.
185171
# GitHub don't provide a better solution :(
186-
- build-web
187-
- deploy-mattrax
172+
- build-js
173+
# - deploy-mattrax # TODO
188174
# Run regardless of if previous steps were skipped
189175
if: ${{ !failure() && !cancelled() }}
190176
environment:

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ Thumbs.db
5858
/TODO
5959

6060
# Nx
61-
.nx/cache
61+
.nx

0 commit comments

Comments
 (0)