Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .github/actions/deploy/deploy.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ const buildType = BUILD_TYPE || 'canary';

const isProduction = buildType === 'stable';
const isBeta = buildType === 'beta';
const isCanary = buildType === 'canary';
const isInternal = buildType === 'internal';
const isSpotEnabled = isBeta || isCanary;

const replicaConfig = {
stable: {
Expand Down Expand Up @@ -72,6 +74,9 @@ const createHelmCommand = ({ isDryRun }) => {
`--set-string global.indexer.endpoint="${AFFINE_INDEXER_SEARCH_ENDPOINT}"`,
`--set-string global.indexer.apiKey="${AFFINE_INDEXER_SEARCH_API_KEY}"`,
];
const cloudSqlNodeSelector = isBeta
? `{ \\"iam.gke.io/gke-metadata-server-enabled\\": \\"true\\", \\"cloud.google.com/gke-spot\\": \\"true\\" }`
: `{ \\"iam.gke.io/gke-metadata-server-enabled\\": \\"true\\" }`;
const serviceAnnotations = [
`--set-json front.serviceAccount.annotations="{ \\"iam.gke.io/gcp-service-account\\": \\"${APP_IAM_ACCOUNT}\\" }"`,
`--set-json graphql.serviceAccount.annotations="{ \\"iam.gke.io/gcp-service-account\\": \\"${APP_IAM_ACCOUNT}\\" }"`,
Expand All @@ -84,10 +89,18 @@ const createHelmCommand = ({ isDryRun }) => {
`--set-json front.services.renderer.annotations="{ \\"cloud.google.com/neg\\": \\"{\\\\\\"ingress\\\\\\": true}\\" }"`,
`--set-json graphql.service.annotations="{ \\"cloud.google.com/neg\\": \\"{\\\\\\"ingress\\\\\\": true}\\" }"`,
`--set-json cloud-sql-proxy.serviceAccount.annotations="{ \\"iam.gke.io/gcp-service-account\\": \\"${CLOUD_SQL_IAM_ACCOUNT}\\" }"`,
`--set-json cloud-sql-proxy.nodeSelector="{ \\"iam.gke.io/gke-metadata-server-enabled\\": \\"true\\" }"`,
`--set-json cloud-sql-proxy.nodeSelector="${cloudSqlNodeSelector}"`,
]
: []
);
const spotNodeSelector = `{ \\"cloud.google.com/gke-spot\\": \\"true\\" }`;
const spotScheduling = isSpotEnabled
? [
`--set-json front.nodeSelector="${spotNodeSelector}"`,
`--set-json graphql.nodeSelector="${spotNodeSelector}"`,
`--set-json doc.nodeSelector="${spotNodeSelector}"`,
]
: [];

const cpu = cpuConfig[buildType];
const memory = memoryConfig[buildType];
Expand Down Expand Up @@ -146,6 +159,7 @@ const createHelmCommand = ({ isDryRun }) => {
`--set-string doc.app.host="${primaryHost}"`,
`--set doc.replicaCount=${replica.doc}`,
...serviceAnnotations,
...spotScheduling,
...resources,
`--timeout 10m`,
flag,
Expand Down
5 changes: 4 additions & 1 deletion .github/helm/affine/charts/doc/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ podSecurityContext:
fsGroup: 2000

resources:
requests:
limits:
cpu: '1'
memory: 4Gi
requests:
cpu: '1'
memory: 2Gi

probe:
initialDelaySeconds: 20
Expand Down
3 changes: 3 additions & 0 deletions .github/helm/affine/charts/front/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ podSecurityContext:
fsGroup: 2000

resources:
limits:
cpu: '1'
memory: 2Gi
requests:
cpu: '1'
memory: 2Gi
Expand Down
5 changes: 4 additions & 1 deletion .github/helm/affine/charts/graphql/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ podSecurityContext:
fsGroup: 2000

resources:
limits:
cpu: '1'
memory: 4Gi
requests:
cpu: '2'
cpu: '1'
memory: 2Gi

probe:
Expand Down
16 changes: 9 additions & 7 deletions packages/backend/server/src/core/auth/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,7 @@ function extractTokenFromHeader(authorization: string) {

@Injectable()
export class AuthService implements OnApplicationBootstrap {
readonly cookieOptions: CookieOptions = {
sameSite: 'lax',
httpOnly: true,
path: '/',
secure: this.config.server.https,
};
readonly cookieOptions: CookieOptions;
static readonly sessionCookieName = 'affine_session';
static readonly userCookieName = 'affine_user_id';
static readonly csrfCookieName = 'affine_csrf_token';
Expand All @@ -51,7 +46,14 @@ export class AuthService implements OnApplicationBootstrap {
private readonly config: Config,
private readonly models: Models,
private readonly mailer: Mailer
) {}
) {
this.cookieOptions = {
sameSite: 'lax',
httpOnly: true,
path: '/',
secure: this.config.server.https,
};
}

async onApplicationBootstrap() {
if (env.dev) {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/apps/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"@toeverything/infra": "workspace:*",
"@types/set-cookie-parser": "^2.4.10",
"@types/uuid": "^11.0.0",
"@vitejs/plugin-react-swc": "^3.7.2",
"@vitejs/plugin-react-swc": "^4.0.0",
"app-builder-lib": "^26.1.0",
"builder-util-runtime": "^9.5.0",
"cross-env": "^10.1.0",
Expand Down
120 changes: 64 additions & 56 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ __metadata:
"@toeverything/infra": "workspace:*"
"@types/set-cookie-parser": "npm:^2.4.10"
"@types/uuid": "npm:^11.0.0"
"@vitejs/plugin-react-swc": "npm:^3.7.2"
"@vitejs/plugin-react-swc": "npm:^4.0.0"
app-builder-lib: "npm:^26.1.0"
async-call-rpc: "npm:^6.4.2"
builder-util-runtime: "npm:^9.5.0"
Expand Down Expand Up @@ -14886,6 +14886,13 @@ __metadata:
languageName: node
linkType: hard

"@rolldown/pluginutils@npm:1.0.0-rc.2":
version: 1.0.0-rc.2
resolution: "@rolldown/pluginutils@npm:1.0.0-rc.2"
checksum: 10/8dba3626ca26f49ed83d4db4a9eaacfcc6715cc8544f2969419489c90a2bb000025976049e0f6c5c2880817bff753fb04bec8fb57df9423f07958ce8da97035e
languageName: node
linkType: hard

"@rollup/pluginutils@npm:^5.0.2, @rollup/pluginutils@npm:^5.1.3, @rollup/pluginutils@npm:^5.3.0":
version: 5.3.0
resolution: "@rollup/pluginutils@npm:5.3.0"
Expand Down Expand Up @@ -15817,92 +15824,92 @@ __metadata:
languageName: node
linkType: hard

"@swc/core-darwin-arm64@npm:1.11.29":
version: 1.11.29
resolution: "@swc/core-darwin-arm64@npm:1.11.29"
"@swc/core-darwin-arm64@npm:1.15.11":
version: 1.15.11
resolution: "@swc/core-darwin-arm64@npm:1.15.11"
conditions: os=darwin & cpu=arm64
languageName: node
linkType: hard

"@swc/core-darwin-x64@npm:1.11.29":
version: 1.11.29
resolution: "@swc/core-darwin-x64@npm:1.11.29"
"@swc/core-darwin-x64@npm:1.15.11":
version: 1.15.11
resolution: "@swc/core-darwin-x64@npm:1.15.11"
conditions: os=darwin & cpu=x64
languageName: node
linkType: hard

"@swc/core-linux-arm-gnueabihf@npm:1.11.29":
version: 1.11.29
resolution: "@swc/core-linux-arm-gnueabihf@npm:1.11.29"
"@swc/core-linux-arm-gnueabihf@npm:1.15.11":
version: 1.15.11
resolution: "@swc/core-linux-arm-gnueabihf@npm:1.15.11"
conditions: os=linux & cpu=arm
languageName: node
linkType: hard

"@swc/core-linux-arm64-gnu@npm:1.11.29":
version: 1.11.29
resolution: "@swc/core-linux-arm64-gnu@npm:1.11.29"
"@swc/core-linux-arm64-gnu@npm:1.15.11":
version: 1.15.11
resolution: "@swc/core-linux-arm64-gnu@npm:1.15.11"
conditions: os=linux & cpu=arm64 & libc=glibc
languageName: node
linkType: hard

"@swc/core-linux-arm64-musl@npm:1.11.29":
version: 1.11.29
resolution: "@swc/core-linux-arm64-musl@npm:1.11.29"
"@swc/core-linux-arm64-musl@npm:1.15.11":
version: 1.15.11
resolution: "@swc/core-linux-arm64-musl@npm:1.15.11"
conditions: os=linux & cpu=arm64 & libc=musl
languageName: node
linkType: hard

"@swc/core-linux-x64-gnu@npm:1.11.29":
version: 1.11.29
resolution: "@swc/core-linux-x64-gnu@npm:1.11.29"
"@swc/core-linux-x64-gnu@npm:1.15.11":
version: 1.15.11
resolution: "@swc/core-linux-x64-gnu@npm:1.15.11"
conditions: os=linux & cpu=x64 & libc=glibc
languageName: node
linkType: hard

"@swc/core-linux-x64-musl@npm:1.11.29":
version: 1.11.29
resolution: "@swc/core-linux-x64-musl@npm:1.11.29"
"@swc/core-linux-x64-musl@npm:1.15.11":
version: 1.15.11
resolution: "@swc/core-linux-x64-musl@npm:1.15.11"
conditions: os=linux & cpu=x64 & libc=musl
languageName: node
linkType: hard

"@swc/core-win32-arm64-msvc@npm:1.11.29":
version: 1.11.29
resolution: "@swc/core-win32-arm64-msvc@npm:1.11.29"
"@swc/core-win32-arm64-msvc@npm:1.15.11":
version: 1.15.11
resolution: "@swc/core-win32-arm64-msvc@npm:1.15.11"
conditions: os=win32 & cpu=arm64
languageName: node
linkType: hard

"@swc/core-win32-ia32-msvc@npm:1.11.29":
version: 1.11.29
resolution: "@swc/core-win32-ia32-msvc@npm:1.11.29"
"@swc/core-win32-ia32-msvc@npm:1.15.11":
version: 1.15.11
resolution: "@swc/core-win32-ia32-msvc@npm:1.15.11"
conditions: os=win32 & cpu=ia32
languageName: node
linkType: hard

"@swc/core-win32-x64-msvc@npm:1.11.29":
version: 1.11.29
resolution: "@swc/core-win32-x64-msvc@npm:1.11.29"
"@swc/core-win32-x64-msvc@npm:1.15.11":
version: 1.15.11
resolution: "@swc/core-win32-x64-msvc@npm:1.15.11"
conditions: os=win32 & cpu=x64
languageName: node
linkType: hard

"@swc/core@npm:^1.10.1, @swc/core@npm:^1.11.21":
version: 1.11.29
resolution: "@swc/core@npm:1.11.29"
"@swc/core@npm:^1.10.1, @swc/core@npm:^1.15.11":
version: 1.15.11
resolution: "@swc/core@npm:1.15.11"
dependencies:
"@swc/core-darwin-arm64": "npm:1.11.29"
"@swc/core-darwin-x64": "npm:1.11.29"
"@swc/core-linux-arm-gnueabihf": "npm:1.11.29"
"@swc/core-linux-arm64-gnu": "npm:1.11.29"
"@swc/core-linux-arm64-musl": "npm:1.11.29"
"@swc/core-linux-x64-gnu": "npm:1.11.29"
"@swc/core-linux-x64-musl": "npm:1.11.29"
"@swc/core-win32-arm64-msvc": "npm:1.11.29"
"@swc/core-win32-ia32-msvc": "npm:1.11.29"
"@swc/core-win32-x64-msvc": "npm:1.11.29"
"@swc/core-darwin-arm64": "npm:1.15.11"
"@swc/core-darwin-x64": "npm:1.15.11"
"@swc/core-linux-arm-gnueabihf": "npm:1.15.11"
"@swc/core-linux-arm64-gnu": "npm:1.15.11"
"@swc/core-linux-arm64-musl": "npm:1.15.11"
"@swc/core-linux-x64-gnu": "npm:1.15.11"
"@swc/core-linux-x64-musl": "npm:1.15.11"
"@swc/core-win32-arm64-msvc": "npm:1.15.11"
"@swc/core-win32-ia32-msvc": "npm:1.15.11"
"@swc/core-win32-x64-msvc": "npm:1.15.11"
"@swc/counter": "npm:^0.1.3"
"@swc/types": "npm:^0.1.21"
"@swc/types": "npm:^0.1.25"
peerDependencies:
"@swc/helpers": ">=0.5.17"
dependenciesMeta:
Expand All @@ -15929,7 +15936,7 @@ __metadata:
peerDependenciesMeta:
"@swc/helpers":
optional: true
checksum: 10/6945229bf6da91adff26033910e8e02ccc457a8229724d0539a0b32995d05949c7709cb9cae2cd7ab10cf4d346b235e22dd4d6b207ded765597304e21e6b6101
checksum: 10/2ee702f6ee39fc68f1e4d03a19191eaa3762d54ab917d5617741196bbe3beba9fb50b1e878af2735f8a42ecdef3632f44acc090611ebf01a0df4dc533a71f5d2
languageName: node
linkType: hard

Expand Down Expand Up @@ -15958,12 +15965,12 @@ __metadata:
languageName: node
linkType: hard

"@swc/types@npm:^0.1.21":
version: 0.1.21
resolution: "@swc/types@npm:0.1.21"
"@swc/types@npm:^0.1.25":
version: 0.1.25
resolution: "@swc/types@npm:0.1.25"
dependencies:
"@swc/counter": "npm:^0.1.3"
checksum: 10/6554bf5c78519f49099a2ba448d170191a14b1c7a35df848f10ee4d6c03ecd681e5213884905187de1d1d221589ec8b5cb77f477d099dc1627c3ec9d7f2fcdb0
checksum: 10/f6741450224892d12df43e5ca7f3cc0287df644dcd672626eb0cc2a3a8e3e875f4b29eb11336f37c7240cf6e010ba59eb3a79f4fb8bee5cbd168dfc1326ff369
languageName: node
linkType: hard

Expand Down Expand Up @@ -18163,14 +18170,15 @@ __metadata:
languageName: node
linkType: hard

"@vitejs/plugin-react-swc@npm:^3.7.2":
version: 3.9.0
resolution: "@vitejs/plugin-react-swc@npm:3.9.0"
"@vitejs/plugin-react-swc@npm:^4.0.0":
version: 4.2.3
resolution: "@vitejs/plugin-react-swc@npm:4.2.3"
dependencies:
"@swc/core": "npm:^1.11.21"
"@rolldown/pluginutils": "npm:1.0.0-rc.2"
"@swc/core": "npm:^1.15.11"
peerDependencies:
vite: ^4 || ^5 || ^6
checksum: 10/545dddee3c2f7f35f37c680f79bebb98f3968209470ec56c594556410d498b41cf86df60d2ab9a56c69b02bef12ee3198371becc804b85172ec97ee0d2d7633d
vite: ^4 || ^5 || ^6 || ^7
checksum: 10/48ab3de0a3833987ff7fc15d4561d930853acf1a2e44523279bc877f8ee81a368465f4b32f21155986986538514cc6aad3dfef62eb25490acde3593c970da521
languageName: node
linkType: hard

Expand Down
Loading