diff mbox series

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

Message ID 20231012221655.632637-11-JPEWhacker@gmail.com
State New
Headers show
Series Bitbake Hash Server WebSockets, Alternate Database Backend, and User Management | expand

Commit Message

Joshua Watt Oct. 12, 2023, 10:16 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>
---
 contrib/hashserv/docker-compose      | 11 +++++++++
 contrib/hashserv/docker-compose.yaml | 36 ++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)
 create mode 100755 contrib/hashserv/docker-compose
 create mode 100644 contrib/hashserv/docker-compose.yaml
diff mbox series

Patch

diff --git a/contrib/hashserv/docker-compose b/contrib/hashserv/docker-compose
new file mode 100755
index 00000000..74cbf480
--- /dev/null
+++ b/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/contrib/hashserv/docker-compose.yaml b/contrib/hashserv/docker-compose.yaml
new file mode 100644
index 00000000..c1ab73c1
--- /dev/null
+++ b/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: