docs(gremlin): create web

This commit is contained in:
traveler 2026-05-07 16:44:57 -05:00
parent d8ec53c035
commit 5e8f298cc7

View file

@ -0,0 +1,110 @@
# web Stack
description: PHP/Apache web server with Caddy reverse proxy for NetGrimoire
---
## 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.
---
## Architecture
| Service | Image | Port | Role |
|---------|-------|------|------|
- **Host:** docker4
- **Network:** netgrimoire
- **Exposed via:** `www.netgrimoire.com`
- **Homepage group:** homepage
---
## Build & Configuration
### Prerequisites
PHP 8.2-apache image, Docker Swarm manager and worker nodes.
### Volume Setup
```bash
mkdir -p /DockerVol/web pages
chown web.web:/var/www/html
```
### 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"
```
### Deploy
```bash
cd services/swarm/stack/web
set -a && source .env && set +a
docker stack config --compose-file web-stack.yml > resolved.yml
docker stack deploy --compose-file resolved.yml web
rm resolved.yml
docker stack services web
```
### First Run
Perform initial setup, including Caddy configuration and PHP application installation.
---
## User Guide
### Accessing web
| Service | URL | Purpose |
|---------|-----|---------|
- **web** | http://web:80 | Serve PHP applications using Apache
### Primary Use Cases
Access the `www.netgrimoire.com` website to view NetGrimoire's web application.
### NetGrimoire Integrations
Connects to Uptime Kuma, Caddy, and Diun services via environment variables and labels.
---
## 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.
### Restore
```bash
cd services/swarm/stack/web
./deploy.sh
```
---
## 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 |
<Generated by Gremlin on 2026-05-07T21:43:51.732Z>
<Source: swarm/web.yaml>