Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MVP of self-hosting #1718

Merged
merged 131 commits into from
Nov 5, 2024
Merged

MVP of self-hosting #1718

merged 131 commits into from
Nov 5, 2024

Conversation

ddimaria
Copy link
Collaborator

@ddimaria ddimaria commented Aug 15, 2024

BUGS

  • Self host deployment Table error
  • Don't pass token to S3 @ddimaria
  • Hide Examples @ddimaria
  • Localhost doesn't work (later)
  • License key shown as revoked incorrectly (can we replicate this?)

TODO

  • Remove self-hosting directory (in favor of new self-hosting repo
  • Deploy self-hosting portal on the production domain
  • Update all references to new domain (selfhost.quadratichq.com)
  • Add cloud formation template for production deployment
  • Update URLs to self-hosting portal production domain
  • Usurp self-hosting checks for quadratic production @ddimaria
  • Set ENV vars for preview (@davidkircos)
  • API Code Review @jimniels
  • Client Code Review @davidfig
  • Set ENV vars for production(@davidkircos)
  • Verify AWS Credentials in production have necessary permissions for creating image repos and pushing.
  • Update portal to link to different self hosting options
  • After start print where to access Quadratic. Quadratic Selfhost ASCII Art + "Open Quadratic at [Link]" @ddimaria

After merge

Self hosting auth alternative (Ory Kratos support)

  • Add Kratos to docker compose and configure
  • Add kratos-selfservice-ui-node to docker compose and configure
  • Implement AUTH_TYPE in quadratic-api and switch between auth0 and ory based on the selection
    • Mirror auth0 functionality in ory
  • Implement AUTH_TYPE in quadratic-client and switch between auth0 and ory based on the selection
    • Mirror auth0 functionality in ory
  • Host jwks.json in the quadratic-client

Simple file storage

  • Implement file-system storage in quadratic-rust-shared and quadratic-files
  • Implement file-system storage in quadratic-api and quadratic-client

On the API side, you denote the storage method as an env var: STORAGE_TYPE=file-system # s3 or file-system. There is a storage abstraction within API that can switch between S3 and FileSystem. The abstracted functions are:

  • getFileUrl()
  • getPresignedFileUrl() (reuse ENCRYPTION_KEY for uuid encryption in presigned URLs)
  • uploadFile()
  • uploadMiddleware() (express middleware for S3 and FileSystem

On the File Service side, the same env var STORAGE_TYPE is used to turn on a few new routes:

  • GET /storage/:key Get any file in storage, validated by JWT
  • POST /storage/:key Upload any file in storage, validated by JWT
  • GET /storage/presigned/:key Get any file in storage via a presigned key, validated by key decryption

Environment Variables to Add:

quadratic-api

STORAGE_TYPE=s3 # s3 or file-system
QUADRATIC_FILE_URI=

AUTH_TYPE=ory # auth0 or ory
ORY_JWKS_URI='http://localhost:3000/.well-known/jwks.json'
ORY_ADMIN_HOST=http://0.0.0.0:4434

LICENSE_KEY="LICENSE_KEY"
LICENSE_API_URI=https://selfhost.quadratic-preview.com

quadratic-client

VITE_AUTH_TYPE=ory # auth0 or ory
VITE_ORY_HOST=http://localhost:4433

quadratic-files

STORAGE_TYPE=s3 # s3 or file-system
STORAGE_DIR=
STORAGE_ENCRYPTION_KEYS=

ddimaria and others added 26 commits July 30, 2024 08:09
Copy link

qa-wolf bot commented Aug 15, 2024

QA Wolf here! As you write new code it's important that your test coverage is keeping up.
Click here to request test coverage for this PR!

Copy link

vercel bot commented Aug 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
quadratic ✅ Ready (Inspect) Visit Preview Nov 5, 2024 8:02pm

@cla-bot cla-bot bot added the cla-signed label Aug 15, 2024
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-1718 August 15, 2024 22:51 Inactive

# Build wasm
WORKDIR /app/quadratic-core
RUN echo 'Building wasm...' && wasm-pack build --target web --out-dir ../quadratic-client/src/app/quadratic-core --weak-refs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--weak-refs is not in Vercel / Amplify build


# Build the quadratic-shared
WORKDIR /app
RUN echo 'Building quadratic-shared...' && npm run compile --workspace=quadratic-shared
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npm run compile is not in Vercel / Amplify build

@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-1718 November 4, 2024 18:46 Inactive
const res = await fetch(file, {
headers: {
Authorization: `Bearer ${jwt}`,
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't do this with s3!

@ddimaria ddimaria temporarily deployed to quadratic-api-dev-pr-1718 November 5, 2024 19:40 Inactive
Copy link
Collaborator

@davidkircos davidkircos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@ddimaria ddimaria merged commit 17ebf8d into qa Nov 5, 2024
19 of 21 checks passed
@ddimaria ddimaria deleted the self-hosting-setup branch November 5, 2024 20:47
Copy link

qa-wolf bot commented Nov 5, 2024

E2E tests

QA 2 blocking bugs

Ran Status Preview Started Run time Est. dev time saved
83 workflows Done (Details) Nov 5, 2024 at 9:18 PM (UTC) 21 minutes ~36.17 hrs
✅ 76 passed

Preexisting bugs

2 Blocking bugs
If you are aware of any of these bugs, you can set their priority to low and prevent them from causing a run failure.
View all blocking bugs

1 Non-blocking bug

. . . . . . . .

Re-run your E2E tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants