mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
fix(server): selfhost startup (#9386)
This commit is contained in:
@@ -11,7 +11,7 @@ PORT=3010
|
|||||||
# AFFINE_SERVER_EXTERNAL_URL=https://affine.yourdomain.com
|
# AFFINE_SERVER_EXTERNAL_URL=https://affine.yourdomain.com
|
||||||
|
|
||||||
# position of the database data to persist
|
# 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 persist
|
# position of the upload data(images, files, etc.) to persist
|
||||||
UPLOAD_LOCATION=~/.affine/self-host/storage
|
UPLOAD_LOCATION=~/.affine/self-host/storage
|
||||||
# position of the configuration files to persist
|
# position of the configuration files to persist
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ services:
|
|||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
environment:
|
environment:
|
||||||
|
- REDIS_SERVER_HOST=redis
|
||||||
- DATABASE_URL=postgresql://${DB_USERNAME}:${DB_PASSWORD}@postgres:5432/${DB_DATABASE:-affine}
|
- DATABASE_URL=postgresql://${DB_USERNAME}:${DB_PASSWORD}@postgres:5432/${DB_DATABASE:-affine}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
@@ -33,6 +34,7 @@ services:
|
|||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
environment:
|
environment:
|
||||||
|
- REDIS_SERVER_HOST=redis
|
||||||
- DATABASE_URL=postgresql://${DB_USERNAME}:${DB_PASSWORD}@postgres:5432/${DB_DATABASE:-affine}
|
- DATABASE_URL=postgresql://${DB_USERNAME}:${DB_PASSWORD}@postgres:5432/${DB_DATABASE:-affine}
|
||||||
depends_on:
|
depends_on:
|
||||||
postgres:
|
postgres:
|
||||||
10
.github/workflows/release-desktop.yml
vendored
10
.github/workflows/release-desktop.yml
vendored
@@ -441,7 +441,7 @@ jobs:
|
|||||||
node-version: 20
|
node-version: 20
|
||||||
- name: Copy Selfhost Release Files
|
- name: Copy Selfhost Release Files
|
||||||
run: |
|
run: |
|
||||||
cp ./.docker/selfhost/compose.yaml ./release/docker-compose.yaml
|
cp ./.docker/selfhost/compose.yml ./release/docker-compose.yml
|
||||||
cp ./.docker/selfhost/.env.example ./release/.env.example
|
cp ./.docker/selfhost/.env.example ./release/.env.example
|
||||||
- name: Generate Release yml
|
- name: Generate Release yml
|
||||||
run: |
|
run: |
|
||||||
@@ -456,7 +456,9 @@ jobs:
|
|||||||
body: ''
|
body: ''
|
||||||
draft: ${{ github.event.inputs.is-draft }}
|
draft: ${{ github.event.inputs.is-draft }}
|
||||||
prerelease: ${{ github.event.inputs.is-pre-release }}
|
prerelease: ${{ github.event.inputs.is-pre-release }}
|
||||||
files: ./release/*
|
files: |
|
||||||
|
- ./release/*
|
||||||
|
- ./release/.env.example
|
||||||
- name: Create Nightly Release Draft
|
- name: Create Nightly Release Draft
|
||||||
if: ${{ github.ref_type == 'branch' }}
|
if: ${{ github.ref_type == 'branch' }}
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
@@ -471,4 +473,6 @@ jobs:
|
|||||||
body: ''
|
body: ''
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: true
|
prerelease: true
|
||||||
files: ./release/*
|
files: |
|
||||||
|
- ./release/*
|
||||||
|
- ./release/.env.example
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ function loadPrivateKey() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function load() {
|
async function load() {
|
||||||
|
let isPrivateKeyFromEnv = !!process.env.AFFINE_PRIVATE_KEY;
|
||||||
// Initializing AFFiNE config
|
// Initializing AFFiNE config
|
||||||
//
|
//
|
||||||
// 1. load dotenv file to `process.env`
|
// 1. load dotenv file to `process.env`
|
||||||
@@ -56,6 +57,12 @@ async function load() {
|
|||||||
path: join(CUSTOM_CONFIG_PATH, '.env'),
|
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`
|
// 2. generate AFFiNE default config and assign to `globalThis.AFFiNE`
|
||||||
globalThis.AFFiNE = getAFFiNEConfigModifier();
|
globalThis.AFFiNE = getAFFiNEConfigModifier();
|
||||||
const { enablePlugin } = await import('./plugins/registry');
|
const { enablePlugin } = await import('./plugins/registry');
|
||||||
|
|||||||
Reference in New Issue
Block a user