Skip to content

Commit bca6418

Browse files
MautjeeFilipHaraldMauro EijsenringMauro Eijsenring
authored
add production environment on digital ocean (#8)
* added a lot more verbosity to blockschema (and types) * successful store and retreival * frontend working * updated package.json * improved types and removed a bunch of eslint ignores * remove install state * fixed stuff * comment and http-server * fixed playground * more improvements * delete * added generic block type * backend new type working * format * removed unknowns * improve UI * updated type and DB * updated schema * split the files * misses * types and shit * fix logs * update deployment * added production * fixed it * small fixes * updq * set different runner * set namespace correct part one * edit namespace * update namespace * delete * fix error * Update github action * update deletion of old registers * update path * update path * update to cleanup script * update to github action * change latest 5 to 1 * removed sha filter * update fiter * change 1 to 2 * added retrys * update token time * change name * use docker login * reverted changes * update path * change to docker login * add env variable * update skaffold file * update the image location * remove dummy node * update namespace * remove dummy node file * updart * change name * add pull secret * update yaml file * add small script for ingress * delete kafka-ui in frontend * add config * change ingress * change position for pull secret * fix: added crash callback to message-bus (#9) * change from local to production * update skaffold nginx controller * change trigger branche * chore: upgrade aztec-packages to 0.53.0 (#16) * chore: refactor `aztec_listener` (#20) also added nodeInfo to kafka message * removed todo * add init containers * fix typo * added todo for fixing domain name * rename database * Update k8s/local/aztec-listener/deployment.yaml * feat: added `/blocks/$blockNumber` to `explorer-ui` (#18) --------- Co-authored-by: filip <[email protected]> Co-authored-by: Mauro Eijsenring <[email protected]> Co-authored-by: Mauro Eijsenring <[email protected]>
1 parent fc1e16d commit bca6418

23 files changed

+671
-262
lines changed

.github/workflows/chicmoz-prod.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: CI/CD Chicmoz Prod
2+
3+
on:
4+
push:
5+
branches:
6+
- production
7+
pull_request:
8+
branches:
9+
- production
10+
types:
11+
- closed
12+
13+
jobs:
14+
build_and_deploy:
15+
runs-on:
16+
labels: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout Repository
20+
uses: actions/checkout@v2
21+
22+
- name: Install Skaffold
23+
run: |
24+
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64
25+
sudo install skaffold /usr/local/bin/
26+
shell: bash
27+
28+
- name: Install doctl
29+
uses: digitalocean/action-doctl@v2
30+
with:
31+
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
32+
33+
- name: Log in to DigitalOcean Container Registry with short-lived credentials
34+
run: doctl registry login --expiry-seconds 1200
35+
36+
- name: Cleanup old images
37+
run: |
38+
chmod +x ".github/workflows/cleanup-script.sh"
39+
bash -x ".github/workflows/cleanup-script.sh"
40+
41+
- name: Save DigitalOcean kubeconfig
42+
run: doctl kubernetes cluster kubeconfig save "chicmoz-prod"
43+
44+
- name: Deploy to cluster with Skaffold
45+
run: |
46+
MAX_RETRIES=3
47+
RETRY_DELAY=10
48+
49+
for i in $(seq 1 $MAX_RETRIES); do
50+
if skaffold run --filename "k8s/production/skaffold.production.yaml" --default-repo=registry.digitalocean.com/aztlan-containers; then
51+
echo "Deployment successful"
52+
exit 0
53+
fi
54+
echo "Attempt $i failed. Retrying in $RETRY_DELAY seconds..."
55+
sleep $RETRY_DELAY
56+
done
57+
58+
echo "Deployment failed after $MAX_RETRIES attempts"
59+
exit 1

.github/workflows/cleanup-script.sh

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
# Enable error reporting
4+
set -e
5+
6+
# Function to delete old tags for a given repository
7+
delete_old_tags() {
8+
local repo="$1"
9+
echo "Processing repository: $repo"
10+
11+
# List tags and filter for SHA-based tags, excluding the most recent 5
12+
SHA_TAGS=$(doctl registry repository list-tags "$repo" --format "Manifest Digest" --no-header | grep -E '^sha' | sort -r | tail -n +3) || true
13+
14+
if [ -z "$SHA_TAGS" ]; then
15+
echo "No old SHA tags found for repository: $repo"
16+
return
17+
fi
18+
19+
# Delete each old SHA-based tag
20+
while IFS= read -r tag; do
21+
echo "Attempting to delete tag: $tag from repository: $repo"
22+
if doctl registry repository delete-manifest "$repo" "$tag" --force; then
23+
echo "Successfully deleted tag: $tag from repository: $repo"
24+
else
25+
echo "Failed to delete tag: $tag from repository: $repo"
26+
fi
27+
done <<< "$SHA_TAGS"
28+
}
29+
30+
# List all repositories in the registry
31+
echo "Listing repositories..."
32+
REPOS=$(doctl registry repository list --format Name --no-header) || { echo "Failed to list repositories"; exit 1; }
33+
34+
if [ -z "$REPOS" ]; then
35+
echo "No repositories found in the registry."
36+
exit 0
37+
fi
38+
39+
# Process each repository
40+
while IFS= read -r repo; do
41+
delete_old_tags "$repo"
42+
done <<< "$REPOS"
43+
44+
echo "Cleanup completed."

.github/workflows/obscura-dev.yaml

-98
This file was deleted.

.github/workflows/obscura-merge-check.yaml

-52
This file was deleted.

.github/workflows/obscura-pre-dev.yaml

-53
This file was deleted.

.github/workflows/obscura-prod.yml

-56
This file was deleted.

k8s/local/aztec-listener/deployment.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ spec:
4949
value: "50"
5050
- name: CHAIN_NAME
5151
value: "AZTEC"
52+
- name: DISABLE_AZTEC
53+
value: "true"
5254
- name: NETWORK_NAME
5355
value: "SANDBOX"
5456
- name: MAX_BATCH_SIZE_FETCH_MISSED_BLOCKS
@@ -69,8 +71,6 @@ spec:
6971
value: "admin"
7072
- name: POSTGRES_PASSWORD
7173
value: "secret-local-password"
72-
- name: AZTEC_RPC
73-
value: "http://host.minikube.internal:8080"
7474
- name: IGNORE_PROCESSED_HEIGHT
75-
value: "true"
75+
value: "false"
7676
status: {}

k8s/production/apply_prod_ingress.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
kubectl apply -f explorer-ui/ingress.yaml
4+
kubectl apply -f explorer-api/ingress.yaml
5+

0 commit comments

Comments
 (0)