From 38992dd327728361c4a37b521c29c6726853f468 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Sat, 29 Aug 2020 22:51:37 +0800 Subject: [PATCH 1/5] daemon works with strict mode now. --- snap/local/launcher.sh | 11 ++++++----- snap/snapcraft.yaml | 12 +++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/snap/local/launcher.sh b/snap/local/launcher.sh index 52b3e4ce5c..29a7a63779 100755 --- a/snap/local/launcher.sh +++ b/snap/local/launcher.sh @@ -15,11 +15,12 @@ case "$SNAP_USER_COMMON" in *) COMMON=$SNAP_USER_COMMON ;; esac -if [ -d /etc/taos ]; then - CONFIG_FILE="/etc/taos" -else - CONFIG_FILE="$SNAP/etc/taos" +if [ ! -f $SNAP_DATA/etc/taos/taos.cfg ]; then + if [ ! -d $SNAP_DATA/etc/taos ]; then + mkdir -p $SNAP_DATA/etc/taos + fi + cp $SNAP/etc/taos/taos.cfg $SNAP_DATA/etc/taos fi # Launch the snap -$SNAP/usr/bin/taosd -c $CONFIG_FILE $@ +$SNAP/usr/bin/taosd -c /etc/taos $@ diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index cf4f993394..4a7dff3ec6 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,13 +1,13 @@ name: tdengine base: core18 # the base snap is the execution environment for this snap -version: '2.0.0.6' # just for humans, typically '1.2+git' or '1.3.2' +version: '2.0.1.1' # just for humans, typically '1.2+git' or '1.3.2' icon: snap/gui/t-dengine.svg summary: an open-source big data platform designed and optimized for IoT. description: | TDengine is an open-source big data platform designed and optimized for Internet of Things (IoT), Connected Vehicles, and Industrial IoT. Besides the 10x faster time-series database, it provides caching, stream computing, message queuing and other functionalities to reduce the complexity and costs of development and operations. grade: stable -confinement: classic +confinement: strict apps: tdengine: @@ -24,7 +24,9 @@ apps: command: taoswrapper.sh plugs: - network + - system-observe - systemfiles + - home taosdemo: command: usr/bin/taosdemo @@ -85,7 +87,7 @@ parts: - usr/bin/taosd - usr/bin/taos - usr/bin/taosdemo - - usr/lib/libtaos.so.2.0.0.6 + - usr/lib/libtaos.so.2.0.1.1 - usr/lib/libtaos.so.1 - usr/lib/libtaos.so @@ -103,8 +105,8 @@ layout: bind: $SNAP_DATA/var/lib/taos /var/log/taos: bind: $SNAP_DATA/var/log/taos - /etc/taos/taos.cfg: - bind-file: $SNAP_DATA/etc/taos/taos.cfg + /etc/taos: + bind: $SNAP_DATA/etc/taos hooks: From b8e2583ca3d35839c68269d777b999edf9c71b0a Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Sun, 30 Aug 2020 00:17:30 +0800 Subject: [PATCH 2/5] upgrade to 2.0.2.0 --- snap/hooks/install | 5 ++++- snap/snapcraft.yaml | 12 +++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/snap/hooks/install b/snap/hooks/install index e58918d2c3..aa12fe051f 100755 --- a/snap/hooks/install +++ b/snap/hooks/install @@ -5,7 +5,7 @@ if [ ! -d /var/lib/taos ]; then fi if [ ! -d /var/log/taos ]; then - mkdir -p -m777 /var/log/taos + mkdir -p --mode=777 /var/log/taos fi if [ ! -d /etc/taos ]; then @@ -13,5 +13,8 @@ if [ ! -d /etc/taos ]; then fi if [ ! -f /etc/taos/taos.cfg ]; then + if [ ! -d /etc/taos ]; then + mkdir -p /etc/taos + fi cp $SNAP/etc/taos/taos.cfg /etc/taos/taos.cfg fi diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 4a7dff3ec6..1d1a00e50e 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,6 +1,6 @@ name: tdengine base: core18 # the base snap is the execution environment for this snap -version: '2.0.1.1' # just for humans, typically '1.2+git' or '1.3.2' +version: '2.0.2.0' # just for humans, typically '1.2+git' or '1.3.2' icon: snap/gui/t-dengine.svg summary: an open-source big data platform designed and optimized for IoT. description: | @@ -22,6 +22,8 @@ apps: taos: command: taoswrapper.sh + environment: + HOME: /home/$USER plugs: - network - system-observe @@ -79,7 +81,7 @@ parts: mkdir -p $SNAPCRAFT_STAGE/var/lib/taos fi if [ ! -d $SNAPCRAFT_STAGE/var/log/taos ]; then - mkdir -p $SNAPCRAFT_STAGE/var/log/taos + mkdir -p --mode=777 $SNAPCRAFT_STAGE/var/log/taos fi prime: @@ -87,16 +89,16 @@ parts: - usr/bin/taosd - usr/bin/taos - usr/bin/taosdemo - - usr/lib/libtaos.so.2.0.1.1 + - usr/lib/libtaos.so.2.0.2.0 - usr/lib/libtaos.so.1 - usr/lib/libtaos.so override-prime: | snapcraftctl prime - if [ ! -d $SNAPCRAFT_STAGE/var/lib/taos ]; then + if [ ! -d $SNAPCRAFT_PRIME/var/lib/taos ]; then cp -rf $SNAPCRAFT_STAGE/var/lib/taos $SNAPCRAFT_PRIME fi - if [ ! -d $SNAPCRAFT_STAGE/var/log/taos ]; then + if [ ! -d $SNAPCRAFT_PRIME/var/log/taos ]; then cp -rf $SNAPCRAFT_STAGE/var/log/taos $SNAPCRAFT_PRIME fi From 4723e21af420aa5a5e655c7c50c2b52359e0d4b0 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 2 Sep 2020 00:09:20 +0800 Subject: [PATCH 3/5] add historyfile plug to access .taos_history file. --- snap/snapcraft.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 1d1a00e50e..3fe1e26759 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -22,13 +22,11 @@ apps: taos: command: taoswrapper.sh - environment: - HOME: /home/$USER plugs: - network - system-observe - systemfiles - - home + - historyfile taosdemo: command: usr/bin/taosdemo @@ -36,6 +34,13 @@ apps: - network plugs: + historyfile: + interface: personal-files + read: + - $HOME/.taos_history + write: + - $HOME/.taos_history + systemfiles: interface: system-files read: From 7e840afee22efc606f5c32426f2361ade1a726fd Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 2 Sep 2020 00:46:20 +0800 Subject: [PATCH 4/5] fix var/log/taos permission issue. --- snap/hooks/install | 2 ++ snap/snapcraft.yaml | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/snap/hooks/install b/snap/hooks/install index aa12fe051f..542be0b834 100755 --- a/snap/hooks/install +++ b/snap/hooks/install @@ -6,6 +6,8 @@ fi if [ ! -d /var/log/taos ]; then mkdir -p --mode=777 /var/log/taos +else + chmod 777 /var/log/taos fi if [ ! -d /etc/taos ]; then diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 3fe1e26759..f8300030c7 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -46,6 +46,7 @@ plugs: read: - /etc/taos - /var/lib/taos + - /var/log/taos - /tmp write: - /var/log/taos @@ -112,11 +113,11 @@ layout: bind: $SNAP_DATA/var/lib/taos /var/log/taos: bind: $SNAP_DATA/var/log/taos + mode: 1777 /etc/taos: bind: $SNAP_DATA/etc/taos hooks: install: - plugs: [systemfiles] - + plugs: [systemfiles, historyfile] From dc991a4745b871ec26eaf98766c4de9662cc3cbd Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 2 Sep 2020 01:02:11 +0800 Subject: [PATCH 5/5] remove mode of layouts due to review comments. --- snap/snapcraft.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index f8300030c7..7a0e1c3b80 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -113,7 +113,6 @@ layout: bind: $SNAP_DATA/var/lib/taos /var/log/taos: bind: $SNAP_DATA/var/log/taos - mode: 1777 /etc/taos: bind: $SNAP_DATA/etc/taos