Skip to content

Commit

Permalink
Add Affine (#1158)
Browse files Browse the repository at this point in the history
* Affine

* Update affine.yml description

* Add logo

* Fix. PR comments
  • Loading branch information
jjchiw authored Oct 19, 2024
1 parent e16b1dc commit d36e1d7
Show file tree
Hide file tree
Showing 2 changed files with 139 additions and 0 deletions.
139 changes: 139 additions & 0 deletions public/v4/apps/affine.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
captainVersion: 4
services:
#affine:
$$cap_appname:
image: ghcr.io/toeverything/affine-graphql:$$cap_affine_version
command:
['sh', '-c', 'node ./scripts/self-host-predeploy && node ./dist/index.js']
ports:
- '5555:5555'
depends_on:
$$cap_appname-redis:
condition: service_healthy
$$cap_appname-postgres:
condition: service_healthy
volumes:
# custom configurations
- $$cap_appname-db-data:/root/.affine/config
# blob storage
- $$cap_appname-db-data:/root/.affine/storage
logging:
driver: 'json-file'
options:
max-size: '1000m'
restart: unless-stopped
environment:
NODE_OPTIONS: "--import=./scripts/register.js"
AFFINE_CONFIG_PATH: /root/.affine/config
REDIS_SERVER_HOST: srv-captain--$$cap_appname_data-redis
DATABASE_URL: postgres://affine:$$cap_db_affine_password@srv-captain--$$cap_appname-postgres:5432/affine
NODE_ENV: production
AFFINE_ADMIN_EMAIL: $$cap_affine_admin_email
AFFINE_ADMIN_PASSWORD: $$cap_affine_admin_password
AFFINE_SERVER_HOST: $$cap_affine_server_host
AFFINE_SERVER_HTTPS: $$cap_affine_server_https
AFFINE_SERVER_EXTERNAL_URL: $$cap_affine_server_external_url
MAILER_HOST: $$cap_mailer_host
MAILER_PORT: $$cap_mailer_port
MAILER_USER: $$cap_mailer_user
MAILER_PASSWORD: $$cap_mailer_password
MAILER_SENDER: $$cap_mailer_sender
# Telemetry allows us to collect data on how you use the affine. This data will helps us improve the app and provide better features.
# Uncomment next line if you wish to quit telemetry.
# - TELEMETRY_ENABLE=false
caproverExtra:
containerHttpPort: '3010'
websocketSupport: true
$$cap_appname-redis:
image: redis
restart: unless-stopped
volumes:
- $$cap_appname-db-data:/data
healthcheck:
test: ['CMD', 'redis-cli', '--raw', 'incr', 'ping']
interval: 10s
timeout: 5s
retries: 5
caproverExtra:
notExposeAsWebApp: 'true'
$$cap_appname-postgres:
image: postgres
restart: unless-stopped
volumes:
- $$cap_appname-db-data:/var/lib/postgresql/data
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U affine']
interval: 10s
timeout: 5s
retries: 5
environment:
POSTGRES_DB: affine
POSTGRES_USER: affine
POSTGRES_PASSWORD: $$cap_db_affine_password
PGDATA: /var/lib/postgresql/data/pgdata
caproverExtra:
notExposeAsWebApp: 'true'
caproverOneClickApp:
variables:
- defaultValue: stable-4b9e2ab
description: Check out their Docker page for the valid tags https://github.com/toeverything/AFFiNE/pkgs/container/affine-graphql
id: $$cap_affine_version
label: Affine version
validRegex: /^([^\s^\/])+$/

- description: Default access domain of AFFiNE. Make sure this matches the URL in browser. (eg. yourdomain.com)
id: $$cap_affine_server_host
label: AFFINE_SERVER_HOST

- defaultValue: true
description: Use https prefix in url. Make sure this matches the URL in browser. (eg. true|false)
id: $$cap_affine_server_https
label: AFFINE_SERVER_HTTPS

- description: Used to factor url to server resources (eg. https://yourdomain.com)
id: $$cap_affine_server_external_url
label: AFFINE_SERVER_EXTERNAL_URL

- description: Email server domain
id: $$cap_mailer_host
label: MAILER_HOST

- description: Email server port
id: $$cap_mailer_port
label: MAILER_PORT

- description: Email login user
id: $$cap_mailer_user
label: MAILER_USER

- description: Email password
id: $$cap_mailer_password
label: MAILER_PASSWORD

- description: Email sender (not avaliable for consumer mail service like gmail/outlook)
id: $$cap_mailer_sender
label: MAILER_SENDER

- defaultValue: $$cap_gen_random_hex(32)
description: Database password of the affine user.
id: $$cap_db_affine_password
label: 'Database password'
validRegex: /^(?=.*\d).{10,}$/

instructions:
start: Affine - There can be more than Notion and Miro. AFFiNE(pronounced [ə'fain]) is a next-gen knowledge base that brings planning.
end: >-
🎉 It's done! Affine is deployed and available as $$cap_appname. 🎉
1. Go to your caprover Affine settings page and enable HTTPS
2. Enable "Force HTTPS by redirecting all HTTP traffic to HTTPS"
Your service is available at http://$$cap_appname.$$cap_root_domain
Go there to create your admin account
IMPORTANT: It will take up to 2 minutes for Affine to be ready. Before that, you might see 502 error page.
displayName: 'Affine'
isOfficial: false
description: Affine - There can be more than Notion and Miro. AFFiNE(pronounced [ə'fain]) is a next-gen knowledge base that brings planning.
documentation: https://docs.affine.pro/docs/code-of-conduct
Binary file added public/v4/logos/affine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d36e1d7

Please sign in to comment.