mirror of
https://github.com/buanet/ioBroker.docker.git
synced 2025-12-17 18:39:01 +02:00
Compare commits
164 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8bb400270d | ||
|
|
caa5a1f763 | ||
|
|
59e3c79574 | ||
|
|
0fe15e0918 | ||
|
|
a1cd12dbfd | ||
|
|
f32d26de7f | ||
|
|
38d352ac9c | ||
|
|
fdb68d7ca8 | ||
|
|
40abbca1a1 | ||
|
|
445ad691c2 | ||
|
|
525d6db3f4 | ||
|
|
5c43c56694 | ||
|
|
94fcc3b98c | ||
|
|
a34e3e0549 | ||
|
|
6d9bf4da5a | ||
|
|
9d7d4e3cd9 | ||
|
|
c109764694 | ||
|
|
6a32591da4 | ||
|
|
4321bd7bfb | ||
|
|
83f3542f68 | ||
|
|
672bca2630 | ||
|
|
bdc6570a71 | ||
|
|
4010c68e20 | ||
|
|
22ea1df41a | ||
|
|
9656527db4 | ||
|
|
13a511f875 | ||
|
|
686b517d6f | ||
|
|
610deb0974 | ||
|
|
c91be00fa7 | ||
|
|
fefe510b93 | ||
|
|
8d0bb13cf2 | ||
|
|
c6d265aa1d | ||
|
|
07c3fe7118 | ||
|
|
a9bb9aacf1 | ||
|
|
3ba390277c | ||
|
|
88eb4ca065 | ||
|
|
fd72d450f1 | ||
|
|
97b5641372 | ||
|
|
eeacc6d4fb | ||
|
|
d50d88ddd0 | ||
|
|
efee71f212 | ||
|
|
eea1c61ac5 | ||
|
|
75468e58d6 | ||
|
|
dc614879be | ||
|
|
d03ce6d24c | ||
|
|
98ad4e8666 | ||
|
|
f3cb86cb94 | ||
|
|
d5a69c506f | ||
|
|
f75043438c | ||
|
|
8e79ccfc2c | ||
|
|
4908fed871 | ||
|
|
9b6273b50f | ||
|
|
4d76a05f5d | ||
|
|
0fcccf3b42 | ||
|
|
23d8b34113 | ||
|
|
04f51a6f47 | ||
|
|
3decc2fec3 | ||
|
|
e2ccabb6e2 | ||
|
|
9b932594fa | ||
|
|
c3aef24ead | ||
|
|
9abc86ddd3 | ||
|
|
bc41f708bf | ||
|
|
fdbde6eb15 | ||
|
|
4f0d07878b | ||
|
|
beb689c33c | ||
|
|
e733f77253 | ||
|
|
1fdce0ae78 | ||
|
|
7ced614900 | ||
|
|
250acdc992 | ||
|
|
f2e6780456 | ||
|
|
2983f1f63d | ||
|
|
ddccbe7dfa | ||
|
|
e99ab6fa82 | ||
|
|
16b9d318fd | ||
|
|
13182735f8 | ||
|
|
426035fa9b | ||
|
|
5eb3e6ef1d | ||
|
|
d56fca4074 | ||
|
|
6f2eb382d5 | ||
|
|
82aa3f0062 | ||
|
|
eb72bfea00 | ||
|
|
6e8f3a1448 | ||
|
|
dc31095c1c | ||
|
|
834fd976c0 | ||
|
|
609804ea0d | ||
|
|
0f39f7ae5e | ||
|
|
fdfbed9846 | ||
|
|
b4f7ba98b1 | ||
|
|
351bfddc8d | ||
|
|
8a8ac64952 | ||
|
|
e015276fc4 | ||
|
|
4f41716e77 | ||
|
|
d301f754f4 | ||
|
|
a0adbc121e | ||
|
|
17ac1a5bcf | ||
|
|
f440613049 | ||
|
|
7a6de5b3c5 | ||
|
|
0687a2ef18 | ||
|
|
3d191b9fd9 | ||
|
|
0cc07e148d | ||
|
|
f841ccf882 | ||
|
|
b8622098b2 | ||
|
|
9aab687492 | ||
|
|
c69f7145b3 | ||
|
|
1fbbd33979 | ||
|
|
911beabb6a | ||
|
|
945c7bfbaa | ||
|
|
19a6eb74bb | ||
|
|
1713562071 | ||
|
|
a34cdfe7bf | ||
|
|
c0eb88812f | ||
|
|
d3737203dc | ||
|
|
a87286ca08 | ||
|
|
220d07cf95 | ||
|
|
0d740d4626 | ||
|
|
36760c0fac | ||
|
|
42b5720086 | ||
|
|
ced4037317 | ||
|
|
243951e73d | ||
|
|
ea5aa974ce | ||
|
|
b0efc2bc0d | ||
|
|
346ae94e29 | ||
|
|
9d69224aaf | ||
|
|
aa3f15a0d8 | ||
|
|
db16d8af3f | ||
|
|
3de75f273e | ||
|
|
b6c2310364 | ||
|
|
c73b129f1b | ||
|
|
281ac557a4 | ||
|
|
1ae64e4262 | ||
|
|
fd4dad6b1c | ||
|
|
16cf5bedaf | ||
|
|
2cfe6df81c | ||
|
|
3bb6bcf4a2 | ||
|
|
8652a3b546 | ||
|
|
f140ee5280 | ||
|
|
7e438bab0b | ||
|
|
715a1d3a6a | ||
|
|
555619480b | ||
|
|
557786d73f | ||
|
|
09453bf7f6 | ||
|
|
45d3815846 | ||
|
|
e57f50e13e | ||
|
|
651c3a219a | ||
|
|
f45a3e3fe4 | ||
|
|
41c80e8807 | ||
|
|
0369eaaff0 | ||
|
|
53d7a07e78 | ||
|
|
85f4370e25 | ||
|
|
f41bdc5ccf | ||
|
|
23b7b2a434 | ||
|
|
e4bd6c8946 | ||
|
|
9e10615346 | ||
|
|
f91d729b74 | ||
|
|
fe3cee643d | ||
|
|
3e9f3b58c7 | ||
|
|
66ddf35e75 | ||
|
|
f3acd7dc43 | ||
|
|
40673b85bb | ||
|
|
792139283b | ||
|
|
202bdb0a57 | ||
|
|
a4d1aac8b8 | ||
|
|
58921f9773 | ||
|
|
1737e01cb8 |
78
Dockerfile
78
Dockerfile
@@ -1,22 +1,80 @@
|
|||||||
FROM debian:latest
|
FROM debian:latest
|
||||||
|
|
||||||
MAINTAINER Andre Germann <info@buanet.de>
|
MAINTAINER Andre Germann <https://buanet.de>
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y apt-utils curl
|
# Install prerequisites
|
||||||
RUN curl -sL https://deb.nodesource.com/setup_4.x | bash
|
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
|
||||||
RUN apt-get install -y build-essential python nodejs
|
acl \
|
||||||
|
apt-utils \
|
||||||
|
build-essential \
|
||||||
|
curl \
|
||||||
|
git \
|
||||||
|
gnupg2 \
|
||||||
|
libavahi-compat-libdnssd-dev \
|
||||||
|
libcap2-bin \
|
||||||
|
libpam0g-dev \
|
||||||
|
libudev-dev \
|
||||||
|
locales \
|
||||||
|
procps \
|
||||||
|
python \
|
||||||
|
sudo \
|
||||||
|
unzip \
|
||||||
|
wget \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN mkdir -p /opt/iobroker/ && chmod 777 /opt/iobroker/
|
# Install node8
|
||||||
|
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash \
|
||||||
|
&& apt-get update && apt-get install -y \
|
||||||
|
nodejs \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Generating locales
|
||||||
|
RUN sed -i 's/^# *\(de_DE.UTF-8\)/\1/' /etc/locale.gen \
|
||||||
|
&& sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen \
|
||||||
|
&& locale-gen
|
||||||
|
|
||||||
|
# Create scripts directory and copy scripts
|
||||||
|
RUN mkdir -p /opt/scripts/ \
|
||||||
|
&& chmod 777 /opt/scripts/
|
||||||
|
WORKDIR /opt/scripts/
|
||||||
|
COPY scripts/iobroker_startup.sh iobroker_startup.sh
|
||||||
|
COPY scripts/setup_avahi.sh setup_avahi.sh
|
||||||
|
COPY scripts/setup_packages.sh setup_packages.sh
|
||||||
|
RUN chmod +x iobroker_startup.sh \
|
||||||
|
&& chmod +x setup_avahi.sh \
|
||||||
|
&& chmod +x setup_packages.sh
|
||||||
|
|
||||||
|
# Install ioBroker
|
||||||
|
WORKDIR /
|
||||||
|
RUN apt-get update \
|
||||||
|
&& curl -sL https://raw.githubusercontent.com/ioBroker/ioBroker/stable-installer/installer.sh | bash - \
|
||||||
|
&& echo $(hostname) > /opt/iobroker/.install_host \
|
||||||
|
&& echo $(hostname) > /opt/.firstrun \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install node-gyp
|
||||||
WORKDIR /opt/iobroker/
|
WORKDIR /opt/iobroker/
|
||||||
|
RUN npm install -g node-gyp
|
||||||
|
|
||||||
RUN npm install iobroker --unsafe-perm && echo $(hostname) > .install_host
|
# Backup initial ioBroker-folder
|
||||||
|
RUN tar -cf /opt/initial_iobroker.tar /opt/iobroker
|
||||||
|
|
||||||
ADD scripts/startup.sh startup.sh
|
# Setting up iobroker-user
|
||||||
RUN chmod +x startup.sh
|
RUN chsh -s /bin/bash iobroker
|
||||||
|
|
||||||
CMD /opt/iobroker/startup.sh
|
# Setting up ENVs
|
||||||
|
ENV DEBIAN_FRONTEND="teletype" \
|
||||||
|
LANG="de_DE.UTF-8" \
|
||||||
|
LANGUAGE="de_DE:de" \
|
||||||
|
LC_ALL="de_DE.UTF-8" \
|
||||||
|
TZ="Europe/Berlin" \
|
||||||
|
PACKAGES="nano" \
|
||||||
|
AVAHI="false"
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND teletype
|
# Setting up EXPOSE for Admin
|
||||||
|
EXPOSE 8081/tcp
|
||||||
|
|
||||||
|
# Run startup-script
|
||||||
|
ENTRYPOINT ["/opt/scripts/iobroker_startup.sh"]
|
||||||
|
|||||||
21
LICENSE.txt
Normal file
21
LICENSE.txt
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2017 Andre Germann
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
166
README.md
166
README.md
@@ -1,2 +1,166 @@
|
|||||||
# docker-iobroker
|
# docker-iobroker
|
||||||
Docker Image for ioBroker based on Debian
|
Docker image for ioBroker (http://iobroker.net) based on debian:latest (http://hub.docker.com/_/debian/)
|
||||||
|
|
||||||
|
This project creates a Docker image for running ioBroker in a Docker container. It is made for and tested on a Synology Disk Station 1515+ with DSM 6 and Docker-package installed. But it should also work on other systems with Docker (Normally I do a small additional test on my Debian-VM with Docker CE)!
|
||||||
|
|
||||||
|
## Important
|
||||||
|
|
||||||
|
Switching an existing installation from docker-iobroker-image v1 to v2 or greater means switching iobroker itself from node6 to node8! This requires additional steps inside ioBroker! After upgrading iobroker-container you have to call "reinstall.sh" for recompiling your installation for the use with node8. For Details see official ioBroker-documentation (http://www.iobroker.net/docu/?page_id=8323&lang=de). Make backup first!!!
|
||||||
|
|
||||||
|
At the moment v3.0.0 does no longer support running in host-mode on Synology-devices because of a kernel issue in actual DSM-kernel! Please use bridged or macvlan mode. For details see new tutorial linked in the following.
|
||||||
|
|
||||||
|
## Installation & Usage
|
||||||
|
|
||||||
|
A detailed tutorial (german, based on new v3.0.0) can be found here: [https://buanet.de](https://buanet.de/2019/05/iobroker-unter-docker-auf-der-synology-diskstation-v3/). Please notice that the old tutorial does no longer work!
|
||||||
|
|
||||||
|
For discussion and support please visit [ioBroker-forum-thread](http://forum.iobroker.net/viewtopic.php?f=17&t=5089) or use the comments section at the linked tutorial. Please do not contact me directly for any support-reasons. Every support-question should be answered in a public place. Thank you.
|
||||||
|
|
||||||
|
## Special Settings
|
||||||
|
|
||||||
|
In v3.0.0 I added some new features. The following will give some short information about that.
|
||||||
|
|
||||||
|
### Environment Variables
|
||||||
|
|
||||||
|
|env|value|description|
|
||||||
|
|---|---|---|
|
||||||
|
|PACKAGES|package1 package2 package2|seperateed by whitespace; will install the listed packages on startup<br>(be paitient, this may take some time!)|
|
||||||
|
|AVAHI|true|will install and activate avahi-daemon for supporting yahka-adapter|
|
||||||
|
|LANGUAGE|de_DE:de|following locales are pre-generated: de_DE:de, en_US:en|
|
||||||
|
|LANG|de_DE.UTF-8|following locales are pre-generated: de_DE.UTF-8, en_US.UTF-8|
|
||||||
|
|LC_ALL|de_DE|following locales are pre-generated: de_DE.UTF-8, en_US.UTF-8|
|
||||||
|
|TZ|Europe/Berlin|all valid Linux-timezones|
|
||||||
|
|
||||||
|
### Mounting Folder/ Volume
|
||||||
|
|
||||||
|
It is now possible to mount an empty folder to /opt/iobroker during first startup of the container. The Startupscript will check this folder and restore content if empty.
|
||||||
|
|
||||||
|
It is absolutely recommended to use a mounted folder or persistent volume for /opt/iobroker folder!
|
||||||
|
|
||||||
|
This also works with mounting a folder containing an existing ioBroker-installation (e.g. when moving an existing installation to docker).
|
||||||
|
|
||||||
|
### Permission Fixer
|
||||||
|
|
||||||
|
I added some code for fixing permissions for new iobroker-user. Permission-fixing is called on first start of the container. This might take a few minutes. Please be patient!
|
||||||
|
|
||||||
|
## Changelog
|
||||||
|
|
||||||
|
### v3.0.0 (2019-05-09)
|
||||||
|
* bringing changes since v2.0.0 to stable
|
||||||
|
* new tutorial available
|
||||||
|
|
||||||
|
### v2.0.6beta (2019-04-14)
|
||||||
|
* added some additional logging
|
||||||
|
* fixing some issues for languag env
|
||||||
|
* added permission fixing on first start
|
||||||
|
|
||||||
|
### v2.0.5beta (2019-02-09)
|
||||||
|
* added ENV to dockerfile
|
||||||
|
* added EXPOSE for admin
|
||||||
|
* final testing
|
||||||
|
|
||||||
|
### v2.0.4beta (2019-01-28)
|
||||||
|
* added support for env variables "avahi" and "packages"
|
||||||
|
* moving avahi-daemon installation into avahi startup script
|
||||||
|
* added script for installing optional packages
|
||||||
|
* optimizing logging output
|
||||||
|
|
||||||
|
### v2.0.3beta (2019-01-24)
|
||||||
|
* added support for running ioBroker under iobroker user
|
||||||
|
* optimizing logging output
|
||||||
|
* optimizing scripts
|
||||||
|
|
||||||
|
### v2.0.2beta (2019-01-23)
|
||||||
|
* optimizing and rearraged dockerfile
|
||||||
|
* changes for new ioBroker install script
|
||||||
|
* added restoring for empty mounted /opt/iobroker folder
|
||||||
|
* some more small fixes
|
||||||
|
|
||||||
|
### v2.0.1beta (2019-01-07)
|
||||||
|
* some changes for supporting other docker-environments than synology ds
|
||||||
|
|
||||||
|
### v2.0.0 (2018-12-05)
|
||||||
|
* using node8 instead of node6
|
||||||
|
* changes for new iobroker setup
|
||||||
|
|
||||||
|
### v1.2.1beta (2018-09-12)
|
||||||
|
* added support for firetv-adapter
|
||||||
|
|
||||||
|
### v1.2.0 (2018-08-21)
|
||||||
|
* after testing making 1.1.3beta to latest stable release
|
||||||
|
|
||||||
|
### v1.1.3beta (2018-08-21)
|
||||||
|
* added ffmpeg-package for yahka to support webcams
|
||||||
|
|
||||||
|
### v1.1.2beta (2018-04-04)
|
||||||
|
* added ENV for timezone issue
|
||||||
|
|
||||||
|
### v1.1.1beta (2018-03-29)
|
||||||
|
* added wget package
|
||||||
|
* updated readme.md
|
||||||
|
|
||||||
|
### v1.1.0 (2017-12-10)
|
||||||
|
* changed startup call to fix restart issue
|
||||||
|
* fixed avahi startup issue
|
||||||
|
* fixed hostname issue
|
||||||
|
* added z-wave support
|
||||||
|
* added logging to /opt/scripts/docker_iobroker_log.txt
|
||||||
|
|
||||||
|
### v1.0.1beta (2017-08-25)
|
||||||
|
* fixed locales issue
|
||||||
|
|
||||||
|
### v1.0.0 (2017-08-22)
|
||||||
|
* moved and renamed iobroker startup script
|
||||||
|
* disabled iobroker deamon to (hopefully) fix restart issue
|
||||||
|
* added some maintenance scripts
|
||||||
|
|
||||||
|
### v0.2.1 (2017-08-16)
|
||||||
|
* added libfontconfig package (for iobroker.phantomjs)
|
||||||
|
* added gnupg2 package as prerequisite for installing node version 6
|
||||||
|
|
||||||
|
### v0.2.0 (2017-06-04)
|
||||||
|
* fixed startup issue in startup.sh
|
||||||
|
* changed node version from 4 to 6
|
||||||
|
|
||||||
|
### v0.1.2 (2017-03-14)
|
||||||
|
* added libpcap-dev package (for iobroker.amazon-dash)
|
||||||
|
|
||||||
|
### v0.1.1 (2017-03-10)
|
||||||
|
* added git package
|
||||||
|
|
||||||
|
### v0.1.0 (2017-03-08)
|
||||||
|
* moved avahi-start.sh to seperate directory
|
||||||
|
* fixed timezone issue (sets now timezone to Europe/Berlin)
|
||||||
|
|
||||||
|
### v0.0.2 (2017-03-06)
|
||||||
|
* added support for avahi-daemon (installation and autostart)
|
||||||
|
|
||||||
|
### v0.0.1 (2017-01-31)
|
||||||
|
* project started / initial release
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2017 Andre Germann
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
|
||||||
|
Inspired by https://github.com/MehrCurry/docker-iobroker
|
||||||
|
|||||||
84
maintenance_scripts/backup_iobroker_folder.sh
Normal file
84
maintenance_scripts/backup_iobroker_folder.sh
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Backupscript fuer ein Backup von ioBroker unter Docker auf einer Synology Disk Station (Sicherung des ioBroker-Verzeichnises).
|
||||||
|
# Vorhaltezeit der letzten Backups: 90 Tage, ältere Backups werden automatisch geloescht.
|
||||||
|
#
|
||||||
|
# By Andre Germann
|
||||||
|
# Version 1.1 (22.09.2017)
|
||||||
|
#
|
||||||
|
# ACHTUNG: Dieses Script muss vorher auf die Synology Disk Station kopiert und dann auch dort ausgefuehrt werden!
|
||||||
|
# Fuer die geplante, regelmaessige Ausfuehrung bietet sich der Aufgabenplaner der Disk Station an.
|
||||||
|
#
|
||||||
|
# ACHTUNG: Dieses Script stoppt vor der Sicherung des Verzeichnises den ioBroker Container!
|
||||||
|
# Zur Sicherheit wird empfohlen ioBroker vor dem Backup innerhalb des Containers zu stoppen.
|
||||||
|
# Dieses kann zum Beispiel ueber den vorherigen Aufruf des Scripts iobroker_stop.sh aus ioBroker heraus erledigt werden.
|
||||||
|
|
||||||
|
|
||||||
|
# Deklaration der Variablen. Pfade und Bezeichnungen muessen ggf. entsprechend angepasst werden.
|
||||||
|
|
||||||
|
iobrokerPATH='/volume1/docker/iobroker_mount' # Pfad des gemounteten ioBroker-Verzeichnises (zu sicherndes Verzeichnis) auf der Synology Disk Station
|
||||||
|
backupPATH='/volume1/docker/iobroker_backup/archiv' # Pfad zum Speichern des Backups
|
||||||
|
iobrokerCONTAINERNAME='iobroker' # Name des ioBroker-Containers in Docker
|
||||||
|
|
||||||
|
|
||||||
|
# Start Script - Ab hier muss nichts mehr geaendert werden!
|
||||||
|
|
||||||
|
echo "#####################################################"
|
||||||
|
echo "############## Backupscript gestartet. ##############"
|
||||||
|
echo "#####################################################"
|
||||||
|
|
||||||
|
|
||||||
|
### Backup ioBroker-Verzeichnis
|
||||||
|
|
||||||
|
|
||||||
|
# ioBroker-Container stoppen
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Der ioBroker-Container ($iobrokerCONTAINERNAME) in Docker wird gestoppt..."
|
||||||
|
|
||||||
|
docker stop $iobrokerCONTAINERNAME > /dev/null
|
||||||
|
|
||||||
|
echo "Container in Docker gestoppt."
|
||||||
|
echo ""
|
||||||
|
echo "######################################################"
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
|
||||||
|
# Backupdatei erstellen
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Der Ordner $iobrokerPATH wird gesichert..."
|
||||||
|
|
||||||
|
tar -C "$iobrokerPATH" -czf "$backupPATH/backup-$(date +%Y-%m-%d_%H-%M).tar.gz" .
|
||||||
|
|
||||||
|
echo "Sicherung des Ordners erstellt."
|
||||||
|
echo ""
|
||||||
|
echo "######################################################"
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
|
||||||
|
# Alte Backups loeschen (Loescht per "rm" alle "*.tar.gz"-Dateien im Ordner, die aelter als 90 Tage sind)
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Entfernen alter Backups aus dem Verzeichnis $backupPATH..."
|
||||||
|
|
||||||
|
find -P "$backupPATH/" -maxdepth 1 -type f \( -name '*.tar.gz' \) -ctime +90 -exec rm {} \;
|
||||||
|
|
||||||
|
echo "Alte Backups wurden entfernt."
|
||||||
|
echo ""
|
||||||
|
echo "######################################################"
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
|
||||||
|
# ioBroker-Container starten
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Der ioBroker-Container ($iobrokerCONTAINERNAME) in Docker wird gestartet..."
|
||||||
|
|
||||||
|
docker start $iobrokerCONTAINERNAME > /dev/null
|
||||||
|
|
||||||
|
echo "Container in Docker gestartet."
|
||||||
|
echo ""
|
||||||
|
echo "################### Script Ende ######################"
|
||||||
|
|
||||||
|
exit 0
|
||||||
11
maintenance_scripts/iobroker_restart.sh
Normal file
11
maintenance_scripts/iobroker_restart.sh
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Einfaches Script zum Stoppen von ioBroker.
|
||||||
|
# Kann zum Beispiel aus ioBroker heraus aufgerufen werden um ioBroker neu zu starten.
|
||||||
|
|
||||||
|
cd /opt/iobroker
|
||||||
|
pkill io
|
||||||
|
sleep 5
|
||||||
|
node node_modules/iobroker.js-controller/controller.js >/opt/scripts/docker_iobroker_log.txt 2>&1 &
|
||||||
|
|
||||||
|
exit 0
|
||||||
9
maintenance_scripts/iobroker_stop.sh
Normal file
9
maintenance_scripts/iobroker_stop.sh
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Einfaches Script zum Stoppen von ioBroker.
|
||||||
|
# Kann zum Beispiel aus ioBroker heraus aufgerufen werden um ioBroker zu stoppen.
|
||||||
|
|
||||||
|
cd /opt/iobroker
|
||||||
|
pkill io
|
||||||
|
|
||||||
|
exit 0
|
||||||
83
scripts/iobroker_startup.sh
Normal file
83
scripts/iobroker_startup.sh
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Reading env-variables
|
||||||
|
packages=$PACKAGES
|
||||||
|
avahi=$AVAHI
|
||||||
|
|
||||||
|
# Getting date and time for logging
|
||||||
|
dati=`date '+%Y-%m-%d %H:%M:%S'`
|
||||||
|
|
||||||
|
# Information
|
||||||
|
echo ''
|
||||||
|
echo '----------------------------------------'
|
||||||
|
echo '----- Image-Version: 3.0.0 -----'
|
||||||
|
echo '----- '$dati' -----'
|
||||||
|
echo '----------------------------------------'
|
||||||
|
echo ''
|
||||||
|
echo 'Startupscript running...'
|
||||||
|
|
||||||
|
# Checking and installing additional packages
|
||||||
|
if [ "$packages" != "" ]
|
||||||
|
then
|
||||||
|
echo ''
|
||||||
|
echo 'Installing additional packages...'
|
||||||
|
echo 'The following packages will be installed:' $packages
|
||||||
|
echo $packages > /opt/scripts/.packages
|
||||||
|
sh /opt/scripts/setup_packages.sh > /opt/scripts/setup_packages.log 2>&1
|
||||||
|
echo 'Installing additional packages done...'
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd /opt/iobroker
|
||||||
|
|
||||||
|
# Checking and restoring ioBroker to empty mounted folder
|
||||||
|
if [ `ls -1a|wc -l` -lt 3 ]
|
||||||
|
then
|
||||||
|
echo ''
|
||||||
|
echo 'Directory /opt/iobroker is empty!'
|
||||||
|
echo 'Restoring data from image...'
|
||||||
|
tar -xf /opt/initial_iobroker.tar -C /
|
||||||
|
echo 'Restoring done...'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Checking for first run of a new installation and renaming ioBroker
|
||||||
|
if [ -f /opt/iobroker/.install_host ]
|
||||||
|
then
|
||||||
|
echo ''
|
||||||
|
echo 'This is the first run of an new installation...'
|
||||||
|
echo 'Hostname given is' $(hostname)'...'
|
||||||
|
echo 'Renaming ioBroker...'
|
||||||
|
iobroker host $(cat /opt/iobroker/.install_host)
|
||||||
|
rm -f /opt/iobroker/.install_host
|
||||||
|
echo 'Renaming ioBroker done...'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Checking for first run and change permissions
|
||||||
|
if [ -f /opt/.firstrun ]
|
||||||
|
then
|
||||||
|
echo ''
|
||||||
|
echo 'Changing permissions upon first run (This might take a while! Please be patient!)...'
|
||||||
|
chown -R iobroker /opt/iobroker
|
||||||
|
chown -R iobroker /opt/scripts
|
||||||
|
rm -f /opt/.firstrun
|
||||||
|
echo 'Changing permissions done...'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Checking for and setting up avahi-daemon
|
||||||
|
if [ "$avahi" = "true" ]
|
||||||
|
then
|
||||||
|
echo ''
|
||||||
|
echo 'Initializing Avahi-Daemon...'
|
||||||
|
sh /opt/scripts/setup_avahi.sh
|
||||||
|
echo 'Initializing Avahi-Daemon done...'
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
# Starting ioBroker
|
||||||
|
echo ''
|
||||||
|
echo 'Starting ioBroker...'
|
||||||
|
sudo -u iobroker node node_modules/iobroker.js-controller/controller.js > /opt/scripts/iobroker.log 2>&1 &
|
||||||
|
echo 'Starting ioBroker done...'
|
||||||
|
|
||||||
|
# Preventing container restart by keeping a process alive
|
||||||
|
tail -f /dev/null
|
||||||
35
scripts/setup_avahi.sh
Normal file
35
scripts/setup_avahi.sh
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo 'Checking avahi-daemon installation state...'
|
||||||
|
|
||||||
|
if [ -f /usr/sbin/avahi-daemon ]
|
||||||
|
then
|
||||||
|
echo 'Avahi already installed...'
|
||||||
|
else
|
||||||
|
echo 'Installing avahi-daemon...'
|
||||||
|
apt-get update > /opt/scripts/avahi_startup.log 2>&1
|
||||||
|
apt-get install -y libavahi-compat-libdnssd-dev avahi-daemon >> /opt/scripts/avahi_startup.log 2>&1
|
||||||
|
rm -rf /var/lib/apt/lists/* >> /opt/scripts/avahi_startup.log 2>&1
|
||||||
|
echo 'Configuring avahi-daemon...'
|
||||||
|
sed -i '/^rlimit-nproc/s/^\(.*\)/#\1/g' /etc/avahi/avahi-daemon.conf
|
||||||
|
echo 'Configuring dbus...'
|
||||||
|
mkdir /var/run/dbus/
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f /var/run/dbus/pid ];
|
||||||
|
then
|
||||||
|
rm -f /var/run/dbus/pid
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f /var/run/avahi-daemon//pid ];
|
||||||
|
then
|
||||||
|
rm -f /var/run/avahi-daemon//pid
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo 'Starting dbus...'
|
||||||
|
dbus-daemon --system
|
||||||
|
|
||||||
|
echo 'Starting avahi-daemon...'
|
||||||
|
/etc/init.d/avahi-daemon start
|
||||||
|
|
||||||
|
exit 0
|
||||||
8
scripts/setup_packages.sh
Normal file
8
scripts/setup_packages.sh
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y $(cat /opt/scripts/.packages)
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
rm -f /opt/scripts/.packages
|
||||||
|
|
||||||
|
exit 0
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ -f .install_host ];
|
|
||||||
then
|
|
||||||
sed -i "s/$(cat .install_host)/$(hostname)/g" iobroker-data/objects.json
|
|
||||||
rm .install_host
|
|
||||||
fi
|
|
||||||
|
|
||||||
node node_modules/iobroker.js-controller/controller.js
|
|
||||||
Reference in New Issue
Block a user