feat: polish & windviz & deploy
This commit is contained in:
parent
81b8e763bd
commit
465ad00f7b
78 changed files with 20622 additions and 2154 deletions
11
deploy/prometheus.yml
Normal file
11
deploy/prometheus.yml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Minimal Prometheus config for the staging compose stack. In production a
|
||||
# central Prometheus scrapes the predictor via Docker Swarm service discovery
|
||||
# (see DEPLOYMENT.md); this file just proves the metrics pipeline locally.
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
|
||||
scrape_configs:
|
||||
- job_name: predictor
|
||||
metrics_path: /metrics
|
||||
static_configs:
|
||||
- targets: ["predictor:8080"]
|
||||
41
deploy/swarmpit-deploy.sh
Executable file
41
deploy/swarmpit-deploy.sh
Executable file
|
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env sh
|
||||
# Deploy (or update) the predictor stack to a Docker Swarm via the Swarmpit
|
||||
# REST API, then trigger a redeploy so running services pick up the new image.
|
||||
#
|
||||
# Required env: SWARMPIT_URL, SWARMPIT_TOKEN, STACK_NAME, TAG
|
||||
# Optional env: CA_CERTIFICATES (PEM bundle for a private Swarmpit TLS CA)
|
||||
set -eu
|
||||
|
||||
: "${SWARMPIT_URL:?SWARMPIT_URL is required}"
|
||||
: "${SWARMPIT_TOKEN:?SWARMPIT_TOKEN is required}"
|
||||
: "${STACK_NAME:?STACK_NAME is required}"
|
||||
TAG="${TAG:-latest}"
|
||||
|
||||
# Pin the image tag in the compose we send (replace the ${TAG:-latest} default
|
||||
# with the concrete tag) so the exact built image is what gets deployed.
|
||||
sed "s|:\${TAG:-latest}|:${TAG}|g" docker-compose.swarm.yml > /tmp/stack.yml
|
||||
|
||||
CA_OPT=""
|
||||
if [ -n "${CA_CERTIFICATES:-}" ]; then
|
||||
echo "${CA_CERTIFICATES}" > /tmp/swarmpit-ca.crt
|
||||
CA_OPT="--cacert /tmp/swarmpit-ca.crt"
|
||||
fi
|
||||
|
||||
compose_json=$(jq -Rs . < /tmp/stack.yml)
|
||||
jq -n --arg name "${STACK_NAME}" --argjson compose "${compose_json}" \
|
||||
'{name: $name, spec: {compose: $compose}}' > /tmp/swarmpit-payload.json
|
||||
|
||||
echo "Deploying stack '${STACK_NAME}' (tag ${TAG}) to ${SWARMPIT_URL}"
|
||||
curl -fsS -X POST "${SWARMPIT_URL}/api/stacks/${STACK_NAME}" \
|
||||
-H "authorization: Bearer ${SWARMPIT_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d @/tmp/swarmpit-payload.json \
|
||||
--max-time 60 ${CA_OPT}
|
||||
|
||||
echo "Triggering redeploy"
|
||||
curl -fsS -X POST "${SWARMPIT_URL}/api/stacks/${STACK_NAME}/redeploy" \
|
||||
-H "authorization: Bearer ${SWARMPIT_TOKEN}" \
|
||||
--max-time 60 ${CA_OPT} || echo "redeploy trigger failed; services may still roll forward via autoredeploy"
|
||||
|
||||
rm -f /tmp/stack.yml /tmp/swarmpit-payload.json /tmp/swarmpit-ca.crt
|
||||
echo "Done."
|
||||
Loading…
Add table
Add a link
Reference in a new issue