Initial commit: web-hosts infrastructure
- hostctl.sh management script for starting/stopping/restarting hosts - test.coppertone.tech domain setup with compose.yaml - deploy.sh for automated deployments from testing branch - frontend-nginx.conf for static file serving 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
124
scripts/README.md
Normal file
124
scripts/README.md
Normal file
@@ -0,0 +1,124 @@
|
||||
# Web Hosts Management
|
||||
|
||||
## Overview
|
||||
|
||||
This system manages web hosting for multiple domains using:
|
||||
- **Podman Compose** - Container orchestration (rootless)
|
||||
- **Nginx** - Reverse proxy with SSL (rootful, via sudo)
|
||||
- All services bind to `127.0.0.1` only
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
/docker/web-hosts/
|
||||
├── scripts/
|
||||
│ └── hostctl.sh # Main management script
|
||||
├── domains/
|
||||
│ └── <domain>/ # One directory per root domain
|
||||
│ ├── compose.yaml
|
||||
│ ├── www/ # Static files
|
||||
│ ├── data/ # Persistent data
|
||||
│ └── config/ # Configuration
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
### 1. Create a new domain
|
||||
|
||||
```bash
|
||||
/docker/web-hosts/scripts/hostctl.sh create example.com 9000
|
||||
```
|
||||
|
||||
This creates:
|
||||
- Directory structure at `/docker/web-hosts/domains/example.com/`
|
||||
- Template `compose.yaml` with services bound to `127.0.0.1:9000`
|
||||
- Default `index.html`
|
||||
|
||||
### 2. Customize the compose file
|
||||
|
||||
Edit `/docker/web-hosts/domains/example.com/compose.yaml` to add your services.
|
||||
|
||||
### 3. Start the domain
|
||||
|
||||
```bash
|
||||
/docker/web-hosts/scripts/hostctl.sh start example.com
|
||||
```
|
||||
|
||||
### 4. Add nginx reverse proxy with SSL
|
||||
|
||||
```bash
|
||||
sudo /docker/www/startup.sh add-domain example.com 9000
|
||||
```
|
||||
|
||||
## Commands Reference
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `hostctl list` | List all configured domains |
|
||||
| `hostctl status [domain]` | Show status |
|
||||
| `hostctl start <domain>` | Start a domain |
|
||||
| `hostctl stop <domain>` | Stop a domain |
|
||||
| `hostctl restart <domain>` | Restart a domain |
|
||||
| `hostctl logs <domain>` | View logs |
|
||||
| `hostctl create <domain> [port]` | Create new domain |
|
||||
| `hostctl remove <domain>` | Remove a domain |
|
||||
| `hostctl start-all` | Start all domains |
|
||||
| `hostctl stop-all` | Stop all domains |
|
||||
|
||||
## Port Assignment Convention
|
||||
|
||||
Each root domain gets a port range starting from the specified port:
|
||||
- `<port>`: Main website (www)
|
||||
- `<port+1>`: API subdomain
|
||||
- `<port+2>`: Additional services
|
||||
- etc.
|
||||
|
||||
Example for `example.com` starting at port 9000:
|
||||
- `example.com` → `127.0.0.1:9000`
|
||||
- `api.example.com` → `127.0.0.1:9001`
|
||||
- `admin.example.com` → `127.0.0.1:9002`
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
Internet
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────┐
|
||||
│ Nginx (rootful, ports 80/443) │
|
||||
│ /docker/www/ │
|
||||
│ - SSL termination │
|
||||
│ - Reverse proxy │
|
||||
└─────────────────────────────────────┘
|
||||
│
|
||||
▼ 127.0.0.1:<port>
|
||||
┌─────────────────────────────────────┐
|
||||
│ Podman Containers (rootless) │
|
||||
│ /docker/web-hosts/domains/ │
|
||||
│ - Web apps │
|
||||
│ - APIs │
|
||||
│ - Databases │
|
||||
└─────────────────────────────────────┘
|
||||
```
|
||||
|
||||
## Adding Subdomains
|
||||
|
||||
1. Add service to domain's `compose.yaml`:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
api:
|
||||
image: your-api-image
|
||||
ports:
|
||||
- "127.0.0.1:9001:8080"
|
||||
```
|
||||
|
||||
2. Restart the domain:
|
||||
```bash
|
||||
hostctl restart example.com
|
||||
```
|
||||
|
||||
3. Add nginx config for subdomain:
|
||||
```bash
|
||||
sudo /docker/www/startup.sh add-domain api.example.com 9001
|
||||
```
|
||||
Reference in New Issue
Block a user