feat: add interactive exploration of Shannon's capacity formula with Plotly graphs
All checks were successful
Build & Deploy Shannon / 🏗️ Build & Deploy Shannon (push) Successful in 3m1s
All checks were successful
Build & Deploy Shannon / 🏗️ Build & Deploy Shannon (push) Successful in 3m1s
- Implemented bandwidth sensitivity and power sensitivity plots. - Created a contour map for bit rate multiplying factors. - Added input parameters for C/N and bandwidth with validation. - Displayed computed results and sensitivity analysis metrics. - Integrated interactive graphs for user exploration. - Included background information section for user guidance.
This commit is contained in:
136
.gitea/workflows/deploy-shannon.yml
Normal file
136
.gitea/workflows/deploy-shannon.yml
Normal file
@@ -0,0 +1,136 @@
|
||||
name: Build & Deploy Shannon
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
paths:
|
||||
- 'app.py'
|
||||
- 'core/**'
|
||||
- 'views/**'
|
||||
- 'requirements.txt'
|
||||
- 'Dockerfile'
|
||||
- 'docker-stack.yml'
|
||||
- '.streamlit/**'
|
||||
- '.gitea/workflows/deploy-shannon.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
IMAGE_NAME: shannon/streamlit
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
name: 🏗️ Build & Deploy Shannon
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 📥 Checkout code
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
|
||||
- name: 🔐 Setup SSH
|
||||
env:
|
||||
SSH_KEY: ${{ secrets.SWARM_SSH_KEY }}
|
||||
SSH_HOST: ${{ secrets.SWARM_MANAGER_HOST }}
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "$SSH_KEY" > ~/.ssh/deploy_key
|
||||
chmod 600 ~/.ssh/deploy_key
|
||||
ssh-keyscan -H $SSH_HOST >> ~/.ssh/known_hosts
|
||||
|
||||
- name: 📦 Copy source to server
|
||||
env:
|
||||
SSH_USER: ${{ secrets.SWARM_USER }}
|
||||
SSH_HOST: ${{ secrets.SWARM_MANAGER_HOST }}
|
||||
run: |
|
||||
tar -czf /tmp/shannon-source.tar.gz \
|
||||
--exclude='.git' \
|
||||
--exclude='.venv' \
|
||||
--exclude='__pycache__' \
|
||||
--exclude='*.db' \
|
||||
--exclude='*.pyc' \
|
||||
-C . .
|
||||
scp -i ~/.ssh/deploy_key /tmp/shannon-source.tar.gz "$SSH_USER@$SSH_HOST":/tmp/
|
||||
echo "✅ Source copied"
|
||||
|
||||
- name: 🐳 Build Docker Image
|
||||
env:
|
||||
SSH_USER: ${{ secrets.SWARM_USER }}
|
||||
SSH_HOST: ${{ secrets.SWARM_MANAGER_HOST }}
|
||||
run: |
|
||||
COMMIT_SHA=$(git rev-parse --short HEAD)
|
||||
echo "📌 Commit: $COMMIT_SHA"
|
||||
|
||||
ssh -i ~/.ssh/deploy_key ${SSH_USER}@${SSH_HOST} << ENDSSH
|
||||
set -e
|
||||
cd /tmp
|
||||
rm -rf shannon-build
|
||||
mkdir -p shannon-build
|
||||
cd shannon-build
|
||||
tar -xzf /tmp/shannon-source.tar.gz
|
||||
|
||||
echo "🐳 Building image with tag: $COMMIT_SHA"
|
||||
docker build -t shannon/streamlit:$COMMIT_SHA \
|
||||
-t shannon/streamlit:latest .
|
||||
|
||||
echo "🧹 Cleaning old images..."
|
||||
docker image prune -f
|
||||
|
||||
echo "✅ Image built: $COMMIT_SHA"
|
||||
ENDSSH
|
||||
|
||||
- name: 🚀 Deploy to Swarm
|
||||
env:
|
||||
SSH_USER: ${{ secrets.SWARM_USER }}
|
||||
SSH_HOST: ${{ secrets.SWARM_MANAGER_HOST }}
|
||||
run: |
|
||||
COMMIT_SHA=$(git rev-parse --short HEAD)
|
||||
|
||||
scp -i ~/.ssh/deploy_key ./docker-stack.yml ${SSH_USER}@${SSH_HOST}:/tmp/shannon-docker-stack.yml
|
||||
|
||||
ssh -i ~/.ssh/deploy_key ${SSH_USER}@${SSH_HOST} << ENDSSH
|
||||
set -e
|
||||
|
||||
echo "🚀 Deploying stack..."
|
||||
docker stack deploy -c /tmp/shannon-docker-stack.yml shannon
|
||||
|
||||
echo "🔄 Forcing service update to use new image..."
|
||||
docker service update --force --image shannon/streamlit:$COMMIT_SHA shannon_shannon
|
||||
|
||||
echo "⏳ Waiting for service to update..."
|
||||
sleep 15
|
||||
|
||||
echo "📊 Service status:"
|
||||
docker service ls --filter name=shannon_shannon
|
||||
docker service ps shannon_shannon --no-trunc
|
||||
|
||||
echo "✅ Deployment complete!"
|
||||
ENDSSH
|
||||
|
||||
- name: 🏥 Health Check
|
||||
env:
|
||||
SSH_USER: ${{ secrets.SWARM_USER }}
|
||||
SSH_HOST: ${{ secrets.SWARM_MANAGER_HOST }}
|
||||
run: |
|
||||
ssh -i ~/.ssh/deploy_key ${SSH_USER}@${SSH_HOST} << ENDSSH
|
||||
echo "🏥 Running health check..."
|
||||
|
||||
for i in 1 2 3 4 5 6 7 8 9 10 11 12; do
|
||||
HTTP_CODE=\$(curl -s -o /dev/null -w "%{http_code}" https://shannon.antopoid.com/_stcore/health)
|
||||
if [ "\$HTTP_CODE" = "200" ]; then
|
||||
echo "✅ Shannon is accessible (HTTP 200)!"
|
||||
exit 0
|
||||
fi
|
||||
echo "⏳ Waiting for Shannon... (\$i/12) - Status: \$HTTP_CODE"
|
||||
sleep 5
|
||||
done
|
||||
|
||||
echo "❌ Health check failed!"
|
||||
echo "📋 Service logs:"
|
||||
docker service logs shannon_shannon --tail 50
|
||||
exit 1
|
||||
ENDSSH
|
||||
|
||||
- name: 🧹 Cleanup
|
||||
run: |
|
||||
rm -f ~/.ssh/deploy_key
|
||||
echo "✅ Deployment finished!"
|
||||
Reference in New Issue
Block a user