base version
This commit is contained in:
commit
bd6b278ccc
107
Dockerfile
Executable file
107
Dockerfile
Executable file
@ -0,0 +1,107 @@
|
||||
FROM debian:buster-slim
|
||||
|
||||
ARG APP_VERSION
|
||||
ARG APP_HASH
|
||||
ARG BUILD_DATE
|
||||
|
||||
ARG STABLE
|
||||
|
||||
LABEL org.label-schema.version=$APP_VERSION \
|
||||
org.label-schema.build-date=$BUILD_DATE \
|
||||
org.label-schema.vcs-ref=$APP_HASH \
|
||||
org.label-schema.vcs-url="https://github.com/domoticz/domoticz" \
|
||||
org.label-schema.url="https://domoticz.com/" \
|
||||
org.label-schema.vendor="Domoticz" \
|
||||
org.label-schema.name="Domoticz" \
|
||||
org.label-schema.description="Domoticz open source Home Automation system" \
|
||||
org.label-schema.license="GPLv3" \
|
||||
org.label-schema.docker.cmd="docker run -v ./config:/config -v ./plugins:/opt/domoticz/plugins -e DATABASE_PATH=/config/domoticz.db -p 8080:8080 -d /usr/local/bin/start.sh" \
|
||||
|
||||
maintainer="Domoticz Docker Maintainers <info@domoticz.com>"
|
||||
|
||||
# org.label-schema.docker.cmd="docker run -v ./config:/config -v ./plugins:/opt/domoticz/plugins -e DATABASE_PATH=/config/domoticz.db -p 8080:8080 -d domoticz/domoticz" \
|
||||
|
||||
|
||||
WORKDIR /opt/domoticz
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN set -ex \
|
||||
&& apt-get update \
|
||||
&& apt-get install --no-install-recommends -y \
|
||||
tzdata \
|
||||
unzip \
|
||||
git \
|
||||
libudev-dev \
|
||||
libusb-0.1-4 \
|
||||
libsqlite3-0 \
|
||||
curl libcurl4 libcurl4-gnutls-dev \
|
||||
libpython3.7-dev \
|
||||
python3 \
|
||||
python3-pip \
|
||||
&& OS="$(uname -s | sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')" \
|
||||
&& MACH=$(uname -m) \
|
||||
&& if [ ${MACH} = "armv6l" ]; then MACH = "armv7l"; fi \
|
||||
&& archive_file="domoticz_${OS}_${MACH}.tgz" \
|
||||
&& version_file="version_${OS}_${MACH}.h" \
|
||||
&& history_file="history_${OS}_${MACH}.txt" \
|
||||
&& if [ -z "$STABLE"]; then curl -k -L https://releases.domoticz.com/releases/beta/${archive_file} --output domoticz.tgz; else curl -k -L https://releases.domoticz.com/releases/release/${archive_file} --output domoticz.tgz; fi \
|
||||
&& tar xfz domoticz.tgz \
|
||||
&& rm domoticz.tgz \
|
||||
&& mkdir -p /opt/domoticz/userdata \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& ln -s /usr/bin/pip3 /usr/bin/pip \
|
||||
&& pip3 install setuptools requests
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install git -y
|
||||
RUN apt-get install build-essential -y
|
||||
RUN apt-get install nut -y
|
||||
RUN apt-get install php -y
|
||||
RUN apt-get install curl -y
|
||||
RUN apt-get install php-curl -y
|
||||
RUN apt-get install perl -y
|
||||
RUN apt-get install mosquitto-clients -y
|
||||
|
||||
RUN cpan Device::Modbus
|
||||
RUN cpan Net::Server
|
||||
RUN cpan Role::Tiny
|
||||
RUN cpan Try::Tiny
|
||||
RUN cpan Device::Modbus::TCP
|
||||
|
||||
RUN apt-get install --reinstall ca-certificates -y
|
||||
RUN git clone https://github.com/tjko/sunspec-monitor.git
|
||||
|
||||
RUN apt-get install socat screen -y
|
||||
#RUN git clone https://github.com/asaif/socat-init.git
|
||||
#COPY socat.conf /etc/default/
|
||||
#RUN cp socat-init/socat /etc/init.d/
|
||||
#RUN chmod +x /etc/init.d/socat
|
||||
#RUN update-rc.d socat defaults
|
||||
|
||||
#COPY /volume2/docker/build/domoticz-docker/socat.conf /etc/default/
|
||||
|
||||
VOLUME /opt/domoticz/userdata
|
||||
|
||||
EXPOSE 8080
|
||||
EXPOSE 443
|
||||
|
||||
ENV LOG_PATH=
|
||||
ENV DATABASE_PATH=
|
||||
ENV WWW_PORT=8080
|
||||
ENV SSL_PORT=443
|
||||
ENV EXTRA_CMD_ARG=
|
||||
|
||||
# timezone env with default
|
||||
ENV TZ=Europe/Amsterdam
|
||||
|
||||
#COPY start.sh /usr/local/bin/
|
||||
#RUN chmod +x /usr/local/bin/start.sh \
|
||||
# && ln -s usr/local/bin/start.sh / # backwards compat
|
||||
#
|
||||
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh \
|
||||
&& ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
124
README.md
Executable file
124
README.md
Executable file
@ -0,0 +1,124 @@
|
||||
|
||||
|
||||
Domoticz
|
||||
======
|
||||
|
||||
Domoticz - http://www.domoticz.com/
|
||||
|
||||
Docker containers with official Domoticz (beta) builds.
|
||||
|
||||
*Currently available for the following Linux platforms:*
|
||||
|
||||
| Image Architectures |
|
||||
| :----: |
|
||||
| Arm 32 bit |
|
||||
| Arm 64 bit |
|
||||
| Linux 64 bit |
|
||||
|
||||
Repository: https://hub.docker.com/repository/docker/domoticz/domoticz
|
||||
|
||||
Domoticz is a Home Automation System that lets you monitor and configure various devices like: Lights, Switches, various sensors/meters like Temperature, Rain, Wind, UV, Electra, Gas, Water and much more. Notifications/Alerts can be sent to any mobile device
|
||||
|
||||
## How to use
|
||||
|
||||
The recommended method is to use Docker Compose (See below)
|
||||
|
||||
**Pull image**
|
||||
|
||||
```
|
||||
docker pull domoticz/domoticz
|
||||
```
|
||||
|
||||
**Run container**
|
||||
|
||||
```
|
||||
docker run -d \
|
||||
-p 8080:8080 \
|
||||
-p 8443:443 \
|
||||
-v <path for config files>:/opt/domoticz/userdata \
|
||||
-e TZ=Europe/Amsterdam
|
||||
--device=<device_id> \
|
||||
--name=<container name> \
|
||||
domoticz/domoticz
|
||||
```
|
||||
|
||||
Please replace all user variables in the above command defined by <> with the correct values (you can have several USB devices attached, just add other `--device=<device_id>`).
|
||||
|
||||
**Access Domoticz**
|
||||
|
||||
```
|
||||
http://<host ip>:8080
|
||||
*or*
|
||||
https://<host ip>:8443
|
||||
```
|
||||
|
||||
8080 can be another port (you change `-p 8080:8080` to `-p 8081:8080` to have 8081 out of the container for example).
|
||||
|
||||
### Usage with docker-compose
|
||||
|
||||
mkdir /opt/domoticz
|
||||
cd /opt/domoticz
|
||||
Inside this folder create a file (*docker-compose.yml*) with the following contents
|
||||
|
||||
*docker-compose.yml*
|
||||
```yaml
|
||||
version: '3.3'
|
||||
|
||||
services:
|
||||
domoticz:
|
||||
image: domoticz/domoticz
|
||||
container_name: domoticz
|
||||
restart: unless-stopped
|
||||
# Pass devices to container
|
||||
# devices:
|
||||
# - "/dev/serial/by-id/usb-0658_0200-if00:/dev/ttyACM0"
|
||||
ports:
|
||||
- "8080:8080"
|
||||
volumes:
|
||||
- ./config:/opt/domoticz/userdata
|
||||
environment:
|
||||
- TZ=Europe/Amsterdam
|
||||
#- LOG_PATH=/opt/domoticz/userdata/domoticz.log
|
||||
```
|
||||
Now you can launch the container by issuing:
|
||||
|
||||
docker-compose up -d
|
||||
|
||||
### Enviroment values
|
||||
**ENV WWW_PORT=8080** - Specify default HTTP port
|
||||
**ENV SSL_PORT=443** - Specify default SSL port
|
||||
**ENV TZ=Europe/Amsterdam** - Specify default timezone (see /usr/share/zoneinfo folder), **only needed when you can not mount the volume /etc/localtime**
|
||||
**EXTRA_CMD_ARG** - Option to override additional command line parameters (See domoticz --help)
|
||||
|
||||
You could use the extra_cmd_arg value to specify the SSL certificate
|
||||
|
||||
### Python Plugins
|
||||
When launching the docker container for the first time, a plugin folder is created in the *userdata* folder
|
||||
You need to place your python plugins is folder
|
||||
|
||||
### Updating the image
|
||||
From within the container folder issue:
|
||||
```
|
||||
docker-compose pull domoticz
|
||||
docker-compose down
|
||||
docker-compose up -d --remove-orphans
|
||||
docker image prune
|
||||
```
|
||||
|
||||
### Logging
|
||||
Logging is disabled by default, and you can see the interna logs via the web gui.
|
||||
When you enable logging, keep in mind that the log file can become quite large.
|
||||
Do not leave this enabled when not needed.
|
||||
|
||||
### Shell access whilst the container is running
|
||||
```
|
||||
docker exec -it domoticz
|
||||
```
|
||||
|
||||
### Monitor the logs of the container
|
||||
```
|
||||
docker logs -f domoticz
|
||||
```
|
||||
|
||||
### Building the image
|
||||
clone the github repository and issue the build.sh script (you might want to edit this file)
|
||||
25
docker-entrypoint.sh
Executable file
25
docker-entrypoint.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
/usr/bin/screen -S socatclientmonitor -d -m /opt/domoticz/userdata/scripts/socatclientmonitor.sh
|
||||
|
||||
|
||||
CMD_ARGS="-www $WWW_PORT"
|
||||
CMD_ARGS="$CMD_ARGS -noupdates -sslwww $SSL_PORT -userdata /opt/domoticz/userdata"
|
||||
|
||||
if [ -n "$LOG_PATH" ]; then
|
||||
CMD_ARGS="$CMD_ARGS -log $LOG_PATH"
|
||||
fi
|
||||
|
||||
if [ -n "$DATABASE_PATH" ]; then
|
||||
CMD_ARGS="$CMD_ARGS -dbase $DATABASE_PATH"
|
||||
fi
|
||||
|
||||
if [ -n "$EXTRA_CMD_ARG" ]; then
|
||||
CMD_ARGS="$CMD_ARGS $EXTRA_CMD_ARG"
|
||||
fi
|
||||
|
||||
if [ $1 == "/opt/domoticz/domoticz" ]; then
|
||||
exec $@ $CMD_ARGS
|
||||
else
|
||||
exec "$@"
|
||||
fi
|
||||
12
install docker.txt
Executable file
12
install docker.txt
Executable file
@ -0,0 +1,12 @@
|
||||
Creating a new image from a DockerFile
|
||||
|
||||
sudo su -
|
||||
docker build --no-cache -t domoticz /volume2/docker/build/domoticz-docker
|
||||
|
||||
Update Container
|
||||
|
||||
In Docker UI op NAS stop container, export settings, rename naar old en import JSON opnieuw.
|
||||
|
||||
|
||||
Cache probleem uitzetten :
|
||||
mv /opt/domoticz/www/html5.appcache /opt/domoti=cz/www/html5.appcache.disabled
|
||||
Loading…
x
Reference in New Issue
Block a user