snapcraft.yaml 2.9 KB
Newer Older
sangshuduo's avatar
sangshuduo 已提交
1 2
name: tdengine
base: core18 # the base snap is the execution environment for this snap
sangshuduo's avatar
sangshuduo 已提交
3
version: '2.0.2.0' # just for humans, typically '1.2+git' or '1.3.2'
sangshuduo's avatar
sangshuduo 已提交
4
icon: snap/gui/t-dengine.svg
5
summary: an open-source big data platform designed and optimized for IoT. 
sangshuduo's avatar
sangshuduo 已提交
6 7 8 9
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
sangshuduo's avatar
sangshuduo 已提交
10
confinement: strict
sangshuduo's avatar
sangshuduo 已提交
11 12 13 14 15 16 17 18 19

apps:
  tdengine:
    command: launcher.sh
    daemon: simple
    restart-condition: always
    plugs:
      - network
      - network-bind
20
      - system-observe
sangshuduo's avatar
sangshuduo 已提交
21 22 23
      - systemfiles

  taos:
24
    command: taoswrapper.sh
sangshuduo's avatar
sangshuduo 已提交
25 26
    plugs:
      - network
sangshuduo's avatar
sangshuduo 已提交
27
      - system-observe
sangshuduo's avatar
sangshuduo 已提交
28
      - systemfiles
29
      - historyfile
sangshuduo's avatar
sangshuduo 已提交
30

31 32 33 34 35
  taosdemo:
    command: usr/bin/taosdemo
    plugs:
      - network

sangshuduo's avatar
sangshuduo 已提交
36
plugs:
37 38 39 40 41 42 43
  historyfile:
    interface: personal-files
    read:
      - $HOME/.taos_history
    write:
      - $HOME/.taos_history

sangshuduo's avatar
sangshuduo 已提交
44 45 46
  systemfiles:
    interface: system-files
    read:
sangshuduo's avatar
sangshuduo 已提交
47
      - /etc/taos
sangshuduo's avatar
sangshuduo 已提交
48
      - /var/lib/taos
sangshuduo's avatar
sangshuduo 已提交
49
      - /var/log/taos
50
      - /tmp
sangshuduo's avatar
sangshuduo 已提交
51 52 53
    write:
      - /var/log/taos
      - /var/lib/taos
54
      - /tmp
sangshuduo's avatar
sangshuduo 已提交
55 56 57 58 59 60 61

parts:
  script:
    plugin: dump
    source: snap/local/
    prime:
      - launcher.sh
62
      - taoswrapper.sh
sangshuduo's avatar
sangshuduo 已提交
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77

  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
78

sangshuduo's avatar
sangshuduo 已提交
79 80 81
      if [ ! -d $SNAPCRAFT_STAGE/etc/taos ]; then
        mkdir -p $SNAPCRAFT_STAGE/etc/taos
      fi
82

sangshuduo's avatar
sangshuduo 已提交
83 84 85
      cp $SNAPCRAFT_PART_BUILD/build/* -rf $SNAPCRAFT_STAGE/usr/
      cp $SNAPCRAFT_PART_SRC/packaging/cfg/taos.cfg -rf $SNAPCRAFT_STAGE/etc/taos/

86 87 88 89
      if [ ! -d $SNAPCRAFT_STAGE/var/lib/taos ]; then
        mkdir -p $SNAPCRAFT_STAGE/var/lib/taos
      fi
      if [ ! -d $SNAPCRAFT_STAGE/var/log/taos ]; then
sangshuduo's avatar
sangshuduo 已提交
90
        mkdir -p --mode=777 $SNAPCRAFT_STAGE/var/log/taos
91 92
      fi

sangshuduo's avatar
sangshuduo 已提交
93 94 95 96 97
    prime:
      - etc/taos/taos.cfg
      - usr/bin/taosd
      - usr/bin/taos
      - usr/bin/taosdemo
sangshuduo's avatar
sangshuduo 已提交
98
      - usr/lib/libtaos.so.2.0.2.0
sangshuduo's avatar
sangshuduo 已提交
99 100 101
      - usr/lib/libtaos.so.1
      - usr/lib/libtaos.so

102 103
    override-prime: |
      snapcraftctl prime
sangshuduo's avatar
sangshuduo 已提交
104
      if [ ! -d $SNAPCRAFT_PRIME/var/lib/taos ]; then
105 106
        cp -rf $SNAPCRAFT_STAGE/var/lib/taos $SNAPCRAFT_PRIME
      fi
sangshuduo's avatar
sangshuduo 已提交
107
      if [ ! -d $SNAPCRAFT_PRIME/var/log/taos ]; then
108 109 110 111 112 113 114 115
        cp -rf  $SNAPCRAFT_STAGE/var/log/taos $SNAPCRAFT_PRIME
      fi

layout:
  /var/lib/taos:
    bind: $SNAP_DATA/var/lib/taos
  /var/log/taos:
    bind: $SNAP_DATA/var/log/taos
sangshuduo's avatar
sangshuduo 已提交
116 117
  /etc/taos:
    bind: $SNAP_DATA/etc/taos
118

sangshuduo's avatar
sangshuduo 已提交
119

120 121
hooks:
  install:
sangshuduo's avatar
sangshuduo 已提交
122
    plugs: [systemfiles, historyfile]