diff --git a/snap/local/launcher.sh b/snap/local/launcher.sh new file mode 100755 index 0000000000000000000000000000000000000000..59861149317975b8b5b56760dda5d93a6bbc9aa6 --- /dev/null +++ b/snap/local/launcher.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# Wrapper to check for custom config in $SNAP_USER_COMMON or $SNAP_COMMON and +# use it otherwise fall back to the included basic config which will at least +# allow mosquitto to run and do something. +# This script will also copy the full example config in to SNAP_USER_COMMON or +# SNAP_COMMON so that people can refer to it. +# +# The decision about whether to use SNAP_USER_COMMON or SNAP_COMMON is taken +# based on the user that runs the command. If the user is root, it is assumed +# that mosquitto is being run as a system daemon, and SNAP_COMMON will be used. +# If a non-root user runs the command, then SNAP_USER_COMMON will be used. + +case "$SNAP_USER_COMMON" in + */root/snap/tdengine/common*) COMMON=$SNAP_COMMON ;; + *) COMMON=$SNAP_USER_COMMON ;; +esac + +CONFIG_FILE="$SNAP/etc/taos" + +# Launch the snap +$SNAP/usr/bin/taosd -c $CONFIG_FILE $@ diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml new file mode 100644 index 0000000000000000000000000000000000000000..031704393fb4a0c7c7e4889ddf05a7318e351aaf --- /dev/null +++ b/snap/snapcraft.yaml @@ -0,0 +1,76 @@ +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' +summary: Single-line elevator pitch for your amazing snap # 79 char long summary +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: strict + +apps: + tdengine: + command: launcher.sh + daemon: simple + restart-condition: always + plugs: + - network + - network-bind + - systemfiles + + taos: + command: usr/bin/taos + plugs: + - network + - systemfiles + +plugs: + systemfiles: + interface: system-files + read: + - /etc/taos + - /var/lib/taos + write: + - /var/log/taos + - /var/lib/taos + +parts: + script: + plugin: dump + source: snap/local/ + prime: + - launcher.sh + + tdengine: + source: . + source-type: local + plugin: cmake + build-packages: + - gcc + - g++ + - make + - cmake + override-build: | + snapcraftctl build + if [ ! -d $SNAPCRAFT_STAGE/usr ]; then + mkdir $SNAPCRAFT_STAGE/usr + fi + if [ ! -d $SNAPCRAFT_STAGE/etc/taos ]; then + mkdir -p $SNAPCRAFT_STAGE/etc/taos + fi + cp $SNAPCRAFT_PART_BUILD/build/* -rf $SNAPCRAFT_STAGE/usr/ + cp $SNAPCRAFT_PART_SRC/packaging/cfg/taos.cfg -rf $SNAPCRAFT_STAGE/etc/taos/ + + prime: + - etc/taos/taos.cfg + - usr/bin/taosd + - usr/bin/taos + - usr/bin/taosdemo + - usr/lib/libtaos.so.2.0.0.6 + - usr/lib/libtaos.so.1 + - usr/lib/libtaos.so + + + #layout: + # usr/bin/taosd: + #bind-file: debug/build/bin/taosd