diff mbox series

[bitbake-devel,RFC,v2,12/12] contrib: hashserv: Add docker-compose

Message ID 20231003145249.1166276-13-JPEWhacker@gmail.com
State New
Headers show
Series Bitbake Hash Server WebSockets and Alternate Database Backend | expand

Commit Message

Joshua Watt Oct. 3, 2023, 2:52 p.m. UTC
Adds a docker-compose.yaml file and docker-compose script wrapper to run
it with the correct arguments. This can be used to easily standup a hash
equivalence server with a postgresql database for demonstration
purposes.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 bitbake/contrib/hashserv/docker-compose      | 11 ++++++
 bitbake/contrib/hashserv/docker-compose.yaml | 36 ++++++++++++++++++++
 2 files changed, 47 insertions(+)
 create mode 100755 bitbake/contrib/hashserv/docker-compose
 create mode 100644 bitbake/contrib/hashserv/docker-compose.yaml
diff mbox series

Patch

diff --git a/bitbake/contrib/hashserv/docker-compose b/bitbake/contrib/hashserv/docker-compose
new file mode 100755
index 00000000000..74cbf4807d0
--- /dev/null
+++ b/bitbake/contrib/hashserv/docker-compose
@@ -0,0 +1,11 @@ 
+#! /bin/sh
+# Copyright (C) 2023 Garmin Ltd.
+#
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Wrapper script to correctly run docker-compose with the correct argument for
+# the hash equivalence server
+
+cd "$(dirname "$0")/../../"
+
+exec docker-compose -f contrib/hashserv/docker-compose.yaml --project-directory . "$@"
diff --git a/bitbake/contrib/hashserv/docker-compose.yaml b/bitbake/contrib/hashserv/docker-compose.yaml
new file mode 100644
index 00000000000..c1ab73c12e8
--- /dev/null
+++ b/bitbake/contrib/hashserv/docker-compose.yaml
@@ -0,0 +1,36 @@ 
+# Copyright (C) 2023 Garmin Ltd.
+#
+# SPDX-License-Identifier: GPL-2.0-only
+
+---
+version: "3.7"
+services:
+  postgresql:
+    image: postgres:16.0
+    restart: always
+    environment:
+      - POSTGRES_DB=hashserver
+      - POSTGRES_USER=postgres
+      - POSTGRES_PASSWORD=postgres
+    volumes:
+      - postgres-data:/var/lib/postgresql/data
+
+  hashserver:
+    build:
+      context: .
+      dockerfile: ./contrib/hashserv/Dockerfile
+    image: bitbake-hashserver:latest
+    restart: always
+    ports:
+      - "9000:9000"
+    environment:
+      - HASHSERVER_LOG_LEVEL=INFO
+      - "HASHSERVER_BIND=ws://0.0.0.0:9000"
+      - "HASHSERVER_DB=postgresql+asyncpg://postgresql:5432/hashserver"
+      - HASHSERVER_DB_USERNAME=postgres
+      - HASHSERVER_DB_PASSWORD=postgres
+    depends_on:
+      - postgresql
+
+volumes:
+  postgres-data: