diff --git a/.github/workflows/cleanup_and_maintainance.yml b/.github/workflows/cleanup_and_maintainance.yml index ca6a54e059..4b8435011f 100644 --- a/.github/workflows/cleanup_and_maintainance.yml +++ b/.github/workflows/cleanup_and_maintainance.yml @@ -33,6 +33,17 @@ jobs: keep-last: 1 prune-untagged: true + - name: "brmo-service-db older than 1 week" + uses: vlaurin/action-ghcr-prune@v0.5.0 + with: + token: ${{ secrets.GHCR_CLEANUP_PAT }} + organization: B3Partners + container: brmo-service-db + dry-run: false + keep-younger-than: 7 + keep-last: 1 + prune-untagged: true + - name: "brmo-bag2-loader older than 1 week" continue-on-error: true uses: vlaurin/action-ghcr-prune@v0.5.0 @@ -67,6 +78,17 @@ jobs: keep-last: 0 prune-untagged: true + - name: "brmo-service-db older than 4 weeks" + uses: vlaurin/action-ghcr-prune@v0.5.0 + with: + token: ${{ secrets.GHCR_CLEANUP_PAT }} + organization: B3Partners + container: brmo-service-db + dry-run: false + keep-younger-than: 28 + keep-last: 0 + prune-untagged: true + - name: "brmo-bag2-loader older than 4 weeks" continue-on-error: true uses: vlaurin/action-ghcr-prune@v0.5.0 diff --git a/.github/workflows/linux-oracle.yml b/.github/workflows/linux-oracle.yml index 71f9a5a0ce..762003edf2 100644 --- a/.github/workflows/linux-oracle.yml +++ b/.github/workflows/linux-oracle.yml @@ -1,8 +1,10 @@ name: Ubuntu Oracle build on: - - push - - pull_request + push: + branches: + - 'master' + pull_request: concurrency: # cancel on PR pushes # More info: https://stackoverflow.com/a/68422069/253468 diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index b5a998202c..11b2347c2f 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -1,8 +1,10 @@ name: 'Ubuntu PostgreSQL build' on: - - push - - pull_request + push: + branches: + - 'master' + pull_request: concurrency: # cancel on PR pushes # More info: https://stackoverflow.com/a/68422069/253468 @@ -17,7 +19,7 @@ env: jobs: build: - name: Java ${{ matrix.java }} / PostGIS ${{ matrix.postgis }} + name: "Java ${{ matrix.java }} / PostGIS ${{ matrix.postgis }}" runs-on: ubuntu-22.04 strategy: fail-fast: false @@ -29,9 +31,9 @@ jobs: postgis: # tot 11-2023 - 11-3.3-alpine - - 12-3.3-alpine - - 13-3.3-alpine - - 14-3.3-alpine + # - 12-3.3-alpine + # - 13-3.3-alpine + # - 14-3.3-alpine - 15-3.3-alpine steps: @@ -180,6 +182,38 @@ jobs: run: mvn -B -V -fae -DskipQA=false -Dfmt.action=check -Dpom.fmt.action=verify -Ddocker.skip=true -Dtest.onlyITs= -Dmaven.test.skip=true clean package + deploy: + name: 'Deploy docker images' + if: ${{ github.repository == 'B3Partners/brmo' && github.ref == 'refs/heads/main' && github.event_name == 'push' }} + needs: [build, qacheck] + runs-on: ubuntu-22.04 + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v3 + with: + lfs: false + + - name: 'Set up JDK' + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 11 + cache: 'maven' + server-id: 'ghcr.io' + server-username: GITHUB_ACTOR + server-password: GITHUB_TOKEN + + - name: 'Build and Push docker images' + env: + GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + mvn -pl docker,datamodel -am -Dmaven.test.skip=true -Dtest.onlyITs= -B -V -fae -DskipQA=true -Ddocker.skip=true install + mvn -pl docker -Dmaven.test.skip=true -Dtest.onlyITs= -B -V -fae -DskipQA=true deploy + + cleanup: name: 'Maven cache cleanup' if: ${{ always() }} diff --git a/.github/workflows/upgrade-oracle.yml b/.github/workflows/upgrade-oracle.yml index f6303a09b8..dbfe9e803d 100644 --- a/.github/workflows/upgrade-oracle.yml +++ b/.github/workflows/upgrade-oracle.yml @@ -1,7 +1,10 @@ name: Oracle Database Upgrade on: - - push + push: + branches: + - 'master' + pull_request: concurrency: # cancel on PR pushes # More info: https://stackoverflow.com/a/68422069/253468 diff --git a/.github/workflows/upgrade-pgsql.yml b/.github/workflows/upgrade-pgsql.yml index 41a94aead2..26fef7bc15 100644 --- a/.github/workflows/upgrade-pgsql.yml +++ b/.github/workflows/upgrade-pgsql.yml @@ -1,7 +1,10 @@ name: 'PostgreSQL Database Upgrade' on: - - push + push: + branches: + - 'master' + pull_request: concurrency: # cancel on PR pushes # More info: https://stackoverflow.com/a/68422069/253468 diff --git a/bag2-loader/Dockerfile b/bag2-loader/Dockerfile index 10e996379f..1411c2e742 100644 --- a/bag2-loader/Dockerfile +++ b/bag2-loader/Dockerfile @@ -6,7 +6,7 @@ FROM eclipse-temurin:11.0.17_8-jre LABEL org.opencontainers.image.source=https://github.com/b3partners/brmo/bag2-loader -ARG BRMO_VERSION=2.3.3-SNAPSHOT +ARG BRMO_VERSION=3.0.0-SNAPSHOT ARG DEBIAN_FRONTEND="noninteractive" ARG TZ="Europe/Amsterdam" diff --git a/bag2-loader/pom.xml b/bag2-loader/pom.xml index 074f792a60..057cdba61e 100644 --- a/bag2-loader/pom.xml +++ b/bag2-loader/pom.xml @@ -295,27 +295,27 @@ SPDX-License-Identifier: MIT - - windows - - - Windows - - - - - - - io.fabric8 - docker-maven-plugin - - false - true - - - - - + + + + + + + + + + + + + + + + + + + + + postgresql diff --git a/bgt-loader/Dockerfile b/bgt-loader/Dockerfile index d74d28cd69..5e0cee23e2 100644 --- a/bgt-loader/Dockerfile +++ b/bgt-loader/Dockerfile @@ -6,7 +6,7 @@ FROM eclipse-temurin:11.0.17_8-jre LABEL org.opencontainers.image.source=https://github.com/b3partners/brmo/bgt-citygml-loader -ARG BRMO_VERSION=2.3.3-SNAPSHOT +ARG BRMO_VERSION=3.0.0-SNAPSHOT ARG DEBIAN_FRONTEND="noninteractive" ARG TZ="Europe/Amsterdam" diff --git a/bgt-loader/pom.xml b/bgt-loader/pom.xml index a3f3f03bed..702ec679d7 100644 --- a/bgt-loader/pom.xml +++ b/bgt-loader/pom.xml @@ -341,26 +341,26 @@ SPDX-License-Identifier: MIT - - windows - - - Windows - - - - - - - io.fabric8 - docker-maven-plugin - - false - true - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/brmo-dist/pom.xml b/brmo-dist/pom.xml index 2fc295f54e..b342306db4 100644 --- a/brmo-dist/pom.xml +++ b/brmo-dist/pom.xml @@ -11,6 +11,12 @@ BRMO distributie Distributie zipfile van de B3Partners BRMO applicaties + + nl.b3p + datamodel + ${project.version} + pom + nl.b3p brmo-proxyservice diff --git a/docker/README.md b/docker/README.md index c74aaadb1f..e122499c69 100644 --- a/docker/README.md +++ b/docker/README.md @@ -18,13 +18,13 @@ mvn clean deploy Start een stack met de bijvoorbeeld volgende command line: ```shell -docker compose --env-file /home/mark/dev/projects/brmo/docker/localhost.env \ - -f /home/mark/dev/projects/brmo/docker/docker-compose.yml \ - -f /home/mark/dev/projects/brmo/docker/docker-compose-ports.yml \ - -p brmo-service up --always-recreate-deps --remove-orphans -d --build +docker compose --env-file docker/localhost.env \ + -f docker/docker-compose.yml \ + -f docker/docker-compose-ports.yml \ + -p brmo-service up --always-recreate-deps --remove-orphans -d ``` -Het default password dient te worden aangepast voordat er data wordt geladen. +Het default password van de brmo-service dient te worden aangepast voordat er data wordt geladen. Gebruik de procedure op https://github.com/B3Partners/brmo/wiki/update-wachtwoord-procedure#versies-vanaf-210 ```shell diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 69f24666c6..a6105a808d 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -8,9 +8,7 @@ volumes: services: db: - build: - context: ./src/main/docker - dockerfile: pg_conf/Dockerfile + image: ghcr.io/b3partners/brmo-service-db:${BRMO_VERSION:-snapshot} shm_size: '2gb' command: > -c shared_buffers=8GB @@ -31,9 +29,6 @@ services: brmo: image: ghcr.io/b3partners/brmo-service:${BRMO_VERSION:-snapshot} - build: - context: ./src/main/docker - dockerfile: Dockerfile shm_size: '512mb' volumes: - brmo-logs:/usr/local/tomcat/logs diff --git a/docker/pom.xml b/docker/pom.xml index b8cb3009c0..d430874a97 100644 --- a/docker/pom.xml +++ b/docker/pom.xml @@ -60,24 +60,35 @@ ghcr.io/b3partners/brmo-service:snapshot + . Dockerfile ${project.version} + + ghcr.io/b3partners/brmo-service-db:snapshot + + . + pg_conf/Dockerfile + + ${project.version} + + + - docker-build + default-build build package - docker-push + default-push push @@ -112,12 +123,29 @@ ghcr.io/b3partners/brmo-service:%l + + . + Dockerfile + + ${project.version} + + + + + ghcr.io/b3partners/brmo-service-db:%l + + . + pg_conf/Dockerfile + + ${project.version} + + - docker-tag + tag-latest tag @@ -128,7 +156,7 @@ - docker-push-latest + push-latest push @@ -139,6 +167,9 @@ ghcr.io/b3partners/brmo-service:latest + + ghcr.io/b3partners/brmo-service-db:latest + @@ -147,26 +178,5 @@ - - windows - - - Windows - - - - - - - io.fabric8 - docker-maven-plugin - - false - true - - - - - diff --git a/docker/src/main/docker/Dockerfile b/docker/src/main/docker/Dockerfile index 95557c6a05..6a3aed39fd 100644 --- a/docker/src/main/docker/Dockerfile +++ b/docker/src/main/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM tomcat:9.0.70-jre11-temurin +FROM tomcat:9.0.71-jre11-temurin ARG TZ="Europe/Amsterdam" ARG DEBIAN_FRONTEND="noninteractive" @@ -20,6 +20,7 @@ LABEL org.opencontainers.image.authors="support@b3partners.nl" \ org.opencontainers.image.title="BRMO service" \ org.opencontainers.image.documentation="https://github.com/B3Partners/brmo/wiki" \ org.opencontainers.image.licenses="GNU General Public License v3.0" \ + org.opencontainers.image.source="https://github.com/B3Partners/brmo" \ org.opencontainers.image.version=${BRMO_VERSION} SHELL ["/bin/bash", "-eux", "-o", "pipefail", "-c"] @@ -31,6 +32,10 @@ RUN set -eux;ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/t && mkdir -p /opt/brmo-data/TOPNL/Top100NL/ \ && mkdir -p /opt/brmo-data/TOPNL/Top250NL/ \ && mkdir -p /opt/brmo-data/sqlscripts/ \ + && chown -R www-data:www-data /usr/local/tomcat/webapps \ + && chown -R www-data:www-data /usr/local/tomcat/logs \ +# && chown -R www-data:www-data /usr/local/tomcat/conf/Catalina/localhost \ + && chown -R www-data:www-data /opt/brmo-data \ && apt-get update \ && apt-get install -y --no-install-recommends postgresql-client less \ && apt-get -y --purge autoremove \ @@ -54,6 +59,10 @@ COPY tomcat_conf /usr/local/tomcat/conf/ EXPOSE 8080 +WORKDIR /usr/local/tomcat + +USER www-data:www-data + HEALTHCHECK --interval=25s --timeout=5s --retries=2 CMD curl -f http://localhost:8080/brmo-service/ || exit 1 VOLUME ["/usr/local/tomcat/logs", "/opt/brmo-data"] diff --git a/docker/src/main/docker/pg_conf/Dockerfile b/docker/src/main/docker/pg_conf/Dockerfile index d777522536..7983c0910d 100644 --- a/docker/src/main/docker/pg_conf/Dockerfile +++ b/docker/src/main/docker/pg_conf/Dockerfile @@ -8,6 +8,15 @@ ARG BRMO_VERSION="3.0.0-SNAPSHOT" #ENV DB_PASS_RSGBBGT=rsgbbgt #ENV DB_PASS_TOPNL=topnl +LABEL org.opencontainers.image.authors="support@b3partners.nl" \ + org.opencontainers.image.description="BRMO services PostGIS database" \ + org.opencontainers.image.vendor="B3Partners BV" \ + org.opencontainers.image.title="BRMO service database" \ + org.opencontainers.image.documentation="https://github.com/B3Partners/brmo/wiki" \ + org.opencontainers.image.licenses="GNU General Public License v3.0" \ + org.opencontainers.image.source="https://github.com/B3Partners/brmo" \ + org.opencontainers.image.version=${BRMO_VERSION} + # get schema export from tailormap persistence RUN set -eux; \ apk upgrade --update && apk -U add --no-cache tzdata curl unzip \ diff --git a/pom.xml b/pom.xml index 7341d1ff47..a7959ca89c 100644 --- a/pom.xml +++ b/pom.xml @@ -134,6 +134,7 @@ sort false + false