diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml index 30aa4bafb..a3ca1d688 100644 --- a/.github/workflows/build-branch.yml +++ b/.github/workflows/build-branch.yml @@ -7,6 +7,7 @@ on: branches: - master - release + - preview - qa - develop @@ -23,39 +24,6 @@ jobs: - name: Check out the repo uses: actions/checkout@v3.3.0 - # - name: Set Target Branch Name on PR close - # if: ${{ github.event_name == 'pull_request' && github.event.action =='closed' }} - # run: echo "TARGET_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV - - # - name: Set Target Branch Name on other than PR close - # if: ${{ github.event_name == 'push' }} - # run: echo "TARGET_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - - - uses: ASzc/change-string-case-action@v2 - id: gh_branch_upper_lower - with: - string: ${{env.TARGET_BRANCH}} - - - uses: mad9000/actions-find-and-replace-string@2 - id: gh_branch_replace_slash - with: - source: ${{ steps.gh_branch_upper_lower.outputs.lowercase }} - find: "/" - replace: "-" - - - uses: mad9000/actions-find-and-replace-string@2 - id: gh_branch_replace_dot - with: - source: ${{ steps.gh_branch_replace_slash.outputs.value }} - find: "." - replace: "" - - - uses: mad9000/actions-find-and-replace-string@2 - id: gh_branch_clean - with: - source: ${{ steps.gh_branch_replace_dot.outputs.value }} - find: "_" - replace: "" - name: Uploading Proxy Source uses: actions/upload-artifact@v3 with: @@ -87,12 +55,24 @@ jobs: !./deploy !./web outputs: - gh_branch_name: ${{ steps.gh_branch_clean.outputs.value }} + gh_branch_name: ${{ env.TARGET_BRANCH }} branch_build_push_frontend: runs-on: ubuntu-20.04 needs: [branch_build_and_push] + env: + FRONTEND_TAG: ${{ secrets.DOCKERHUB_USERNAME }}/plane-frontend-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} steps: + - name: Set Frontend Docker Tag + run: | + if [ "${{ needs.branch_build_and_push.outputs.gh_branch_name }}" = "master" ]; then + TAG=${{ secrets.DOCKERHUB_USERNAME }}/plane-frontend-private:latest" + elif [ "${{ needs.branch_build_and_push.outputs.gh_branch_name }}" = "release" ] || [ "${{ needs.branch_build_and_push.outputs.gh_branch_name }}" = "preview" ]; then + TAG=${{ secrets.DOCKERHUB_USERNAME }}/plane-frontend-private:preview,${{ secrets.DOCKERHUB_USERNAME }}/plane-frontend:preview" + else + TAG=${{ env.FRONTEND_TAG }}" + fi + echo "FRONTEND_TAG=${TAG}" >> $GITHUB_ENV - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2.5.0 @@ -112,7 +92,7 @@ jobs: context: . file: ./web/Dockerfile.web platforms: linux/amd64 - tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-frontend-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} + tags: ${{ env.FRONTEND_TAG }} push: true env: DOCKER_BUILDKIT: 1 @@ -122,7 +102,19 @@ jobs: branch_build_push_space: runs-on: ubuntu-20.04 needs: [branch_build_and_push] + env: + SPACE_TAG: ${{ secrets.DOCKERHUB_USERNAME }}/plane-space-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} steps: + - name: Set Space Docker Tag + run: | + if [ "${{ needs.branch_build_and_push.outputs.gh_branch_name }}" = "master" ]; then + TAG=${{ secrets.DOCKERHUB_USERNAME }}/plane-space:latest" + elif [ "${{ needs.branch_build_and_push.outputs.gh_branch_name }}" = "release" ] || [ "${{ needs.branch_build_and_push.outputs.gh_branch_name }}" = "preview" ]; then + TAG=${{ secrets.DOCKERHUB_USERNAME }}/plane-space-private:preview,${{ secrets.DOCKERHUB_USERNAME }}/plane-space:preview" + else + TAG=${{ env.SPACE_TAG }}" + fi + echo "SPACE_TAG=${TAG}" >> $GITHUB_ENV - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2.5.0 @@ -142,7 +134,7 @@ jobs: context: . file: ./space/Dockerfile.space platforms: linux/amd64 - tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-space-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} + tags: ${{ env.SPACE_TAG }} push: true env: DOCKER_BUILDKIT: 1 @@ -152,7 +144,19 @@ jobs: branch_build_push_backend: runs-on: ubuntu-20.04 needs: [branch_build_and_push] + env: + BACKEND_TAG: ${{ secrets.DOCKERHUB_USERNAME }}/plane-backend-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} steps: + - name: Set Backend Docker Tag + run: | + if [ "${{ needs.branch_build_and_push.outputs.gh_branch_name }}" = "master" ]; then + TAG=${{ secrets.DOCKERHUB_USERNAME }}/plane-backend-private:latest" + elif [ "${{ needs.branch_build_and_push.outputs.gh_branch_name }}" = "release" ] || [ "${{ needs.branch_build_and_push.outputs.gh_branch_name }}" = "preview" ]; then + TAG=${{ secrets.DOCKERHUB_USERNAME }}/plane-backend-private:preview",${{ secrets.DOCKERHUB_USERNAME }}/plane-backend:preview" + else + TAG=${{ env.BACKEND_TAG }} + fi + echo "BACKEND_TAG=${TAG}" >> $GITHUB_ENV - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2.5.0 @@ -173,7 +177,7 @@ jobs: file: ./Dockerfile.api platforms: linux/amd64 push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-backend-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} + tags: ${{ env.BACKEND_TAG }} env: DOCKER_BUILDKIT: 1 DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} @@ -182,7 +186,19 @@ jobs: branch_build_push_proxy: runs-on: ubuntu-20.04 needs: [branch_build_and_push] + env: + PROXY_TAG: ${{ secrets.DOCKERHUB_USERNAME }}/plane-proxy-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} steps: + - name: Set Proxy Docker Tag + run: | + if [ "${{ needs.branch_build_and_push.outputs.gh_branch_name }}" = "master" ]; then + TAG=${{ secrets.DOCKERHUB_USERNAME }}/plane-proxy-private:latest" + elif [ "${{ needs.branch_build_and_push.outputs.gh_branch_name }}" = "release" ] || [ "${{ needs.branch_build_and_push.outputs.gh_branch_name }}" = "preview" ]; then + TAG=${{ secrets.DOCKERHUB_USERNAME }}/plane-proxy-private:preview,${{ secrets.DOCKERHUB_USERNAME }}/plane-proxy:preview" + else + TAG=${{ env.PROXY_TAG }} + fi + echo "PROXY_TAG=${TAG}" >> $GITHUB_ENV - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2.5.0 @@ -203,7 +219,7 @@ jobs: context: . file: ./Dockerfile platforms: linux/amd64 - tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-proxy-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} + tags: ${{ env.PROXY_TAG }} push: true env: DOCKER_BUILDKIT: 1 diff --git a/deploy/coolify/README.md b/deploy/coolify/README.md new file mode 100644 index 000000000..9bd11568f --- /dev/null +++ b/deploy/coolify/README.md @@ -0,0 +1,8 @@ +## Coolify Setup + +Access the `coolify-docker-compose` file [here](https://raw.githubusercontent.com/makeplane/plane/master/deploy/coolify/coolify-docker-compose.yml) or download using using below command + +``` +curl -fsSL https://raw.githubusercontent.com/makeplane/plane/master/deploy/coolify/coolify-docker-compose.yml + +``` \ No newline at end of file diff --git a/deploy/coolify/coolify-docker-compose.yml b/deploy/coolify/coolify-docker-compose.yml new file mode 100644 index 000000000..861ff3ab8 --- /dev/null +++ b/deploy/coolify/coolify-docker-compose.yml @@ -0,0 +1,238 @@ + +services: + web: + container_name: web + platform: linux/amd64 + image: makeplane/plane-frontend:latest + restart: always + command: /usr/local/bin/start.sh web/server.js web + environment: + - NEXT_PUBLIC_ENABLE_OAUTH=${NEXT_PUBLIC_ENABLE_OAUTH:-0} + - NEXT_PUBLIC_DEPLOY_URL=$SERVICE_FQDN_SPACE_8082 + depends_on: + - api + - worker + + space: + container_name: space + platform: linux/amd64 + image: makeplane/plane-space:latest + restart: always + command: /usr/local/bin/start.sh space/server.js space + environment: + - SERVICE_FQDN_SPACE_8082=/api + - NEXT_PUBLIC_ENABLE_OAUTH=${NEXT_PUBLIC_ENABLE_OAUTH:-0} + depends_on: + - api + - worker + - web + + api: + container_name: api + platform: linux/amd64 + image: makeplane/plane-backend:latest + restart: always + command: ./bin/takeoff + environment: + - DEBUG=${DEBUG:-0} + - DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE:-plane.settings.selfhosted} + - SENTRY_DSN=${SENTRY_DSN:-""} + - PGUSER=${PGUSER:-plane} + - PGPASSWORD=${PGPASSWORD:-plane} + - PGHOST=${PGHOST:-plane-db} + - PGDATABASE=${PGDATABASE:-plane} + - DATABASE_URL=postgresql://${PGUSER}:${PGPASSWORD}@${PGHOST}/${PGDATABASE} + - REDIS_HOST=${REDIS_HOST:-plane-redis} + - REDIS_PORT=${REDIS_PORT:-6379} + - REDIS_URL=redis://${REDIS_HOST}:6379/ + - EMAIL_HOST=${EMAIL_HOST:-""} + - EMAIL_HOST_USER=${EMAIL_HOST_USER:-""} + - EMAIL_HOST_PASSWORD=${EMAIL_HOST_PASSWORD:-""} + - EMAIL_PORT=${EMAIL_PORT:-587} + - EMAIL_FROM=${EMAIL_FROM:-Team Plane } + - EMAIL_USE_TLS=${EMAIL_USE_TLS:-1} + - EMAIL_USE_SSL=${EMAIL_USE_SSL:-0} + - AWS_REGION=${AWS_REGION:-""} + - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-access-key} + - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-secret-key} + - AWS_S3_ENDPOINT_URL=${AWS_S3_ENDPOINT_URL:-http://plane-minio:9000} + - AWS_S3_BUCKET_NAME=${AWS_S3_BUCKET_NAME:-uploads} + - FILE_SIZE_LIMIT=${FILE_SIZE_LIMIT:-5242880} + - OPENAI_API_BASE=${OPENAI_API_BASE:-https://api.openai.com/v1} + - OPENAI_API_KEY=${OPENAI_API_KEY:-sk-} + - GPT_ENGINE=${GPT_ENGINE:-gpt-3.5-turbo} + - GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET:-""} + - DOCKERIZED=${DOCKERIZED:-1} + - USE_MINIO=${USE_MINIO:-1} + - NGINX_PORT=${NGINX_PORT:-8082} + - DEFAULT_EMAIL=${DEFAULT_EMAIL:-captain@plane.so} + - DEFAULT_PASSWORD=${DEFAULT_PASSWORD:-password123} + - ENABLE_SIGNUP=${ENABLE_SIGNUP:-1} + - ENABLE_EMAIL_PASSWORD=${ENABLE_EMAIL_PASSWORD:-1} + - ENABLE_MAGIC_LINK_LOGIN=${ENABLE_MAGIC_LINK_LOGIN:-0} + - SECRET_KEY=${SECRET_KEY:-60gp0byfz2dvffa45cxl20p1scy9xbpf6d8c5y0geejgkyp1b5} + - WEB_URL=$SERVICE_FQDN_PLANE_8082 + - LICENSE_ENGINE_BASE_URL=${LICENSE_ENGINE_BASE_URL:-"https://control-center.plane.so"} + depends_on: + - plane-db + - plane-redis + + worker: + container_name: bgworker + platform: linux/amd64 + image: makeplane/plane-backend:latest + restart: always + command: ./bin/worker + environment: + - DEBUG=${DEBUG:-0} + - DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE:-plane.settings.selfhosted} + - SENTRY_DSN=${SENTRY_DSN:-""} + - PGUSER=${PGUSER:-plane} + - PGPASSWORD=${PGPASSWORD:-plane} + - PGHOST=${PGHOST:-plane-db} + - PGDATABASE=${PGDATABASE:-plane} + - DATABASE_URL=postgresql://${PGUSER}:${PGPASSWORD}@${PGHOST}/${PGDATABASE} + - REDIS_HOST=${REDIS_HOST:-plane-redis} + - REDIS_PORT=${REDIS_PORT:-6379} + - REDIS_URL=redis://${REDIS_HOST}:6379/ + - EMAIL_HOST=${EMAIL_HOST:-""} + - EMAIL_HOST_USER=${EMAIL_HOST_USER:-""} + - EMAIL_HOST_PASSWORD=${EMAIL_HOST_PASSWORD:-""} + - EMAIL_PORT=${EMAIL_PORT:-587} + - EMAIL_FROM=${EMAIL_FROM:-Team Plane } + - EMAIL_USE_TLS=${EMAIL_USE_TLS:-1} + - EMAIL_USE_SSL=${EMAIL_USE_SSL:-0} + - AWS_REGION=${AWS_REGION:-""} + - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-access-key} + - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-secret-key} + - AWS_S3_ENDPOINT_URL=${AWS_S3_ENDPOINT_URL:-http://plane-minio:9000} + - AWS_S3_BUCKET_NAME=${AWS_S3_BUCKET_NAME:-uploads} + - FILE_SIZE_LIMIT=${FILE_SIZE_LIMIT:-5242880} + - OPENAI_API_BASE=${OPENAI_API_BASE:-https://api.openai.com/v1} + - OPENAI_API_KEY=${OPENAI_API_KEY:-sk-} + - GPT_ENGINE=${GPT_ENGINE:-gpt-3.5-turbo} + - GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET:-""} + - DOCKERIZED=${DOCKERIZED:-1} + - USE_MINIO=${USE_MINIO:-1} + - NGINX_PORT=${NGINX_PORT:-8082} + - DEFAULT_EMAIL=${DEFAULT_EMAIL:-captain@plane.so} + - DEFAULT_PASSWORD=${DEFAULT_PASSWORD:-password123} + - ENABLE_SIGNUP=${ENABLE_SIGNUP:-1} + - SECRET_KEY=${SECRET_KEY:-60gp0byfz2dvffa45cxl20p1scy9xbpf6d8c5y0geejgkyp1b5} + - LICENSE_ENGINE_BASE_URL=${LICENSE_ENGINE_BASE_URL:-"https://control-center.plane.so"} + depends_on: + - api + - plane-db + - plane-redis + + beat-worker: + container_name: beatworker + platform: linux/amd64 + image: makeplane/plane-backend:latest + restart: always + command: ./bin/beat + environment: + - DEBUG=${DEBUG:-0} + - DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE:-plane.settings.selfhosted} + - SENTRY_DSN=${SENTRY_DSN:-""} + - PGUSER=${PGUSER:-plane} + - PGPASSWORD=${PGPASSWORD:-plane} + - PGHOST=${PGHOST:-plane-db} + - PGDATABASE=${PGDATABASE:-plane} + - DATABASE_URL=postgresql://${PGUSER}:${PGPASSWORD}@${PGHOST}/${PGDATABASE} + - REDIS_HOST=${REDIS_HOST:-plane-redis} + - REDIS_PORT=${REDIS_PORT:-6379} + - REDIS_URL=redis://${REDIS_HOST}:6379/ + - EMAIL_HOST=${EMAIL_HOST:-""} + - EMAIL_HOST_USER=${EMAIL_HOST_USER:-""} + - EMAIL_HOST_PASSWORD=${EMAIL_HOST_PASSWORD:-""} + - EMAIL_PORT=${EMAIL_PORT:-587} + - EMAIL_FROM=${EMAIL_FROM:-Team Plane } + - EMAIL_USE_TLS=${EMAIL_USE_TLS:-1} + - EMAIL_USE_SSL=${EMAIL_USE_SSL:-0} + - AWS_REGION=${AWS_REGION:-""} + - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-access-key} + - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-secret-key} + - AWS_S3_ENDPOINT_URL=${AWS_S3_ENDPOINT_URL:-http://plane-minio:9000} + - AWS_S3_BUCKET_NAME=${AWS_S3_BUCKET_NAME:-uploads} + - FILE_SIZE_LIMIT=${FILE_SIZE_LIMIT:-5242880} + - OPENAI_API_BASE=${OPENAI_API_BASE:-https://api.openai.com/v1} + - OPENAI_API_KEY=${OPENAI_API_KEY:-sk-} + - GPT_ENGINE=${GPT_ENGINE:-gpt-3.5-turbo} + - GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET:-""} + - DOCKERIZED=${DOCKERIZED:-1} + - USE_MINIO=${USE_MINIO:-1} + - NGINX_PORT=${NGINX_PORT:-8082} + - DEFAULT_EMAIL=${DEFAULT_EMAIL:-captain@plane.so} + - DEFAULT_PASSWORD=${DEFAULT_PASSWORD:-password123} + - ENABLE_SIGNUP=${ENABLE_SIGNUP:-1} + - SECRET_KEY=${SECRET_KEY:-60gp0byfz2dvffa45cxl20p1scy9xbpf6d8c5y0geejgkyp1b5} + - LICENSE_ENGINE_BASE_URL=${LICENSE_ENGINE_BASE_URL:-"https://control-center.plane.so"} + depends_on: + - api + - plane-db + - plane-redis + + plane-db: + container_name: plane-db + image: postgres:15.2-alpine + restart: always + command: postgres -c 'max_connections=1000' + volumes: + - pgdata:/var/lib/postgresql/data + environment: + - POSTGRES_USER=${POSTGRES_USER:-plane} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-plane} + - POSTGRES_DB=${POSTGRES_DB:-plane} + - PGDATA=${PGDATA:-/var/lib/postgresql/data} + + plane-redis: + container_name: plane-redis + image: redis:6.2.7-alpine + restart: always + volumes: + - redisdata:/data + + plane-minio: + container_name: plane-minio + image: minio/minio + restart: always + command: server /export --console-address ":9090" + volumes: + - uploads:/export + environment: + - MINIO_ROOT_USER=${MINIO_ROOT_USER:-access-key} + - MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD:-secret-key} + + createbuckets: + image: minio/mc + entrypoint: > + /bin/sh -c " /usr/bin/mc config host add plane-minio http://plane-minio:9000 \$AWS_ACCESS_KEY_ID \$AWS_SECRET_ACCESS_KEY; /usr/bin/mc mb plane-minio/\$AWS_S3_BUCKET_NAME; /usr/bin/mc anonymous set download plane-minio/\$AWS_S3_BUCKET_NAME; exit 0; " + environment: + - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-access-key} + - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-secret-key} + - AWS_S3_BUCKET_NAME=${AWS_S3_BUCKET_NAME:-uploads} + depends_on: + - plane-minio + + # Comment this if you already have a reverse proxy running + proxy: + container_name: proxy + platform: linux/amd64 + image: makeplane/plane-proxy:latest + ports: + - 8082:80 + environment: + - SERVICE_FQDN_PLANE_8082 + - NGINX_PORT=${NGINX_PORT:-8082} + - FILE_SIZE_LIMIT=${FILE_SIZE_LIMIT:-5242880} + - BUCKET_NAME=${AWS_S3_BUCKET_NAME:-uploads} + depends_on: + - web + - api + - space + +volumes: + pgdata: + redisdata: + uploads: diff --git a/deploy/kubernetes/README.md b/deploy/kubernetes/README.md new file mode 100644 index 000000000..fe7991fcf --- /dev/null +++ b/deploy/kubernetes/README.md @@ -0,0 +1,8 @@ + +# Helm Chart + +Click on the below link to access the helm chart instructions. + +[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/makeplane)](https://artifacthub.io/packages/search?repo=makeplane) + + diff --git a/deploy/selfhost/README.md b/deploy/selfhost/README.md new file mode 100644 index 000000000..e36c33c76 --- /dev/null +++ b/deploy/selfhost/README.md @@ -0,0 +1,309 @@ +# Self Hosting + +In this guide, we will walk you through the process of setting up a self-hosted environment. Self-hosting allows you to have full control over your applications and data. It's a great way to ensure privacy, control, and customization. + +We will cover two main options for setting up your self-hosted environment: using a cloud server or using your desktop. For the cloud server, we will use an AWS EC2 instance. For the desktop, we will use Docker to create a local environment. + +Let's get started! + +## Setting up Docker Environment +
+ Option 1 - Using Cloud Server +

