Commit Graph

192 Commits

Author SHA1 Message Date
Iain Sproat a1ee8a89a7 chore(server): graceful shutdown (#3125)
* chore(server): graceful shutdown
- stop() on the apollo server should be called

* chore(server): gracefully drain apollo server

* Allow grace period to be configured

* Terminus manages the readiness and liveness endpoints

* terminus is responsible for stopping the graphql server

* remove logging on shutdown

* Remove redundant parameter

* move healthchecks out of business modules to top-level directory
- terminus can only handle readiness check, not liveness
- app needs to return readiness handler, so that server terminus can use it

* fix tests

* Fix broken merge

* fix broken merge

* incorporate review comments

* fix invalid merge

* fix readinesscheck not being passed as parameter
2024-11-19 11:08:38 +01:00
Iain Sproat 4e7a00250c chore(error): improve error log message for not found project id (#3507) 2024-11-18 16:29:04 +00:00
Kristaps Fabians Geikins f961a6da81 chore(server): various useful multiregion changes from comments pr (#3499)
* chore(server): various useful multiregion changes from comments pr

* hopefully fixing CI?

* test fix

* more test fixes??

* more test fixes..

* plz work ;((((

* revert multiregion on by default
2024-11-15 15:49:34 +02:00
Kristaps Fabians Geikins 37824bb845 Merge branch 'main' into fabians/multiregion-testing3 2024-11-12 09:59:58 +02:00
Kristaps Fabians Geikins 2643d32d0a Merge branch 'main' into fabians/multiregion-testing3 2024-11-11 14:53:53 +02:00
Gergő Jedlicska 50a76315ef Merge branch 'main' of github.com:specklesystems/speckle-server into alessandro/web-2138-models-resolvers 2024-11-11 06:15:31 +01:00
Gergő Jedlicska 1c19f67dd2 feat(models): support streamId, branchId in models 2024-11-11 06:09:53 +01:00
Gergő Jedlicska b77d70585e fix(redis): make redis client singleton from a module (#3469)
* fix(redis): make redis client singleton from a module

* fix(projectDownload): pass region key properly
2024-11-08 17:18:28 +01:00
Kristaps Fabians Geikins ee16b083ba feat(server): run tests in multiregion mode if RUN_TESTS_IN_MULTIREGION_MODE=true 2024-11-08 18:03:13 +02:00
Iain Sproat de4235a9d0 chore(healthchecks): refactor out of modules (#3465) 2024-11-08 13:36:02 +00:00
Kristaps Fabians Geikins 69ff3864af feat(server): multi region support in dataloaders 2024-11-07 09:57:43 +02:00
Chuck Driesler b195df37d6 feat(sso): active user sso information (#3432)
* feat(workspaces): add workspace sso feature flag

* feat(workspaceSso): wip validate sso

* feat(workspaces): validate and add sso provider to the workspace with user sso sessions

* feat(workspaces): validate and add sso provider to the workspace with user sso sessions

* WIP

* fix(sso): restructure to handle all branches at end of flow

* fix(sso): add and validate emails used for sso

* fix(sso): park progress

* chore(workspaces): review sso login/valdate

* fix(sso): adjust validate url

* chore(sso): auth header puzzle

* fix(sso): happy-path config

* chore(gql): gqlgen

* fix(sso): almost almost

* fix(sso): auth endpoint

* a lil more terse

* fix(sso): light at the end of the tunnel

* fix(sso): improve catch block error messages

* fix(sso): session lifespan => validUntil

* fix(sso): I think we've got it

* feat(sso): limited workspace values for public sso login

* fix(sso): use factory functions

* fix(sso): til decrypt is single-use

* fix(sso): correct usage of access codes

* fix(sso): use finalize middleware in all routes

* chore(sso): cheeky tweak

* fix(sso): move some types around

* fix(sso): stencil final shape I'm sleepy

* fix(sso): more factories more factories

* fix(sso): on to final boss of factories

* fix(sso): needs a haircut but she works

* fix(sso): init rest w function, not side-effects

* fix(sso): /authn => /sso

* chore(sso): errors

* chore(sso): test test test

* chore(sso): test all the corners

* feat(sso): list workspace sso memberships

* chore(sso): tests, expose in rest

* fix(sso): sketch active user auth

* fix(sso): expose search via gql

* fix(sso): active user session information

* chore(sso): sso session test utils

* chore(sso): test sso session repo/services

* chore(sso): gqlgen

* fix(sso): simplify gql resolver structure

* chore(sso): gqlgen

---------

Co-authored-by: Gergő Jedlicska <gergo@jedlicska.com>
Co-authored-by: Mike Tasset <mike.tasset@gmail.com>
2024-11-05 12:27:46 +00:00
Kristaps Fabians Geikins 5df716bf1c feat: add & list server regions (#3423)
* WIP create modal

* babababa

* create dialog looks ok

* FE largely there

* workss

* cleanup

* fixed up test plumbing to avoid deadlocks and simplify GQL calls

* test fix

* added all tests

* CI fix
2024-10-31 16:08:50 +01:00
Chuck Driesler 52bb1116ed SSO (#3376)
* feat(workspaces): add workspace sso feature flag

* feat(workspaceSso): wip validate sso

* feat(workspaces): validate and add sso provider to the workspace with user sso sessions

* feat(workspaces): validate and add sso provider to the workspace with user sso sessions

* WIP

* fix(sso): restructure to handle all branches at end of flow

* fix(sso): add and validate emails used for sso

* fix(sso): park progress

* chore(workspaces): review sso login/valdate

* fix(sso): adjust validate url

* chore(sso): auth header puzzle

* fix(sso): happy-path config

* chore(gql): gqlgen

* fix(sso): almost almost

* fix(sso): auth endpoint

* a lil more terse

* fix(sso): light at the end of the tunnel

* fix(sso): improve catch block error messages

* fix(sso): session lifespan => validUntil

* fix(sso): I think we've got it

* feat(sso): limited workspace values for public sso login

* fix(sso): use factory functions

* fix(sso): til decrypt is single-use

* fix(sso): correct usage of access codes

* fix(sso): use finalize middleware in all routes

* chore(sso): cheeky tweak

* fix(sso): move some types around

* fix(sso): stencil final shape I'm sleepy

* fix(sso): more factories more factories

* fix(sso): on to final boss of factories

* fix(sso): needs a haircut but she works

* fix(sso): init rest w function, not side-effects

* fix(sso): /authn => /sso

* chore(sso): errors

* chore(sso): test test test

* chore(sso): test all the corners

---------

Co-authored-by: Gergő Jedlicska <gergo@jedlicska.com>
Co-authored-by: Mike Tasset <mike.tasset@gmail.com>
2024-10-31 13:20:53 +01:00
Gergő Jedlicska da7f0dda0e gergo/web 2047 user joins the workspace event (#3412)
* feat(gatekeeper): add gatekeeper module feature flag

* feat(gatekeeper): add workspace pricing table domain

* feat(gatekeeper): add checkout session creation

* feat(gatekeeper): verify stripe signature

* wip(gatekeeper): checkout callbacks

* feat(gatekeeper): add unlimited and academia plan types

* refactor(envHelper): getStringFromEnv helper

* chore(gatekeeper): add future todos

* feat(gatekeeper): add productId to the subscription domain

* feat(gatekeeper): add in memory repositories

* feat(gatekeeper): add more errors

* feat(gatekeeper): complete checkout session service

* feat(gatekeeper): add stripe client implementation

* feat(gatekeeper): add checkout session completion webhook callback path

* feat(gendo): fix not needing env vars if gendo module is not enabled

* feat(gatekeeper): require a license for billing

* chore(gatekeeper): cleanup before testing

* feat(gatekeeper): subscriptionData parsing model

* ci: add billing integration and gatekeeper modules to test config

* test(gatekeeper): add checkout service tests

* feat(gatekeeper): make completeCheckout callback idempotent properly

* feat(gatekeeper): move to knex based repositories

* test(gatekeeper): billing repository tests

* feat(gatekeeper): add yearly billing cycle toggle

* feat(ci): add stripe integration context to test job

* feat(billingPage): conditionally render the checkout CTAs

* fix(gatekeeper): remove flaky test condition

* feat(helm): add billing integration feature flag

* WIP billing gql api

* feat(gatekeeper): cancel checkout session api

* feat(gatekeeper): handle existing checkout sessions, when trying to create a new one

* feat(gatekeeper): add workspace plans gql api

* feat(gatekeeper): handle cancelation and subscription updates

* fix(gatekeeper): scope initialization

* fix(gatekeeper): eliminate stripe client import sideeffect

* fix(gatekeeper): eliminate stripe client import sideeffect 2

* feat(gatekeeper): upsize subscription on workspace role change

* feat(shared): add command pattern implementation

* refactor(eventBus): remove return capabilities from the event bus

* refactor(workspaces): use new commandFactory in workspace resolver

* feat(core): facelift taskLock

* feat(gatekeeper): shedule subscription downscale

* feat(gatekeeper): manage subscription downscale

* feat(gatekeeper): get workspace subscriptions, that are about to expire

* feat(gatekeeper): manage subscription downscale

* fix(gatekeeper): do not update subscription to canceled subs

* ci: bump postgres and max connections

* feat(workspaces): fix command factory event bugs
2024-10-30 15:51:40 +01:00
Iain Sproat 8ea43d7b98 feat(server/multi region config): mount file and read config from file (#3407)
* feat(multi region config): mount file and read config from file
* feat(helm): allow multi region config to be mounted from a secret
* Allow the file name to be amended
2024-10-30 10:59:03 +00:00
Kristaps Fabians Geikins 9783537ea9 Merge branch 'main' into fabians/quick-js-to-ts-4 2024-10-25 15:19:29 +03:00
Kristaps Fabians Geikins 6cf31becad commitDeleted 2024-10-25 15:16:31 +03:00
Kristaps Fabians Geikins cbbf9b6ad4 commitUpdated 2024-10-25 15:03:15 +03:00
Kristaps Fabians Geikins a3604331c4 commitCreated 2024-10-25 14:21:58 +03:00
Kristaps Fabians Geikins f690f1016a branchDeleted 2024-10-25 13:57:58 +03:00
Kristaps Fabians Geikins 64d2888506 branchUpdated sub 2024-10-25 13:55:26 +03:00
Kristaps Fabians Geikins cedc1beb6c branchCreated sub 2024-10-25 13:50:01 +03:00
Kristaps Fabians Geikins ca61e4f4a1 ip.ts 2024-10-25 10:51:48 +03:00
Kristaps Fabians Geikins 5c30d4a5ab Merge pull request #3351 from specklesystems/fabians/sign-up-event-improvements
fix(server): more resilient sign up tracking
2024-10-23 10:16:26 +01:00
Iain Sproat 0ec4a87c7c fix(file import): server port was broken when localhost was canonical url (#3360)
* fix(file import): server port was broken when localhost was canonical url
- use getServerOrigin() instead of directly calling process.env.CANONICAL_URL
- where server is calling itself, use 127.0.0.1 instead of CANONICAL_URL.
- where server is calling itself (i.e. 127.0.0.1, use the server's listening port and not default for protocol http/80, https/443
- tidy some areas where process.env was called directly; should use envHelper.

* fix tests
2024-10-22 21:12:18 +02:00
Adam Hathcock 89882c4fd6 Add otel tracing (#3294)
* add OpenTelemetry

* fix local tracing and add pino

* fix otel as seperate file

* Rework provider initialization

* Use env vars

* review comments

* lock update

* updates to env var handling

* Helm chart for opentelemetry environment variables
- also adds try/catch when detecting if environment variable exists

* review fixes

---------

Co-authored-by: Iain Sproat <68657+iainsproat@users.noreply.github.com>
2024-10-22 15:23:39 +01:00
Kristaps Fabians Geikins e2c886f27e fix(server): more resilient sign up tracking 2024-10-21 16:20:48 +03:00
Gergő Jedlicska 8cba7eb6f7 gergo/web 1968 add features list (#3332)
* feat(gatekeeper): add gatekeeper module feature flag

* feat(gatekeeper): add workspace pricing table domain

* feat(gatekeeper): add checkout session creation

* feat(gatekeeper): verify stripe signature

* wip(gatekeeper): checkout callbacks

* feat(gatekeeper): add unlimited and academia plan types

* refactor(envHelper): getStringFromEnv helper

* chore(gatekeeper): add future todos

* feat(gatekeeper): add productId to the subscription domain

* feat(gatekeeper): add in memory repositories

* feat(gatekeeper): add more errors

* feat(gatekeeper): complete checkout session service

* feat(gatekeeper): add stripe client implementation

* feat(gatekeeper): add checkout session completion webhook callback path

* feat(gendo): fix not needing env vars if gendo module is not enabled

* feat(gatekeeper): require a license for billing

* chore(gatekeeper): cleanup before testing

* feat(gatekeeper): subscriptionData parsing model

* ci: add billing integration and gatekeeper modules to test config

* test(gatekeeper): add checkout service tests

* feat(gatekeeper): make completeCheckout callback idempotent properly

* feat(gatekeeper): move to knex based repositories

* test(gatekeeper): billing repository tests

* feat(gatekeeper): add yearly billing cycle toggle

* feat(ci): add stripe integration context to test job

* feat(billingPage): conditionally render the checkout CTAs

* fix(gatekeeper): remove flaky test condition

* feat(helm): add billing integration feature flag
2024-10-20 15:40:31 +02:00
Kristaps Fabians Geikins fe1997b86d chore(server): core IoC #76 - validateTokenFactory 2024-10-16 17:43:26 +03:00
Kristaps Fabians Geikins 1cb27e6fdd chore(server): core IoC #51 - getUser(s)Factory 2024-10-14 17:24:11 +03:00
Alessandro Magionami d489975037 Activitystream IoC 4 addCommitCreatedActivity (#3239)
* chore(activitystream): addStreamUpdatedActivity refactor multi region

* chore(activitystream): addStreamAccessRequestedActivity refactor multiregion

* chore(activitystream): addStreamAccessRequestDeclinedActivity refactor multiregion

* chore(activitystream): onUserCreated refactor multiregion

* chore(activitystream): addCommitCreatedActivity refactor multiregion

* chore(activitystream): fix types
2024-10-11 15:49:38 +02:00
Kristaps Fabians Geikins 5b5dd201e2 chore(server): IoC 29 - getStream(s)Factory 2024-10-09 10:39:00 +03:00
Alessandro Magionami d8e789ef6a chore(activitystream): addStreamInviteAcceptedActivity refactor multi region 2024-10-08 10:43:16 +02:00
Alessandro Magionami 68dc836e7f chore(activitystream): addStreamPermissionsRevokedActivity refactor multiregion 2024-10-08 09:51:47 +02:00
Kristaps Fabians Geikins 1c07c76106 chore(server): shared IoC 4 - middleware cleanup (#3119) 2024-09-26 12:17:19 +03:00
Iain Sproat b3f07fa2ce chore(server): Use helpers to get S3 environment variables (#3118)
- use helper method when converting environment variable to boolean
2024-09-26 11:04:41 +02:00
Alessandro Magionami 9714ab5764 Merge pull request #3117 from specklesystems/fabians/shared-ioc-3
chore(server): shared IoC 3 - repo cleanup
2024-09-25 15:19:03 +02:00
Alessandro Magionami d4ec3ebc3f Merge pull request #3116 from specklesystems/fabians/shared-ioc-2
chore(server): shared IoC 2 - authz pipelines
2024-09-25 15:11:01 +02:00
Alessandro Magionami 8903b9c515 Merge pull request #3115 from specklesystems/fabians/shared-ioc-1
chore(server): shared IoC 1 - index.js
2024-09-25 15:10:09 +02:00
Kristaps Fabians Geikins c757d9d03a chore(server): shared IoC 3 - repo cleanup 2024-09-25 16:06:28 +03:00
Kristaps Fabians Geikins c1a87bd6ce chore(server): shared IoC 2 - authz pipelines 2024-09-25 15:59:41 +03:00
Kristaps Fabians Geikins 3653762f59 anutha one 2024-09-25 15:57:53 +03:00
Kristaps Fabians Geikins 7a5bf6cc79 bugfix 2024-09-25 15:55:49 +03:00
Kristaps Fabians Geikins af92ad0e78 chore(server): shared IoC 1 - index.js 2024-09-25 14:58:25 +03:00
Iain Sproat f93d9093a0 fix(errors): all error should define an appropriate status code (#3112)
* fix(errors): all error should define a status code (default is 500)
- rename NoInviteFoundError to InviteNotFoundError to match xNotFoundError pattern

* remove unused errors
2024-09-25 13:08:13 +02:00
Alessandro Magionami 65db85e7e1 Merge pull request #3067 from specklesystems/fabians/automate-ioc-13
chore(server): automate IoC 13 - logStream API
2024-09-23 11:28:09 +02:00
Kristaps Fabians Geikins b29a06b386 chore(server): automate IoC 13 - logStream API 2024-09-20 15:49:13 +03:00
Kristaps Fabians Geikins 3b47774a9a chore(server): auth typescript cleanup (#3045)
* chore(server): auth IoC 19 - setupStrategiesFactory

* chore(server): auth typescript cleanup
2024-09-20 12:23:12 +03:00
Gergő Jedlicska 00c01db923 feat(workspaces): add workspace slug support (#2982)
* feat(workspaces): add workspace slug support

* chore(workspaces): lint

* feat(workspaces): add slug validation and generation

* fix(workspaces): test lint miss
2024-09-18 13:29:36 +02:00