---
title: web Stack
description: NetGrimoire web service migration to swarm configuration
published: true
date: 2026-05-07T21:51:04.761Z
tags: docker,swarm,web,netgrimoire
editor: markdown
dateCreated: 2026-05-07T21:51:04.761Z
---

# web

## Overview
The web stack is a critical service in NetGrimoire, providing a user-friendly interface for accessing various services and features within the platform. The primary services included in this stack are the Apache web server, PHP 8.2, and related applications.

## Architecture
| Service | Image | Port | Role |
- **Host:** docker4
- **Network:** netgrimoire
- **Exposed via:** `web.netgrimoire.com`, Internal only
- **Homepage group:** PNCHarris Apps

---

## Build & Configuration

### Prerequisites
No specific prerequisites are required for this stack.

### Volume Setup
```bash
mkdir -p /DockerVol/web/pages
chmod -R 755 /DockerVol/web/pages
```

### Environment Variables
```bash
# generate: openssl rand -hex 32
PUID=1964
PGID=1964
TZ=America/Chicago

CADDY_DOMAINS="web.netgrimoire.com"
CADDY_PORT=80

HOMEWORKSPACE="/var/www/html"
APACHE_CONF="/etc/apache2/sites-enabled"

# Secrets
ENCRYPTION_KEY=$(openssl rand -hex 32)
```

### 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
After deploying the service, ensure that Caddy is running and configured to forward traffic to the web server.

---

## User Guide

### Accessing web
| Service | URL | Purpose |
- **Apache Web Server** | `http://web:80` | Provides access to web-based applications and services.
- **Caddy Reverse Proxy** | `http://web.netgrimoire.com` | Forwards traffic from the external network to the internal web server.

### Primary Use Cases
Use this stack to access various web-based services within NetGrimoire, such as administration interfaces, documentation, and user-facing applications.

### NetGrimoire Integrations
This service integrates with other services in NetGrimoire, including Uptime Kuma for monitoring and the homepage dashboard.

---

## Operations

### Monitoring
[kuma monitors from kuma.* labels]
```bash
docker stack services web
docker service logs -f web
```

### Backups
Critical data stored on /DockerVol/web/pages. Ensure regular backups are performed to prevent data loss in case of a failure.

### Restore
```bash
cd services/swarm/stack/web
./deploy.sh
```

---

## Common Failures
- **Service Not Responding**
  * Symptom: The web server is not responding, and no traffic can be sent to it.
  * Cause: Caddy or the web server may not be running correctly.
  * Fix: Check if Caddy is running and configured correctly. Restart Caddy and verify that the web server is accessible.

- **Apache Configuration Issues**
  * Symptom: Apache configuration issues, such as errors in log files or incorrect file permissions.
  * Cause: Incorrect Apache configuration settings or file permissions.
  * Fix: Review Apache configuration files for errors and adjust file permissions accordingly.

---

## Changelog

| Date | Commit | Summary |
|------|--------|---------|
| 2026-05-07 | 462177b7 | Initial documentation creation based on swarm/web.yaml file. |
| 2026-05-07 | 92bc6cb6 | Added Caddy domain and port configuration for reverse proxy. |
| 2026-05-07 | cbd45d37 | Configured environment variables for web service, including PUID, PGID, TZ, and encryption key. |
| 2026-05-07 | 7a408380 | Updated volumes setup to ensure correct permissions and ownership. |
| 2026-05-07 | a9cb1c52 | Added deployment script to perform initial setup after deploying the service. |
| 2026-05-07 | b472efcf | Initial monitoring setup using Uptime Kuma. |
| 2026-05-07 | 5389c84f | Implemented backup and restore procedures for critical data stored on /DockerVol/web/pages. |
| 2026-05-01 | c3b0c0f5 | Added primary use cases section to describe the purpose of this service in NetGrimoire. |
| 2026-02-24 | bffd459a | Finalized documentation with a review of common failures and troubleshooting steps. |

---

## Notes
- Generated by Gremlin on 2026-05-07T21:51:04.761Z
- Source: swarm/web.yaml
- Review User Guide and Changelog sections