Best way to start is to create EC2 maching on AWS. It must of minimum t3.medium/t3a/medium

+

Run the below command to install docker engine.

+ + ```curl -fsSL https://get.docker.com -o install-docker.sh``` +
+ +--- + +
+ Option 2 - Using Desktop + + #### For Mac +
    +
  1. Download Docker Desktop for Mac from the Docker Hub.
  2. +
  3. Double-click the downloaded `.dmg` file and drag the Docker app icon to the Applications folder.
  4. +
  5. Open Docker Desktop from the Applications folder. You might be asked to provide your system password to install additional software.
  6. +
+ + #### For Windows: +
    +
  1. Download Docker Desktop for Windows from the Docker Hub.
  2. +
  3. Run the installer and follow the instructions. You might be asked to enable Hyper-V and "Containers" Windows features.
  4. +
  5. Open Docker Desktop. You might be asked to log out and log back in, or restart your machine, for changes to take effect.
  6. +
+ + After installation, you can verify the installation by opening a terminal (Command Prompt on Windows, Terminal app on Mac) and running the command `docker --version`. This should display the installed version of Docker. +
+ +--- + +## Installing Plane + +Installing plane is a very easy and minimal step process. + +### Prerequisite +- Docker installed and running +- OS with bash scripting enabled (Ubuntu, Linux AMI, macos). Windows systems need to have [gitbash](https://git-scm.com/download/win) +- User context used must have access to docker services. In most cases, use sudo su to switch as root user +- Use the terminal (or gitbash) window to run all the future steps + +### Downloading Latest Stable Release + +``` +mkdir plane-selfhost + +cd plane-selfhost + +curl -fsSL -o setup.sh https://raw.githubusercontent.com/makeplane/plane/master/deploy/selfhost/install.sh + +chmod +x setup.sh +``` + +
+ Downloading Preview Release + +``` +mkdir plane-selfhost + +cd plane-selfhost + +export RELEASE=preview + +curl -fsSL https://raw.githubusercontent.com/makeplane/plane/$BRANCH/deploy/selfhost/install.sh | sed 's@BRANCH=master@BRANCH='"$RELEASE"'@' > setup.sh + +chmod +x setup.sh +``` + +
+ +--- + +### Proceed with setup + +Above steps will set you ready to install and start plane services. + +Lets get started by running the `./setup.sh` command. + +This will prompt you with the below options. + +``` +Select a Action you want to perform: + 1) Install + 2) Start + 3) Stop + 4) Restart + 5) Upgrade + 6) Exit + +Action [2]: 1 +``` + +For the 1st time setup, type "1" as action input. + +This will create a create a folder `plane-app` or `plane-app-preview` (in case of preview deployment) and will download 2 files inside that +- `docker-compose.yaml` +- `.env` + +Again the `options [1-6]` will be popped up and this time hit `6` to exit. + +--- + +### Continue with setup - Environment Settings + +Before proceeding, we suggest used to review `.env` file and set the values. +Below are the most import keys you must refer to. *You can use any text editor to edit this file*. + +> `NGINX_PORT` - This is default set to `80`. Make sure the port you choose to use is not preoccupied. (e.g `NGINX_PORT=8080`) + +> `WEB_URL` - This is default set to `http://localhost`. Change this to the FQDN you plan to use along with NGINX_PORT (eg. `https://plane.example.com:8080` or `http://[IP-ADDRESS]:8080`) + +> `CORS_ALLOWED_ORIGINS` - This is default set to `http://localhost`. Change this to the FQDN you plan to use along with NGINX_PORT (eg. `https://plane.example.com:8080` or `http://[IP-ADDRESS]:8080`) + +There are many other settings you can play with, but we suggest you configure `EMAIL SETTINGS` as it will enable you to invite your teammates onto the platform. + +--- + +### Continue with setup - Start Server + +Lets again run the `./setup.sh` command. You will again be prompted with the below options. This time select `2` to start the sevices + +``` +Select a Action you want to perform: + 1) Install + 2) Start + 3) Stop + 4) Restart + 5) Upgrade + 6) Exit + +Action [2]: 2 +``` + +Expect something like this. +![Downloading docker images](images/download.png) + +Be patient as it might take sometime based on download speed and system configuration. If all goes well, you must see something like this + +![Downloading completed](images/started.png) + +This is the confirmation that all images were downloaded and the services are up & running. + +You have successfully self hosted `Plane` instance. Access the application by going to IP or domain you have configured it (e.g `https://plane.example.com:8080` or `http://[IP-ADDRESS]:8080`) + +--- + +### Stopping the Server + +In case you want to make changes to `.env` variables, we suggest you to stop the services before doing that. + +Lets again run the `./setup.sh` command. You will again be prompted with the below options. This time select `3` to stop the sevices + +``` +Select a Action you want to perform: + 1) Install + 2) Start + 3) Stop + 4) Restart + 5) Upgrade + 6) Exit + +Action [2]: 3 +``` + +If all goes well, you must see something like this + +![Stop Services](images/stopped.png) + +--- + +### Restarting the Server + +In case you want to make changes to `.env` variables, without stopping the server or you noticed some abnormalies in services, you can restart the services with RESTART option. + +Lets again run the `./setup.sh` command. You will again be prompted with the below options. This time select `4` to restart the sevices + +``` +Select a Action you want to perform: + 1) Install + 2) Start + 3) Stop + 4) Restart + 5) Upgrade + 6) Exit + +Action [2]: 4 +``` + +If all goes well, you must see something like this + +![Restart Services](images/restart.png) + +--- + +### Upgrading Plane Version + +It is always advised to keep Plane up to date with the latest release. + +Lets again run the `./setup.sh` command. You will again be prompted with the below options. This time select `5` to upgrade the release. + +``` +Select a Action you want to perform: + 1) Install + 2) Start + 3) Stop + 4) Restart + 5) Upgrade + 6) Exit + +Action [2]: 5 +``` + +By choosing this, it will stop the services and then will download the latest `docker-compose.yaml` and `variables-upgrade.env`. Here system will not replace `.env` with the new one. + +You must expect the below message + +![Alt text](images/upgrade.png) + +Once done, choose `6` to exit from prompt. + +> It is very important for you to compare the 2 files `variables-upgrade.env` and `.env`. Copy the newly added variable from downloaded file to `.env` and set the expected values. + +Once done with making changes in `.env` file, jump on to `Start Server` + + +## Upgrading from v0.13.2 to v0.14.x + +This is one time activity for users who are upgrading from v0.13.2 to v0.14.0 + +As there has been significant changes to Self Hosting process, this step mainly covers the data migration from current (v0.13.2) docker volumes from newly created volumes + +> Before we begin with migration, make sure your v0.14.0 was started and then stopped. This is required to know the newly created docker volume names. + +Begin with downloading the migration script using below command + +``` + +curl -fsSL -o migrate.sh https://raw.githubusercontent.com/makeplane/plane/master/deploy/selfhost/migration-0.13-0.14.sh + +chmod +x migrate.sh + +``` + +Now run the `./migrate.sh` command and expect the instructions as below + +``` +****************************************************************** + +This script is solely for the migration purpose only. +This is a 1 time migration of volume data from v0.13.2 => v0.14.x + +Assumption: +1. Postgres data volume name ends with _pgdata +2. Minio data volume name ends with _uploads +3. Redis data volume name ends with _redisdata + +Any changes to this script can break the migration. + +Before you proceed, make sure you run the below command +to know the docker volumes + +docker volume ls -q | grep -i "_pgdata" +docker volume ls -q | grep -i "_uploads" +docker volume ls -q | grep -i "_redisdata" + +******************************************************* + +Given below list of REDIS volumes, identify the prefix of source and destination volumes leaving "_redisdata" +--------------------- +plane-app_redisdata +v0132_redisdata + +Provide the Source Volume Prefix : +``` + +**Open another terminal window**, and run the mentioned 3 command. This may be different for users who have changed the volume names in their previous setup (v0.13.2) + +For every command you must see 2 records something like shown in above example of `redisdata` + +To move forward, you would need PREFIX of old setup and new setup. As per above example, `v0132` is the prefix of v0.13.2 and `plane-app` is the prefix of v0.14.0 setup + +**Back to original terminal window**, *Provide the Source Volume Prefix* and hit ENTER. + +Now you will be prompted to *Provide Destination Volume Prefix*. Provide the value and hit ENTER + +``` +Provide the Source Volume Prefix : v0132 +Provide the Destination Volume Prefix : plane-app +``` + +In case the suffixes are wrong or the mentioned volumes are not found, you will receive the error shown below. The image below displays an error for source volumes. + +![Migrate Error](images/migrate-error.png) + +In case of successful migration, it will be a silent exit without error. + +Now its time to restart v0.14.0 setup. + + diff --git a/deploy/selfhost/images/download.png b/deploy/selfhost/images/download.png new file mode 100644 index 000000000..bb0d1183e Binary files /dev/null and b/deploy/selfhost/images/download.png differ diff --git a/deploy/selfhost/images/migrate-error.png b/deploy/selfhost/images/migrate-error.png new file mode 100644 index 000000000..f42ec441a Binary files /dev/null and b/deploy/selfhost/images/migrate-error.png differ diff --git a/deploy/selfhost/images/restart.png b/deploy/selfhost/images/restart.png new file mode 100644 index 000000000..0387599a0 Binary files /dev/null and b/deploy/selfhost/images/restart.png differ diff --git a/deploy/selfhost/images/started.png b/deploy/selfhost/images/started.png new file mode 100644 index 000000000..d6a0a0baa Binary files /dev/null and b/deploy/selfhost/images/started.png differ diff --git a/deploy/selfhost/images/stopped.png b/deploy/selfhost/images/stopped.png new file mode 100644 index 000000000..0f5876882 Binary files /dev/null and b/deploy/selfhost/images/stopped.png differ diff --git a/deploy/selfhost/images/upgrade.png b/deploy/selfhost/images/upgrade.png new file mode 100644 index 000000000..b78fbbb60 Binary files /dev/null and b/deploy/selfhost/images/upgrade.png differ diff --git a/deploy/selfhost/install-private.sh b/deploy/selfhost/install-private.sh new file mode 100755 index 000000000..fe410d570 --- /dev/null +++ b/deploy/selfhost/install-private.sh @@ -0,0 +1,125 @@ +#!/bin/bash + +BRANCH=develop +SCRIPT_DIR=$PWD +PLANE_INSTALL_DIR=$PWD/plane-app-private + +function install(){ + echo + echo "Installing on $PLANE_INSTALL_DIR" + download +} +function download(){ + cd $SCRIPT_DIR + TS=$(date +%s) + if [ -f "$PLANE_INSTALL_DIR/docker-compose.yaml" ] + then + mv $PLANE_INSTALL_DIR/docker-compose.yaml $PLANE_INSTALL_DIR/archive/$TS.docker-compose.yaml + fi + + curl -H 'Cache-Control: no-cache, no-store' -s -o $PLANE_INSTALL_DIR/docker-compose.yaml https://raw.githubusercontent.com/makeplane/plane/$BRANCH/deploy/selfhost/docker-compose.yml?$(date +%s) + curl -H 'Cache-Control: no-cache, no-store' -s -o $PLANE_INSTALL_DIR/variables-upgrade.env https://raw.githubusercontent.com/makeplane/plane/$BRANCH/deploy/selfhost/variables.env?$(date +%s) + + if [ -f "$PLANE_INSTALL_DIR/.env" ]; + then + cp $PLANE_INSTALL_DIR/.env $PLANE_INSTALL_DIR/archive/$TS.env + else + mv $PLANE_INSTALL_DIR/variables-upgrade.env $PLANE_INSTALL_DIR/.env + fi + + cp $PLANE_INSTALL_DIR/docker-compose.yaml $PLANE_INSTALL_DIR/temp.yaml + sed -e 's@plane-frontend:@plane-frontend-private:@g' \ + -e 's@plane-space:@plane-space-private:@g' \ + -e 's@plane-backend:@plane-backend-private:@g' \ + -e 's@plane-proxy:@plane-proxy-private:@g' \ + -e 's@${APP_RELEASE:-latest}@'"$BRANCH"'@g' \ + $PLANE_INSTALL_DIR/temp.yaml > $PLANE_INSTALL_DIR/docker-compose.yaml + + rm $PLANE_INSTALL_DIR/temp.yaml + + echo "" + echo "Latest version is now available for you to use" + echo "" + echo "In case of Upgrade, your new setting file is availabe as 'variables-upgrade.env'. Please compare and set the required values in '.env 'file." + echo "" + +} +function startServices(){ + cd $PLANE_INSTALL_DIR + docker compose up -d + cd $SCRIPT_DIR +} +function stopServices(){ + cd $PLANE_INSTALL_DIR + docker compose down + cd $SCRIPT_DIR +} +function restartServices(){ + cd $PLANE_INSTALL_DIR + docker compose restart + cd $SCRIPT_DIR +} +function upgrade(){ + echo "***** STOPPING SERVICES ****" + stopServices + + echo + echo "***** DOWNLOADING LATEST VERSION ****" + download + + echo "***** PLEASE VALIDATE AND START SERVICES ****" + +} +function askForAction(){ + echo + echo "Select a Action you want to perform:" + echo " 1) Install" + echo " 2) Start" + echo " 3) Stop" + echo " 4) Restart" + echo " 5) Upgrade" + echo " 6) Exit" + echo + read -p "Action [2]: " ACTION + until [[ -z "$ACTION" || "$ACTION" =~ ^[1-6]$ ]]; do + echo "$ACTION: invalid selection." + read -p "Action [2]: " ACTION + done + echo + + + if [ "$ACTION" == "1" ] + then + install + askForAction + elif [ "$ACTION" == "2" ] || [ "$ACTION" == "" ] + then + startServices + askForAction + elif [ "$ACTION" == "3" ] + then + stopServices + askForAction + elif [ "$ACTION" == "4" ] + then + restartServices + askForAction + elif [ "$ACTION" == "5" ] + then + upgrade + askForAction + elif [ "$ACTION" == "6" ] + then + exit 0 + else + echo "INVALID ACTION SUPPLIED" + fi +} + +if [ "$BRANCH" != "master" ]; +then + PLANE_INSTALL_DIR=$PWD/plane-app-private-$(echo $BRANCH | sed -r 's@(\/|" "|\.)@-@g') +fi +mkdir -p $PLANE_INSTALL_DIR/archive + +askForAction diff --git a/deploy/selfhost/install.sh b/deploy/selfhost/install.sh index 6f1226821..645e99cb8 100755 --- a/deploy/selfhost/install.sh +++ b/deploy/selfhost/install.sh @@ -30,12 +30,7 @@ function download(){ if [ "$BRANCH" != "master" ]; then cp $PLANE_INSTALL_DIR/docker-compose.yaml $PLANE_INSTALL_DIR/temp.yaml - - sed -e 's@plane-frontend:@plane-frontend-private:@g' \ - -e 's@plane-space:@plane-space-private:@g' \ - -e 's@plane-backend:@plane-backend-private:@g' \ - -e 's@plane-proxy:@plane-proxy-private:@g' \ - -e 's@${APP_RELEASE:-latest}@'"$BRANCH"'@g' \ + sed -e 's@${APP_RELEASE:-latest}@'"$BRANCH"'@g' \ $PLANE_INSTALL_DIR/temp.yaml > $PLANE_INSTALL_DIR/docker-compose.yaml rm $PLANE_INSTALL_DIR/temp.yaml diff --git a/deploy/selfhost/variables.env b/deploy/selfhost/variables.env index c72fec098..a90a546d7 100644 --- a/deploy/selfhost/variables.env +++ b/deploy/selfhost/variables.env @@ -13,7 +13,7 @@ NEXT_PUBLIC_DEPLOY_URL=http://localhost/spaces SENTRY_DSN="" GITHUB_CLIENT_SECRET="" DOCKERIZED=1 # deprecated -CORS_ALLOWED_ORIGINS="" +CORS_ALLOWED_ORIGINS="http://localhost" SENTRY_ENVIRONMENT="production" #DB SETTINGS