Skip to content
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
143 changes: 143 additions & 0 deletions .github/workflows/install-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
name: SimpleRisk Install/Uninstall Tests

on:
push:
branches: [main, "feature/**"]
paths: &test-paths
- simplerisk-setup.sh
- tests/**
- .github/workflows/install-test.yml
pull_request:
branches: [main]
paths: *test-paths
workflow_dispatch:

jobs:
test:
name: "Test: ${{ matrix.os-slug }}"
runs-on: ubuntu-latest

strategy:
# Run all matrix jobs even if one fails so we get a full picture
fail-fast: false
matrix:
os-slug:
- ubuntu-22.04
- ubuntu-24.04
- ubuntu-26.04
- debian-13
- centos-stream-9
- centos-stream-10

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# ── Build ───────────────────────────────────────────────────────────────
- name: Build test image
run: |
docker build \
-f tests/dockerfiles/Dockerfile.${{ matrix.os-slug }} \
-t simplerisk-test:${{ matrix.os-slug }} \
tests/dockerfiles/

# ── Start container ─────────────────────────────────────────────────────
# All OSes use --init (tini as PID 1) so that child processes (Apache
# workers, mysqld) are properly reaped and multiple rapid service
# start/stop/restart calls during apt/dnf post-install triggers work
# correctly. CentOS/RHEL uses the /usr/local/bin/systemctl shim baked
# into the image; no real systemd is needed.
# --privileged is required for ufw/iptables inside Debian/Ubuntu and
# is harmless for CentOS.
- name: Start container
run: |
docker run -d \
--name simplerisk-test-${{ matrix.os-slug }} \
--privileged \
--init \
simplerisk-test:${{ matrix.os-slug }} \
/bin/bash -c "tail -f /dev/null"
sleep 2

# ── Pre-start services (Ubuntu only) ────────────────────────────────────
# Ubuntu images pre-install lamp-server^ during the Docker build (with
# policy-rc.d blocking auto-start). Start MySQL and Apache now so that
# the setup script finds them in the expected running state — mirroring
# what would happen on a freshly provisioned real server where the
# package post-install scripts start the services.
- name: Start pre-installed services (Ubuntu only)
if: ${{ startsWith(matrix.os-slug, 'ubuntu') }}
run: |
docker exec simplerisk-test-${{ matrix.os-slug }} service mysql start 2>/dev/null || true
docker exec simplerisk-test-${{ matrix.os-slug }} service apache2 start 2>/dev/null || true
sleep 2

# ── Copy files ──────────────────────────────────────────────────────────
- name: Copy scripts into container
run: |
CONTAINER="simplerisk-test-${{ matrix.os-slug }}"
docker cp simplerisk-setup.sh "$CONTAINER:/root/simplerisk-setup.sh"
docker cp tests/verify-install.sh "$CONTAINER:/root/verify-install.sh"
docker cp tests/verify-uninstall.sh "$CONTAINER:/root/verify-uninstall.sh"
docker exec "$CONTAINER" chmod +x \
/root/simplerisk-setup.sh \
/root/verify-install.sh \
/root/verify-uninstall.sh

# ── Install ─────────────────────────────────────────────────────────────
- name: Run install
run: |
docker exec simplerisk-test-${{ matrix.os-slug }} \
bash /root/simplerisk-setup.sh --yes --debug

# ── Verify install ──────────────────────────────────────────────────────
- name: Verify installation
run: |
docker exec simplerisk-test-${{ matrix.os-slug }} \
bash /root/verify-install.sh

# ── Uninstall ───────────────────────────────────────────────────────────
- name: Run uninstall
run: |
docker exec simplerisk-test-${{ matrix.os-slug }} \
bash /root/simplerisk-setup.sh --uninstall --yes --debug

# ── Verify uninstall ────────────────────────────────────────────────────
- name: Verify uninstallation
run: |
docker exec simplerisk-test-${{ matrix.os-slug }} \
bash /root/verify-uninstall.sh

# ── Diagnostics on failure ──────────────────────────────────────────────
- name: Collect diagnostics on failure
if: failure()
run: |
CONTAINER="simplerisk-test-${{ matrix.os-slug }}"
echo "=== /etc/my.cnf ===" && \
docker exec "$CONTAINER" cat /etc/my.cnf 2>/dev/null || true
echo "=== /etc/my.cnf.d/ ===" && \
docker exec "$CONTAINER" ls -la /etc/my.cnf.d/ 2>/dev/null || true
echo "=== /etc/my.cnf.d/* contents ===" && \
docker exec "$CONTAINER" sh -c 'for f in /etc/my.cnf.d/*.cnf; do echo "--- $f ---"; cat "$f"; done' 2>/dev/null || true
echo "=== MySQL sql_mode ===" && \
docker exec "$CONTAINER" sh -c \
'PW=$(grep "MYSQL ROOT PASSWORD:" /root/passwords.txt 2>/dev/null | cut -d" " -f4); mysql -uroot -p"$PW" -e "SELECT @@sql_mode;" 2>/dev/null' || true
echo "=== journalctl (last 50 lines) ===" && \
docker exec "$CONTAINER" journalctl -n 50 2>/dev/null || true
echo "=== Apache error log ===" && \
docker exec "$CONTAINER" cat /var/log/apache2/error.log 2>/dev/null || \
docker exec "$CONTAINER" cat /var/log/httpd/error_log 2>/dev/null || true
echo "=== MySQL error log (last 30 lines) ===" && \
docker exec "$CONTAINER" tail -30 /var/log/mysql/error.log 2>/dev/null || \
docker exec "$CONTAINER" tail -30 /var/log/mysqld.log 2>/dev/null || true
echo "=== /root/passwords.txt ===" && \
docker exec "$CONTAINER" cat /root/passwords.txt 2>/dev/null || true

# ── Teardown ────────────────────────────────────────────────────────────
- name: Teardown container
if: always()
run: |
docker rm -f simplerisk-test-${{ matrix.os-slug }} 2>/dev/null || true
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
# SimpleRisk Setup Script

[![SimpleRisk Install/Uninstall Tests](https://github.com/simplerisk/setup-scripts/actions/workflows/install-test.yml/badge.svg)](https://github.com/simplerisk/setup-scripts/actions/workflows/install-test.yml)

## Supported versions

- Ubuntu LTS 22.04, 24.04, and 25.x
- Although it is possible to install on non-LTS versions in between the two most recent LTS versions or above the most
recent version specified above, we do not support them officially
- Ubuntu LTS 22.04, 24.04, and 26.04
- Interim (non-LTS) Ubuntu releases are not supported; they get ~9 months of upstream support and churn every 6 months
- Debian 13
- CentOS Stream 9, 10
- Red Hat Enterprise Linux (RHEL) 9, 10
- SUSE Linux Enterprise Server (SLES) 15.x

SUSE Linux Enterprise Server (SLES) is not currently supported: SimpleRisk requires PHP >= 8.3, and SLES 15's own
repositories only offer PHP 8.2 with no upgrade path currently available. Support may return once a SLES release with a
newer PHP is available.

## Instructions

Run as root or insert `sudo -E` before `bash`:

- `curl -sL https://raw.githubusercontent.com/simplerisk/setup-scripts/master/simplerisk-setup.sh | bash -`
- `wget -qO- https://raw.githubusercontent.com/simplerisk/setup-scripts/master/simplerisk-setup.sh | bash -`
- `curl -sL https://raw.githubusercontent.com/simplerisk/setup-scripts/main/simplerisk-setup.sh | bash -`
- `wget -qO- https://raw.githubusercontent.com/simplerisk/setup-scripts/main/simplerisk-setup.sh | bash -`

## `--help`

Expand Down
Loading
Loading