From 1d81feb698dffe7eeeb0f894a5a0fca4d1c9d72f Mon Sep 17 00:00:00 2001 From: Fu Zi Xiang Date: Tue, 26 Dec 2023 10:18:10 +0800 Subject: [PATCH 01/12] fix: user docker compose without hyphen --- deploy.env | 1 + doc/EC2_SELF_HOST_GUIDE.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/deploy.env b/deploy.env index c7b38f2a..701833d7 100644 --- a/deploy.env +++ b/deploy.env @@ -26,6 +26,7 @@ GOTRUE_ADMIN_PASSWORD=password # change this to your own domain where you host the docker-compose or gotrue API_EXTERNAL_URL=http://your-host +# Refer to this for details: https://github.com/AppFlowy-IO/AppFlowy-Cloud/blob/main/doc/AUTHENTICATION.md # Google OAuth2 GOTRUE_EXTERNAL_GOOGLE_ENABLED=true GOTRUE_EXTERNAL_GOOGLE_CLIENT_ID= diff --git a/doc/EC2_SELF_HOST_GUIDE.md b/doc/EC2_SELF_HOST_GUIDE.md index 7434adca..35cf63b0 100644 --- a/doc/EC2_SELF_HOST_GUIDE.md +++ b/doc/EC2_SELF_HOST_GUIDE.md @@ -85,7 +85,7 @@ If you have any questions, please feel free to reach out to us on [Discord](http 4. **Start AppFlowy Services**: Launch the services using Docker Compose: ```bash - docker-compose up -d + docker compose up -d ``` 5. **Verify Service Status**: From 04270eb2bfda7788210f19e318336a1ca650e429 Mon Sep 17 00:00:00 2001 From: Fu Zi Xiang Date: Tue, 26 Dec 2023 10:42:54 +0800 Subject: [PATCH 02/12] docs: ec2 guide simplify set up --- doc/AUTHENTICATION.md | 1 + doc/EC2_SELF_HOST_GUIDE.md | 55 +++++++++----------------------------- 2 files changed, 14 insertions(+), 42 deletions(-) diff --git a/doc/AUTHENTICATION.md b/doc/AUTHENTICATION.md index 1b83d6a6..added90e 100644 --- a/doc/AUTHENTICATION.md +++ b/doc/AUTHENTICATION.md @@ -25,6 +25,7 @@ For example, I create a project that used for localhost development. After creat ![create_credentials.png](../assets/images/create_google_credentials.png) +Under 'Application type*', select 'Web application'. The redirect URI should be `/gotrue/callback`. For example, my host server is `localhost`, so the redirect URI is `http://localhost/gotrue/callback`. ![create_client.png](../assets/images/create_google_oauth_client_id.png) diff --git a/doc/EC2_SELF_HOST_GUIDE.md b/doc/EC2_SELF_HOST_GUIDE.md index 35cf63b0..ce8697a7 100644 --- a/doc/EC2_SELF_HOST_GUIDE.md +++ b/doc/EC2_SELF_HOST_GUIDE.md @@ -17,46 +17,13 @@ If you have any questions, please feel free to reach out to us on [Discord](http - 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 +## Installing Docker Compose on Your EC2 Ubuntu Instance -1. **Update Packages**: +- Follow the official guide for docker installation on Ubuntu: [docker install guide](https://docs.docker.com/engine/install/ubuntu/#installation-methods) +- After it's installed, verify the installation: ```bash - sudo apt update - ``` - -2. **Install Prerequisites**: - ```bash - sudo apt install apt-transport-https ca-certificates curl software-properties-common - ``` - -3. **Add Docker's Official GPG Key**: - ```bash - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - - ``` - -4. **Add Docker Repository**: - ```bash - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" - ``` - -5. **Update Package Database with Docker Packages**: - ```bash - sudo apt update - ``` - -6. **Install Docker**: - ```bash - sudo apt install docker-ce - ``` - -7. **Check Docker Status**: - ```bash - sudo systemctl status docker - ``` - -8. **Add User to Docker Group** (optional, to run Docker commands without `sudo`): - ```bash - sudo usermod -aG docker ${USER} + docker compose version + # Docker Compose version v2.21.0 ``` ## Installing AppFlowy-Cloud @@ -81,17 +48,21 @@ If you have any questions, please feel free to reach out to us on [Discord](http ![img.png](../assets/images/google_callback_url.png) For detailed setup instructions, refer to the Authentication documentation. + By default, no authentication is needed to sign in. -4. **Start AppFlowy Services**: +4. **Authentication Setup**: + Configure `docker-compose.yml` by removing unneeded services such as `tunnel` (cloudflare tunnel). More details: [here](https://github.com/AppFlowy-IO/AppFlowy-Cloud/blob/main/doc/DEPLOYMENT.md#3-optional-services) + +5. **Start AppFlowy Services**: Launch the services using Docker Compose: ```bash - docker compose up -d + sudo docker compose up -d ``` -5. **Verify Service Status**: +6. **Verify Service Status**: Check that all services are running: ```bash - docker ps -a + sudo docker ps -a ``` ## Post Install From 6dedb80ec00f774d62f18e6a7268a6835b52f6f0 Mon Sep 17 00:00:00 2001 From: Fu Zi Xiang Date: Wed, 27 Dec 2023 03:42:43 +0800 Subject: [PATCH 03/12] feat: added build for gotrue image --- .github/workflows/push_latest_docker.yml | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/push_latest_docker.yml b/.github/workflows/push_latest_docker.yml index 3e461005..91bf5e6d 100644 --- a/.github/workflows/push_latest_docker.yml +++ b/.github/workflows/push_latest_docker.yml @@ -18,6 +18,20 @@ env: LATEST_TAG: latest jobs: + gotrue_image: + runs-on: ubuntu-22.04 + steps: + - name: Check out the repository + uses: actions/checkout@v3 + + - name: Build and Push GoTrue + run: | + docker compose build gotrue + docker tag appflowy-cloud-gotrue appflowyinc/gotrue:${{ env.GIT_TAG }} + echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login --username appflowyinc --password-stdin + docker push appflowyinc/gotrue:${{ env.GIT_TAG }} + docker push appflowyinc/gotrue:latest + appflowy_cloud_image: runs-on: ubuntu-22.04 env: @@ -49,7 +63,7 @@ jobs: id: vars run: | T=${GITHUB_REF#refs/*/} # Remove "refs/*/" prefix from GITHUB_REF - echo "GIT_TAG=$T" >> $GITHUB_ENV + echo "GIT_TAG=$T" >> $GITHUB_ENV - name: Extract metadata id: meta @@ -92,7 +106,7 @@ jobs: id: vars run: | T=${GITHUB_REF#refs/*/} # Remove "refs/*/" prefix from GITHUB_REF - echo "GIT_TAG=$T" >> $GITHUB_ENV + echo "GIT_TAG=$T" >> $GITHUB_ENV - name: Create and push manifest for ${{ matrix.job.image_name }}:version uses: Noelware/docker-manifest-action@master @@ -143,7 +157,7 @@ jobs: id: vars run: | T=${GITHUB_REF#refs/*/} # Remove "refs/*/" prefix from GITHUB_REF - echo "GIT_TAG=$T" >> $GITHUB_ENV + echo "GIT_TAG=$T" >> $GITHUB_ENV - name: Extract metadata id: meta @@ -187,7 +201,7 @@ jobs: id: vars run: | T=${GITHUB_REF#refs/*/} # Remove "refs/*/" prefix from GITHUB_REF - echo "GIT_TAG=$T" >> $GITHUB_ENV + echo "GIT_TAG=$T" >> $GITHUB_ENV - name: Create and push manifest for ${{ matrix.job.image_name }}:version uses: Noelware/docker-manifest-action@master @@ -205,4 +219,4 @@ jobs: - name: Logout from Docker Hub if: always() - run: docker logout \ No newline at end of file + run: docker logout From 7e7c692156b65bc3d22a414d084a7f68b46080e6 Mon Sep 17 00:00:00 2001 From: Fu Zi Xiang Date: Wed, 27 Dec 2023 03:52:11 +0800 Subject: [PATCH 04/12] fix: github tag --- .github/workflows/push_latest_docker.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push_latest_docker.yml b/.github/workflows/push_latest_docker.yml index 91bf5e6d..014d3726 100644 --- a/.github/workflows/push_latest_docker.yml +++ b/.github/workflows/push_latest_docker.yml @@ -26,10 +26,11 @@ jobs: - name: Build and Push GoTrue run: | + export TAG=${GITHUB_REF#refs/*/} docker compose build gotrue - docker tag appflowy-cloud-gotrue appflowyinc/gotrue:${{ env.GIT_TAG }} + docker tag appflowy-cloud-gotrue appflowyinc/gotrue:$TAG echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login --username appflowyinc --password-stdin - docker push appflowyinc/gotrue:${{ env.GIT_TAG }} + docker push appflowyinc/gotrue:$TAG docker push appflowyinc/gotrue:latest appflowy_cloud_image: From 689486f091534008e26a7392df74005a958a3e63 Mon Sep 17 00:00:00 2001 From: Fu Zi Xiang Date: Wed, 27 Dec 2023 03:57:38 +0800 Subject: [PATCH 05/12] fix: latest tag --- .github/workflows/push_latest_docker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/push_latest_docker.yml b/.github/workflows/push_latest_docker.yml index 014d3726..904f7e35 100644 --- a/.github/workflows/push_latest_docker.yml +++ b/.github/workflows/push_latest_docker.yml @@ -31,6 +31,7 @@ jobs: docker tag appflowy-cloud-gotrue appflowyinc/gotrue:$TAG echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login --username appflowyinc --password-stdin docker push appflowyinc/gotrue:$TAG + docker tag appflowy-cloud-gotrue appflowyinc/gotrue:latest docker push appflowyinc/gotrue:latest appflowy_cloud_image: From dc6ff036b148637012cbb05a125b3d6e94653e16 Mon Sep 17 00:00:00 2001 From: Fu Zi Xiang Date: Wed, 27 Dec 2023 05:15:40 +0800 Subject: [PATCH 06/12] feat: support arm build --- .github/workflows/push_latest_docker.yml | 25 ++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/push_latest_docker.yml b/.github/workflows/push_latest_docker.yml index 904f7e35..43433dcd 100644 --- a/.github/workflows/push_latest_docker.yml +++ b/.github/workflows/push_latest_docker.yml @@ -20,19 +20,32 @@ env: jobs: gotrue_image: runs-on: ubuntu-22.04 + strategy: + matrix: + include: + - arch: amd64 + - arch: arm64 steps: - name: Check out the repository uses: actions/checkout@v3 + - name: Set up QEMU + if: matrix.arch == 'arm64' + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + - name: Build and Push GoTrue run: | export TAG=${GITHUB_REF#refs/*/} - docker compose build gotrue - docker tag appflowy-cloud-gotrue appflowyinc/gotrue:$TAG - echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login --username appflowyinc --password-stdin - docker push appflowyinc/gotrue:$TAG - docker tag appflowy-cloud-gotrue appflowyinc/gotrue:latest - docker push appflowyinc/gotrue:latest + docker buildx build --platform linux/${{ matrix.arch }} -t appflowyinc/gotrue:${TAG} -t appflowyinc/gotrue:latest --push . appflowy_cloud_image: runs-on: ubuntu-22.04 From 1c02b3d03f29df128abd626267ca0e1d79f63fbf Mon Sep 17 00:00:00 2001 From: Fu Zi Xiang Date: Wed, 27 Dec 2023 05:39:29 +0800 Subject: [PATCH 07/12] fix: gotrue dockerfile --- .github/workflows/push_latest_docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push_latest_docker.yml b/.github/workflows/push_latest_docker.yml index 43433dcd..091a253d 100644 --- a/.github/workflows/push_latest_docker.yml +++ b/.github/workflows/push_latest_docker.yml @@ -45,7 +45,7 @@ jobs: - name: Build and Push GoTrue run: | export TAG=${GITHUB_REF#refs/*/} - docker buildx build --platform linux/${{ matrix.arch }} -t appflowyinc/gotrue:${TAG} -t appflowyinc/gotrue:latest --push . + docker buildx build --platform linux/${{ matrix.arch }} -t appflowyinc/gotrue:${TAG} -t appflowyinc/gotrue:latest -f docker/gotrue.Dockerfile --push . appflowy_cloud_image: runs-on: ubuntu-22.04 From 4bb38f7a60f46dbd42aab943b90db803e2c6a279 Mon Sep 17 00:00:00 2001 From: Fu Zi Xiang Date: Wed, 27 Dec 2023 05:46:34 +0800 Subject: [PATCH 08/12] feat: add gotrue image to docker compose --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 2f6864eb..8da5aadd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -55,6 +55,7 @@ services: build: context: . dockerfile: docker/gotrue.Dockerfile + image: appflowyinc/gotrue:${GOTRUE_VERSION:-latest} depends_on: - postgres environment: From 4b055d161b2bcbe4e7f3d13bc0b506098a0463d7 Mon Sep 17 00:00:00 2001 From: Fu Zi Xiang Date: Wed, 27 Dec 2023 06:25:37 +0800 Subject: [PATCH 09/12] fix: arm and amd arch --- .github/workflows/push_latest_docker.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/push_latest_docker.yml b/.github/workflows/push_latest_docker.yml index 091a253d..27c8b123 100644 --- a/.github/workflows/push_latest_docker.yml +++ b/.github/workflows/push_latest_docker.yml @@ -30,7 +30,6 @@ jobs: uses: actions/checkout@v3 - name: Set up QEMU - if: matrix.arch == 'arm64' uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx @@ -45,7 +44,7 @@ jobs: - name: Build and Push GoTrue run: | export TAG=${GITHUB_REF#refs/*/} - docker buildx build --platform linux/${{ matrix.arch }} -t appflowyinc/gotrue:${TAG} -t appflowyinc/gotrue:latest -f docker/gotrue.Dockerfile --push . + docker buildx build --platform linux/amd64,linux/arm64 -t appflowyinc/gotrue:${TAG} -t appflowyinc/gotrue:latest -f docker/gotrue.Dockerfile --push . appflowy_cloud_image: runs-on: ubuntu-22.04 From e17a3ec92a2f60773e134018e7372db2b93ae1e9 Mon Sep 17 00:00:00 2001 From: Fu Zi Xiang Date: Wed, 27 Dec 2023 06:28:00 +0800 Subject: [PATCH 10/12] fix: remove strategy --- .github/workflows/push_latest_docker.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/push_latest_docker.yml b/.github/workflows/push_latest_docker.yml index 27c8b123..06228119 100644 --- a/.github/workflows/push_latest_docker.yml +++ b/.github/workflows/push_latest_docker.yml @@ -20,11 +20,6 @@ env: jobs: gotrue_image: runs-on: ubuntu-22.04 - strategy: - matrix: - include: - - arch: amd64 - - arch: arm64 steps: - name: Check out the repository uses: actions/checkout@v3 From d2a957e5ff861c89b58e00466aad5eba51731d57 Mon Sep 17 00:00:00 2001 From: Fu Zi Xiang Date: Wed, 27 Dec 2023 15:15:25 +0800 Subject: [PATCH 11/12] feat: improve ec2 docs --- doc/EC2_SELF_HOST_GUIDE.md | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/doc/EC2_SELF_HOST_GUIDE.md b/doc/EC2_SELF_HOST_GUIDE.md index ce8697a7..69d8abb5 100644 --- a/doc/EC2_SELF_HOST_GUIDE.md +++ b/doc/EC2_SELF_HOST_GUIDE.md @@ -19,13 +19,25 @@ If you have any questions, please feel free to reach out to us on [Discord](http ## Installing Docker Compose on Your EC2 Ubuntu Instance -- Follow the official guide for docker installation on Ubuntu: [docker install guide](https://docs.docker.com/engine/install/ubuntu/#installation-methods) -- After it's installed, verify the installation: +1. **Follow the official guide for docker installation on Ubuntu: [docker install guide](https://docs.docker.com/engine/install/ubuntu/#installation-methods)** + +2. **After it's installed, verify the installation** ```bash docker compose version # Docker Compose version v2.21.0 ``` +3. **Ensure that the docker daemon is running** + ```bash + sudo systemctl enable --now docker + ``` + +4. **Add current user to Docker Group (optional, to run Docker commands without `sudo`)** + ```bash + sudo usermod -aG docker ${USER} + sudo systemctl restart docker + ``` + ## Installing AppFlowy-Cloud 1. **Clone Repository**: @@ -56,13 +68,13 @@ If you have any questions, please feel free to reach out to us on [Discord](http 5. **Start AppFlowy Services**: Launch the services using Docker Compose: ```bash - sudo docker compose up -d + docker compose up -d ``` 6. **Verify Service Status**: Check that all services are running: ```bash - sudo docker ps -a + docker ps -a ``` ## Post Install From a3ea420b1b9625770d68816dfcd43bd46bce0817 Mon Sep 17 00:00:00 2001 From: Fu Zi Xiang Date: Wed, 27 Dec 2023 15:30:20 +0800 Subject: [PATCH 12/12] feat: improve ec2 docs --- doc/EC2_SELF_HOST_GUIDE.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/EC2_SELF_HOST_GUIDE.md b/doc/EC2_SELF_HOST_GUIDE.md index 69d8abb5..3a9c7e1a 100644 --- a/doc/EC2_SELF_HOST_GUIDE.md +++ b/doc/EC2_SELF_HOST_GUIDE.md @@ -37,6 +37,7 @@ If you have any questions, please feel free to reach out to us on [Discord](http sudo usermod -aG docker ${USER} sudo systemctl restart docker ``` +- Logout(exit/Ctrl-D) and log back in to take effect. ## Installing AppFlowy-Cloud