Skip to content

Conversation

@knonomura
Copy link

@knonomura knonomura commented Dec 15, 2020

Hello,
We would like to add an official image for our GridDB.

Checklist for Review

NOTE: This checklist is intended for the use of the Official Images maintainers both to track the status of your PR and to help inform you and others of where we're at. As such, please leave the "checking" of items to the repository maintainers. If there is a point below for which you would like to provide additional information or note completion, please do so by commenting on the PR. Thanks! (and thanks for staying patient with us ❤️)

@tianon
Copy link
Member

tianon commented Dec 13, 2021

Sorry for the delay 🙇

I think the biggest issue I see here is the tail -f in that entrypoint script -- having that be the final command of the image means that the container orchestrator doesn't get any indication if any of the actual GridDB processes fails. Is there not a better command which could be run in a "foreground" mode to properly capture signals and appropriately represent the lifecycle of the service?

@knonomura
Copy link
Author

Thank you so much for your comment.
I'll improve our script.

@github-actions
Copy link

Diff for fb18acb:
diff --git a/_bashbrew-cat b/_bashbrew-cat
index bdfae4a..95f8e2b 100644
--- a/_bashbrew-cat
+++ b/_bashbrew-cat
@@ -1 +1,6 @@
-Maintainers: New Image! :D (@docker-library-bot)
+Maintainers: Katsuhiko Nonomura <[email protected]> (@knonomura)
+GitRepo: https://github.com/griddb/griddb-docker.git
+
+Tags: latest, 4.5.2-bionic
+GitCommit: fc29e77474c69ccd3ff989b48eb745f9a3bb4808
+Directory: griddb/4.5/bionic
diff --git a/_bashbrew-list b/_bashbrew-list
index e69de29..95c47a2 100644
--- a/_bashbrew-list
+++ b/_bashbrew-list
@@ -0,0 +1,2 @@
+griddb:4.5.2-bionic
+griddb:latest
diff --git a/griddb_4.5.2-bionic/Dockerfile b/griddb_4.5.2-bionic/Dockerfile
new file mode 100644
index 0000000..928f2da
--- /dev/null
+++ b/griddb_4.5.2-bionic/Dockerfile
@@ -0,0 +1,32 @@
+FROM ubuntu:18.04
+
+# You can download griddb V4.5.2 directly at https://github.com/griddb/griddb/releases/tag/v4.5.2
+ENV GRIDDB_VERSION=4.5.2
+ENV GRIDDB_DOWNLOAD_SHA512=92d0e382c8d694c2b37274fa37785e2bdb9d6ad8aee0f559e75a528ad171aea1221091ca24db5e2f90442fd92042a6307198d74d0eb1b5f9a23659a26ca7b609
+ENV GS_HOME=/var/lib/gridstore
+ENV GS_LOG=/var/lib/gridstore/log
+ENV PORTS=10001
+
+# Install griddb server
+RUN set -eux \
+    && apt-get update \
+# Install dependency for griddb
+    && apt-get install -y dpkg python wget \
+    && apt-get clean all \
+# Download package griddb server
+    && wget -q https://github.com/griddb/griddb/releases/download/v${GRIDDB_VERSION}/griddb_${GRIDDB_VERSION}_amd64.deb \
+# Check sha512sum package
+    && echo "$GRIDDB_DOWNLOAD_SHA512 griddb_${GRIDDB_VERSION}_amd64.deb" | sha512sum --strict --check \
+# Install package griddb server
+    && dpkg -i griddb_${GRIDDB_VERSION}_amd64.deb \
+# Remove package
+    && rm griddb_${GRIDDB_VERSION}_amd64.deb
+
+VOLUME /var/lib/gridstore
+
+# Config file for griddb
+COPY start-griddb.sh /
+USER gsadm
+ENTRYPOINT ["/bin/bash", "/start-griddb.sh"]
+EXPOSE $PORTS
+CMD ["griddb"]
diff --git a/griddb_4.5.2-bionic/start-griddb.sh b/griddb_4.5.2-bionic/start-griddb.sh
new file mode 100644
index 0000000..338b5fe
--- /dev/null
+++ b/griddb_4.5.2-bionic/start-griddb.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+if [ "${1:0:1}" = '-' ]; then
+    set -- griddb "$@"
+fi
+
+# Save variable and value to config file
+save_config() {
+    echo "GRIDDB_CLUSTER_NAME=\"$GRIDDB_CLUSTER_NAME\"" >> /var/lib/gridstore/conf/gridstore.conf
+    echo "GRIDDB_USERNAME=\"$GRIDDB_USERNAME\""         >> /var/lib/gridstore/conf/gridstore.conf
+    echo "GRIDDB_PASSWORD=\"$GRIDDB_PASSWORD\""         >> /var/lib/gridstore/conf/gridstore.conf
+}
+
+# First parameter after run images
+if [ "${1}" = 'griddb' ]; then
+
+    isSystemInitialized=0
+    if [ "$(ls -A /var/lib/gridstore/data)" ]; then
+        isSystemInitialized=1
+    fi
+
+    if [ $isSystemInitialized = 0 ]; then
+        export GRIDDB_CLUSTER_NAME=${GRIDDB_CLUSTER_NAME:-"dockerGridDB"}
+        export GRIDDB_USERNAME=${GRIDDB_USERNAME:-"admin"}
+        export GRIDDB_PASSWORD=${GRIDDB_PASSWORD:-"admin"}
+
+        # Extra modification based on environment variable
+        gs_passwd $GRIDDB_USERNAME -p $GRIDDB_PASSWORD
+        sed -i -e s/\"clusterName\":\"\"/\"clusterName\":\"$GRIDDB_CLUSTER_NAME\"/g \/var/lib/gridstore/conf/gs_cluster.json
+
+        # MULTICAST mode
+        if [ ! -z $NOTIFICATION_ADDRESS ]; then
+            echo "MULTICAST mode address"
+            sed -i -e s/\"notificationAddress\":\"239.0.0.1\"/\"notificationAddress\":\"$NOTIFICATION_ADDRESS\"/g \/var/lib/gridstore/conf/gs_cluster.json
+        fi
+
+        if [ ! -z $NOTIFICATION_PORT ]; then
+            echo "MULTICAST mode port"
+            sed -i -e s/\"notificationPort\":31999/\"notificationPort\":$NOTIFICATION_PORT/g \/var/lib/gridstore/conf/gs_cluster.json
+        fi
+
+        # FIXED_LIST mode
+        if [ ! -z $NOTIFICATION_MEMBER ]; then
+            echo "FIXED_LIST mode, not suported"
+            exit 1
+        fi
+
+        # PROVIDER mode
+        if [ ! -z $NOTIFICATION_PROVIDER ]; then
+            echo "PROVIDER mode, not supported"
+            exit 1
+        fi
+
+        # Write to config file
+        save_config
+    fi
+
+    # Read config file
+    . /var/lib/gridstore/conf/gridstore.conf
+
+    # Start service
+    cd /var/lib/gridstore
+    sleep 5 && gs_joincluster -u $GRIDDB_USERNAME/$GRIDDB_PASSWORD -c $GRIDDB_CLUSTER_NAME -w &
+    gsserver --conf ./conf
+fi
+exec "$@"
+

@knonomura
Copy link
Author

Sorry for late update.

I updated our entrypoint script to start GridDB process directly.
Could you please check it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants