Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seprated env variables for specific app containers and added SSL feature using caddy #5429

Draft
wants to merge 24 commits into
base: preview
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
de2cb6b
Separated environment variables for specific app containers.
akshat5302 Aug 20, 2024
779a9c0
added caddy setup for with or without SSL
akshat5302 Aug 26, 2024
99ab338
added envs in variables file
akshat5302 Aug 26, 2024
da11073
fix: handling localhost as APP_DOMAIN
akshat5302 Aug 28, 2024
3d12305
Update variables.env
akshat5302 Aug 28, 2024
a6f8d14
fix: handling localhost as APP_DOMAIN
akshat5302 Aug 28, 2024
0741a00
Merge branch 'env-update' of https://github.com/makeplane/plane into …
akshat5302 Aug 28, 2024
f02e67a
fixed envs
akshat5302 Aug 28, 2024
83a6ba8
fixed typo changes
akshat5302 Aug 28, 2024
1968242
added release assets
mguptahub Aug 29, 2024
78edbc8
updated build.yml
mguptahub Aug 29, 2024
e13c561
Merge branch 'preview' of https://github.com/makeplane/plane into env…
mguptahub Aug 29, 2024
c8c7d43
update install.sh
mguptahub Aug 29, 2024
7b1df8f
updated selfhost README
mguptahub Sep 3, 2024
ee50529
Update selfhost README
mguptahub Sep 3, 2024
607ad3d
Merge branch 'preview' of https://github.com/makeplane/plane into env…
mguptahub Sep 3, 2024
bae525e
selfhost fix for live
mguptahub Sep 3, 2024
085fc16
AIO updates for LIVE
mguptahub Sep 3, 2024
7d4ec00
updated AIP
mguptahub Sep 3, 2024
54a83ef
add default value for CERT_EMAIL
akshat5302 Sep 6, 2024
f0ddcd7
Merge branch 'preview' of github.com:makeplane/plane into env-update
mguptahub Sep 10, 2024
5184ce6
updated branch-build
mguptahub Sep 10, 2024
c5e5b99
updated install.sh to not use release assets
mguptahub Sep 10, 2024
4a7ecfe
Merge branch 'preview' of https://github.com/makeplane/plane into env…
akshat5302 Dec 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 61 additions & 2 deletions .github/workflows/build-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,71 @@ jobs:
- name: Build and Push Plane-Proxy to Docker Hub
uses: docker/[email protected]
with:
context: ./nginx
file: ./nginx/Dockerfile
context: ./caddy
file: ./caddy/Dockerfile
platforms: ${{ env.BUILDX_PLATFORMS }}
tags: ${{ env.PROXY_TAG }}
push: true
env:
DOCKER_BUILDKIT: 1
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}

publish_assets:
if : ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
needs: [branch_build_push_web, branch_build_push_admin, branch_build_push_space, branch_build_push_apiserver, branch_build_push_proxy]
steps:
- id: checkout_files
name: Checkout Files
uses: actions/checkout@v4

- name: Update shell script branch
run: |
sed -i "s/^RELEASE_TAG=.*/RELEASE_TAG=${{ github.event.release.tag_name }}/" ./deploy/selfhost/install.sh
sed -i "s/^export APP_RELEASE=.*/export APP_RELEASE=${{ github.event.release.tag_name }}/g" ./deploy/selfhost/install.sh
sed -i "s/APP_RELEASE=stable/APP_RELEASE=${{ github.event.release.tag_name }}/g" ./deploy/selfhost/install.sh

sed -i "s/^APP_RELEASE=.*/APP_RELEASE=${{ github.event.release.tag_name }}/" ./deploy/selfhost/variables.env

echo "Release Upload URL :::: ${{ github.event.release.upload_url }}"

- name: Upload docker-compose.yaml
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./deploy/selfhost/docker-compose.yml
asset_name: docker-compose.yaml
asset_content_type: application/octet-stream

- name: Upload variables.env
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./deploy/selfhost/variables.env
asset_name: variables.env
asset_content_type: application/octet-stream

- name: Upload setup.sh
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./deploy/selfhost/install.sh
asset_name: setup.sh
asset_content_type: application/octet-stream

