Skip to content

Commit 354a374

Browse files
committed
chore: update the docker-compose pipeline
1 parent 1fb7569 commit 354a374

File tree

7 files changed

+28
-3
lines changed

7 files changed

+28
-3
lines changed

.github/workflows/ci-cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
run: |
8282
docker compose up -d sdci-server
8383
sleep 5
84-
docker compose run sdci-client
84+
docker compose run --rm sdci-client
8585
curl -s -o /dev/null -w "%{http_code}" http://localhost:8842/docs || true
8686
docker compose down
8787

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ RUN apt-get update && \
1717
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
1818
tee /etc/apt/sources.list.d/docker.list > /dev/null \
1919
&& apt-get update \
20-
&& apt-get install -y docker-ce-cli
20+
&& apt-get install -y docker-ce-cli curl
2121

2222
COPY ./ /app/
2323

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,10 @@ build: clean
1212

1313
publish: build
1414
uv publish
15+
16+
docker-build: build
17+
docker compose build sdci-base
18+
19+
docker-testing: docker-build
20+
docker compose run --rm sdci-client
21+
docker compose down

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ SDCI (Sistema de Deploy Continuo Integrado - Integrated Continuous Deployment Sy
1111
- Token-based authentication
1212
- Real-time task output streaming
1313
- Task status monitoring
14+
- CLI interface to manage tasks
1415

1516
## 🔩 Architecture Diagram
1617
The ideal way to work with this tool is using the following structure:
@@ -43,6 +44,9 @@ python -m src.server
4344

4445
By default, the server runs on `0.0.0.0:8842`.
4546

47+
## Creating tasks
48+
The server will look up for tasks in the `tasks/` directory where you ran this server. It will look for shell scripts on this folder. The job name is the script name without the `.sh` extension.
49+
4650
### Using the client
4751

4852
The client tool can be used to trigger tasks on the server:

docker-compose.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ services:
1313
- "8842:8842"
1414
environment:
1515
- SDCI_SERVER_TOKEN=HELLO_WORLD_123
16+
healthcheck:
17+
test: ["CMD", "curl", "-f", "http://localhost:8842/health"]
18+
interval: 3s
19+
timeout: 3s
20+
retries: 4
21+
start_period: 1s
1622
volumes:
1723
- /var/run/docker.sock:/var/run/docker.sock
1824
- ./src/tasks:/app/src/tasks
@@ -25,5 +31,8 @@ services:
2531
- SDCI_TOKEN=HELLO_WORLD_123
2632
profiles:
2733
- client-run
34+
depends_on:
35+
sdci-server:
36+
condition: service_healthy
2837
volumes:
2938
- ./:/app/

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "sdci"
3-
version = "0.6.1"
3+
version = "0.6.2"
44
description = "SDCI - Sistema de Deploy Continuo Integrado - Integrated Continuous Deployment System - Sidecar Micro CD"
55
readme = "README.md"
66
authors = [

src/sdci/server.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ async def verify_token(token: str = Depends(oauth2_scheme)):
5858
return token
5959

6060

61+
@app.get("/health")
62+
async def health():
63+
return {"status": "OK"}
64+
65+
6166
@app.post("/tasks/{task_name:str}/", dependencies=[Depends(verify_token)])
6267
async def run_task(task_name: str, request: TaskRequestSchema):
6368
global task_info_store

0 commit comments

Comments
 (0)