Skip to content

Commit

Permalink
Merge pull request AppFlowy-IO#205 from AppFlowy-IO/doc/optional
Browse files Browse the repository at this point in the history
feat: update optional component of deployment
  • Loading branch information
speed2exe authored Dec 13, 2023
2 parents fe47452 + 4f63233 commit efdd35a
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 67 deletions.
17 changes: 14 additions & 3 deletions doc/DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
45 changes: 23 additions & 22 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -93,4 +72,26 @@ services:
- GOTRUE_METRICS_ENABLED=true
- GOTRUE_METRICS_EXPORTER=prometheus
ports:
- 9998:9999
- 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

90 changes: 48 additions & 42 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -164,6 +124,7 @@ services:
ports:
- 8000:8000

# Optional
admin_frontend:
restart: on-failure
build:
Expand All @@ -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:
4 changes: 4 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit efdd35a

Please sign in to comment.