From c4f612a762412caa7bc73606f9032a2bd224a9a0 Mon Sep 17 00:00:00 2001 From: Ben Schumacher Date: Thu, 10 Apr 2025 12:09:10 +0200 Subject: [PATCH 1/9] Migrate from CircleCI to GitHub Actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove CircleCI configuration - Add GitHub Actions workflow for shellcheck 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .circleci/config.yml | 8 -------- .github/workflows/shellcheck.yml | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 8 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/shellcheck.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 6c51b3c..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,8 +0,0 @@ -version: 2.1 -orbs: - shellcheck: circleci/shellcheck@2.2.4 -workflows: - check-scripts: - jobs: - - shellcheck/check: - dir: ./scripts diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 0000000..0331383 --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -0,0 +1,18 @@ +name: ShellCheck + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + shellcheck: + name: Shellcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Run ShellCheck + uses: ludeeus/action-shellcheck@master + with: + scandir: './scripts' \ No newline at end of file From 7ee5da48c81f11389158f53921b8a1071f1bd758 Mon Sep 17 00:00:00 2001 From: Ben Schumacher Date: Thu, 10 Apr 2025 12:20:25 +0200 Subject: [PATCH 2/9] Fix ShellCheck issues in upgrade-postgres.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix variable quoting issues to prevent globbing and word splitting - Fix variable reference typo (POSTGRES_POSTGRES_NEW_VERSION → POSTGRES_NEW_VERSION) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- scripts/upgrade-postgres.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade-postgres.sh b/scripts/upgrade-postgres.sh index b1ba55b..2f5846c 100755 --- a/scripts/upgrade-postgres.sh +++ b/scripts/upgrade-postgres.sh @@ -103,7 +103,7 @@ fi if [[ $POSTGRES_UPGRADE_LINE == "" ]]; then echo "no exported POSTGRES_UPGRADE_LINE environment variable found" - echo "setting POSTGRES_UPGRADE_LINE to default $POSTGRES_OLD_VERSION-to-$POSTGRES_POSTGRES_NEW_VERSION" + echo "setting POSTGRES_UPGRADE_LINE to default $POSTGRES_OLD_VERSION-to-$POSTGRES_NEW_VERSION" echo "the POSTGRES_UPGRADE_LINE needs to match a folder found here - https://github.com/tianon/docker-postgres-upgrade" echo "it should read 'old-to-new'" POSTGRES_UPGRADE_LINE=$POSTGRES_OLD_VERSION-to-$POSTGRES_NEW_VERSION # i.e. '9.4-to-13' @@ -164,7 +164,7 @@ cp -ra "$PATH_TO_MATTERMOST_DOCKER"/volumes/db/ "$PATH_TO_MATTERMOST_DOCKER"/bac mkdir "$PATH_TO_MATTERMOST_DOCKER"/volumes/db/"$POSTGRES_OLD_VERSION" mv "$PATH_TO_MATTERMOST_DOCKER"/volumes/db/var/lib/postgresql/data/ "$PATH_TO_MATTERMOST_DOCKER"/volumes/db/"$POSTGRES_OLD_VERSION" rm -rf "$PATH_TO_MATTERMOST_DOCKER"/volumes/db/var -mkdir -p "$PATH_TO_MATTERMOST_DOCKER"/volumes/db/$POSTGRES_NEW_VERSION/data +mkdir -p "$PATH_TO_MATTERMOST_DOCKER"/volumes/db/"$POSTGRES_NEW_VERSION"/data sed -i "s/$POSTGRES_OLD_DOCKER_FROM/$POSTGRES_NEW_DOCKER_FROM/" "$PATH_TO_MATTERMOST_DOCKER"/db/Dockerfile @@ -185,7 +185,7 @@ docker run --rm \ tianon/postgres-upgrade:"$POSTGRES_UPGRADE_LINE" \ --link -cp -p "$PATH_TO_MATTERMOST_DOCKER"/volumes/db/"$POSTGRES_OLD_VERSION"/data/pg_hba.conf "$PATH_TO_MATTERMOST_DOCKER"/volumes/db/$POSTGRES_NEW_VERSION/data/ +cp -p "$PATH_TO_MATTERMOST_DOCKER"/volumes/db/"$POSTGRES_OLD_VERSION"/data/pg_hba.conf "$PATH_TO_MATTERMOST_DOCKER"/volumes/db/"$POSTGRES_NEW_VERSION"/data/ # rebuild the containers docker-compose build From 0f6a992c7af8aee3b1d283523ded64c8a9c255eb Mon Sep 17 00:00:00 2001 From: Ben Schumacher Date: Thu, 10 Apr 2025 12:25:58 +0200 Subject: [PATCH 3/9] Add Docker deployment test workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Create GitHub Actions workflow that tests Docker deployment - Test both with and without NGINX configurations - Verify containers run properly and services are accessible - Follow steps from official documentation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .github/workflows/docker-test.yml | 65 +++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/docker-test.yml diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml new file mode 100644 index 0000000..e1e00d6 --- /dev/null +++ b/.github/workflows/docker-test.yml @@ -0,0 +1,65 @@ +name: Docker Deployment Test + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test-docker-deployment: + name: Test Docker Deployment + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Create required directories + run: | + mkdir -p ./volumes/app/mattermost/{config,data,logs,plugins,client/plugins,bleve-indexes} + sudo chown -R 2000:2000 ./volumes/app/mattermost + + - name: Setup environment file + run: | + cp env.example .env + sed -i 's/DOMAIN=mm.example.com/DOMAIN=localhost/g' .env + + - name: Start Mattermost without NGINX + run: | + docker compose -f docker-compose.yml -f docker-compose.without-nginx.yml up -d + + - name: Verify containers are running + run: | + sleep 30 + docker ps + docker compose ps + + - name: Check Mattermost container logs + run: | + docker compose logs app + + - name: Verify Mattermost API is accessible + run: | + curl -f --retry 10 --retry-delay 5 --retry-connrefused http://localhost:8065/api/v4/system/ping || exit 1 + + - name: Stop containers + run: | + docker compose down + + - name: Test with NGINX deployment + run: | + docker compose -f docker-compose.yml -f docker-compose.nginx.yml up -d + + - name: Verify NGINX containers are running + run: | + sleep 30 + docker ps + docker compose ps + + - name: Verify NGINX serves Mattermost + run: | + curl -f --retry 10 --retry-delay 5 --retry-connrefused http://localhost || exit 1 + + - name: Stop all containers + run: | + docker compose down + if: always() \ No newline at end of file From d3bfab3d1977534db29deb924052cdfae61118c1 Mon Sep 17 00:00:00 2001 From: Ben Schumacher Date: Thu, 10 Apr 2025 12:29:30 +0200 Subject: [PATCH 4/9] Remove app logs check from Docker test workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove the step that was checking logs for a service named 'app' - Fix CI failure due to 'no such service: app' error 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .github/workflows/docker-test.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml index e1e00d6..54a6091 100644 --- a/.github/workflows/docker-test.yml +++ b/.github/workflows/docker-test.yml @@ -33,10 +33,6 @@ jobs: docker ps docker compose ps - - name: Check Mattermost container logs - run: | - docker compose logs app - - name: Verify Mattermost API is accessible run: | curl -f --retry 10 --retry-delay 5 --retry-connrefused http://localhost:8065/api/v4/system/ping || exit 1 From 48660b33d304d63811a6e56e73c4e5189979e167 Mon Sep 17 00:00:00 2001 From: Ben Schumacher Date: Thu, 10 Apr 2025 12:33:09 +0200 Subject: [PATCH 5/9] Fix Docker test workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add generation of self-signed certificates for NGINX - Update log checking to use service names from docker-compose: mattermost, postgres, nginx - Fix HTTPS test with -k flag for self-signed certificate 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .github/workflows/docker-test.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml index 54a6091..5638fbc 100644 --- a/.github/workflows/docker-test.yml +++ b/.github/workflows/docker-test.yml @@ -22,6 +22,13 @@ jobs: run: | cp env.example .env sed -i 's/DOMAIN=mm.example.com/DOMAIN=localhost/g' .env + # Create required certificates directory + mkdir -p ./volumes/web/cert + # Generate self-signed certificate for testing + openssl req -x509 -nodes -days 365 -newkey rsa:2048 \ + -keyout ./volumes/web/cert/key-no-password.pem \ + -out ./volumes/web/cert/cert.pem \ + -subj "/CN=localhost" -addext "subjectAltName=DNS:localhost" - name: Start Mattermost without NGINX run: | @@ -33,6 +40,11 @@ jobs: docker ps docker compose ps + - name: Check service logs + run: | + docker compose logs mattermost --tail 20 + docker compose logs postgres --tail 20 + - name: Verify Mattermost API is accessible run: | curl -f --retry 10 --retry-delay 5 --retry-connrefused http://localhost:8065/api/v4/system/ping || exit 1 @@ -51,9 +63,13 @@ jobs: docker ps docker compose ps + - name: Check NGINX logs + run: | + docker compose logs nginx --tail 20 + - name: Verify NGINX serves Mattermost run: | - curl -f --retry 10 --retry-delay 5 --retry-connrefused http://localhost || exit 1 + curl -f -k --retry 10 --retry-delay 5 --retry-connrefused https://localhost || exit 1 - name: Stop all containers run: | From bb896795f2c1fffcb912736eb3f5d690f749f63b Mon Sep 17 00:00:00 2001 From: Ben Schumacher Date: Thu, 10 Apr 2025 12:38:38 +0200 Subject: [PATCH 6/9] Simplify Docker test workflow to only test without NGINX --- .github/workflows/docker-test.yml | 39 ++++--------------------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml index 5638fbc..df232b2 100644 --- a/.github/workflows/docker-test.yml +++ b/.github/workflows/docker-test.yml @@ -22,56 +22,27 @@ jobs: run: | cp env.example .env sed -i 's/DOMAIN=mm.example.com/DOMAIN=localhost/g' .env - # Create required certificates directory - mkdir -p ./volumes/web/cert - # Generate self-signed certificate for testing - openssl req -x509 -nodes -days 365 -newkey rsa:2048 \ - -keyout ./volumes/web/cert/key-no-password.pem \ - -out ./volumes/web/cert/cert.pem \ - -subj "/CN=localhost" -addext "subjectAltName=DNS:localhost" - name: Start Mattermost without NGINX run: | + # Configure docker-compose to use without-nginx setup docker compose -f docker-compose.yml -f docker-compose.without-nginx.yml up -d - name: Verify containers are running run: | + # Allow time for containers to start sleep 30 docker ps docker compose ps - - name: Check service logs + - name: Check container logs run: | + # Check logs for any issues docker compose logs mattermost --tail 20 docker compose logs postgres --tail 20 - - - name: Verify Mattermost API is accessible - run: | - curl -f --retry 10 --retry-delay 5 --retry-connrefused http://localhost:8065/api/v4/system/ping || exit 1 - name: Stop containers run: | - docker compose down - - - name: Test with NGINX deployment - run: | - docker compose -f docker-compose.yml -f docker-compose.nginx.yml up -d - - - name: Verify NGINX containers are running - run: | - sleep 30 - docker ps - docker compose ps - - - name: Check NGINX logs - run: | - docker compose logs nginx --tail 20 - - - name: Verify NGINX serves Mattermost - run: | - curl -f -k --retry 10 --retry-delay 5 --retry-connrefused https://localhost || exit 1 - - - name: Stop all containers - run: | + # Clean up containers docker compose down if: always() \ No newline at end of file From aa811e1cbb14d6ea15f780ccc4751f49da8e49b6 Mon Sep 17 00:00:00 2001 From: Ben Schumacher Date: Thu, 10 Apr 2025 12:41:59 +0200 Subject: [PATCH 7/9] Add API accessibility check to Docker test workflow --- .github/workflows/docker-test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml index df232b2..6ac639e 100644 --- a/.github/workflows/docker-test.yml +++ b/.github/workflows/docker-test.yml @@ -41,6 +41,11 @@ jobs: docker compose logs mattermost --tail 20 docker compose logs postgres --tail 20 + - name: Verify Mattermost API is accessible + run: | + # Check that API is responding + curl -f --retry 10 --retry-delay 5 --retry-connrefused http://localhost:8065/api/v4/system/ping || exit 1 + - name: Stop containers run: | # Clean up containers From 7e0cc8502aa308dd047f8a2642becc12c3f02397 Mon Sep 17 00:00:00 2001 From: Ben Schumacher Date: Thu, 10 Apr 2025 12:44:55 +0200 Subject: [PATCH 8/9] Add Docker Compose validation job to workflow --- .github/workflows/docker-test.yml | 43 +++++++++++++++++++++++-------- .github/workflows/shellcheck.yml | 6 ++--- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml index 6ac639e..d295f8f 100644 --- a/.github/workflows/docker-test.yml +++ b/.github/workflows/docker-test.yml @@ -1,53 +1,74 @@ -name: Docker Deployment Test +name: Docker Test on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: + validate-compose-files: + name: Validate Docker Compose Files + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Setup environment file + run: | + cp env.example .env + + - name: Validate base docker-compose file + run: docker compose config + + - name: Validate docker-compose with NGINX + run: | + docker compose -f docker-compose.yml -f docker-compose.nginx.yml config + + - name: Validate docker-compose without NGINX + run: docker compose -f docker-compose.yml -f docker-compose.without-nginx.yml config + test-docker-deployment: name: Test Docker Deployment runs-on: ubuntu-latest + needs: validate-compose-files steps: - uses: actions/checkout@v3 - + - name: Create required directories run: | mkdir -p ./volumes/app/mattermost/{config,data,logs,plugins,client/plugins,bleve-indexes} sudo chown -R 2000:2000 ./volumes/app/mattermost - + - name: Setup environment file run: | cp env.example .env sed -i 's/DOMAIN=mm.example.com/DOMAIN=localhost/g' .env - + - name: Start Mattermost without NGINX run: | # Configure docker-compose to use without-nginx setup docker compose -f docker-compose.yml -f docker-compose.without-nginx.yml up -d - + - name: Verify containers are running run: | # Allow time for containers to start sleep 30 docker ps docker compose ps - + - name: Check container logs run: | # Check logs for any issues docker compose logs mattermost --tail 20 docker compose logs postgres --tail 20 - + - name: Verify Mattermost API is accessible run: | # Check that API is responding curl -f --retry 10 --retry-delay 5 --retry-connrefused http://localhost:8065/api/v4/system/ping || exit 1 - + - name: Stop containers run: | # Clean up containers docker compose down - if: always() \ No newline at end of file + if: always() diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index 0331383..3b1da38 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -2,9 +2,9 @@ name: ShellCheck on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: shellcheck: @@ -15,4 +15,4 @@ jobs: - name: Run ShellCheck uses: ludeeus/action-shellcheck@master with: - scandir: './scripts' \ No newline at end of file + scandir: "./scripts" From 157e8f010c1bc5e2ac277fc003c5b498c4bed7b7 Mon Sep 17 00:00:00 2001 From: Ben Schumacher Date: Mon, 21 Jul 2025 13:35:59 +0200 Subject: [PATCH 9/9] Update readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b82b32f..9309c47 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # Mattermost Docker [![ShellCheck](https://github.com/mattermost/docker/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/mattermost/docker/actions/workflows/shellcheck.yml) +[![Docker Test](https://github.com/mattermost/docker/actions/workflows/docker-test.yml/badge.svg)](https://github.com/mattermost/docker/actions/workflows/docker-test.yml) The official Docker deployment solution for Mattermost.