|
| 1 | +# Disable all the default make stuff |
| 2 | +MAKEFLAGS += --no-builtin-rules |
| 3 | +.SUFFIXES: |
| 4 | + |
| 5 | +## Display a list of the documented make targets |
| 6 | +.PHONY: help |
| 7 | +help: |
| 8 | + @echo Documented Make targets: |
| 9 | + @perl -e 'undef $$/; while (<>) { while ($$_ =~ /## (.*?)(?:\n# .*)*\n.PHONY:\s+(\S+).*/mg) { printf "\033[36m%-30s\033[0m %s\n", $$2, $$1 } }' $(MAKEFILE_LIST) | sort |
| 10 | + |
| 11 | +.PHONY: .FORCE |
| 12 | +.FORCE: |
| 13 | + |
| 14 | +.score-compose/state.yaml: |
| 15 | + score-compose init \ |
| 16 | + --no-sample \ |
| 17 | + --provisioners https://raw.githubusercontent.com/score-spec/community-provisioners/refs/heads/main/service/score-compose/10-service.provisioners.yaml |
| 18 | + |
| 19 | +compose.yaml: account-service/score.yaml database/score.yaml ingress/score.yaml people-service/score.yaml position-service/score.yaml reference-data/score.yaml trade-feed/score.yaml trade-processor/score.yaml trade-service/score.yaml web-frontend/score.yaml .score-compose/state.yaml Makefile |
| 20 | + score-compose generate \ |
| 21 | + account-service/score.yaml \ |
| 22 | + database/score.yaml \ |
| 23 | + people-service/score.yaml \ |
| 24 | + position-service/score.yaml \ |
| 25 | + reference-data/score.yaml \ |
| 26 | + trade-feed/score.yaml \ |
| 27 | + trade-processor/score.yaml \ |
| 28 | + trade-service/score.yaml \ |
| 29 | + web-frontend/score.yaml |
| 30 | + score-compose generate \ |
| 31 | + ingress/score.yaml \ |
| 32 | + --build 'ingress={"context":"ingress/","tags":["ingress:local"]}' |
| 33 | + |
| 34 | +## Generate a compose.yaml file from the score specs and launch it. |
| 35 | +.PHONY: compose-up |
| 36 | +compose-up: compose.yaml |
| 37 | + docker compose up --build -d --remove-orphans |
| 38 | + |
| 39 | +## Generate a compose.yaml file from the score spec, launch it and test (curl) the exposed container. |
| 40 | +.PHONY: compose-test |
| 41 | +compose-test: compose-up |
| 42 | + sleep 5 |
| 43 | + curl $$(score-compose resources get-outputs 'dns.default#ingress.dns' --format '{{ .host }}:8080') |
| 44 | + |
| 45 | +## Delete the containers running via compose down. |
| 46 | +.PHONY: compose-down |
| 47 | +compose-down: |
| 48 | + docker compose down -v --remove-orphans || true |
| 49 | + |
| 50 | +.score-k8s/state.yaml: |
| 51 | + score-k8s init \ |
| 52 | + --no-sample \ |
| 53 | + --provisioners https://raw.githubusercontent.com/score-spec/community-provisioners/refs/heads/main/service/score-k8s/10-service.provisioners.yaml |
| 54 | + |
| 55 | +manifests.yaml: account-service/score.yaml database/score.yaml ingress/score.yaml people-service/score.yaml position-service/score.yaml reference-data/score.yaml trade-feed/score.yaml trade-processor/score.yaml trade-service/score.yaml web-frontend/score.yaml .score-k8s/state.yaml Makefile |
| 56 | + score-k8s generate \ |
| 57 | + account-service/score.yaml \ |
| 58 | + database/score.yaml \ |
| 59 | + people-service/score.yaml \ |
| 60 | + position-service/score.yaml \ |
| 61 | + reference-data/score.yaml \ |
| 62 | + trade-feed/score.yaml \ |
| 63 | + trade-processor/score.yaml \ |
| 64 | + trade-service/score.yaml \ |
| 65 | + web-frontend/score.yaml |
| 66 | + score-k8s generate \ |
| 67 | + ingress/score.yaml \ |
| 68 | + --image ingress:local |
| 69 | + |
| 70 | +## Create a local Kind cluster. |
| 71 | +.PHONY: kind-create-cluster |
| 72 | +kind-create-cluster: |
| 73 | + ./scripts/setup-kind-cluster.sh |
| 74 | + |
| 75 | +## Load the local container image in the current Kind cluster. |
| 76 | +.PHONY: kind-load-image |
| 77 | +kind-load-image: |
| 78 | + kind load docker-image ingress:local |
| 79 | + |
| 80 | +NAMESPACE ?= default |
| 81 | +## Generate a manifests.yaml file from the score spec and apply it in Kubernetes. |
| 82 | +.PHONY: k8s-up |
| 83 | +k8s-up: manifests.yaml kind-load-image |
| 84 | + kubectl apply \ |
| 85 | + -f manifests.yaml \ |
| 86 | + -n ${NAMESPACE} |
| 87 | + kubectl wait deployments/ingress \ |
| 88 | + -n ${NAMESPACE} \ |
| 89 | + --for condition=Available \ |
| 90 | + --timeout=90s |
| 91 | + kubectl wait pods \ |
| 92 | + -n ${NAMESPACE} \ |
| 93 | + -l app.kubernetes.io/name=ingress \ |
| 94 | + --for condition=Ready \ |
| 95 | + --timeout=90s |
| 96 | + |
| 97 | +## Expose the container deployed in Kubernetes via port-forward. |
| 98 | +.PHONY: k8s-test |
| 99 | +k8s-test: k8s-up |
| 100 | + curl $$(score-k8s resources get-outputs dns.default#ingress.dns --format '{{ .host }}') |
| 101 | + |
| 102 | +## Delete the deployment of the local container in Kubernetes. |
| 103 | +.PHONY: k8s-down |
| 104 | +k8s-down: |
| 105 | + kubectl delete \ |
| 106 | + -f manifests.yaml \ |
| 107 | + -n ${NAMESPACE} |
| 108 | + |
| 109 | +## Generate catalog-info.yaml for Backstage. |
| 110 | +.PHONY: generate-catalog-info |
| 111 | +generate-catalog-info: |
| 112 | + score-k8s init \ |
| 113 | + --no-sample \ |
| 114 | + --provisioners https://raw.githubusercontent.com/score-spec/community-provisioners/refs/heads/main/service/score-k8s/10-service.provisioners.yaml \ |
| 115 | + --patch-templates https://raw.githubusercontent.com/score-spec/community-patchers/refs/heads/main/score-k8s/backstage-catalog-entities.tpl |
| 116 | + score-k8s generate \ |
| 117 | + --namespace traderx-demo \ |
| 118 | + account-service/score.yaml \ |
| 119 | + database/score.yaml \ |
| 120 | + people-service/score.yaml \ |
| 121 | + position-service/score.yaml \ |
| 122 | + reference-data/score.yaml \ |
| 123 | + trade-feed/score.yaml \ |
| 124 | + trade-processor/score.yaml \ |
| 125 | + trade-service/score.yaml \ |
| 126 | + web-frontend/score.yaml |
| 127 | + --output catalog-info.yaml |
| 128 | + score-k8s generate \ |
| 129 | + --namespace traderx-demo \ |
| 130 | + --generate-namespace \ |
| 131 | + ingress/score.yaml \ |
| 132 | + --image ingress:local \ |
| 133 | + --output catalog-info.yaml |
| 134 | + sed 's,$$GITHUB_REPO,score-spec/examples,g' -i catalog-info.yaml |
0 commit comments