Build + CI/CD
Table of Contents
CI/CD Process based on Github Actions
Github Actions
Checklist
-
api Gradle Build with Docker Push
-
ui Angular Build with Docker Push
-
docs Antora build
-
docs Deploy to S3 Bucket
-
for all modules: trigger redeploy on new build
There is a lot to do! |
Post Action Webhook
Workflow Webhook Action A Github workflow action to call (POST) a remote webhook endpoint with a json payload
- name: Invoke deployment hook
uses: distributhor/workflow-webhook@v1
env:
webhook_url: ${{ secrets.WEBHOOK_URL }}
webhook_secret: ${{ secrets.WEBHOOK_SECRET }}
data: '{ "module": "api", "drink" : "milk" }'
Tip: The hash signature is identical to that which a regular Github webhook would generate, and sent in a header field named X-Hub-Signature
.
if __name__ == '__main__':
app.run(host="0.0.0.0", port=8080, ssl_context=('/etc/letsencrypt/live/domain.io/fullchain.pem', '/etc/letsencrypt/live/domain.io/privkey.pem'))
Angkor Development CLI
The entire project uses GNU Make on top level to manage the various ecosystems for our different modules.
The Makefile documents itself when make
is called without arguments (inspired by Self-Documented Makefile)
Output of all documented make targets
$ make
api-clean Cleans up ./api/build folder
api-build Assembles backend jar in ./api/build with gradle (alias: assemble)
api-run Runs springBoot API in ./api using gradle bootRun (alias: bootrun)
api-deploy Deploys API with subsequent pull and restart of server on EC2
ui-clean Remove UI dist folder ./ui/dist
ui-build Run ng build in ./ui
ui-build-prod Run ng build --prod in ./ui
ui-run Run UI with ng serve and opens UI in browser (alias: serve,open)
ui-deploy Deploys UI with subsequent pull and restart of server on EC2
ui-mocks Run json-server on foreground to mock API services for UI (alias: mock)
infra-init Runs terraform init on working directory ./infra
infra-plan Runs terraform plan with implicit init and fmt (alias: plan)
infra-deploy Runs terraform apply with auto-approval (alias: apply)
ec2-stop Stops the ec2 instance (alias: stop)
ec2-start Launches the ec-2instamce (alias: start)
ec2-status Get ec2 instance status (alias: status)
ec2-ps Run docker compose status on instance (alias: ps)
ec2-login Exec ssh login into current instance (alias: ssh)
ec2-pull Pull recent config on server, triggers docker-compose up (alias: pull)
docs-clean Cleanup docs build directory
docs-build Generate documentation site using antora-playbook.yml (alias: docs)
docs-push Generate documentation site and push to s3
docs-deploy Deploys docs with subsequent pull and restart of server on EC2
all-clean Clean up build artifact directories in backend and frontend (alias: clean)
all-build Builds frontend and backend (alias: build)
all-deploy builds and deploys frontend and backend images (alias deploy)
angkor The ultimate target - builds and deploys everything 🦄----