initialize
This commit is contained in:
commit
f6e3fdd3c2
22 changed files with 7447 additions and 0 deletions
13
scripts/build.sh
Executable file
13
scripts/build.sh
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "🦀 Building Rust Update Manager"
|
||||
|
||||
# Build the Docker image
|
||||
docker build -t silserv:latest .
|
||||
|
||||
# Tag for registry
|
||||
docker tag silserv:latest pakin-inspiron-15-3530.tail110d9.ts.net/pakin/silserv:latest
|
||||
|
||||
echo "✅ Build completed"
|
||||
echo "🚀 To run: docker-compose up -d"
|
||||
42
scripts/deploy.sh
Executable file
42
scripts/deploy.sh
Executable file
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "🚀 Deploying Silserv"
|
||||
|
||||
# Check prerequisites
|
||||
if ! command -v docker &> /dev/null; then
|
||||
echo "❌ Docker is not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v docker-compose &> /dev/null; then
|
||||
echo "❌ Docker Compose is not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create necessary directories
|
||||
mkdir -p data logs
|
||||
|
||||
# Create network if it doesn't exist
|
||||
docker network create silserv-network 2>/dev/null || echo "Network already exists"
|
||||
|
||||
# Build and start services
|
||||
docker-compose down || true
|
||||
docker-compose up --build -d
|
||||
|
||||
# Wait for services to be ready
|
||||
echo "⏳ Waiting for services to start..."
|
||||
sleep 10
|
||||
|
||||
# Check health
|
||||
if curl -f -s http://localhost:36530/health > /dev/null; then
|
||||
echo "✅ Silserv is healthy"
|
||||
else
|
||||
echo "❌ Silserv health check failed"
|
||||
docker compose logs silserv
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "🎉 Deployment completed successfully!"
|
||||
echo "📊 Dashboard: http://localhost:36530"
|
||||
echo "🔍 API Status: http://localhost:36530/api/status"
|
||||
93
scripts/test-demo.sh
Executable file
93
scripts/test-demo.sh
Executable file
|
|
@ -0,0 +1,93 @@
|
|||
#!/bin/bash
|
||||
# Test script to demonstrate the update manager functionality
|
||||
|
||||
set -e
|
||||
|
||||
echo "🧪 Testing Rust Update Manager with Demo Application"
|
||||
|
||||
# Create a simple demo application
|
||||
mkdir -p demo-app
|
||||
|
||||
cat > demo-app/Dockerfile << 'EOF'
|
||||
FROM node:18-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN echo -e 'const express = require("express");\nconst app = express();\nconst PORT = process.env.PORT || 3000;\nconst VERSION = process.env.APP_VERSION || "1.0.0";\n\napp.get("/health", (req, res) => {\nres.json({ status: "healthy", version: VERSION });\n});\napp.get("/", (req, res) => {\nres.json({\nmessage: "Demo App",\nversion: VERSION,\ntimestamp: new Date().toISOString()\n});\n});\n\napp.listen(PORT, () => {\nconsole.log(`Demo app v${VERSION} running on port ${PORT}`);\n});' > app.js
|
||||
|
||||
RUN npm init -y && npm install express
|
||||
|
||||
ENV APP_VERSION=1.0.0
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["node", "app.js"]
|
||||
EOF
|
||||
|
||||
cat > demo-app/package.json << 'EOF'
|
||||
{
|
||||
"name": "demo-app",
|
||||
"version": "1.0.0",
|
||||
"main": "app.js",
|
||||
"dependencies": {
|
||||
"express": "^4.18.2"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# Build initial version
|
||||
echo "📦 Building demo app v1.0.0..."
|
||||
cd demo-app
|
||||
docker build -t pakin-inspiron-15-3530.tail110d9.ts.net/pakin/demo-app:1.0.0 .
|
||||
docker push pakin-inspiron-15-3530.tail110d9.ts.net/pakin/demo-app:1.0.0
|
||||
cd ..
|
||||
|
||||
# Deploy the update manager
|
||||
echo "🚀 Deploying update manager..."
|
||||
./scripts/deploy.sh
|
||||
|
||||
# Wait for everything to start
|
||||
echo "⏳ Waiting for services to initialize..."
|
||||
sleep 30
|
||||
|
||||
# Check status
|
||||
echo "📊 Checking system status..."
|
||||
curl -s http://localhost:36530/api/status | jq .
|
||||
|
||||
echo "📋 Checking discovered containers..."
|
||||
curl -s http://localhost:36530/api/containers | jq .
|
||||
|
||||
# Build and push v1.1.0
|
||||
echo "📦 Building demo app v1.1.0..."
|
||||
cd demo-app
|
||||
|
||||
# Update the version in Dockerfile
|
||||
# sed -i 's/APP_VERSION=1.0.0/APP_VERSION=1.1.0/' Dockerfile
|
||||
|
||||
docker build -f ./Dockerfile.next -t pakin-inspiron-15-3530.tail110d9.ts.net/pakin/demo-app:1.1.0 .
|
||||
docker push pakin-inspiron-15-3530.tail110d9.ts.net/pakin/demo-app:1.1.0
|
||||
cd ..
|
||||
|
||||
echo "🔄 Triggering update check..."
|
||||
curl -X POST http://localhost:36530/api/discovery/scan
|
||||
|
||||
# Wait a bit for the update to be detected and processed
|
||||
sleep 60
|
||||
|
||||
# Check if update happened
|
||||
echo "✅ Checking if update was applied..."
|
||||
curl -s http://localhost:3000/ | jq .
|
||||
|
||||
echo "📊 Final system status..."
|
||||
curl -s http://localhost:36530/api/stats | jq .
|
||||
|
||||
echo "🎉 Demo completed!"
|
||||
echo ""
|
||||
echo "What happened:"
|
||||
echo "1. Built and deployed demo app v1.0.0"
|
||||
echo "2. Update manager discovered the container"
|
||||
echo "3. Built and pushed demo app v1.1.0 to registry"
|
||||
echo "4. Update manager detected the new version"
|
||||
echo "5. Automatically updated the container"
|
||||
echo ""
|
||||
echo "🌐 Check the API at: http://localhost:36530"
|
||||
echo "🔍 View logs with: docker-compose logs -f"
|
||||
Loading…
Add table
Add a link
Reference in a new issue