The objective is to standardize Kubernetes deployment templates into parameterizable formats and deliver a CLI tool capable of assembling diverse deployment units.
This project provides the hammerhand CLI tool, which you can symlink into a directory on your $PATH.
Run on vanilla k8s cluster.
export K8S_CLUSTER=production
export INGRESS_ENTRYPOINT=websecure
# deploy HTTP only ingress (work in progress on a production ready solution. Now it is manually configured now on production server)
hammerhand u ingress/traefik ingress_http
export NAMESPACE=ipfs
export PRE_PIN=true
# deploy IPFS core service (for details consult: `hammerhand u service/ipfs` unit)
hammerhand u service/ipfs deploy_service
# deploy javaexperience.eu pages
## deploy git.javaexperience.eu
INGRESS_NAME=git-jvx INGRESS_HOST=git.javaexperience.eu IPFS_CID=QmUt4yYjUg9QMzjQyVN9CsDEbWbiPYjNLrtKw9LW5zKT5n IPFS_CID_PIN=true hammerhand u service/ipfs serve_page
## deploy maven.javaexperience.eu
INGRESS_NAME=mvn-jvx INGRESS_HOST=maven.javaexperience.eu IPFS_CID=QmQX53dGEP2UwYg3bo5Ksd4eenghkHQGyWV7NwkRSfRyFa IPFS_CID_PIN=true hammerhand u service/ipfs serve_page
# deploy redirect on main domain
NAME=jvx INGRESS_HOST=javaexperience.eu REDIRECT_TARGET=https://maven.javaexperience.eu hammerhand u tools/redirect deployRun on kind k8s cluster, DNS *.k8s.static.dev.intra.net is set to kind container IP.
export DOMAIN_ROOT=k8s.static.dev.intra.net
# deploys plain HTTP ingress as daemonset.
hammerhand u ingress/traefik ingress_http
# deploys a debug container with debug services
hammerhand u dev/debug deploy_devops
# deploys an image registry, you can push and pull images to the node and expose on host's tcp/5000 port
hammerhand u service/registry deploy_registry
TYPE=TCP PORT=5000 SERVICE=registry-service SERVICE_PORT=5000 BIND_ADDRESS=127.0.0.1 hammerhand u ingress/serviceport ingress_port
# ipfs: install IPFS as core service
hammerhand u service/ipfs deploy_service
# deploy javaexperience maven repo (sserve static files)
INGRESS_NAME=maven INGRESS_HOST=maven.${DOMAIN_ROOT} IPFS_CID=bafybeibamkzqsjwbvkj5igauuvliffqebdgn2ydiyqt3idpd3vh7hd55nu hammerhand u service/ipfs serve_page
# Serve szabilinux.hu website
INGRESS_NAME=szabilinux INGRESS_HOST=szabilinux.${DOMAIN_ROOT} IPFS_CID=bafybeig2i4gtt6azojl32noco3ov6e6o7qaxasu2q32qlzssvcgdw3kdbi hammerhand u service/ipfs serve_page
# Open up IPFS endpoint, you can directly access http://ipfs.${DOMAIN_ROOT}/ipfs/$CID
# put a built static site on IPFS and serve it under a host
CID=$(hammerhand u service/ipfs add_dir ./dist)
INGRESS_NAME=mysite INGRESS_HOST=mysite.${DOMAIN_ROOT} IPFS_CID=$CID hammerhand u service/ipfs serve_page
INGRESS_NAME=ipfs-direct-gateway INGRESS_HOST=ipfs.${DOMAIN_ROOT} SERVICE=ipfs-service PORT=8080 hammerhand u ingress/traefik ing_srv_host
# deploys a supabase stack (community helm chart), then an ingress on its API gateway, the dashboard is served there too
# keys and passwords are generated on the first deploy and kept in the cluster; SUPABASE_STUDIO=false leaves out the dashboard
HOST=supabase.${DOMAIN_ROOT} hammerhand u apps/supabase deploy
HOST=supabase.${DOMAIN_ROOT} SERVICE=supabase-supabase-kong PORT=8000 hammerhand u ingress/traefik ing_srv_short
# the mails of auth (confirmations, password resets) through a mail server, here the dev/mailpit collector
hammerhand u dev/mailpit deploy
HOST=supabase.${DOMAIN_ROOT} SUPABASE_SMTP_HOST=mailpit-service SUPABASE_SMTP_PORT=1025 hammerhand u apps/supabase deploy
# prints the dashboard login and the API keys
HOST=supabase.${DOMAIN_ROOT} hammerhand u apps/supabase print_keys
# login: anonymous sign-in, linking more logins to an account, where a login returns to, and login
# with google, facebook, github or gitlab (client secret on stdin, stored in the cluster;
# print_auth shows the callback URL to register at the provider)
HOST=supabase.${DOMAIN_ROOT} SUPABASE_ANONYMOUS_USERS=true SUPABASE_MANUAL_LINKING=true SUPABASE_SITE_URL=https://www.example.com hammerhand u apps/supabase deploy
echo "$CLIENT_SECRET" | HOST=supabase.${DOMAIN_ROOT} hammerhand u apps/supabase set_oauth google "$CLIENT_ID"
HOST=supabase.${DOMAIN_ROOT} hammerhand u apps/supabase print_auth
# auth limits requests per client address taken from X-Forwarded-For (SUPABASE_RATE_LIMIT_HEADER):
# the proxy in front must overwrite that header when the client sends one, traefik does by default
# applies the *.sql files of a directory in one transaction (tables, access rules, functions)
hammerhand u apps/supabase migrate ./sql
# deploys a testapp
HOST=test.${DOMAIN_ROOT} hd u apps/testwebapp deploy
# deploys static file hosting
HOST=files.${DOMAIN_ROOT} NAME=files DIR_LISTING=true SERVE_PATH=/static_files hammerhand u tools/servedir deployhammerhand looks for extensions in the directories listed in HELMSDEEP_EXTENSION_DIR_ROOT,
separated by colon. The default is ~/.lxe/extensions/helmsdeep/:./.helmsdeep: your personal
directory, then .helmsdeep in the directory you call hammerhand from. This way a project can
keep its own deployment units in its repository.
myproject/
.helmsdeep/
units/site/web/u.hd # hammerhand u site/web deploy
units/site/web/web.yml
kust.hd # customizers (kust_* functions) of the project
A unit has the same form as the built-in ones in units/. When the same unit path exists in more
places, the later directory of the list wins, and any of them wins over the built-in unit.
hammerhand list_units shows what is found and where, hammerhand kust lists the customizers.
HELMSDEEP_UNIT_EXTENSION_DIR can add further unit directories (also colon separated) that are
not inside an extension directory.
./hammerhand run_tests runs the offline tests in tests/offline. They cover the tool itself (unit
lookup, extension directories) and need no cluster.
The deployments are tested by the cicd script, described below.
It creates a kind cluster, deploys the sample units listed above and checks that their URLs answer. It is a smoke test of a successful deploy, not more.
It installs kind, edits /etc/hosts and deletes the cluster when it finishes, so do not run it
directly on your machine. Run it inside the build container, which needs Docker on the host:
# opens a shell in a privileged lxeu/devops-build-image container, the repository is mounted at /code
./cicd cicd_launch_tmp_container
# then inside the container
cd /code
./cicd cicd_testThe steps can be run one by one as well: cicd_prepare, cicd_deploy_samples,
cicd_test_deploy_samples, cicd_teardown.
The GitLab pipeline (.gitlab-ci.yml) runs ./hammerhand run_tests on every push, and the same
./cicd cicd_test on master. The Docker runner can not start a kind cluster inside the job
container, so the second job does not pass there yet (ticket task-1 in backlog/).
Known open work is tracked as Backlog.md tickets in
backlog/: backlog task list --plain, or backlog board for the board.