Skip to content

Commit 68e8bee

Browse files
committed
INDEXER UPDATE
1 parent 32ed79f commit 68e8bee

File tree

3 files changed

+54
-29
lines changed

3 files changed

+54
-29
lines changed

.github/workflows/prod.yml

Lines changed: 51 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,17 @@ jobs:
5757
username: ${{ secrets.DOCKER_USERNAME }}
5858
password: ${{ secrets.DOCKER_PASSWORD }}
5959

60-
- name: Build and push Docker images with unique tag
61-
uses: docker/bake-action@v2.3.0
62-
env:
63-
IMAGE_TAG: ${{ steps.tag.outputs.tag }}
60+
- name: Build and push server with unique tag
61+
uses: docker/build-push-action@v4
6462
with:
65-
files: ./server/docker-bake.hcl
63+
context: ./server
6664
push: true
67-
set: |
68-
*.cache-from=type=gha
69-
*.cache-to=type=gha,mode=max
65+
tags: |
66+
paymesh/server:${{ steps.tag.outputs.tag }}
67+
paymesh/server:latest
68+
cache-from: type=gha
69+
cache-to: type=gha,mode=max
70+
platforms: linux/amd64
7071

7172
- name: Build and push indexer with unique tag
7273
uses: docker/build-push-action@v4
@@ -158,24 +159,48 @@ jobs:
158159
echo "Deployment complete!"
159160
echo "Running containers:"
160161
docker ps
161-
# - name: Copy docker-compose.yml to paymesh indexer droplet
162-
# run: sshpass -v -p ${{ secrets.PAYMESH_DROPLET_PASSWORD }} scp -o StrictHostKeyChecking=no the_last_indexer/docker-compose.yml root@${{ vars.PAYMESH_DROPLET_IP }}:~
162+
163+
- name: Copy docker-compose.yml to indexer droplet
164+
run: sshpass -v -p ${{ secrets.INDEXER_DROPLET_PASSWORD }} scp -o StrictHostKeyChecking=no server/docker-compose.yml root@${{ vars.INDEXER_DROPLET_IP }}:~
163165

164-
# - name: Deploy with environment variables
165-
# uses: appleboy/ssh-action@master
166-
# with:
167-
# host: ${{ vars.PAYMESH_DROPLET_IP }}
168-
# username: root
169-
# password: ${{ secrets.PAYMESH_DROPLET_PASSWORD }}
170-
# script: |
171-
# cd ~
172-
# cat > .env <<EOL
173-
# DNA_TOKEN=${{ secrets.DNA_TOKEN }}
174-
# API_URL=${{ secrets.API_URL }}
175-
# PAYMESH_API_KEY=${{ secrets.PAYMESH_API_KEY }}
166+
- name: Deploy with environment variables
167+
uses: appleboy/ssh-action@master
168+
env:
169+
IMAGE_TAG: ${{ needs.build.outputs.image_tag }}
170+
with:
171+
host: ${{ vars.INDEXER_DROPLET_IP }}
172+
username: root
173+
password: ${{ secrets.INDEXER_DROPLET_PASSWORD }}
174+
envs: IMAGE_TAG
175+
script: |
176+
cd ~
177+
178+
# Create environment file
179+
cat > .env <<EOL
180+
DNA_TOKEN=${{ secrets.DNA_TOKEN }}
181+
API_URL=${{ secrets.API_URL }}
182+
PAYMESH_API_KEY=${{ secrets.PAYMESH_API_KEY }}
183+
IMAGE_TAG=${IMAGE_TAG}
184+
EOL
185+
186+
echo "Deploying with image tag: ${IMAGE_TAG}"
187+
188+
# Stop, pull new images, and restart
189+
docker compose --env-file .env stop
190+
docker compose --env-file .env pull
191+
docker compose --env-file .env up -d
192+
193+
# Cleanup old images - keep last 5 versions
194+
echo "Cleaning up old images..."
195+
docker images "paymesh/the-last-indexer" --format "{{.Repository}}:{{.Tag}}" | \
196+
grep -v latest | \
197+
sort -r | \
198+
tail -n +6 | \
199+
xargs -r docker rmi || true
176200
177-
# EOL
201+
# Remove dangling images
202+
docker image prune -f
178203
179-
# docker compose --env-file .env stop
180-
# docker compose --env-file .env pull
181-
# docker compose --env-file .env up -d
204+
echo "Deployment complete!"
205+
echo "Running containers:"
206+
docker ps
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
services:
22
indexer:
3-
image: paymesh/the-last-indexer:latest
3+
image: paymesh/the-last-indexer:${IMAGE_TAG:-latest}
44
restart: always
55
environment:
66
DNA_TOKEN: "${DNA_TOKEN}"
77
API_URL: "${API_URL}"
8-
PAYMESH_API_KEY: "${PAYMESH_API_KEY}"
8+
PAYMESH_API_KEY: "${PAYMESH_API_KEY}"

the_last_indexer/indexers/paymesh-starknet.indexer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default function (runtimeConfig: ApibaraRuntimeConfig) {
3535
let crowd_funding_cache = [...crowdFundingContractAddresses];
3636
let group_cache = [...group_address_cache];
3737

38-
console.log("Crowd Funding Cache: ", crowd_funding_cache);
38+
console.log("Tracking with paymesh \n Crowd Funding Cache: ", crowd_funding_cache);
3939
console.log("Group Cache: ", group_cache);
4040
console.log("starting block ", startingBlock)
4141

0 commit comments

Comments
 (0)