Go to file
2024-11-25 13:31:32 -05:00
.gitignore Initial commit 2024-11-05 14:01:52 -05:00
deploy.env Update for version 0.7.22 2024-11-25 13:31:32 -05:00
docker-compose.yml Update for version 0.7.22 2024-11-25 13:31:32 -05:00
README.md Update README for SSL 2024-11-05 14:53:29 -05:00

Self-Hosted AppFlowy Cloud Setup Guide

This guide will help you set up your own instance of AppFlowy Cloud.

Prerequisites

  • Docker and Docker Compose
  • PostgreSQL 14 or higher
  • Redis
  • Minimum 2GB RAM
  • Git

Quick Start

  1. Clone the Appflowy-Cloud repository:
git clone https://github.com/AppFlowy-IO/AppFlowy-Cloud.git
cd AppFlowy-Cloud
  1. Configure environment variables:
cp deploy.env .env

Edit the following variables in the .env file to reflect your setup:

# PostgreSQL Settings
POSTGRES_PASSWORD=

# Supabase user settings
SUPABASE_PASSWORD=

# authentication key, change this and keep the key safe and secret
# self defined key, you can use any string
GOTRUE_JWT_SECRET=

# If you want to use AWS SES, set the following variables:
GOTRUE_MAILER_AUTOCONFIRM=false
GOTRUE_SMTP_HOST=email-smtp.us-east-1.amazonaws.com
GOTRUE_SMTP_PORT=465
GOTRUE_SMTP_USER=
GOTRUE_SMTP_PASSWORD=
GOTRUE_SMTP_ADMIN_EMAIL=

# This user will be created when AppFlowy Cloud starts successfully
# You can use this user to login to the admin panel
GOTRUE_ADMIN_EMAIL=
GOTRUE_ADMIN_PASSWORD=

# Change this to your own domain where you host the docker-compose or gotrue
API_EXTERNAL_URL=

# File Storage
# This is where storage like images, files, etc. will be stored.
# By default, Minio is used as the default file storage which uses host's file system.
APPFLOWY_S3_SECRET_KEY=

# AppFlowy Cloud Mailer Configuration (same credentials as GOTRUE_SMTP_*)
APPFLOWY_MAILER_SMTP_HOST=email-smtp.us-east-1.amazonaws.com
APPFLOWY_MAILER_SMTP_PORT=465
APPFLOWY_MAILER_SMTP_USERNAME=
APPFLOWY_MAILER_SMTP_PASSWORD=

# PgAdmin
# Optional module to manage the postgres database
# You can access the pgadmin at http://your-host/pgadmin
# Refer to the APPFLOWY_DATABASE_URL for password when connecting to the database
PGADMIN_DEFAULT_EMAIL=
PGADMIN_DEFAULT_PASSWORD=

# Portainer (username: admin)
PORTAINER_PASSWORD=

# AppFlowy AI (Optional)
APPFLOWY_AI_OPENAI_API_KEY=

# AppFlowy Web (change localhost to your host address)
APPFLOWY_WEB_URL=http://localhost:3000
  1. Start the services:
docker-compose up -d
  1. Confirm that your services are running:
docker ps -a
  1. To enable SSL, you can use certbot:
sudo apt update
sudo apt install certbot
sudo certbot certonly --standalone -d yourdomain.com

This will create SSL certificates in /etc/letsencrypt/live/yourdomain.com

  1. Update your docker-compose.yml file to use these certificates by mounting the certificate and private key locations:
services:
  nginx:
    restart: on-failure
    image: nginx
    ports:
      - ${NGINX_PORT:-80}:80
      - ${NGINX_TLS_PORT:-443}:443
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf
      - /etc/letsencrypt/live/yourdomain.com/fullchain.pem:/etc/nginx/ssl/certificate.crt:ro
      - /etc/letsencrypt/live/yourdomain.com/privkey.pem:/etc/nginx/ssl/private_key.key:ro
  1. Restart your services:
docker-compose down
docker-compose up -d
  1. Set up auto renewal for the certificates with cron job:
sudo crontab -e

Add this line to run the renewal daily (it will only renew if necessary):

0 3 * * * certbot renew --quiet --deploy-hook "docker-compose restart nginx"