Sepolia db updates and fixes to ci/cd deployments (#19) #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to Remote Server | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: SSH into Remote Server and Deploy Changes | |
uses: appleboy/[email protected] | |
with: | |
host: ec2-3-87-142-202.compute-1.amazonaws.com | |
username: ubuntu | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
passphrase: ${{ secrets.SSH_PASSPHRASE }} | |
port: 22 | |
script: | | |
# Navigate to the project directory | |
cd ~/fossil-headers-db | |
# Pull the latest changes from the main branch | |
git fetch origin main | |
git reset --hard origin/main | |
# Ensure Docker and Docker Compose are installed | |
docker --version || { echo "Docker not found"; exit 1; } | |
docker-compose --version || { echo "Docker Compose not found"; exit 1; } | |
# Stop existing Mainnet services | |
docker-compose -f docker-compose.mainnet.yml --project-name mainnet down | |
# Build and deploy Mainnet services | |
docker-compose -f docker-compose.mainnet.yml --env-file .env.mainnet --project-name mainnet build --no-cache | |
docker-compose -f docker-compose.mainnet.yml --env-file .env.mainnet --project-name mainnet up -d | |
# Verify running services | |
docker ps |