refactor: single container image only, update terraform and docs
- Remove two-container compose from distribution - Single docker-compose.yml using unified OCIR image - Update cloud-init template for single container - README with 4 deployment options: local Docker, OCI VM (Terraform), Container Instances, Kubernetes
This commit is contained in:
@@ -48,7 +48,6 @@ fi
|
||||
mkdir -p /data
|
||||
mount "$DATA_DEVICE" /data
|
||||
|
||||
# Add to fstab if not already present
|
||||
if ! grep -q "$DATA_DEVICE" /etc/fstab; then
|
||||
echo "$DATA_DEVICE /data ext4 defaults,_netdev,nofail 0 2" >> /etc/fstab
|
||||
fi
|
||||
@@ -56,9 +55,6 @@ fi
|
||||
echo ">>> /data mounted successfully"
|
||||
df -h /data
|
||||
|
||||
# Create application data directories
|
||||
mkdir -p /data/db /data/configs /data/reports /data/terraform /data/wallets
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 4. Docker login to OCIR
|
||||
# -----------------------------------------------------------------------------
|
||||
@@ -69,16 +65,12 @@ echo '${ocir_auth_token}' | docker login "$OCIR_ENDPOINT" \
|
||||
--password-stdin
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 5. Pull images
|
||||
# 5. Pull image
|
||||
# -----------------------------------------------------------------------------
|
||||
BACKEND_IMAGE="$OCIR_ENDPOINT/${ocir_namespace}/${ocir_repo_prefix}/backend:latest"
|
||||
FRONTEND_IMAGE="$OCIR_ENDPOINT/${ocir_namespace}/${ocir_repo_prefix}/frontend:latest"
|
||||
IMAGE="$OCIR_ENDPOINT/${ocir_namespace}/${ocir_repo_prefix}:latest"
|
||||
|
||||
echo ">>> Pulling backend image: $BACKEND_IMAGE"
|
||||
docker pull "$BACKEND_IMAGE"
|
||||
|
||||
echo ">>> Pulling frontend image: $FRONTEND_IMAGE"
|
||||
docker pull "$FRONTEND_IMAGE"
|
||||
echo ">>> Pulling image: $IMAGE"
|
||||
docker pull "$IMAGE"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 6. Write docker-compose.yml
|
||||
@@ -88,43 +80,29 @@ mkdir -p "$APP_DIR"
|
||||
|
||||
cat > "$APP_DIR/docker-compose.yml" <<'COMPOSE_EOF'
|
||||
services:
|
||||
backend:
|
||||
image: ${ocir_region}.ocir.io/${ocir_namespace}/${ocir_repo_prefix}/backend:latest
|
||||
container_name: cisagent-backend
|
||||
agent:
|
||||
image: ${ocir_region}.ocir.io/${ocir_namespace}/${ocir_repo_prefix}:latest
|
||||
container_name: oci-cis-agent
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- APP_SECRET=${app_secret}
|
||||
- JWT_EXPIRY_HOURS=${jwt_expiry_hours}
|
||||
- DATA_DIR=/data
|
||||
- CORS_ORIGINS=${cors_origins}
|
||||
- TZ=${app_timezone}
|
||||
- OCI_CLI_SUPPRESS_FILE_PERMISSIONS_WARNING=True
|
||||
ports:
|
||||
- "8080:8080"
|
||||
volumes:
|
||||
- /data:/data
|
||||
mem_limit: 4g
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8000/api/health"]
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8080/api/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
networks:
|
||||
- agent-net
|
||||
|
||||
frontend:
|
||||
image: ${ocir_region}.ocir.io/${ocir_namespace}/${ocir_repo_prefix}/frontend:latest
|
||||
container_name: cisagent-frontend
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8080:80"
|
||||
mem_limit: 512m
|
||||
depends_on:
|
||||
backend:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- agent-net
|
||||
|
||||
networks:
|
||||
agent-net:
|
||||
driver: bridge
|
||||
COMPOSE_EOF
|
||||
|
||||
echo ">>> docker-compose.yml written to $APP_DIR"
|
||||
@@ -132,7 +110,7 @@ echo ">>> docker-compose.yml written to $APP_DIR"
|
||||
# -----------------------------------------------------------------------------
|
||||
# 7. Start application
|
||||
# -----------------------------------------------------------------------------
|
||||
echo ">>> Starting application with Docker Compose..."
|
||||
echo ">>> Starting application..."
|
||||
cd "$APP_DIR"
|
||||
docker compose up -d
|
||||
|
||||
@@ -154,10 +132,10 @@ done
|
||||
|
||||
if [ $ATTEMPTS -eq $MAX_ATTEMPTS ]; then
|
||||
echo "WARNING: Application did not become healthy within expected time"
|
||||
echo ">>> Docker container status:"
|
||||
echo ">>> Container status:"
|
||||
docker compose ps
|
||||
echo ">>> Backend logs:"
|
||||
docker compose logs backend --tail 50
|
||||
echo ">>> Logs:"
|
||||
docker compose logs --tail 50
|
||||
fi
|
||||
|
||||
echo "=== OCI CIS Agent cloud-init finished at $(date) ==="
|
||||
|
||||
Reference in New Issue
Block a user