fix: improve self-host convenience (#5582)

This commit is contained in:
liuyi
2024-01-15 09:24:52 +00:00
parent 2f9b4fd0cf
commit 24e18dd475
8 changed files with 132 additions and 26 deletions

View File

@@ -1,13 +1,9 @@
services:
affine:
image: ghcr.io/toeverything/affine-graphql:beta
container_name: affine
container_name: affine_selfhosted
command:
[
'sh',
'-c',
'./node_modules/.bin/dotenv -e /root/.affine/.env -- npm run predeploy && node --es-module-specifier-resolution=node ./dist/index.js',
]
['sh', '-c', 'node ./scripts/self-host-predeploy && node ./dist/index.js']
ports:
- '3010:3010'
- '5555:5555'
@@ -17,23 +13,31 @@ services:
postgres:
condition: service_healthy
volumes:
- ~/.affine/storage:/root/.affine/storage
- ~/.affine/.env:/root/.affine/.env
# custom configurations
- ~/.affine/self-host/config:/root/.affine/config
# blob storage
- ~/.affine/self-host/storage:/root/.affine/storage
logging:
driver: 'json-file'
options:
max-size: '1000m'
restart: unless-stopped
environment:
- NODE_OPTIONS=--es-module-specifier-resolution node
- AFFINE_CONFIG_PATH=/root/.affine/config
- REDIS_SERVER_HOST=redis
- DATABASE_URL=postgres://affine:affine@postgres:5432/affine
- DISABLE_TELEMETRY=true
- NODE_ENV=production
- SERVER_FLAVOR=selfhosted
- AFFINE_ADMIN_EMAIL=${AFFINE_ADMIN_EMAIL}
- AFFINE_ADMIN_PASSWORD=${AFFINE_ADMIN_PASSWORD}
redis:
image: redis
container_name: redis
container_name: affine_redis
restart: unless-stopped
volumes:
- ~/.affine/redis:/data
- ~/.affine/self-host/redis:/data
healthcheck:
test: ['CMD', 'redis-cli', '--raw', 'incr', 'ping']
interval: 10s
@@ -41,10 +45,10 @@ services:
retries: 5
postgres:
image: postgres
container_name: postgres
container_name: affine_postgres
restart: unless-stopped
volumes:
- ~/.affine/postgres:/var/lib/postgresql/data
- ~/.affine/self-host/postgres:/var/lib/postgresql/data
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U affine']
interval: 10s