From 4f6323312f8f22eead0291096b77516f5dce2f0c Mon Sep 17 00:00:00 2001 From: Fu Zi Xiang Date: Mon, 11 Dec 2023 23:06:15 -0800 Subject: [PATCH] feat: update optional component of deployment --- doc/DEPLOYMENT.md | 17 ++++++-- docker-compose-dev.yml | 45 ++++++++++----------- docker-compose.yml | 90 ++++++++++++++++++++++-------------------- nginx/nginx.conf | 4 ++ 4 files changed, 89 insertions(+), 67 deletions(-) diff --git a/doc/DEPLOYMENT.md b/doc/DEPLOYMENT.md index d89165049..265f5b278 100644 --- a/doc/DEPLOYMENT.md +++ b/doc/DEPLOYMENT.md @@ -58,7 +58,8 @@ GOTRUE_JWT_SECRET=hello456 # or else no user will be able to be authenticated GOTRUE_MAILER_AUTOCONFIRM=true -# if you enable mail confirmation, you need to set the SMTP configuration below +# If you require mail confirmation, you need to set the SMTP configuration below +# and set `GOTRUE_MAILER_AUTOCONFIRM` to be false GOTRUE_SMTP_HOST=smtp.gmail.com GOTRUE_SMTP_PORT=465 GOTRUE_SMTP_USER=user1@example.com @@ -114,9 +115,19 @@ GOTRUE_EXTERNAL_DISCORD_SECRET=your-discord-secret GOTRUE_EXTERNAL_DISCORD_REDIRECT_URI=http://your-host/gotrue/callback ``` -### 3. Running the services +### 3. Optional Services +Some services in `docker-compose.yml` are optinal and can be commented out if you dont need them, the will be marked as `Optional` +- `pgadmin` (Web UI configured easy view into deployed postgres database) +- `portainer`/`portainer_init` (Web UI for providing some monitoring and ease of container management) +- `tunnel` (cloud flare tunnel: provide secure way to connect appflowy to Cloudflare without a publicly routable IP address) +- `admin_frontend` (admin portal to manage accounts and adding authentication method, recommended to keep) +If you did not deploy an optional component, else the nginx server will not start properly +1. comment out the corresponding `depends_on` in `nginx` service in file `docker-compose.yml` +2. comment out the corresponding `location` section in file `nginx/nginx.conf` -### Start and run AppFlowy-Cloud +### 4. Running the services + +#### Start and run AppFlowy-Cloud - The following command will build and start the AppFlowy-Cloud. ```bash diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 6699dd569..1aeca5ed7 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -1,13 +1,5 @@ version: '3' services: - portainer: - restart: on-failure - image: portainer/portainer-ce:latest - ports: - - 9442:9000 - volumes: - - /var/run/docker.sock:/var/run/docker.sock - minio: restart: on-failure image: minio/minio @@ -31,19 +23,6 @@ services: volumes: - ./migrations/before:/docker-entrypoint-initdb.d - pgadmin: - restart: on-failure - image: dpage/pgadmin4 - depends_on: - - postgres - environment: - - PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL} - - PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD} - ports: - - 5400:80 - volumes: - - ./docker/pgadmin/servers.json:/pgadmin4/servers.json - redis: restart: on-failure image: redis @@ -93,4 +72,26 @@ services: - GOTRUE_METRICS_ENABLED=true - GOTRUE_METRICS_EXPORTER=prometheus ports: - - 9998:9999 \ No newline at end of file + - 9998:9999 + + portainer: + restart: on-failure + image: portainer/portainer-ce:latest + ports: + - 9442:9000 + volumes: + - /var/run/docker.sock:/var/run/docker.sock + + pgadmin: + restart: on-failure + image: dpage/pgadmin4 + depends_on: + - postgres + environment: + - PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL} + - PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD} + ports: + - 5400:80 + volumes: + - ./docker/pgadmin/servers.json:/pgadmin4/servers.json + diff --git a/docker-compose.yml b/docker-compose.yml index 6085d9c84..a1c8c78bb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,40 +1,12 @@ version: '3' services: - tunnel: - image: cloudflare/cloudflared - restart: unless-stopped - command: tunnel --no-autoupdate run - environment: - - TUNNEL_TOKEN=${CLOUDFLARE_TUNNEL_TOKEN} - depends_on: - - nginx - - portainer: - restart: on-failure - image: portainer/portainer-ce:latest - ports: - - 9442:9000 - volumes: - - /var/run/docker.sock:/var/run/docker.sock - - portainer_init: - depends_on: - - portainer - image: alpine/curl - restart: on-failure - environment: - - PORTAINER_PASSWORD=${PORTAINER_PASSWORD} - volumes: - - ./docker/portainer/setup.sh:/setup.sh - command: ./setup.sh - nginx: restart: on-failure image: nginx ports: - 80:80 - 443:443 - depends_on: + depends_on: # If you did not deploy any of the services below, comment those out - minio - appflowy_cloud - gotrue @@ -45,6 +17,7 @@ services: - ./nginx/ssl/certificate.crt:/etc/nginx/ssl/certificate.crt - ./nginx/ssl/private_key.key:/etc/nginx/ssl/private_key.key + # You do not need this if you have configured to use your own s3 file storage minio: restart: on-failure image: minio/minio @@ -71,19 +44,6 @@ services: - ./migrations/before:/docker-entrypoint-initdb.d - postgres_data:/var/lib/postgresql/data - pgadmin: - restart: on-failure - image: dpage/pgadmin4 - depends_on: - - postgres - environment: - - PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL} - - PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD} - ports: - - 5400:80 - volumes: - - ./docker/pgadmin/servers.json:/pgadmin4/servers.json - redis: restart: on-failure image: redis @@ -164,6 +124,7 @@ services: ports: - 8000:8000 + # Optional admin_frontend: restart: on-failure build: @@ -175,6 +136,51 @@ services: ports: - 3000:3000 + # Optional + tunnel: + image: cloudflare/cloudflared + restart: unless-stopped + command: tunnel --no-autoupdate run + environment: + - TUNNEL_TOKEN=${CLOUDFLARE_TUNNEL_TOKEN} + depends_on: + - nginx + + # Optional + portainer: + restart: on-failure + image: portainer/portainer-ce:latest + ports: + - 9442:9000 + volumes: + - /var/run/docker.sock:/var/run/docker.sock + + # Optional + portainer_init: + depends_on: + - portainer + image: alpine/curl + restart: on-failure + environment: + - PORTAINER_PASSWORD=${PORTAINER_PASSWORD} + volumes: + - ./docker/portainer/setup.sh:/setup.sh + command: ./setup.sh + + # Optional + pgadmin: + restart: on-failure + image: dpage/pgadmin4 + depends_on: + - postgres + environment: + - PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL} + - PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD} + ports: + - 5400:80 + volumes: + - ./docker/pgadmin/servers.json:/pgadmin4/servers.json + volumes: postgres_data: minio_data: diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 62ae2ffb9..5efdb2e63 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -59,6 +59,7 @@ http { # Minio Web UI # Derive from: https://min.io/docs/minio/linux/integrations/setup-nginx-proxy-with-minio.html + # Optional Module, comment this section if you are did not deploy minio in docker-compose.yml location /minio/ { rewrite ^/minio/(.*) /$1 break; proxy_set_header Host $http_host; @@ -86,6 +87,7 @@ http { } # PgAdmin + # Optional Module, comment this section if you are did not deploy pgadmin in docker-compose.yml location /pgadmin/ { proxy_set_header X-Script-Name /pgadmin; proxy_set_header X-Scheme $scheme; @@ -95,11 +97,13 @@ http { } # Portainer + # Optional Module, comment this section if you are did not deploy portainer in docker-compose.yml location /portainer/ { proxy_pass http://portainer:9000/; } # Admin Frontend + # Optional Module, comment this section if you are did not deploy admin_frontend in docker-compose.yml location / { proxy_set_header X-Scheme $scheme; proxy_set_header Host $host;