diff options
-rw-r--r-- | .SRCINFO | 18 | ||||
-rw-r--r-- | PKGBUILD | 32 | ||||
-rw-r--r-- | blynk-server-bin.install | 42 | ||||
-rw-r--r-- | blynk-start.sh | 18 | ||||
-rw-r--r-- | blynk.service | 3 | ||||
-rw-r--r-- | mail.properties.example | 9 | ||||
-rw-r--r-- | server.properties | 150 | ||||
-rw-r--r-- | sms.properties.example | 5 |
8 files changed, 88 insertions, 189 deletions
@@ -1,7 +1,7 @@ pkgbase = blynk-server-bin pkgdesc = Blynk server for the Blynk IoT platform pkgver = 0.41.0 - pkgrel = 2 + pkgrel = 3 url = https://www.blynk.cc/ install = blynk-server-bin.install arch = any @@ -9,14 +9,22 @@ pkgbase = blynk-server-bin depends = java-runtime-headless>=10 noextract = server-0.41.0.jar backup = etc/blynk/server.properties + backup = etc/blynk/mail.properties + backup = etc/blynk/sms.properties source = server-0.41.0.jar::https://github.com/blynkkk/blynk-server/releases/download/v0.41.0/server-0.41.0.jar + source = server.properties::https://raw.githubusercontent.com/blynkkk/blynk-server/master/server/core/src/main/resources/server.properties source = blynk.service source = blynk-server-bin.install - source = server.properties + source = blynk-start.sh + source = mail.properties.example + source = sms.properties.example sha256sums = 4283acf195ec75de6ba04ebb11d975f8dc3fb0cb72ed457c616443ad24de98ee - sha256sums = 9d3c4395d3a76fd26ae9c453ab89a54ea91f42fd06b9c7217c5b6f6f56f9530e - sha256sums = 220c68ca2f65904d66ab0791b726e733fcf9e9c7ad396b75678b96a4af9bb232 - sha256sums = fc825817a90f2d4ec5bef5d10733957289ce478e67c9f5fff09682e1bff4c655 + sha256sums = c99ade828ecfd9f3a71b6ac6d319bd8f898c97af754bb834b8f3ac88f4862b15 + sha256sums = 298b02167fec72ac884541f63a660e3e5505afe220084bb72b032d24374a1846 + sha256sums = 140aefbac5fbfe38c886353079ddca35fbc071d01b7895ea772e7a14fb02fdf0 + sha256sums = be2d3b0201ad52baa2bfd4173dc7a6948d67b67e3531379bd92bc0cf390bd97b + sha256sums = 7f9c55179c35e4c5c81e068f104c977d2cdb728103a9fef6506780f306c563c1 + sha256sums = 276644e9d2e68654ae947830b8c048b885d843d7d22c8520abb178e9caba8309 pkgname = blynk-server-bin @@ -2,31 +2,41 @@ # Contributor: Bertrand Ciroux <bertrand.ciroux@gmail.com> pkgname=blynk-server-bin pkgver=0.41.0 -pkgrel=2 +pkgrel=3 pkgdesc="Blynk server for the Blynk IoT platform" arch=('any') url="https://www.blynk.cc/" license=('GPL3') depends=('java-runtime-headless>=10') -backup=('etc/blynk/server.properties') +backup=('etc/blynk/server.properties' + 'etc/blynk/mail.properties' + 'etc/blynk/sms.properties') install="${pkgname}.install" source=("server-${pkgver}.jar::https://github.com/blynkkk/blynk-server/releases/download/v${pkgver}/server-${pkgver}.jar" + "server.properties::https://raw.githubusercontent.com/blynkkk/blynk-server/master/server/core/src/main/resources/server.properties" "blynk.service" - "blynk-server-bin.install" - "server.properties") + "blynk-server-bin.install" + "blynk-start.sh" + "mail.properties.example" + "sms.properties.example") noextract=("server-${pkgver}.jar") sha256sums=("4283acf195ec75de6ba04ebb11d975f8dc3fb0cb72ed457c616443ad24de98ee" - "9d3c4395d3a76fd26ae9c453ab89a54ea91f42fd06b9c7217c5b6f6f56f9530e" - "220c68ca2f65904d66ab0791b726e733fcf9e9c7ad396b75678b96a4af9bb232" - "fc825817a90f2d4ec5bef5d10733957289ce478e67c9f5fff09682e1bff4c655") + "c99ade828ecfd9f3a71b6ac6d319bd8f898c97af754bb834b8f3ac88f4862b15" + "298b02167fec72ac884541f63a660e3e5505afe220084bb72b032d24374a1846" + "140aefbac5fbfe38c886353079ddca35fbc071d01b7895ea772e7a14fb02fdf0" + "be2d3b0201ad52baa2bfd4173dc7a6948d67b67e3531379bd92bc0cf390bd97b" + "7f9c55179c35e4c5c81e068f104c977d2cdb728103a9fef6506780f306c563c1" + "276644e9d2e68654ae947830b8c048b885d843d7d22c8520abb178e9caba8309") package() { - install -d ${pkgdir}/{etc,usr/share,var/lib,var/log}/blynk - install -Dm644 blynk.service "${pkgdir}/usr/lib/systemd/system/blynk.service" - install -Dm644 server-${pkgver}.jar ${pkgdir}/usr/share/blynk/blynk-server.jar - install -Dm644 server.properties ${pkgdir}/etc/blynk/ + install -d ${pkgdir}/{etc,usr/share,var/lib,var/log}/blynk + install -d ${pkgdir}/usr/bin + install -Dm644 blynk.service ${pkgdir}/usr/lib/systemd/system/blynk.service + install -Dm644 server-${pkgver}.jar ${pkgdir}/usr/share/blynk/blynk-server.jar + install -Dm644 server.properties ${pkgdir}/etc/blynk/ + install -Dm755 blynk-start.sh ${pkgdir}/usr/bin/ } diff --git a/blynk-server-bin.install b/blynk-server-bin.install index 3133cf8f1d09..b87ded006d31 100644 --- a/blynk-server-bin.install +++ b/blynk-server-bin.install @@ -1,34 +1,34 @@ _user="blynk" post_install() { - getent group "${_user}" &>/dev/null - if [ $? -ne 0 ]; then - echo -e "\e[34;1m==>\e[39;1m Adding ${_user} system group... \e[0m" - groupadd -r ${_user} 1>/dev/null - fi - getent passwd "${_user}" &>/dev/null - if [ $? -ne 0 ]; then - echo -e "\e[34;1m==>\e[39;1m Adding ${_user} system user... \e[0m" - useradd -r -g ${_user} -d /usr/share/blynk ${_user} 1>/dev/null - fi - chown -R ${_user}:${_user} /var/lib/blynk - chown -R ${_user}:${_user} /var/log/blynk - chown -R ${_user}:${_user} /usr/share/blynk + getent group "${_user}" &>/dev/null + if [ $? -ne 0 ]; then + echo -e "\e[34;1m==>\e[39;1m Adding ${_user} system group... \e[0m" + groupadd -r ${_user} 1>/dev/null + fi + getent passwd "${_user}" &>/dev/null + if [ $? -ne 0 ]; then + echo -e "\e[34;1m==>\e[39;1m Adding ${_user} system user... \e[0m" + useradd -r -g ${_user} -d /usr/share/blynk ${_user} 1>/dev/null + fi + chown -R ${_user}:${_user} /var/lib/blynk + chown -R ${_user}:${_user} /var/log/blynk + chown -R ${_user}:${_user} /usr/share/blynk } post_upgrade() { - echo -e "\e[34;1m==>\e[39;1m NOTE: Please restart blynk service to take the update into account. \e[0m" + echo -e "\e[34;1m==>\e[39;1m NOTE: Please restart blynk service to take the update into account. \e[0m" } pre_remove() { - systemctl stop blynk.service - rm -rf /usr/share/blynk/static + systemctl stop blynk.service + rm -rf /usr/share/blynk/static } post_remove() { - echo -e "\e[34;1m==>\e[39;1m Removing ${_user} user and group... \e[0m" - userdel ${_user} - if [ -d /var/lib/blynk ]; then - echo -e "\e[34;1m==>\e[39;1m NOTE: Data folder /var/lib/blynk has been preserved. \e[0m" - fi + echo -e "\e[34;1m==>\e[39;1m Removing ${_user} user and group... \e[0m" + userdel ${_user} + if [ -d /var/lib/blynk ]; then + echo -e "\e[34;1m==>\e[39;1m NOTE: Data folder /var/lib/blynk has been preserved. \e[0m" + fi } diff --git a/blynk-start.sh b/blynk-start.sh new file mode 100644 index 000000000000..3c40259a0135 --- /dev/null +++ b/blynk-start.sh @@ -0,0 +1,18 @@ +#!/bin/bash +## This script executes the blynk server. +## It should not be run manually, please use systemd unit instead. + +# additional options to pass to blynk server +additionalOptions= + +# add sms.properties if found +if [ -f /etc/blynk/sms.properties ]; then + additionalOptions="-smsConfig /etc/blynk/sms.properties" +fi + +# add mail.properties if found +if [ -f /etc/blynk/mail.properties ]; then + additionalOptions="-mailConfig /etc/blynk/mail.properties ${additionalOptions}" +fi + +exec /usr/bin/java -jar /usr/share/blynk/blynk-server.jar -serverConfig /etc/blynk/server.properties ${additionalOptions} diff --git a/blynk.service b/blynk.service index e08fab78b3c6..b1c587e498f8 100644 --- a/blynk.service +++ b/blynk.service @@ -6,8 +6,7 @@ User=blynk Group=blynk Restart=on-failure RestartSec=10 - -ExecStart=/usr/bin/java -jar /usr/share/blynk/blynk-server.jar -serverConfig /etc/blynk/server.properties +ExecStart=/usr/bin/blynk-start.sh [Install] WantedBy=multi-user.target diff --git a/mail.properties.example b/mail.properties.example new file mode 100644 index 000000000000..feda06569c68 --- /dev/null +++ b/mail.properties.example @@ -0,0 +1,9 @@ +# Change to your Gmail values +# Once renamed to mail.properties, it will be automatically taken into account +# after restarting the server. +mail.smtp.auth=true +mail.smtp.starttls.enable=true +mail.smtp.host=smtp.gmail.com +mail.smtp.port=587 +mail.smtp.username=YOUR_EMAIL_HERE +mail.smtp.password=YOUR_EMAIL_PASS_HERE diff --git a/server.properties b/server.properties deleted file mode 100644 index 72c15b406a97..000000000000 --- a/server.properties +++ /dev/null @@ -1,150 +0,0 @@ -#hardware mqtt port -hardware.mqtt.port=8440 - -#http, plain web sockets and plain hardware port -http.port=8080 - -#if this property is true csv download url will use port 80 and will ignore http.port -force.port.80.for.csv=false - -#if this property is true redirect_command will use 80 port and will ignore http.port -force.port.80.for.redirect=true - -#secured https, web sockets and app port -https.port=9443 - -#address to bind to. by default bounded to all interfaces -listen.address= - -#by default server uses embedded in jar cert to simplify local server installation. -#WARNNING DO NOT USE THIS CERTIFICATES ON PRODUCTION OR IN WHERE ENVIRNOMENTS REAL SECURITY REQUIRED. -#provide either full path to files either use '.' for specifying current directory. For instance "./myfile.crt" -server.ssl.cert= -server.ssl.key= -server.ssl.key.pass= - -#by default System.getProperty("java.io.tmpdir")/blynk used -data.folder=/var/lib/blynk - -#folder for logs. -logs.folder=/var/log/blynk - -#log debug level. trace|debug|info|error. Defines how precise logging will be. -log.level=info - -#maximum number of devices allowed per account -user.devices.limit=50 - -#maximum number of tags allowed per account -user.tags.limit=100 - -#defines maximum allowed number of user dashboards. Needed to limit possible number of tokens. -user.dashboard.max.limit=100 - -#defines maximum allowed widget size in KBs as json string. -user.widget.max.size.limit=20 - -#user is limited with 100 messages per second. -user.message.quota.limit=100 - -#maximum allowed number of notification queue. Queue responsible for processing email, pushes, twits sending. -#Because of performance issue - those queue is processed in separate thread, this is required due -#to blocking nature of all above operations. Usually limit shouldn't be reached. -notifications.queue.limit=2000 - -#Number of threads for performing blocking operations - push, twits, emails, db queries. -#Recommended to hold this value low unless you have to perform a lot of blocking operations. -blocking.processor.thread.pool.limit=6 - -#this setting defines how often we can send mail/tweet/push or any other notification. Specified in seconds -notifications.frequency.user.quota.limit=5 - -#this setting defines how often we can send webhooks. Specified in miliseconds -webhooks.frequency.user.quota.limit=1000 - -#this setting defines how big could be response for webhook GET request. Specified in kbs -webhooks.response.size.limit=96 - -#maximum size of user profile in kb's -user.profile.max.size=128 - -#number of strings to store in terminal widget -terminal.strings.pool.size=25 - -#number of strings to store in map widget -map.strings.pool.size=25 - -#number of strings to store in lcd widget -lcd.strings.pool.size=6 - -#maximum number of rows allowed -table.rows.pool.size=100 - -#period in millis for saving all user DB to disk. -profile.save.worker.period=60000 - -#period in millis for saving stats to disk. -stats.print.worker.period=60000 - -#max size of web request in bytes, 256 kb (256x1024) is default -web.request.max.size=524288 - -#maximum number of points that are fetched during CSV export -#43200 == 60 * 24 * 30 - minutes points for 1 month -csv.export.data.points.max=43200 - -#specifies maximum period of time when hardware socket could be idle. After which -#socket will be closed due to non activity. In seconds. Default value 10 if not provided. -#leave it empty for infinity timeout -hard.socket.idle.timeout=10 - -#enable DB -enable.db=false - -#enable raw data storage to DB -enable.raw.db.data.store=false - -#size of async logger ring buffer. should be increased for loads >2-3k req/sec -async.logger.ring.buffer.size=2048 - -#when true - allows reading worker to trigger hardware even app is offline -allow.reading.widget.without.active.app=false - -#when enabled server will also store hardware and app IP -allow.store.ip=true - -#initial amount of energy -initial.energy=100000 - -#ADMINISTRATION SECTION - -admin.rootPath=/admin - -#used for reset password page and certificate generation. -#by default current server IP is taken. could be replaced with more friendly hostname. -#it is recommended to override this property with your server IP to avoid possible problems of host resolving -#server.host=test.blynk.cc - -#used for fallback page for reset user password, in most cases it should be the same as server.host -#IP is not allowed here, it should be blynk-cloud.com for Blynk app -#or *.blynk.cc for private servers with own apps -restore.host=blynk-cloud.com - -product.name=Blynk - -#email used for certificate registration, could be omitted in case you already specified it in mail.properties -#contact.email= - -#network interface to determine server's current IP. -#only the first characters of the interface's name are needed. -#the default setting eth will use the first ethX interface found (i.e. eth0) -net.interface=eth - -#comma separated list of administrator IPs. allow access to admin UI only for those IPs. -#you may set it for 0.0.0.0/0 to allow access for all. -#you may use CIDR notation. For instance, 192.168.0.53/24 -allowed.administrator.ips=0.0.0.0/0,::/0 - -# default admin name and password. that will be created on initial server start -admin.email=admin@blynk.cc -admin.pass=admin diff --git a/sms.properties.example b/sms.properties.example new file mode 100644 index 000000000000..9443fc4b38ae --- /dev/null +++ b/sms.properties.example @@ -0,0 +1,5 @@ +# Change to your Nexmo values +# Once renamed to sms.properties, it will be automatically taken into account +# after restarting the server. +nexmo.api.key= +nexmo.api.secret= |