From 4caad884833d44967126433771fe07ea993c7600 Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Sat, 4 Jan 2025 13:39:18 +0100 Subject: [PATCH 1/2] Create compose.yaml --- agdb_server/compose.yaml | 80 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 agdb_server/compose.yaml diff --git a/agdb_server/compose.yaml b/agdb_server/compose.yaml new file mode 100644 index 00000000..9b24f3b7 --- /dev/null +++ b/agdb_server/compose.yaml @@ -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] From 94998d9b822b3a691689f507e3d2022cfd894b30 Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Sat, 4 Jan 2025 13:49:54 +0100 Subject: [PATCH 2/2] Update agdb_server.yaml --- .github/workflows/agdb_server.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/agdb_server.yaml b/.github/workflows/agdb_server.yaml index 4a2c6829..b2cdda44 100644 --- a/.github/workflows/agdb_server.yaml +++ b/.github/workflows/agdb_server.yaml @@ -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