docs: Update 2 files
This commit is contained in:
54
TEMPLATES.md
54
TEMPLATES.md
@@ -306,6 +306,60 @@ _check_required_env_vars "CONTAINER_NAME"
|
||||
docker logs "$CONTAINER_NAME" "$@"
|
||||
```
|
||||
|
||||
### check-config.sh
|
||||
|
||||
Validates the service configuration without restarting or modifying the service. **OPTIONAL** - if not provided, `dropshell check-config` reports that the template doesn't support this command.
|
||||
|
||||
This is useful for:
|
||||
- Validating configuration changes before applying them
|
||||
- Checking syntax errors in config files
|
||||
- Verifying that required dependencies are available
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
source "${AGENT_PATH}/common.sh"
|
||||
_check_required_env_vars "CONTAINER_NAME"
|
||||
|
||||
# Example: Validate nginx configuration
|
||||
docker exec "$CONTAINER_NAME" nginx -t || _die "Configuration validation failed"
|
||||
|
||||
echo "Configuration is valid"
|
||||
```
|
||||
|
||||
### reload-config.sh
|
||||
|
||||
Hot-reloads the service configuration without restarting the container. **OPTIONAL** - if not provided, `dropshell reload-config` reports that the template doesn't support this command.
|
||||
|
||||
This is useful for services that support graceful configuration reloading:
|
||||
- Web servers (nginx, Caddy, Apache)
|
||||
- Reverse proxies and load balancers
|
||||
- Database connection pools
|
||||
|
||||
**Note:** Before reload-config.sh runs, Dropshell automatically syncs the latest configuration files to the remote server.
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
source "${AGENT_PATH}/common.sh"
|
||||
_check_required_env_vars "CONTAINER_NAME"
|
||||
|
||||
# Example: Reload nginx configuration
|
||||
docker exec "$CONTAINER_NAME" nginx -s reload || _die "Failed to reload configuration"
|
||||
|
||||
echo "Configuration reloaded successfully"
|
||||
```
|
||||
|
||||
**Example for Caddy:**
|
||||
```bash
|
||||
#!/bin/bash
|
||||
source "${AGENT_PATH}/common.sh"
|
||||
_check_required_env_vars "CONTAINER_NAME"
|
||||
|
||||
# Caddy supports hot-reload via API
|
||||
docker exec "$CONTAINER_NAME" caddy reload --config /etc/caddy/Caddyfile || _die "Failed to reload Caddy"
|
||||
|
||||
echo "Caddy configuration reloaded"
|
||||
```
|
||||
|
||||
### backup.sh
|
||||
|
||||
Backs up persistent data for a service. **OPTIONAL** - if not provided, `dropshell backup` reports "nothing to backup".
|
||||
|
||||
Reference in New Issue
Block a user