Skip to content
SHC Docs

Your own page

This page adds a file of the app: guestbook’s own page, mounted into the container, so nginx serves your page instead of its welcome page. An app carries the files its services need beside app.yaml, and every node that runs it gets a copy.

Write the page on home01, in a directory of the app.

~/learn/guestbook/site/index.html
<!doctype html>
<title>guestbook</title>
<p>Sign the guestbook.</p>

Mount it where nginx looks for pages. ./site is a path in the app’s directory; :ro mounts it read-only, which SHC requires of a directory of the app, so a container cannot change the app’s own files.

~/learn/guestbook/compose.yaml
services:
web:
image: nginx:1.27-alpine
expose:
- "80"
volumes:
- ./site:/usr/share/nginx/html:ro

--quiet makes shc validate print nothing and answer with its exit code alone, which is what a script wants.

home01
$ shc validate ~/learn/guestbook --quiet

The deployment runs from the copy of the app SHC took at install, not from ~/learn/guestbook. shc update reads the directory again and starts what changed. --stack validates the copy a deployment runs, instead of a directory.

home01
$ shc update guestbook
...
$ shc validate --stack guestbook
...
home01
$ curl -sk --resolve guestbook.learn.test:443:127.0.0.1 https://guestbook.learn.test/
<!doctype html>
<title>guestbook</title>
<p>Sign the guestbook.</p>

shc status -s reads one deployment: its services, the node each replica runs on and its state.

home01
$ shc status -s guestbook
...

Next: A second service.