====== How to deploy a Docker Service ====== Deploying a new service for Hackeriet requires completing a couple of steps: - Deploying and running the application code - Route traffic to the application - (Optionally) register a subdomain - (Optionally) expose the application publicly by routing external traffic to it ====== Deploying application code ====== [[infra:hosts:app-01|app-01]] hosts several of Hackeriet's services. It provides a Docker runtime, and a local reverse proxy. To set up a new app, create or place a docker compose file in a subdirectory for your app under ''/storage/services/''. ====== Reverse Proxy ====== ''/etc/nginx/conf.d/.hackeriet.no'' ====== Register subdomain in DNS ====== [[infra:hosts:blade|blade]] is the primary DNS server. SSH into it, elevate to root, and edit the zonefile at ''/etc/nsd/pv/hackeriet.no''. You want to add a CNAME record pointing at either ingress.hackeriet.no or app01.hackeriet.no, depending on whether it should be available publicly or only within Hackeriet's network. Check that the zonefile is syntactically correct by running ''nsd checkzone hackeriet.no hackeriet.no''. The zonefiles are in a git repository, so do not forget to commit with a descriptive commit message, and push. TODO: Clarify if etckeeper is relevant here Finally, to apply and test the record, reload the nameserver: ''systemctl reload nsd.service''