4.7 KiB
Installing AppFlowy-Cloud on an AWS EC2 Ubuntu Instance
This guide provides a step-by-step process for setting up an EC2 instance, installing Docker on Ubuntu, and deploying AppFlowy-Cloud, along with some optional Docker maintenance commands.
Only for demonstration purposes, we will be using a free-tier EC2 instance. However, we recommend using a paid instance for production deployments. If you have any questions, please feel free to reach out to us on Discord.
Setting Up an EC2 Instance
- Launch an EC2 Instance:
- Visit the Amazon EC2 console.
- Select your preferred AWS Region.
- Choose "Launch instance" from the EC2 dashboard.
- Optionally, under "Name and tags," provide a name for your instance.
- For "Application and OS Images (Amazon Machine Image)," select "Quick Start" and choose Ubuntu.
- In "Key pair (login)," select an existing key pair or create a new one.
- Review and launch the instance from the Summary panel.
Installing Docker on Your EC2 Ubuntu Instance
-
Update Packages:
sudo apt update -
Install Prerequisites:
sudo apt install apt-transport-https ca-certificates curl software-properties-common -
Add Docker's Official GPG Key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - -
Add Docker Repository:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" -
Update Package Database with Docker Packages:
sudo apt update -
Install Docker:
sudo apt install docker-ce -
Check Docker Status:
sudo systemctl status docker -
Add User to Docker Group (optional, to run Docker commands without
sudo):sudo usermod -aG docker ${USER}
Installing AppFlowy-Cloud
-
Clone Repository: Access your EC2 instance and clone the AppFlowy-Cloud repository:
git clone https://github.com/AppFlowy-IO/AppFlowy-Cloud cd AppFlowy-Cloud -
Configuration Setup: Create a
.envfile from the template. There will be values in the.envthat needs to be change according to your needs Kindly read the comments in.envfile.cp dev.env .env -
Mailer Configuration: Set up auto-confirmation for the Gotrue mailer in the
.envfile:echo "GOTRUE_MAILER_AUTOCONFIRM=true" >> .env -
Authentication Setup: Update OAuth redirect URIs in
.envwith your EC2 Public IPv4 DNS, e.g.,http:ec2-13-228-28-244.ap-southeast-1.compute.amazonaws.com/callback. Refer to the Authentication documentation for detailed setup instructions. -
Start AppFlowy Services: Launch the services using Docker Compose:
docker-compose up -d -
Verify Service Status: Check that all services are running:
docker ps -a
Configuring Environment Secrets for AppFlowy-Cloud Client
Once you've successfully set up AppFlowy Cloud on your server, the next step is to configure the environment secrets for the AppFlowy-Cloud client. These settings are crucial for the client to communicate with your self-hosted server.
-
Verify Server Functionality:
- Ensure that your AppFlowy Cloud server is up and running without any issues.
-
Copy Configuration URLs:
- Use the following URLs as your environment secrets. These URLs correspond to the services running on your EC2 instance:
APPFLOWY_CLOUD_BASE_URL:http://ec2-13-228-28-244.ap-southeast-1.compute.amazonaws.com:8000APPFLOWY_CLOUD_WS_BASE_URL:ws://ec2-13-228-28-244.ap-southeast-1.compute.amazonaws.com:8000/wsAPPFLOWY_CLOUD_GOTRUE_URL:http://ec2-13-228-28-244.ap-southeast-1.compute.amazonaws.com:9998
- Use the following URLs as your environment secrets. These URLs correspond to the services running on your EC2 instance:
-
Configure the Client:
- Return to the Building AppFlowy with a Self-hosted Server guide.
- Follow the instructions to input these URLs into the appropriate fields in your AppFlowy-Cloud client's environment settings.
Additional Docker Commands (Optional)
These commands are helpful for Docker maintenance but use them with caution as they can affect your Docker setup.
-
Remove All Docker Containers:
docker rm -f $(sudo docker ps -a) -
Restart Docker Service:
sudo systemctl restart docker -
Clean Up Docker (excluding volumes):
docker system prune -af -
Remove Docker Volumes:
docker system prune -af --volumes