@@ -2,52 +2,65 @@ captainVersion: 4
22services :
33 # affine:
44 $$cap_appname :
5- image : ghcr.io/toeverything/affine-graphql:$$cap_affine_version
6- command :
7- [
8- ' sh' ,
9- ' -c' ,
10- ' node ./scripts/self-host-predeploy && node ./dist/index.js' ,
11- ]
12- ports :
13- - ' 5555:5555'
5+ image : ghcr.io/toeverything/affine:$$cap_affine_version
6+ # No command is needed, uses the image's default CMD
147 depends_on :
158 $$cap_appname-redis :
169 condition : service_healthy
1710 $$cap_appname-postgres :
1811 condition : service_healthy
12+ $$cap_appname-migration :
13+ condition : service_completed_successfully
1914 volumes :
20- # custom configurations
2115 - $$cap_appname-db-data:/root/.affine/config
22- # blob storage
2316 - $$cap_appname-db-data:/root/.affine/storage
2417 logging :
2518 driver : ' json-file'
2619 options :
2720 max-size : ' 1000m'
2821 restart : unless-stopped
2922 environment :
30- NODE_OPTIONS : ' --import=./scripts/register.js'
31- AFFINE_CONFIG_PATH : /root/.affine/config
3223 REDIS_SERVER_HOST : srv-captain--$$cap_appname-redis
3324 DATABASE_URL : postgres://affine:$$cap_db_affine_password@srv-captain--$$cap_appname-postgres:5432/affine
3425 NODE_ENV : production
35- AFFINE_ADMIN_EMAIL : $$cap_affine_admin_email
36- AFFINE_ADMIN_PASSWORD : $$cap_affine_admin_password
26+ AFFINE_INDEXER_ENABLED : ' false '
27+ # CapRover variables for setup
3728 AFFINE_SERVER_HOST : $$cap_affine_server_host
3829 AFFINE_SERVER_HTTPS : $$cap_affine_server_https
3930 AFFINE_SERVER_EXTERNAL_URL : $$cap_affine_server_external_url
31+ # Mailer settings
4032 MAILER_HOST : $$cap_mailer_host
4133 MAILER_PORT : $$cap_mailer_port
4234 MAILER_USER : $$cap_mailer_user
4335 MAILER_PASSWORD : $$cap_mailer_password
4436 MAILER_SENDER : $$cap_mailer_sender
45- # Telemetry allows us to collect data on how you use the affine. This data will helps us improve the app and provide better features.
46- # Uncomment next line if you wish to quit telemetry.
47- # - TELEMETRY_ENABLE=false
37+ # Telemetry
38+ # TELEMETRY_ENABLE: 'false'
4839 caproverExtra :
4940 containerHttpPort : ' 3010'
5041 websocketSupport : true
42+
43+ # Affine Database Migration Job
44+ $$cap_appname-migration-delete-me-after-install :
45+ image : ghcr.io/toeverything/affine:$$cap_affine_version
46+ command : ['sh', '-c', 'node ./scripts/self-host-predeploy.js']
47+ depends_on :
48+ $$cap_appname-redis :
49+ condition : service_healthy
50+ $$cap_appname-postgres :
51+ condition : service_healthy
52+ volumes :
53+ - $$cap_appname-db-data:/root/.affine/config
54+ - $$cap_appname-db-data:/root/.affine/storage
55+ restart : on-failure # Run as a one-off job
56+ environment :
57+ REDIS_SERVER_HOST : srv-captain--$$cap_appname-redis
58+ DATABASE_URL : postgres://affine:$$cap_db_affine_password@srv-captain--$$cap_appname-postgres:5432/affine
59+ AFFINE_INDEXER_ENABLED : ' false'
60+ caproverExtra :
61+ notExposeAsWebApp : ' true'
62+
63+ # Redis Service
5164 $$cap_appname-redis :
5265 image : redis
5366 restart : unless-stopped
@@ -60,13 +73,15 @@ services:
6073 retries : 5
6174 caproverExtra :
6275 notExposeAsWebApp : ' true'
76+
77+ # PostgreSQL Service (with pgvector)
6378 $$cap_appname-postgres :
64- image : postgres
79+ image : pgvector/pgvector:pg16 # Updated image
6580 restart : unless-stopped
6681 volumes :
6782 - $$cap_appname-db-data:/var/lib/postgresql/data
6883 healthcheck :
69- test : ['CMD-SHELL ', 'pg_isready -U affine']
84+ test : ['CMD', 'pg_isready', '-U', ' affine', '-d', 'affine'] # Updated healthcheck
7085 interval : 10s
7186 timeout : 5s
7287 retries : 5
@@ -75,69 +90,77 @@ services:
7590 POSTGRES_USER : affine
7691 POSTGRES_PASSWORD : $$cap_db_affine_password
7792 PGDATA : /var/lib/postgresql/data/pgdata
93+ POSTGRES_INITDB_ARGS : ' --data-checksums'
94+ POSTGRES_HOST_AUTH_METHOD : trust # Kept from new GH file for easier setup
7895 caproverExtra :
7996 notExposeAsWebApp : ' true'
97+
8098caproverOneClickApp :
8199 variables :
82- - defaultValue : stable-4b9e2ab
83- description : Check out their Docker page for the valid tags https://github.com/toeverything/AFFiNE/pkgs/container/affine-graphql
100+ - defaultValue : 0.25.5
101+ description : Check out their Docker page for valid tags https://github.com/toeverything/AFFiNE/pkgs/container/affine
84102 id : $$cap_affine_version
85- label : Affine version
103+ label : Affine Version Tag
86104 validRegex : /^([^\s^\/])+$/
87105
88- - description : Default access domain of AFFiNE. Make sure this matches the URL in browser. (eg. yourdomain.com)
106+ - description : Default access domain of AFFiNE. Make sure this matches the URL in browser. (e.g., affine. yourdomain.com)
89107 id : $$cap_affine_server_host
90108 label : AFFINE_SERVER_HOST
91109
92110 - defaultValue : true
93- description : Use https prefix in url. Make sure this matches the URL in browser. (eg. true|false)
111+ description : Use https prefix in url. Make sure this matches the URL in browser. (e.g., true|false)
94112 id : $$cap_affine_server_https
95113 label : AFFINE_SERVER_HTTPS
96114
97- - description : Used to factor url to server resources (eg. https://yourdomain.com)
115+ - description : Used to factor url to server resources (e.g., https://affine. yourdomain.com)
98116 id : $$cap_affine_server_external_url
99117 label : AFFINE_SERVER_EXTERNAL_URL
100118
101- - description : Email server domain
119+ - description : Email server domain (optional)
102120 id : $$cap_mailer_host
103- label : MAILER_HOST
121+ label : MAILER_HOST (Optional)
122+ optional : true
104123
105- - description : Email server port
124+ - description : Email server port (optional)
106125 id : $$cap_mailer_port
107- label : MAILER_PORT
126+ label : MAILER_PORT (Optional)
127+ optional : true
108128
109- - description : Email login user
129+ - description : Email login user (optional)
110130 id : $$cap_mailer_user
111- label : MAILER_USER
131+ label : MAILER_USER (Optional)
132+ optional : true
112133
113- - description : Email password
134+ - description : Email password (optional)
114135 id : $$cap_mailer_password
115- label : MAILER_PASSWORD
136+ label : MAILER_PASSWORD (Optional)
137+ optional : true
116138
117- - description : Email sender (not avaliable for consumer mail service like gmail/outlook )
139+ - description : Email sender (optional, not available for consumer mail services )
118140 id : $$cap_mailer_sender
119- label : MAILER_SENDER
141+ label : MAILER_SENDER (Optional)
142+ optional : true
120143
121144 - defaultValue : $$cap_gen_random_hex(32)
122- description : Database password of the affine user.
145+ description : Database password for the affine user.
123146 id : $$cap_db_affine_password
124- label : ' Database password '
147+ label : Database Password
125148 validRegex : /^(?=.*\d).{10,}$/
126149
127150 instructions :
128- start : Affine - There can be more than Notion and Miro. AFFiNE(pronounced [ə'fain]) is a next-gen knowledge base that brings planning.
151+ start : Affine - A next-gen knowledge base that brings planning, sorting, and creating all together .
129152 end : >-
130- 🎉 It's done! Affine is deployed and available as $$cap_appname. 🎉
131-
132- 1. Go to your caprover Affine settings page and enable HTTPS
153+ 🎉 It's done! Affine is being deployed as $$cap_appname. 🎉
133154
134- 2. Enable "Force HTTPS by redirecting all HTTP traffic to HTTPS"
155+ IMPORTANT: On first deploy, the '$$cap_appname-migration' service will run to set up your database. This may take a minute or two.
156+ During this time, the main app (http://$$cap_appname.$$cap_root_domain) might show a 502 error. This is normal.
135157
136- Your service is available at http://$$cap_appname.$$cap_root_domain
137- Go there to create your admin account
158+ Once the migration is complete, the app will start.
138159
139- IMPORTANT: It will take up to 2 minutes for Affine to be ready. Before that, you might see 502 error page.
140- displayName : ' Affine'
160+ 1. Go to your CapRover app settings and enable HTTPS.
161+ 2. Enable "Force HTTPS by redirecting all HTTP traffic to HTTPS".
162+ 3. Go to http://$$cap_appname.$$cap_root_domain to create your admin account (using the email/password you provided).
163+ displayName : ' Affine (Community)'
141164 isOfficial : false
142- description : Affine - There can be more than Notion and Miro. AFFiNE(pronounced [ə'fain]) is a next-gen knowledge base that brings planning.
143- documentation : https://docs.affine.pro/docs/code-of-conduct
165+ description : Affine is a next-gen knowledge base that brings planning, sorting, and creating all together .
166+ documentation : https://docs.affine.pro/docs/self-host
0 commit comments