- name: Upload restore.sh
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./deploy/selfhost/restore.sh
asset_name: restore.sh
asset_content_type: application/octet-stream
32 changes: 32 additions & 0 deletions caddy/Caddyfile.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
(plane_proxy) {
request_body {
max_size {$FILE_SIZE_LIMIT}
}

reverse_proxy /spaces/* space:3000

reverse_proxy /god-mode/* admin:3000

reverse_proxy /api/* api:8000

reverse_proxy /auth/* api:8000

reverse_proxy /{$BUCKET_NAME}/* plane-minio:9000

reverse_proxy /* web:3000
}

{
email {$CERT_EMAIL:[email protected]}
acme_ca {$CERT_ACME_CA}
{$CERT_ACME_DNS}
servers {
max_header_size 5MB
client_ip_headers X-Forwarded-For X-Real-IP
trusted_proxies static {$TRUSTED_PROXIES:0.0.0.0/0}
}
}

{$SITE_ADDRESS} {
import plane_proxy
}
9 changes: 9 additions & 0 deletions caddy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM makeplane/caddy:latest

Check warning on line 1 in caddy/Dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

caddy/Dockerfile#L1

Using latest is prone to errors if the image will ever update. Pin the version explicitly to a release tag
mguptahub marked this conversation as resolved.
Show resolved Hide resolved

COPY ./Caddyfile.template /etc/caddy/Caddyfile

COPY ./caddy.sh /docker-entrypoint.sh

RUN chmod +x /docker-entrypoint.sh

CMD ["/docker-entrypoint.sh"]
11 changes: 11 additions & 0 deletions caddy/caddy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

if [ "$APP_DOMAIN" == "localhost" ]; then
mguptahub marked this conversation as resolved.
Show resolved Hide resolved
export SITE_ADDRESS=":${LISTEN_HTTP_PORT}"
elif [ "$SSL" == "true" ]; then
export SITE_ADDRESS="${APP_DOMAIN}:${LISTEN_HTTPS_PORT}"
else
export SITE_ADDRESS="http://${APP_DOMAIN}:${LISTEN_HTTP_PORT}"
fi

exec caddy run --config /etc/caddy/Caddyfile
32 changes: 24 additions & 8 deletions deploy/selfhost/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ Installing plane is a very easy and minimal step process.
- 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
### Downloading Latest Release

```
mkdir plane-selfhost
mkdir -p plane-selfhost && cd plane-selfhost

cd plane-selfhost
RELEASE_VERSION=<vX.XX-dev>

curl -fsSL -o setup.sh https://raw.githubusercontent.com/makeplane/plane/master/deploy/selfhost/install.sh
curl -fsSL -o setup.sh https://github.com/makeplane/plane/releases/download/${RELEASE_VERSION}/setup.sh

chmod +x setup.sh
```
Expand Down Expand Up @@ -106,11 +106,15 @@ Again the `options [1-8]` will be popped up and this time hit `8` to exit.
Before proceeding, we suggest used to review `.env` file and set the values.
Below are the most import keys you must refer to. _<span style="color: #fcba03">You can use any text editor to edit this file</span>_.

> `NGINX_PORT` - This is default set to `80`. Make sure the port you choose to use is not preoccupied. (e.g `NGINX_PORT=8080`)
> `APP_DOMAIN` - Set the Fully Qualified Domain Name here. (eg. `plane.example.com`)

> `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`)
> `LISTEN_PORT` - This is default set to `80`. Make sure the port you choose to use is not preoccupied. (e.g `LISTEN_PORT=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`)
> `LISTEN_SSL_PORT` - This is default set to `443`. Make sure the port you choose to use is not preoccupied. (e.g `LISTEN_SSL_PORT=8443`)

> `WEB_URL` - This is default set to `http://localhost`. Change this to the FQDN you plan to use along with LISTEN_PORT/LISTEN_SSL_PORT (eg. `https://plane.example.com:8443` or `http://[IP-ADDRESS]:8080`)

> `CORS_ALLOWED_ORIGINS` - This is default set to `http://${APP_DOMAIN},https://${APP_DOMAIN}`. Change this to the FQDN you plan to use along with LISTEN_PORT and LISTEN_SSL_PORT (eg. `http://plane.example.com:8080,https://plane.example.com:8443`)

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.

Expand All @@ -134,6 +138,8 @@ Select a Action you want to perform:
Action [2]: 2
```

> You can also choose to run `./setup.sh start` as direct command.

Expect something like this.
![Downloading docker images](images/download.png)

Expand Down Expand Up @@ -167,6 +173,8 @@ Select a Action you want to perform:
Action [2]: 3
```

> You can also choose to run `./setup.sh stop` as direct command.

If all goes well, you must see something like this

![Stop Services](images/stopped.png)
Expand All @@ -193,6 +201,8 @@ Select a Action you want to perform:
Action [2]: 4
```

> You can also choose to run `./setup.sh restart` as direct command.

If all goes well, you must see something like this

![Restart Services](images/restart.png)
Expand All @@ -219,6 +229,8 @@ Select a Action you want to perform:
Action [2]: 5
```

> You can also choose to run `./setup.sh upgrade` as direct command.

By choosing this, it will stop the services and then will download the latest `docker-compose.yaml` and `plane.env`.

You must expect the below message
Expand Down Expand Up @@ -253,6 +265,7 @@ Select a Action you want to perform:
Action [2]: 6
```

> You can also choose to run `./setup.sh logs` as direct command.

This will further open sub-menu with list of services
```bash
Expand Down Expand Up @@ -343,6 +356,8 @@ Select a Action you want to perform:
Action [2]: 7
```

> You can also choose to run `./setup.sh backup` as direct command.

In response, you can find the backup folder

```bash
Expand All @@ -364,7 +379,8 @@ When you want to restore the previously backed-up data, follow the instructions
1. Download the restore script using the command below. We suggest downloading it in the same folder as `setup.sh`.

```bash
curl -fsSL -o restore.sh https://raw.githubusercontent.com/makeplane/plane/master/deploy/selfhost/restore.sh
RELEASE_VERSION=<vX.XX-dev>
curl -fsSL -o restore.sh https://github.com/makeplane/plane/releases/download/${RELEASE_VERSION}/restore.sh
chmod +x restore.sh
```

Expand Down
2 changes: 1 addition & 1 deletion deploy/selfhost/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ services:
proxy:
image: ${DOCKERHUB_USER:-local}/plane-proxy:${APP_RELEASE:-latest}
build:
context: ./nginx
context: ./caddy
dockerfile: ./Dockerfile
Loading