fix(sol): bootstrap public edge host firewall in workflow
Some checks failed
deploy-sol-public-edge / apply (push) Has been cancelled
Some checks failed
deploy-sol-public-edge / apply (push) Has been cancelled
This commit is contained in:
@@ -16,6 +16,49 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install OpenSSH client
|
||||||
|
run: |
|
||||||
|
if ! command -v ssh >/dev/null 2>&1; then
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y --no-install-recommends openssh-client
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Materialize sol SSH key
|
||||||
|
env:
|
||||||
|
SOL_SSH_PRIVATE_KEY_B64: ${{ secrets.SOL_SSH_PRIVATE_KEY_B64 }}
|
||||||
|
run: |
|
||||||
|
test -n "$SOL_SSH_PRIVATE_KEY_B64"
|
||||||
|
install -d -m 0700 "$HOME/.ssh"
|
||||||
|
printf '%s' "$SOL_SSH_PRIVATE_KEY_B64" | base64 -d >"$HOME/.ssh/sol_mevnode"
|
||||||
|
chmod 600 "$HOME/.ssh/sol_mevnode"
|
||||||
|
|
||||||
|
- name: Prepare host firewall
|
||||||
|
run: |
|
||||||
|
ssh_target() {
|
||||||
|
ssh \
|
||||||
|
-i "$HOME/.ssh/sol_mevnode" \
|
||||||
|
-o IdentitiesOnly=yes \
|
||||||
|
-o StrictHostKeyChecking=no \
|
||||||
|
user@149.50.96.162 \
|
||||||
|
"$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
ensure_rule() {
|
||||||
|
local port="$1"
|
||||||
|
local comment="$2"
|
||||||
|
local pattern="${port}/tcp on enp6s0"
|
||||||
|
if ssh_target "sudo ufw status numbered | grep -F -- $(printf '%q' "$pattern") >/dev/null"; then
|
||||||
|
echo "ufw rule already present: ${pattern}"
|
||||||
|
else
|
||||||
|
ssh_target "sudo ufw allow in on enp6s0 to any port ${port} proto tcp comment '${comment}'"
|
||||||
|
echo "added ufw rule: ${pattern}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
ensure_rule 80 trade-public-http
|
||||||
|
ensure_rule 443 trade-public-https
|
||||||
|
ssh_target "sudo ufw status numbered"
|
||||||
|
|
||||||
- name: Materialize kubeconfig
|
- name: Materialize kubeconfig
|
||||||
env:
|
env:
|
||||||
K3S_KUBECONFIG_B64: ${{ secrets.K3S_KUBECONFIG_B64 }}
|
K3S_KUBECONFIG_B64: ${{ secrets.K3S_KUBECONFIG_B64 }}
|
||||||
@@ -78,6 +121,7 @@ jobs:
|
|||||||
KUBECONFIG: /tmp/kubeconfig
|
KUBECONFIG: /tmp/kubeconfig
|
||||||
run: |
|
run: |
|
||||||
kubectl -n trade-r001-canary get ingress trade-frontend-public -o wide
|
kubectl -n trade-r001-canary get ingress trade-frontend-public -o wide
|
||||||
|
kubectl -n kube-system get ds traefik -o wide
|
||||||
curl -fsS --resolve trade.mpabi.pl:80:149.50.96.162 http://trade.mpabi.pl/healthz
|
curl -fsS --resolve trade.mpabi.pl:80:149.50.96.162 http://trade.mpabi.pl/healthz
|
||||||
|
|
||||||
- name: Report TLS state
|
- name: Report TLS state
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ Public ingress and TLS edge for the reconstructed `R001` trade surface on `sol`.
|
|||||||
./sol/public-edge/scripts/prepare-sol-public-edge.sh
|
./sol/public-edge/scripts/prepare-sol-public-edge.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Push this repository to `main` and let `deploy-sol-public-edge` apply the cluster-side resources.
|
2. Push this repository to `main` and let `deploy-sol-public-edge` prepare the host firewall and apply the cluster-side resources.
|
||||||
|
|
||||||
The workflow bootstraps `cert-manager` and `Traefik` first, then applies `ClusterIssuer/letsencrypt-prod` only after the cert-manager CRDs are ready.
|
The workflow bootstraps `cert-manager` and `Traefik` first, then applies `ClusterIssuer/letsencrypt-prod` only after the cert-manager CRDs are ready.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user