infra/lxc-container.md creates an unprivileged container on a Proxmox host with ShellBook's key, waits for its address and adds it to Hosts. services/web-server.md installs nginx on an existing host or on a new container through ::use. Document chaining in the spec (3.6) and in the workspace format guide.
1.7 KiB
1.7 KiB
title, params
| title | params | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Install a web server (nginx) |
|
Install nginx on {{host}}
Example of a chained notebook. Choose Install on: lxc to create a fresh Proxmox container first (its form appears below), or existing to pick a server from Hosts. The install steps then target Target server, which defaults to the new container once it is in Hosts.
:::when{target=lxc}
New container
::use{notebook="infra/lxc-container.md" as=ct with="hostname={{server_name}}"} :::
Install
Runs as root, or through passwordless sudo -n for other users.
command -v apt-get
command -v systemctl
dpkg-query -W -f='${Status}\n' nginx | grep -qx 'install ok installed'
if [ "$(id -u)" -eq 0 ]; then as_root=""; else as_root="sudo -n"; fi
$as_root apt-get update
$as_root env DEBIAN_FRONTEND=noninteractive apt-get install -y nginx
$as_root systemctl enable --now nginx
systemctl is-active nginx
timeout 5 bash -c 'exec 3<>/dev/tcp/127.0.0.1/80'
:::after{step=install}
nginx is installed on {{host}}. Put your site into /etc/nginx/sites-available/
and review the firewall before exposing it.
:::