Skip to content

Update docker compose syntax to Compose V2 and add healthchecks #1387

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

Merged
merged 3 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
56 changes: 50 additions & 6 deletions deploy/docker/docker-compose-multi.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3"
services:

##
Expand All @@ -14,11 +13,30 @@ services:
volumes:
- ./lowcoder-stacks/data/mongodb:/data/db
restart: unless-stopped
healthcheck: # https://github.com/rodrigobdz/docker-compose-healthchecks?tab=readme-ov-file#mongo
test:
[
"CMD",
"mongosh",
"--quiet",
"127.0.0.1/test",
"--eval",
"'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)'",
]
interval: 5s
timeout: 10s
retries: 10
start_period: 40s

redis:
image: redis:7-alpine
container_name: redis
restart: unless-stopped
healthcheck: # https://stackoverflow.com/a/71504657
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
interval: 1s
timeout: 3s
retries: 10


##
Expand Down Expand Up @@ -82,11 +100,20 @@ services:
LOWCODER_SUPERUSER_PASSWORD:
restart: unless-stopped
depends_on:
- mongodb
- redis
mongodb:
condition: service_healthy
restart: true
redis:
condition: service_healthy
restart: true
volumes:
- ./lowcoder-stacks:/lowcoder-stacks
- ./lowcoder-stacks/assets:/lowcoder/assets
healthcheck: #https://stackoverflow.com/questions/71101967/how-should-i-use-grep-in-docker-compose-healthcheck
test: curl -sS http://lowcoder-api-service:8080 | grep -c "Lowcoder API is up and runnig" > /dev/null
interval: 3s
timeout: 5s
retries: 10


lowcoder-node-service:
Expand All @@ -101,7 +128,14 @@ services:
LOWCODER_API_SERVICE_URL: "http://lowcoder-api-service:8080"
restart: unless-stopped
depends_on:
- lowcoder-api-service
lowcoder-api-service:
condition: service_healthy
restart: true
healthcheck: #https://stackoverflow.com/questions/71101967/how-should-i-use-grep-in-docker-compose-healthcheck
test: curl -sS http://lowcoder-node-service:6060 | grep -c "Lowcoder Node Service is up and running" > /dev/null
interval: 3s
timeout: 5s
retries: 10

##
## Start Lowcoder web frontend
Expand All @@ -120,8 +154,18 @@ services:
LOWCODER_NODE_SERVICE_URL: "http://lowcoder-node-service:6060"
restart: unless-stopped
depends_on:
- lowcoder-node-service
- lowcoder-api-service
lowcoder-node-service:
condition: service_healthy
restart: true
lowcoder-api-service:
condition: service_healthy
restart: true
volumes:
- ./lowcoder-stacks/assets:/lowcoder/assets
healthcheck:
test: curl --fail http://lowcoder-frontend:3000 || exit 1
interval: 5s
retries: 10
start_period: 10s
timeout: 10s

1 change: 0 additions & 1 deletion docs/.gitbook/assets/upgrade-mongo-4x-to-5x.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3"
services:

##
Expand Down
1 change: 0 additions & 1 deletion docs/.gitbook/assets/upgrade-mongo-5x-to-6x.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3"
services:

##
Expand Down
1 change: 0 additions & 1 deletion docs/.gitbook/assets/upgrade-mongo-6x-to-7x.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3"
services:

##
Expand Down
16 changes: 8 additions & 8 deletions docs/setup-and-run/self-hosting/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Self-hosting

In this article, you will be guided through how to host Lowcoder on your own server using Docker-Compose or Docker.
In this article, you will be guided through how to host Lowcoder on your own server using Docker Compose or Docker.

There are multiple ways of installation. We directly support:

