Alcove CMS
Ru

Part IV, Delivery

Running and deploying

Flags, a reverse proxy and a service unit.

Alcove is one program. It applies the migrations, builds the site into dist/, serves it, and rebuilds when a file changes. A failed rebuild is logged and the previous site keeps being served.

FlagDefaultMeaning
-dir./contentThe content folder
-port8080Port on localhost
-migrationsnext to -dirThe migrations folder
-checkoffCheck the content and exit with 0 or 1
-minifyoffMinify CSS, JS and HTML
-draftsoffInclude pages with draft: true
-seed-adminoffCreate the admin from ALCOVE_ADMIN_PASSWORD and exit

The server only listens on localhost, so it runs behind a reverse proxy. These are the files this site runs with:

Live result This page is rendered on request.

Database
SQLite 3.54.1
Migrations applied
4: 001_schema.sql, 002_library.sql, 003_docs.sql, 004_guest.sql
Guestbook lines
1

Source the files behind the result above

deploy/Caddyfile

alcovecms.org {
	encode zstd gzip

	@assets path /assets/*
	header @assets Cache-Control "public, max-age=31536000, immutable"

	reverse_proxy 127.0.0.1:8080
}

www.alcovecms.org {
	redir https://alcovecms.org{uri} 308
}

deploy/alcove-site.service

[Unit]
Description=Alcove CMS site
After=network.target

[Service]
Type=simple
User=alcove
Group=alcove
WorkingDirectory=/srv/alcove-site
ExecStart=/srv/alcove-site/alcove -dir /srv/alcove-site/content -port 8080 -minify
Restart=on-failure
RestartSec=3
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/srv/alcove-site
PrivateTmp=true

[Install]
WantedBy=multi-user.target

content/alcoves/demo_server/alcove.yaml

query: |
  SELECT sqlite_version() AS sqlite,
         (SELECT count(*) FROM alcove_migrations) AS applied,
         (SELECT group_concat(name, ', ') FROM (SELECT name FROM alcove_migrations ORDER BY name)) AS names,
         (SELECT count(*) FROM guestbook) AS lines