There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix(server): selfhost startup (#9386)
liuyia16471c1855e
diff --git a/.docker/selfhost/.env.example b/.docker/selfhost/.env.exampleindex a128097915..a42c74e61e 100644--- a/.docker/selfhost/.env.example+++ b/.docker/selfhost/.env.example@@ -11,7 +11,7 @@ PORT=3010# AFFINE_SERVER_EXTERNAL_URL=https://affine.yourdomain.com# position of the database data to persist-DB_DATA_LOCATION=~/.affine/self-host/postgres+DB_DATA_LOCATION=~/.affine/self-host/postgres/pgdata# position of the upload data(images, files, etc.) to persistUPLOAD_LOCATION=~/.affine/self-host/storage# position of the configuration files to persistdiff --git a/.docker/selfhost/compose.yaml b/.docker/selfhost/compose.ymlsimilarity index 97%rename from .docker/selfhost/compose.yamlrename to .docker/selfhost/compose.ymlindex 3d99a2ca51..50ef654fd0 100644--- a/.docker/selfhost/compose.yaml+++ b/.docker/selfhost/compose.yml@@ -19,6 +19,7 @@ services:env_file:- .envenvironment:+ - REDIS_SERVER_HOST=redis- DATABASE_URL=postgresql://${DB_USERNAME}:${DB_PASSWORD}@postgres:5432/${DB_DATABASE:-affine}restart: unless-stopped@@ -33,6 +34,7 @@ services:env_file:- .envenvironment:+ - REDIS_SERVER_HOST=redis- DATABASE_URL=postgresql://${DB_USERNAME}:${DB_PASSWORD}@postgres:5432/${DB_DATABASE:-affine}depends_on:postgres:diff --git a/.github/workflows/release-desktop.yml b/.github/workflows/release-desktop.ymlindex ac91db0b23..e1b38e4d76 100644--- a/.github/workflows/release-desktop.yml+++ b/.github/workflows/release-desktop.yml@@ -441,7 +441,7 @@ jobs:node-version: 20- name: Copy Selfhost Release Filesrun: |- cp ./.docker/selfhost/compose.yaml ./release/docker-compose.yaml+ cp ./.docker/selfhost/compose.yml ./release/docker-compose.ymlcp ./.docker/selfhost/.env.example ./release/.env.example- name: Generate Release ymlrun: |@@ -456,7 +456,9 @@ jobs:body: ''draft: ${{ github.event.inputs.is-draft }}prerelease: ${{ github.event.inputs.is-pre-release }}- files: ./release/*+ files: |+ - ./release/*+ - ./release/.env.example- name: Create Nightly Release Draftif: ${{ github.ref_type == 'branch' }}uses: softprops/action-gh-release@v2@@ -471,4 +473,6 @@ jobs:body: ''draft: falseprerelease: true- files: ./release/*+ files: |+ - ./release/*+ - ./release/.env.examplediff --git a/packages/backend/server/src/prelude.ts b/packages/backend/server/src/prelude.tsindex 9d1c1ba95b..00a0f339a9 100644--- a/packages/backend/server/src/prelude.ts+++ b/packages/backend/server/src/prelude.ts@@ -45,6 +45,7 @@ function loadPrivateKey() {}async function load() {+ let isPrivateKeyFromEnv = !!process.env.AFFINE_PRIVATE_KEY;// Initializing AFFiNE config//// 1. load dotenv file to `process.env`@@ -56,6 +57,12 @@ async function load() {path: join(CUSTOM_CONFIG_PATH, '.env'),});+ // @deprecated+ // The old AFFINE_PRIVATE_KEY in old .env is somehow not working, we should ignore it+ if (!isPrivateKeyFromEnv) {+ delete process.env.AFFINE_PRIVATE_KEY;+ }+// 2. generate AFFiNE default config and assign to `globalThis.AFFiNE`globalThis.AFFiNE = getAFFiNEConfigModifier();const { enablePlugin } = await import('./plugins/registry');