Skip to content

Commit

Permalink
[ci] Add docker compose for running local cluster #1446 (#1461)
Browse files Browse the repository at this point in the history
* Create compose.yaml

* Update agdb_server.yaml
  • Loading branch information
michaelvlach authored Jan 4, 2025
1 parent e62a513 commit 3fca8ef
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/agdb_server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: docker build --pull -t agnesoft/agdb:dev -f agdb_server/containerfile .
- run: docker run -d -p 3000:3000 agnesoft/agdb:dev
- run: docker compose -f agdb_server/compose.yaml up --wait
- run: sleep 5
- run: curl http://localhost:3000/api/v1/status
- run: if [[ "$(curl -s http://localhost:3000/api/v1/cluster/status | grep "\"leader\":true")" == "" ]]; then exit 1; fi
- run: |
token=$(curl -X POST http://localhost:3000/api/v1/user/login -H "Content-Type: application/json" -d '{"username":"admin","password":"admin"}')
token=$(curl -X POST http://localhost:3002/api/v1/cluster/user/login -H "Content-Type: application/json" -d '{"username":"admin","password":"admin"}')
curl -H "Authorization: Bearer $token" -X POST http://localhost:3002/api/v1/admin/shutdown
curl -H "Authorization: Bearer $token" -X POST http://localhost:3000/api/v1/admin/shutdown
curl -H "Authorization: Bearer $token" -X POST http://localhost:3001/api/v1/admin/shutdown
80 changes: 80 additions & 0 deletions agdb_server/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
services:
agdb0:
image: agnesoft/agdb:dev
hostname: agdb0
container_name: agdb0
ports:
- "3000:3000"
volumes:
- agdb0_data:/agdb
configs:
- source: agdb0_config
target: /agdb/agdb_server.yaml
agdb1:
image: agnesoft/agdb:dev
hostname: agdb1
container_name: agdb1
ports:
- "3001:3001"
volumes:
- agdb1_data:/agdb
configs:
- source: agdb1_config
target: /agdb/agdb_server.yaml
agdb2:
image: agnesoft/agdb:dev
hostname: agdb2
container_name: agdb2
ports:
- "3002:3002"
volumes:
- agdb2_data:/agdb
configs:
- source: agdb2_config
target: /agdb/agdb_server.yaml

volumes:
agdb0_data:
agdb1_data:
agdb2_data:

configs:
agdb0_config:
content: |
bind: :::3000
address: http://agdb0:3000
basepath: ""
admin: admin
log_level: INFO
data_dir: /agdb/data
pepper_path: ""
cluster_token: cluster
cluster_heartbeat_timeout_ms: 1000
cluster_term_timeout_ms: 3000
cluster: [http://agdb0:3000, http://agdb1:3001, http://agdb2:3002]
agdb1_config:
content: |
bind: :::3001
address: http://agdb1:3001
basepath: ""
admin: admin
log_level: INFO
data_dir: /agdb/data
pepper_path: ""
cluster_token: cluster
cluster_heartbeat_timeout_ms: 1000
cluster_term_timeout_ms: 3000
cluster: [http://agdb0:3000, http://agdb1:3001, http://agdb2:3002]
agdb2_config:
content: |
bind: :::3002
address: http://agdb2:3002
basepath: ""
admin: admin
log_level: INFO
data_dir: /agdb/data
pepper_path: ""
cluster_token: cluster
cluster_heartbeat_timeout_ms: 1000
cluster_term_timeout_ms: 3000
cluster: [http://agdb0:3000, http://agdb1:3001, http://agdb2:3002]

0 comments on commit 3fca8ef

Please sign in to comment.