doc: lint & enhancements
This commit is contained in:
+10
-89
@@ -2,20 +2,6 @@
|
||||
|
||||
Deploy static websites from Git repositories with Nginx.
|
||||
|
||||
## Features
|
||||
|
||||
- Clone static sites from Git repositories
|
||||
- Automatic Nginx vhost configuration
|
||||
- HTTPS enabled by default with Let's Encrypt
|
||||
- Support for build commands (npm, hugo, jekyll, etc.)
|
||||
- Subdirectory serving (for built assets)
|
||||
- Static file caching
|
||||
- Security headers (including HSTS for HTTPS)
|
||||
|
||||
## Dependencies
|
||||
|
||||
- nginx role (automatically included via meta/main.yml)
|
||||
|
||||
## Variables
|
||||
|
||||
See [defaults/main.yml](defaults/main.yml)
|
||||
@@ -24,82 +10,17 @@ See [defaults/main.yml](defaults/main.yml)
|
||||
|
||||
```yaml
|
||||
static_web_sites:
|
||||
"portfolio.example.fr":
|
||||
git_repo: "https://github.com/example/portfolio.git"
|
||||
git_branch: "main" # Optional, defaults to main
|
||||
git_depth: 1 # Optional, shallow clone
|
||||
build_command: "npm install && npm run build" # Optional
|
||||
root_dir: "dist" # Optional, serve subdirectory
|
||||
ssl_enabled: true # Optional, defaults to true (HTTPS)
|
||||
"portfolio.example.fr":
|
||||
git_repo: "https://github.com/example/portfolio.git"
|
||||
git_branch: "main" # Optional, defaults to main
|
||||
git_depth: 1 # Optional, shallow clone
|
||||
build_command: "npm install && npm run build" # Optional
|
||||
root_dir: "dist" # Optional, serve subdirectory
|
||||
ssl_enabled: true # Optional, defaults to true (HTTPS)
|
||||
|
||||
"blog.example.com":
|
||||
git_repo: "https://github.com/example/blog.git"
|
||||
# ssl_enabled defaults to true, set to false for HTTP only
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
**Inventory (host_vars or group_vars):**
|
||||
|
||||
```yaml
|
||||
static_web_sites:
|
||||
"portfolio.example.fr":
|
||||
git_repo: "https://github.com/username/portfolio.git"
|
||||
|
||||
"docs.example.com":
|
||||
git_repo: "https://github.com/company/documentation.git"
|
||||
git_branch: "gh-pages"
|
||||
root_dir: "_site"
|
||||
```
|
||||
|
||||
**Playbook:**
|
||||
|
||||
```yaml
|
||||
- hosts: webservers
|
||||
roles:
|
||||
- static-web
|
||||
```
|
||||
|
||||
## File Structure
|
||||
|
||||
Sites are deployed to `/var/www/static/<hostname>/`
|
||||
|
||||
Example:
|
||||
```
|
||||
/var/www/static/
|
||||
├── portfolio.example.fr/
|
||||
│ └── index.html
|
||||
└── blog.example.com/
|
||||
├── _site/ # Built assets (if root_dir specified)
|
||||
└── ...
|
||||
```
|
||||
|
||||
## Advanced Examples
|
||||
|
||||
**Hugo site:**
|
||||
```yaml
|
||||
static_web_sites:
|
||||
"blog.example.com":
|
||||
git_repo: "https://github.com/example/hugo-blog.git"
|
||||
build_command: "hugo --minify"
|
||||
root_dir: "public"
|
||||
```
|
||||
|
||||
**React app:**
|
||||
```yaml
|
||||
static_web_sites:
|
||||
"app.example.com":
|
||||
git_repo: "https://github.com/example/react-app.git"
|
||||
build_command: "npm ci && npm run build"
|
||||
root_dir: "build"
|
||||
```
|
||||
|
||||
## Updating Sites
|
||||
|
||||
Re-run the playbook to pull latest changes:
|
||||
|
||||
```bash
|
||||
ansible-playbook -i inventory playbook.yml --tags static-web
|
||||
"blog.example.com":
|
||||
git_repo: "https://github.com/example/blog.git"
|
||||
# ssl_enabled defaults to true, set to false for HTTP only
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
Reference in New Issue
Block a user