Skip to content

Commit a943e67

Browse files
committed
manuall run added
1 parent 24bb968 commit a943e67

File tree

1 file changed

+124
-69
lines changed

1 file changed

+124
-69
lines changed
Lines changed: 124 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,124 @@
1-
version: "3.9"
2-
3-
services:
4-
5-
redis:
6-
image: redis:7-alpine
7-
container_name: anomaly-redis
8-
ports:
9-
- "6379:6379"
10-
11-
networks:
12-
- anomaly-network
13-
anomaly-db:
14-
image: quay.io/osclimate/postgresql-13:1-101
15-
container_name: anomaly-db
16-
ports:
17-
- "5433:5432"
18-
environment:
19-
- POSTGRESQL_ADMIN_PASSWORD=admin123$
20-
- POSTGRESQL_DATABASE=anomaly-db
21-
- POSTGRESQL_PASSWORD=anomaly123$
22-
- POSTGRESQL_USER=anomaly
23-
networks:
24-
- anomaly-network
25-
llm-faiss:
26-
build: ./anomaly-llm-faiss
27-
container_name: llm-faiss
28-
ports:
29-
- "8002:8002"
30-
# command: uvicorn app.main:app --host 0.0.0.0 --port 8002 --workers 2
31-
environment:
32-
- REDIS_HOST=redis
33-
- REDIS_PORT=6379
34-
- REDIS_DB=0
35-
- ACTION_REQ=N
36-
- LLM_INFERENCE_QUEUE=llm_inference_queue
37-
depends_on:
38-
- redis
39-
networks:
40-
- anomaly-network
41-
42-
anomaly-detection:
43-
build:
44-
context: ./anomaly_isolation_forest
45-
dockerfile: Dockerfile
46-
container_name: anomaly-detection
47-
ports:
48-
- "8001:8001"
49-
environment:
50-
- PYTHONPATH=/app
51-
- REDIS_HOST=redis
52-
- REDIS_PORT=6379
53-
- PROCESS_ANOMALY_URL=http://llm-faiss:8002/process-anomaly
54-
- REDIS_OBS_HOST=redis
55-
- REDIS_OBS_PORT=6379
56-
- DATABASE_URL=postgresql://anomaly:anomaly123$@anomaly-db:5432/anomaly-db
57-
# volumes:
58-
# - ${PWD}/anomaly_isolation_forest:/app
59-
depends_on:
60-
- redis
61-
- llm-faiss
62-
# command: uvicorn app.main:app --host 0.0.0.0 --port 8001 --workers 2
63-
networks:
64-
- anomaly-network
65-
66-
67-
networks:
68-
anomaly-network:
69-
external: true
1+
name: Run Podman Compose (Folder-based)
2+
3+
on:
4+
# βœ… Manual trigger (run anytime, no code changes needed)
5+
workflow_dispatch:
6+
7+
# βœ… Auto trigger only when demo folder changes
8+
push:
9+
branches: [ main ]
10+
paths:
11+
- 'demo/**'
12+
13+
pull_request:
14+
paths:
15+
- 'demo/**'
16+
17+
jobs:
18+
podman-compose:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
# 1️⃣ Checkout repository
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
# 2️⃣ Detect which demo changed
27+
- name: Detect changed demo folders
28+
id: changes
29+
uses: dorny/paths-filter@v3
30+
with:
31+
filters: |
32+
demo1:
33+
- 'demo/demo-1-basics/**'
34+
demo2:
35+
- 'demo/demo-2-otel/**'
36+
37+
# 3️⃣ HARD CLEAN – free disk space (CRITICAL)
38+
- name: Hard cleanup previous Podman state
39+
run: |
40+
echo "πŸ”₯ Cleaning Podman data to avoid disk issues"
41+
42+
podman ps -aq && podman stop -a || true
43+
podman system prune -af --volumes || true
44+
45+
rm -rf $GITHUB_WORKSPACE/containers || true
46+
rm -rf $GITHUB_WORKSPACE/runroot || true
47+
rm -rf $GITHUB_WORKSPACE/tmp || true
48+
49+
sudo rm -rf /tmp/* || true
50+
51+
# 4️⃣ Install Podman & podman-compose
52+
- name: Install Podman
53+
run: |
54+
sudo apt-get update -y
55+
sudo apt-get install -y podman python3-pip
56+
pip install --no-cache-dir podman-compose
57+
podman --version
58+
59+
# 5️⃣ Configure Podman storage (CI-safe)
60+
- name: Configure Podman storage
61+
run: |
62+
STORAGE_ROOT="${GITHUB_WORKSPACE}/containers"
63+
RUN_ROOT="${GITHUB_WORKSPACE}/runroot"
64+
TMP_ROOT="${GITHUB_WORKSPACE}/tmp"
65+
66+
mkdir -p $STORAGE_ROOT $RUN_ROOT $TMP_ROOT
67+
sudo mkdir -p /etc/containers
68+
69+
cat <<EOF | sudo tee /etc/containers/storage.conf
70+
[storage]
71+
driver = "overlay"
72+
graphroot = "$STORAGE_ROOT"
73+
runroot = "$RUN_ROOT"
74+
EOF
75+
76+
echo "TMPDIR=$TMP_ROOT" >> $GITHUB_ENV
77+
echo "PIP_NO_CACHE_DIR=1" >> $GITHUB_ENV
78+
echo "BUILDAH_FORMAT=docker" >> $GITHUB_ENV
79+
echo "PODMAN_LOG_LEVEL=error" >> $GITHUB_ENV
80+
81+
podman system migrate
82+
83+
# 6️⃣ Ensure Podman network
84+
- name: Ensure Podman network
85+
run: |
86+
podman network exists edge-network || podman network create edge-network
87+
88+
# ===============================
89+
# πŸš€ DEMO-1 – BASIC STACK
90+
# ===============================
91+
- name: Build & Run Demo-1
92+
if: steps.changes.outputs.demo1 == 'true' || github.event_name == 'workflow_dispatch'
93+
working-directory: demo/demo-1-basics
94+
run: |
95+
echo "Running Demo-1..."
96+
podman-compose build --no-cache
97+
podman-compose up -d
98+
podman ps
99+
100+
# ===============================
101+
# πŸš€ DEMO-2 – OTEL CORE
102+
# ===============================
103+
- name: Build & Run Demo-2 (Core)
104+
if: steps.changes.outputs.demo2 == 'true' || github.event_name == 'workflow_dispatch'
105+
working-directory: demo/demo-2-otel
106+
run: |
107+
echo "Running Demo-2 Core..."
108+
podman-compose -f docker-compose.yml build --no-cache
109+
podman-compose -f docker-compose.yml up -d
110+
111+
# ===============================
112+
# πŸš€ DEMO-2 – PERSISTENCE
113+
# ===============================
114+
- name: Run Demo-2 (Persistence)
115+
if: steps.changes.outputs.demo2 == 'true' || github.event_name == 'workflow_dispatch'
116+
working-directory: demo/demo-2-otel
117+
run: |
118+
podman-compose -f docker-compose-persistance.yml up -d
119+
120+
# πŸ”Ÿ FINAL CLEANUP (always)
121+
- name: Final cleanup
122+
if: always()
123+
run: |
124+
podman system prune -af --volumes || true

0 commit comments

Comments
Β (0)