Expand All @@ -22,7 +22,7 @@ For easy setup and deployment, we provide an [all-in-one image](https://hub.dock
#### Prerequisites

* [Docker](https://docs.docker.com/get-docker/) (version 20.10.7 or above)
* [Docker-Compose](https://docs.docker.com/compose/install/) (version 1.29.2 or above)
* [Docker Compose](https://docs.docker.com/compose/install/) (version 1.29.2 or above)

{% hint style="info" %}
Recommended system spec: 1-core CPU and 2 GB RAM.
Expand All @@ -40,7 +40,7 @@ cd lowcoder
#### Deploy

{% tabs %}
{% tab title="Docker-Compose (Recommended)" %}
{% tab title="Docker Compose (Recommended)" %}
Follow the steps below:

1. Download the configuration file by clicking [docker-compose.yml](https://github.com/lowcoder-org/lowcoder/blob/main/deploy/docker/docker-compose.yaml) or running the curl command:
Expand All @@ -54,7 +54,7 @@ curl https://raw.githubusercontent.com/lowcoder-org/lowcoder/main/deploy/docker/
2. Start the Docker container by running this command:

```bash
docker-compose up -d
docker compose up -d
```

\
Expand Down Expand Up @@ -85,13 +85,13 @@ docker run -d --name lowcoder -p 3000:3000 -v "$PWD/stacks:/lowcoder-stacks" low
#### Update to the latest version

{% tabs %}
{% tab title="Docker-Compose" %}
{% tab title="Docker Compose" %}
Run the following commands to update to the latest Lowcoder image:

```bash
docker-compose pull
docker-compose rm -fsv lowcoder
docker-compose up -d
docker compose pull
docker compose rm -fsv lowcoder
docker compose up -d
```
{% endtab %}

Expand Down
8 changes: 4 additions & 4 deletions docs/setup-and-run/self-hosting/lowcoder-version-update.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ With Docker Compose

{% tabs %}
{% tab title="All-in-one Docker image" %}
`docker-compose down`
`docker compose down`
{% endtab %}

{% tab title="Multi-Image Deployment" %}
`docker-compose -f docker-compose-multi.yaml down`
`docker compose -f docker-compose-multi.yaml down`
{% endtab %}
{% endtabs %}

Expand Down Expand Up @@ -141,11 +141,11 @@ Mind to re-connect (mount) the /lowcoder-stacks folder

{% tabs %}
{% tab title="All-in-one Docker image" %}
`docker-compose up -d`
`docker compose up -d`
{% endtab %}

{% tab title="Multi-Image Deployment" %}
`docker-compose -f docker-compose-multi.yaml up -d`
`docker compose -f docker-compose-multi.yaml up -d`
{% endtab %}
{% endtabs %}

Expand Down
8 changes: 4 additions & 4 deletions docs/setup-and-run/self-hosting/migration-from-openblocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ if not using Lowcoder v1.1.8 or the latest Openblocks released version (v1.1.8),

{% tabs %}
{% tab title="All-in-one Docker image" %}
`docker-compose down`
`docker compose down`
{% endtab %}

{% tab title="Multi-Image Deployment" %}
`docker-compose -f docker-compose-multi.yaml down`
`docker compose -f docker-compose-multi.yaml down`
{% endtab %}
{% endtabs %}

Expand Down Expand Up @@ -49,10 +49,10 @@ MONGODB_URL:

{% tabs %}
{% tab title="All-in-one Docker image" %}
`docker-compose up -d`
`docker compose up -d`
{% endtab %}

{% tab title="Multi-Image Deployment" %}
`docker-compose -f docker-compose-multi.yaml up -d`
`docker compose -f docker-compose-multi.yaml up -d`
{% endtab %}
{% endtabs %}
14 changes: 7 additions & 7 deletions docs/setup-and-run/self-hosting/update-mongodb-versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Suppose you currently run v4 and want to update to v7- these are the necessary s
Stop your Lowcoder instance and wait for it to completely stop the service.

```bash
docker-compose down
docker compose down
```

### 2) Create a Backup Copy of the **lowcoder-stacks** folder
Expand All @@ -33,7 +33,7 @@ Update MongoDB from v4 to v5
{% endfile %}

```bash
docker-compose -f upgrade-mongo-4x-to-5x.yaml up -d && sleep 30
docker compose -f upgrade-mongo-4x-to-5x.yaml up -d && sleep 30
```

### 4) Set MongoDB Compatibility-Version to 5
Expand All @@ -45,7 +45,7 @@ docker exec mongodb-5 /usr/bin/mongosh --eval 'use admin' --eval 'db.adminComman
### 5) Stop and remove MongoDB 5 Update-Container

```bash
docker-compose -f upgrade-mongo-4x-to-5x.yaml down
docker compose -f upgrade-mongo-4x-to-5x.yaml down
```

### 6) Run upgrade-mongo-5x-to-6x docker compose file
Expand All @@ -55,7 +55,7 @@ Update MongoDB from v5 to v6
{% endfile %}

```bash
docker-compose -f upgrade-mongo-5x-to-6x.yaml up -d && sleep 30
docker compose -f upgrade-mongo-5x-to-6x.yaml up -d && sleep 30
```

### 7) Set MongoDB Compatibility-Version to 6
Expand All @@ -67,7 +67,7 @@ docker exec mongodb-6 /usr/bin/mongosh --eval 'use admin' --eval 'db.adminComman
### 8) Stop and remove MongoDB 6 Update-Container 

```bash
docker-compose -f upgrade-mongo-5x-to-6x.yaml down
docker compose -f upgrade-mongo-5x-to-6x.yaml down
```

### 9) Run upgrade-mongo-6x-to-7x docker compose file
Expand All @@ -77,13 +77,13 @@ Update MongoDB from v6 to v7
{% endfile %}

```bash
docker-compose -f upgrade-mongo-6x-to-7x.yaml up -d && sleep 30
docker compose -f upgrade-mongo-6x-to-7x.yaml up -d && sleep 30
```

### 10) Stop and remove MongoDB 7 Update-Container

```bash
docker-compose -f upgrade-mongo-6x-to-7x.yaml down
docker compose -f upgrade-mongo-6x-to-7x.yaml down
```

As result your MongoDB is now updated to Version 7 without Data loss.
Loading