From 265d9bdd1d176696d3d5197bf8cd2e83437f4d2c Mon Sep 17 00:00:00 2001 From: Niels Vandekeybus Date: Tue, 23 Nov 2021 16:11:19 +0100 Subject: [PATCH 1/5] add a script to generate backups --- scripts/config.json | 21 +++++++++++++++++++++ scripts/virtuoso/create-backup.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 scripts/config.json create mode 100755 scripts/virtuoso/create-backup.sh diff --git a/scripts/config.json b/scripts/config.json new file mode 100644 index 0000000..7ee99c9 --- /dev/null +++ b/scripts/config.json @@ -0,0 +1,21 @@ +{ + "version": "0.1", + "scripts": [ + { + "documentation": { + "command": "create-backup", + "description": "A virtuoso backup will be created db/backups.\n Parameters:\n prefix: default backup_${DATE}\n hostname: default triplestore\n username: default dba\n password: default dba", + "arguments": ["prefix", "hostname", "username", "password"] + }, + "environment": { + "image": "redpencil/virtuoso", + "interactive": false, + "script": "virtuoso/create-backup.sh", + "join_networks": true + }, + "mounts": { + "app": "/project/" + } + } + ] +} diff --git a/scripts/virtuoso/create-backup.sh b/scripts/virtuoso/create-backup.sh new file mode 100755 index 0000000..5385239 --- /dev/null +++ b/scripts/virtuoso/create-backup.sh @@ -0,0 +1,28 @@ +#!/bin/bash +USERNAME=${3:-"dba"} +PASSWORD=${4:-"dba"} +TRIPLESTORE=${2:-"triplestore"} +DATE=`date +%Y%0m%0d%0H%0M%0S` +PREFIX=${1:-"backup_${DATE}_"} +if [[ "$#" -ge 4 ]]; then + echo "Usage:" + echo " mu script triplestore [prefix] [hostname] [username] [password]" + exit -1; +fi + +if [[ -d "/project/data/db" ]];then + mkdir -p /project/data/db/backups +else + echo "WARNING:" + echo " did not find data/db folder in your project, so did not create data/db/backups!" + echo " " +fi + +echo "connecting to $TRIPLESTORE with $USERNAME" +isql-v -H $TRIPLESTORE -U $USERNAME -P $PASSWORD < Date: Tue, 23 Nov 2021 16:26:11 +0100 Subject: [PATCH 2/5] add some maintenance scripts --- scripts/config.json | 13 +++++++++++++ scripts/virtuoso/maintenance.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100755 scripts/virtuoso/maintenance.sh diff --git a/scripts/config.json b/scripts/config.json index 7ee99c9..87c518e 100644 --- a/scripts/config.json +++ b/scripts/config.json @@ -16,6 +16,19 @@ "mounts": { "app": "/project/" } + }, + { + "documentation": { + "command": "maintenance", + "description": "Execute basic maintenance commands.\n Parameters:\n command : needs to be one of 'checkpoint', 'vacuum', 'dump_quads'\n hostname: default triplestore\n username: default dba\n password: default dba", + "arguments": ["command", "hostname", "username", "password"] + }, + "environment": { + "image": "redpencil/virtuoso", + "interactive": false, + "script": "virtuoso/maintenance.sh", + "join_networks": true + } } ] } diff --git a/scripts/virtuoso/maintenance.sh b/scripts/virtuoso/maintenance.sh new file mode 100755 index 0000000..d006b17 --- /dev/null +++ b/scripts/virtuoso/maintenance.sh @@ -0,0 +1,32 @@ +#!/bin/bash +USERNAME=${3:-"dba"} +PASSWORD=${4:-"dba"} +TRIPLESTORE=${2:-"triplestore"} +COMMAND=$1 + +if [[ "$#" -lt 1 ]]; then + echo "command is a required parameter" + exit -1 +fi + +case $COMMAND in + "checkpoint") + isql-v -H $TRIPLESTORE -U $USERNAME -P $PASSWORD < Date: Fri, 20 May 2022 10:14:41 +0200 Subject: [PATCH 3/5] add scripts to container --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index a6ed59d..1259595 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,6 +51,9 @@ COPY virtuoso.sh /virtuoso.sh RUN ln -s /usr/local/virtuoso-opensource/var/lib/virtuoso/ /var/lib/virtuoso \ && ln -s /var/lib/virtuoso/db /data +# Add mu scripts +COPY ./scripts/ /app/scripts/ + WORKDIR /data EXPOSE 8890 EXPOSE 1111 From 1d9aa5ee9909e30a7ba1ce54ddb30c641c844f1e Mon Sep 17 00:00:00 2001 From: Niels V Date: Fri, 20 May 2022 10:15:06 +0200 Subject: [PATCH 4/5] increase default nquad dump size --- scripts/virtuoso/maintenance.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/virtuoso/maintenance.sh b/scripts/virtuoso/maintenance.sh index d006b17..ba8cd3a 100755 --- a/scripts/virtuoso/maintenance.sh +++ b/scripts/virtuoso/maintenance.sh @@ -22,7 +22,7 @@ EOF ;; "dump_quads") isql-v -H $TRIPLESTORE -U $USERNAME -P $PASSWORD < Date: Wed, 13 Jul 2022 12:16:25 +0200 Subject: [PATCH 5/5] setup drone secrets --- .drone.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.drone.yml b/.drone.yml index 7da2571..ed195d5 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,3 +1,4 @@ +--- kind: pipeline type: docker name: push-latest @@ -46,3 +47,17 @@ steps: trigger: event: - pull_request +--- +kind: secret +name: docker_username +data: RIRsbI8DZz2JGGUHsUp4zU5qtnyK/XU3xzTiUkeHIjOzhIH9+/ozwiIFniT3dWBYcQ== +--- +kind: secret +name: docker_password +data: 7ocNZAPA+djeVNr4lf8RAANxyiDDmilj/42UILm8h25Umh4kkDVvdLG92cSgX2JdXirLEMlNxjw+iA0yLYh1Ug== + +--- +kind: signature +hmac: df3b659cb4f53b7b18e128cf365183953239a9523ce20e09faaa3a11941098e5 + +...