# 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: ```bash git clone https://github.com/AppFlowy-IO/AppFlowy-Cloud.git cd AppFlowy-Cloud ``` 2. Configure environment variables: ```bash cp deploy.env .env ``` Edit the following variables in the `.env` file to reflect your setup: ```env # 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 ``` 3. Start the services: ```bash docker-compose up -d ``` 4. Confirm that your services are running: ```bash docker ps -a ``` 5. To enable SSL, you can use certbot: ```bash 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 6. Update your docker-compose.yml file to use these certificates by mounting the certificate and private key locations: ```yaml 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 ``` 7. Restart your services: ```bash docker-compose down docker-compose up -d ``` 8. Set up auto renewal for the certificates with cron job: ```bash sudo crontab -e ``` Add this line to run the renewal daily (it will only renew if necessary): ```bash 0 3 * * * certbot renew --quiet --deploy-hook "docker-compose restart nginx" ```