From 4dced587ad5404d0083e7a4e2353c205b04acdc9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Brunner?=
Date: Thu, 6 Jul 2023 09:26:25 +0200
Subject: [PATCH 1/2] Clarify the horizontal scaling documentation
---
docs/src/main/resources/templates/_main.html | 4 +
docs/src/main/resources/templates/docker.html | 45 -------
.../src/main/resources/templates/scaling.html | 115 ++++++++++++++++++
3 files changed, 119 insertions(+), 45 deletions(-)
create mode 100644 docs/src/main/resources/templates/scaling.html
diff --git a/docs/src/main/resources/templates/_main.html b/docs/src/main/resources/templates/_main.html
index 465eeb71a6..86b5587e7f 100644
--- a/docs/src/main/resources/templates/_main.html
+++ b/docs/src/main/resources/templates/_main.html
@@ -93,6 +93,10 @@
Docker
+
+
+ Horizontal scaling
+
diff --git a/docs/src/main/resources/templates/docker.html b/docs/src/main/resources/templates/docker.html
index 5360fa4fc0..c616772cb7 100644
--- a/docs/src/main/resources/templates/docker.html
+++ b/docs/src/main/resources/templates/docker.html
@@ -104,48 +104,3 @@
-
-
- Multi-instance
-
-
-
-
- In this mode several instances of the print will collaborate together to handle the print jobs. The state is
- stored in a database. You need to add the following parameters to CATALINA_OPTS:
-
-
- -Ddb.username=...
: The PostgresQL username
- -Ddb.password=...
: The PostgresQL password
- -Ddb.host=...
: The PostgresQL host name
- -Ddb.name=...
: The PostgresQL database name
- -Ddb.port=...
: The PostgresQL database port (defaults to 5432
)
-
-
-Example:
-
-
-docker run --name=mapfish-print-test --publish=8080:8080
---env=TOMCAT_LOG_TYPE=json
---env=CATALINA_OPTS="-Ddb.name=mydb -Ddb.host=myserver -Ddb.username=myuser -Ddb.password=mypwd -Ddb.port=5432"
-mydockerhub/mapfish-print:latest
-
-
-
- The necessary tables are created automatically (print_accountings, print_job_results, print_job_statuses).
- In this mode the container will wait for the database to be reachable before actually starting the tomcat
- server.
-
-
-The DB polling can be tuned with those two environment variables:
-
- -
-
PRINT_CANCEL_OLD_POLL_INTERVAL
: How often in seconds the DB is polled for jobs to be canceled
- (default=60
s)
-
-
- -
-
PRINT_POLL_INTERVAL
: How often in seconds the DB is polled for new jobs
- (default=0.5
s)
-
-
diff --git a/docs/src/main/resources/templates/scaling.html b/docs/src/main/resources/templates/scaling.html
new file mode 100644
index 0000000000..07f6bb5b4d
--- /dev/null
+++ b/docs/src/main/resources/templates/scaling.html
@@ -0,0 +1,115 @@
+
+ Introduction
+
+
+
+ The print has a state containing the job queue and each job's state. To enable horizontal scaling, these
+ states must be persisted.
+
+
+ Solution
+
+
+
+ To store the state we use a PostgreSQL database, the database connection should be configured with the
+ following Java system properties:
+
+
+
+ db.host
: The database server host name
+ db.port
: The database server port (defaults to 5432
)
+ db.username
: The username to connect to the database
+ db.password
: The password to connect to the database
+ db.name
: The name of the database
+ db.schema
: The schema to use (defaults to public
)
+
+
+
+ The schema should exist, and the necessary tables are created automatically (print_accountings
,
+ print_job_results
, print_job_statuses
). In this mode, the container will wait for
+ the database to be reachable before actually starting the tomcat server.
+
+
+The DB polling can be tuned with these two environment variables:
+
+ -
+
PRINT_CANCEL_OLD_POLL_INTERVAL
: How often in seconds the DB is polled for jobs to be canceled
+ (default=60
s)
+
+
+ -
+
PRINT_POLL_INTERVAL
: How often in seconds the DB is polled for new jobs
+ (default=0.5
s)
+
+
+
+
+ Docker
+
+
+
+ In a Docker environment, the system properties should be added in the CATALINA_OPTS
environment
+ variable Like that: -D<property name>=<property value>
.
+
+
+
+ Kubernetes
+
+
+In Kubernetes, you can reuse an environment variable with:
+
+ env:
+ - name: PROPERTY_VALUE
+ value: test
+ - name: CATALINA_OPTS
+ value: -D<property name>==$(PROPERTY_VALUE)
+
+
+The order is important.
+
+Full example where we get the database credentials from a secret:
+
+
+
+env:
+ - name: PGHOST
+ valueFrom:
+ secretKeyRef:
+ key: hostname
+ name: database-credential-secret
+ - name: PGPORT
+ valueFrom:
+ secretKeyRef:
+ key: port
+ name: database-credential-secret
+ - name: PGUSER
+ valueFrom:
+ secretKeyRef:
+ key: username
+ name: database-credential-secret
+ - name: PGPASSWORD
+ valueFrom:
+ secretKeyRef:
+ key: password
+ name: database-credential-secret
+ - name: PGDATABASE
+ valueFrom:
+ secretKeyRef:
+ key: database
+ name: database-credential-secret
+ - name: PGSCHEMA
+ value: print
+ - name: PGOPTIONS
+ value: '-c statement_timeout=30000'
+ - name: PRINT_POLL_INTERVAL
+ value: '1'
+ - name: CATALINA_OPTS
+ value: >-
+ -Ddb.host=$(PGHOST)
+ -Ddb.port=$(PGPORT)
+ -Ddb.username=$(PGUSER)
+ -Ddb.password=$(PGPASSWORD)
+ -Ddb.name=$(PGDATABASE)
+ -Ddb.schema=$(PGSCHEMA)
+
+
From 6b1461078cd4b315924970af400b8a4dd349cec3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Brunner?=
Date: Fri, 7 Jul 2023 09:45:55 +0200
Subject: [PATCH 2/2] Fix CI
---
.github/workflows/audit.yaml | 2 +-
.github/workflows/auto-review.yaml | 2 +-
.github/workflows/backport.yaml | 2 +-
.github/workflows/clean.yaml | 2 +-
.github/workflows/codeql.yaml | 45 -------------------
.../workflows/delete-old-workflows-run.yaml | 2 +-
.github/workflows/main.yaml | 2 +-
.github/workflows/pr-checks.yaml | 2 +-
.github/workflows/rebuild.yaml | 2 +-
9 files changed, 8 insertions(+), 53 deletions(-)
delete mode 100644 .github/workflows/codeql.yaml
diff --git a/.github/workflows/audit.yaml b/.github/workflows/audit.yaml
index 208a261218..484b7d6e5f 100644
--- a/.github/workflows/audit.yaml
+++ b/.github/workflows/audit.yaml
@@ -7,7 +7,7 @@ on:
jobs:
audit:
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-22.04
name: Audit
timeout-minutes: 20
diff --git a/.github/workflows/auto-review.yaml b/.github/workflows/auto-review.yaml
index 0d8dd4381e..5df8b8c8fe 100644
--- a/.github/workflows/auto-review.yaml
+++ b/.github/workflows/auto-review.yaml
@@ -11,7 +11,7 @@ on:
jobs:
auto-merge:
name: Auto reviews updates
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
diff --git a/.github/workflows/backport.yaml b/.github/workflows/backport.yaml
index 11ba6385c3..2d6c29aa4e 100644
--- a/.github/workflows/backport.yaml
+++ b/.github/workflows/backport.yaml
@@ -12,7 +12,7 @@ env:
jobs:
backport:
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-22.04
name: Backport
timeout-minutes: 5
diff --git a/.github/workflows/clean.yaml b/.github/workflows/clean.yaml
index 951ca4ff26..afe155f07b 100644
--- a/.github/workflows/clean.yaml
+++ b/.github/workflows/clean.yaml
@@ -7,7 +7,7 @@ on:
- closed
jobs:
clean:
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-22.04
name: Clean docker hub tags
timeout-minutes: 5
diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml
deleted file mode 100644
index 71f2e972da..0000000000
--- a/.github/workflows/codeql.yaml
+++ /dev/null
@@ -1,45 +0,0 @@
-name: Code scanning
-
-on:
- push:
- branches:
- - master
- - '[0-9]+.[0-9]+'
- tags:
- - '*'
- pull_request:
- schedule:
- - cron: '0 19 * * 0'
-
-env:
- HAS_SECRETS: ${{ secrets.HAS_SECRETS }}
-
-jobs:
- CodeQL-Build:
- runs-on: ubuntu-20.04
- name: Code scanning
- timeout-minutes: 15
-
- steps:
- - name: Checkout repository
- uses: actions/checkout@v3
- if: env.HAS_SECRETS == 'HAS_SECRETS'
-
- - name: Setup Java JDK
- uses: actions/setup-java@v3
- with:
- java-version: 11
- distribution: temurin
- if: env.HAS_SECRETS == 'HAS_SECRETS'
-
- - name: Initialize CodeQL
- uses: github/codeql-action/init@v2
- if: env.HAS_SECRETS == 'HAS_SECRETS'
-
- - name: Autobuild
- uses: github/codeql-action/autobuild@v2
- if: env.HAS_SECRETS == 'HAS_SECRETS'
-
- - name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v2
- if: env.HAS_SECRETS == 'HAS_SECRETS'
diff --git a/.github/workflows/delete-old-workflows-run.yaml b/.github/workflows/delete-old-workflows-run.yaml
index d07b97ca69..ca093a3877 100644
--- a/.github/workflows/delete-old-workflows-run.yaml
+++ b/.github/workflows/delete-old-workflows-run.yaml
@@ -9,7 +9,7 @@ env:
jobs:
build:
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-22.04
timeout-minutes: 25
name: Delete old workflow runs
diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml
index 133456be77..0e5e5722cb 100644
--- a/.github/workflows/main.yaml
+++ b/.github/workflows/main.yaml
@@ -17,7 +17,7 @@ permissions:
jobs:
build:
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-22.04
timeout-minutes: 30
name: Continuous integration
if: "!startsWith(github.event.head_commit.message, '[skip ci] ')"
diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml
index c731cd9c33..9bef144dfc 100644
--- a/.github/workflows/pr-checks.yaml
+++ b/.github/workflows/pr-checks.yaml
@@ -13,7 +13,7 @@ on:
jobs:
build:
name: Pull request check
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
diff --git a/.github/workflows/rebuild.yaml b/.github/workflows/rebuild.yaml
index 44a5516223..181cd986a7 100644
--- a/.github/workflows/rebuild.yaml
+++ b/.github/workflows/rebuild.yaml
@@ -6,7 +6,7 @@ on:
jobs:
rebuild:
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-22.04
timeout-minutes: 25
name: Rebuild