diff --git a/Netgrimoire/Services/web/web.md b/Netgrimoire/Services/web/web.md index dd4da37..8832266 100644 --- a/Netgrimoire/Services/web/web.md +++ b/Netgrimoire/Services/web/web.md @@ -1,20 +1,24 @@ -# web Stack - -description: PHP/Apache web server with Caddy reverse proxy for NetGrimoire - --- +title: web Stack +description: NetGrimoire web services +published: true +date: 2026-05-07T21:43:54.394Z +tags: docker,swarm,web,netgrimoire +editor: markdown +dateCreated: 2026-05-07T21:43:54.394Z +--- + +# web ## Overview -The `web` stack is a Docker Swarm configuration that deploys a PHP/Apache web server, utilizing Caddy as a reverse proxy. It consists of a single service running on `docker4`, connected to the `netgrimoire` network. This setup provides a stable and scalable environment for hosting web applications. - ---- +The web stack in NetGrimoire provides a centralized platform for serving web content. It consists of a replicated PHP-based web server that handles requests and serves pages from the /var/www/html directory. ## Architecture | Service | Image | Port | Role | -|---------|-------|------|------| +|-|-------|------|------| - **Host:** docker4 - **Network:** netgrimoire -- **Exposed via:** `www.netgrimoire.com` +- **Exposed via:** www.netgrimoire.com - **Homepage group:** homepage --- @@ -22,22 +26,21 @@ The `web` stack is a Docker Swarm configuration that deploys a PHP/Apache web se ## Build & Configuration ### Prerequisites - PHP 8.2-apache image, Docker Swarm manager and worker nodes. +This stack requires Docker Swarm and Caddy reverse proxy setup. ### Volume Setup ```bash -mkdir -p /DockerVol/web pages -chown web.web:/var/www/html +mkdir -p /DockerVol/web/pages:/var/www/html +chown web:web /DockerVol/web/pages ``` ### Environment Variables ```bash -# generate: openssl rand -hex 32 PUID=1964 PGID=1964 TZ=America/Chicago -CADDY_URL=www.netgrimoire.com -CADDY_DOMAINS="www.netgrimoire.com" + +# generate: openssl rand -hex 32 for secrets ``` ### Deploy @@ -51,7 +54,7 @@ docker stack services web ``` ### First Run -Perform initial setup, including Caddy configuration and PHP application installation. +After deployment, ensure that Caddy is configured to reverse proxy the web service. --- @@ -59,52 +62,36 @@ Perform initial setup, including Caddy configuration and PHP application install ### Accessing web | Service | URL | Purpose | -|---------|-----|---------| -- **web** | http://web:80 | Serve PHP applications using Apache +|-|-------|------| +- **web:** http://www.netgrimoire.com:80 | ### Primary Use Cases -Access the `www.netgrimoire.com` website to view NetGrimoire's web application. +This stack serves as a primary entry point for accessing NetGrimoire's web services. ### NetGrimoire Integrations -Connects to Uptime Kuma, Caddy, and Diun services via environment variables and labels. +This stack integrates with Diun, Kuma, and Caddy to provide a robust monitoring, backup, and reverse proxy setup. --- ## Operations ### Monitoring + ```bash docker stack services web docker service logs -f web ``` ### Backups -Critical `DockerVol/web/pages` volume requires regular backup to ensure data integrity. Reconstructible `DockerVol/web/apache` volume can be restored using the Caddy configuration. +Critical data stored in /DockerVol/web/pages should be backed up regularly to prevent loss of content. ### Restore -```bash -cd services/swarm/stack/web -./deploy.sh -``` +Restore by re-running the deployment script. --- ## Common Failures -1. Service not starting due to failed Caddy startup: Check Caddy logs and adjust configuration as necessary. -2. PHP application crashes: Inspect Apache logs, restart the service if necessary, and ensure proper PHP configuration. -3. Network issues with Docker Swarm services: Check network connectivity, verify container configurations, and attempt restarting affected containers. - ---- - -## Changelog - -| Date | Commit | Summary | -|------|--------|---------| -| 2026-05-07 | 5389c84f | Initial documentation creation | -| 2026-05-01 | c3b0c0f5 | Minor configuration updates and bug fixes | -| 2026-02-24 | bffd459a | Caddy reverse proxy integration improvements | -| 2026-02-12 | 0d192da2 | PHP/ Apache stack initial setup with environment variables | -| 2026-01-22 | 76e190d2 | Docker Swarm manager and worker node compatibility updates | - - - \ No newline at end of file +| Symptom | Cause | Fix | +|-|-------|------| +- No reverse proxy is established | Caddy not configured correctly | Check and correct caddy configuration | +- Web service is not accessible | Docker swarm services not started | Run docker stack services web | \ No newline at end of file