commit d8ae17a192c3696b3b836130334cd1aa4ab8f863 Author: Beda Schmid Date: Fri Oct 23 16:00:37 2026 +0000 Reset history to current sanitized state diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..704008c --- /dev/null +++ b/.gitignore @@ -0,0 +1,38 @@ +# Legacy application-state paths +/sonarqube_data/ +/sonarqube_extensions/ +/sonarqube_logs/ +/sonarqube_temp/ +/postgresql_data/ + +# Local state and recovery copies +/appdata/ +/backups/ +/pre-cleanup/ + +# Environment and secrets +.env +.env.* +*.env +*.env.* +/secrets/ +*.key +*.pem +*.p12 +*.pfx + +# Editor and operating-system files +.DS_Store +*~ +*.swp + +# BEGIN reset-history environment exclusions +.env +.env.* +*.env +*.env.* +!.env.example +!.env.*.example +!*.env.example +!*.env.*.example +# END reset-history environment exclusions diff --git a/README.md b/README.md new file mode 100644 index 0000000..9a8c035 --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# SonarQube + +SonarQube analyzes source code and records code-quality findings and analysis history. + +## Deployment layout + +- **Compose:** `/srv/docker/sonarqube/docker-compose.yml` +- **Static configuration/source:** none beyond Compose; this deployment uses container images +- **Non-secret environment:** JVM options are declared inline in Compose; other environment values are supplied through the protected central environment file +- **Secrets:** `/srv/docker/secrets/sonarqube/.env`, supplied to both SonarQube and PostgreSQL +- **NVMe application state:** `/srv/appdata/sonarqube/data`, `/srv/appdata/sonarqube/extensions`, `/srv/appdata/sonarqube/logs`, `/srv/appdata/sonarqube/temp`, and `/srv/appdata/sonarqube/postgres` +- **Bulk HDD data:** none +- **Other mounts:** none + +Secrets are never committed to this repository. Preserve the protected central +environment alongside recoverable application and database backups without +copying its values into this repository. + +## Dependencies and recovery + +- **Networks/dependencies:** PostgreSQL on the project bridge `sonarqube_internal`; SonarQube also joins external `npm_proxy` at `192.168.98.19`. The database healthcheck gates application startup. Existing reverse-proxy and scanner integrations remain dependencies. +- **Back up:** a consistent PostgreSQL backup, `/srv/appdata/sonarqube/extensions`, the protected central environment, and this deployment repository. Preserve all five state directories together for a stopped-service migration rollback. Verify independent backup coverage and restore testing. +- **Re-creatable:** container images, temporary files, and Elasticsearch indexes when PostgreSQL is the verified authoritative database; logs are generated but may be needed for diagnostics diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..75caaf4 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,55 @@ +services: + sonarqube: + image: sonarqube:community + hostname: sonarqube + container_name: sonarqube + mem_limit: 3g + memswap_limit: 3g + mem_swappiness: 0 + depends_on: + db: + condition: service_healthy + env_file: + - /srv/docker/secrets/sonarqube/.env + environment: + SONAR_JAVA_OPTS: > + -Xms512m -Xmx1536m -XX:+UseG1GC + -XX:MaxMetaspaceSize=256m + -XX:MaxDirectMemorySize=256m + SONAR_SEARCH_JAVAADDITIONALOPTS: > + -Xms512m -Xmx512m + -XX:MaxMetaspaceSize=256m + -XX:MaxDirectMemorySize=256m + volumes: + - /srv/appdata/sonarqube/data:/opt/sonarqube/data + - /srv/appdata/sonarqube/extensions:/opt/sonarqube/extensions + - /srv/appdata/sonarqube/logs:/opt/sonarqube/logs + - /srv/appdata/sonarqube/temp:/opt/sonarqube/temp + restart: unless-stopped + networks: + sonarqube_internal: + npm_proxy: + ipv4_address: 192.168.98.19 + db: + image: postgres:17 + healthcheck: + test: [ "CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}" ] + interval: 10s + timeout: 5s + retries: 5 + hostname: postgresql + container_name: sonarpostgresql + env_file: + - /srv/docker/secrets/sonarqube/.env + volumes: + - /srv/appdata/sonarqube/postgres:/var/lib/postgresql/data + restart: unless-stopped + networks: + - sonarqube_internal + +networks: + npm_proxy: + external: true + sonarqube_internal: + driver: bridge + enable_ipv6: false