Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] Add docker compose for running local cluster #1446 #1461

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]
Loading