Skip to content
SHC Docs

A compose file

The smallest app is a directory. This one has a compose file and one page. Create these files on home01. Create the parent directories as you go.

~/learn/nginx/compose.yaml
services:
nginx:
image: nginx:1.27-alpine
expose:
- "80"
volumes:
- ./site:/usr/share/nginx/html:ro
~/learn/nginx/site/index.html
<!doctype html>
<title>hello</title>
<p>Hello from SHC.</p>
home01
$ shc install ~/learn/nginx -s web --expose 18080=nginx:80
installing deployment "web"
[web] Healthy 1/1
✔ nginx healthy
✔ installed deployment "web"
exposure: lan
$ shc ls
STACK TENANT ENV APP STATUS NODE
web prod prod /root/learn/nginx running home01

The deployment is named web. Port 18080 on the node forwards to port 80 of its nginx service. The directory is the app; web is its installed name.

Run the curl command again if the published port is not answering yet.

home01
$ curl -s http://localhost:18080/
<!doctype html>
<title>hello</title>
<p>Hello from SHC.</p>

A compose service can name profiles:. It then runs only when the deployment names one of them; a service that names none always runs. --profile names them at install, and shc update --profile replaces them on a running deployment.

explained, not walked: the nginx app this page wrote names no compose profile
$ shc install ~/learn/nginx -s web --expose 18080=nginx:80 --profile debug
$ shc update web --profile debug

Keep web installed for now.

Read Underneath the nginx deployment before going on; it reads what this page left running.

Next: A simple Postgres.