Code Monkey home page Code Monkey logo

mkdomoticz's Introduction

mkdomoticz

Make a persistent domoticz container PDQ

Requirements

docker

Contributing

Feel free to make an issue or pull request here

Usage

make auto

should ask you any pertinent questions and bring up a container running domoticz

DockerHub Usage

docker pull joshuacox/mkdomoticz

Temporary demo of domoticz1

 @docker run --name=domoticz \
        --privileged \
        --cidfile="cid" \
        -d \
        -p 8080:8080 \
        -v $(DATADIR)/config:/config \
        -v $(LOGDIR)/log:/log \
        -t joshuacox/mkdomoticz

or simply use the temp recipe from the Makefile

make temp

Persistence

First run an instance like above with make init and then use the 'grab' recipe to make grab it's data dirctory:

make grab

or manually

        mkdir -p datadir/domoticz
        docker cp `cat cid`:/config  - |sudo tar -C datadir/ -pxf -

Note this only need be done once to grab the files and directory structure from within /config in the running image and write them out to our volume mount

then kill off the original container and run the persistent image

make clean
make run

or manually

 @docker run --name=domoticz \
        --privileged \
        -d \
        -p 8080:8080 \
        -v `pwd`/datadir/config:/config \
        -t joshuacox/mkdomoticz

Branches

master / stretch
  • pulls and runs joshuacox/mkdomoticz from github by default
arm
  • pulls and runs joshuacox/mkdomoticz:arm from github by default
local-stretch
  • builds locally using local-debian this branch should work on any architecture given debian also runs there (and therefore debootstrap)

there are branches for raspberryPi as well, checkout the arm branch to pull my image from docker hub, or use the local-stretch to build locally though it should be noted you'll need a locally built stretch image named local-stretch, I have another Makefile repo for that as well. Merely make stretch and a local stretch image can be built using debootstrap (which is available in most distribution [even ones not based on debian])

CLI options

You can add command lines opts by adding them to DOMOTICZ_OPTS

i.e. to change verbosity to debug

echo '-verbose 2'

Here's the current list of opts:

Usage: Domoticz -www port -verbose x
        -www port (for example -www 8080, or -www 0 to disable http)
        -wwwbind address (for example -wwwbind 0.0.0.0 or -wwwbind 192.168.0.20)
        -sslwww port (for example -sslwww 443, or -sslwww 0 to disable https)
        -sslcert file_path (for example /opt/domoticz/server_cert.pem)
        -sslkey file_path (if different from certificate file)
        -sslpass passphrase (to access to server private key in certificate)
        -sslmethod method (for SSL method)
        -ssloptions options (for SSL options, default is 'default_workarounds,no_sslv2,no_sslv3,no_tlsv1,no_tlsv1_1,single_dh_use')
        -ssldhparam file_path (for SSL DH parameters)
        -wwwroot file_path (for example /opt/domoticz/www)
        -dbase file_path (for example /opt/domoticz/domoticz.db)
        -userdata file_path (for example /opt/domoticz)
        -webroot additional web root, useful with proxy servers (for example domoticz)
        -verbose x (where x=0 is none, x=1 is all important, x=2 is debug)
        -startupdelay seconds (default=0)
        -nowwwpwd (in case you forgot the web server username/password)
        -nocache (do not return appcache, use only when developing the web pages)
        -log file_path (for example /var/log/domoticz.log)
        -loglevel (0=All, 1=Status+Error, 2=Error , 3= Trace )
        -debug    allow log trace level 3
        -notimestamps (do not prepend timestamps to logs; useful with syslog, etc.)
        -php_cgi_path (for example /usr/bin/php-cgi)
        -daemon (run as background daemon)
        -pidfile pid file location (for example /var/run/domoticz.pid)
        -syslog [user|daemon|local0 .. local7] (use syslog as log output, defaults to facility 'user')

mkdomoticz's People

Contributors

glecoz avatar joshuacox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mkdomoticz's Issues

Aligned images for stable builds + ARG domoticz_version on Dockerfiles

Hi, first of all thanks for building and maintaining the only functional Docker images and Dockerfiles I could find for Domoticz containers on Raspberry Pi :)

I'm currently Dockerizing my existing Domoticz on the following context :

  • High powered main server (amd64)
  • Backup server (arm / Raspberry Pi 3 B+)

The backup server being used only when the main one is under maintenance. In such context, Domoticz persisted data and config must be transferred back and forth between containers on both servers, with the same Domoticz versions, to avoid hazardous automated up/down migrations on Domoticz database between both instances relying on different CPU architectures.

So, could you provide images of the latest Domoticz stable version (3.8153 and further ones when available) on Docker Hub for both your strech and arm-stretch branches ?

Like :

  • stretch-stable-3.8153
  • arm-stable-3.8153

I guess this would be useful to many users, since your images for those branches are currently built on different periods, and relying on Domoticz master (beta) branch :

  • stretch : 9 months ago
  • arm : 11 days ago

Or, at least, could you provide an argument for the Domoticz version on your stretch and stretch-arm Dockerfiles, so that anyone can build the same Domoticz version on both architectures ?

This way any user can override these settings upon build from command line or docker-compose files to build from any Domoticz tag or the master branch :

# Domoticz
  ha-domoticz:
    build:
      context: ./domoticz/build/arm  # (<- mkdomoticz Dockerfile)
      args:
        DOMOTICZ_VERSION: 3.8153      # (or master)

Please check my pull requests below.

Thanks.

" invalid tar header" on latest hyriotOS - hypriotos-rpi-v1.8.0-rc2.img.zip

$ docker run --name=domoticz         --privileged         --cidfile="cid"         -d         -p 8080:8080         -t joshuacox/mkdomoticz:arm
Unable to find image 'joshuacox/mkdomoticz:arm' locally
arm: Pulling from joshuacox/mkdomoticz
8d1b22c79612: Extracting [==================================================>]  140.5MB/140.5MB
c5a849e7f0d1: Download complete 
4c534d38e9da: Download complete 
docker: failed to register layer: Error processing tar file(exit status 1): archive/tar: invalid tar header.
See 'docker run --help'.

other docker seems to be fine:

$ docker run -d -p 80:80 hypriot/rpi-busybox-httpd
Unable to find image 'hypriot/rpi-busybox-httpd:latest' locally
latest: Pulling from hypriot/rpi-busybox-httpd
c74a9c6a645f: Pull complete 
6f1938f6d8ae: Pull complete 
e1347d4747a6: Pull complete 
a3ed95caeb02: Pull complete 
Digest: sha256:c00342f952d97628bf5dda457d3b409c37df687c859df82b9424f61264f54cd1
Status: Downloaded newer image for hypriot/rpi-busybox-httpd:latest
ce43188a7747e24f1af4d0648b83c81366812fd5ad1185e47bcdf4d25de6911b

Docker not starting for rapsberry PI 1

Docker not starting for rapsberry PI 1:

$ docker ps -a
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS                        PORTS                    NAMES
64c41d9e1fe0        joshuacox/mkdomoticz:arm    "/start.sh"              15 minutes ago      Exited (139) 59 seconds ago                            domoticz

Possible improvements

Hi,

Well first thanks for this project, it worked for me on an RPI. I wonder, there is few domoticz/docker projects. Is this the official one?

Some observations.

  • Updating domoticz doesn't work for me. When I log in to the container, I can run .updaterelease after installing git, wget, sudo etc.. As the container is running, I am not exactly sure how the update is picked-up. I tried a docker restart, which left the container not running...

  • The container time is not in sync with host time. This is a common docker thing, there seems to be solutions for it.

I might have a go with a PR for these issues.

GCM notifications not working

Hello,

After all, thanks for the efforts. They are really appreciated.

On a cleanly built docker image, and after sending GCM ID from the mobile App, an error occurs when trying to send GCM notification. After enabling as much as log as possible, only this log is relevant to the issue:

2019-03-13 14:06:42.592 [7f72b4b4e700] Notification sent (gcm) => Failed
2019-03-13 14:06:42.601 [7f72b4b4e700] Active notification Subsystems: (0/13)
2019-03-13 14:06:42.581 [7f72b4b4e700] Status: Notification: Domoticz test
2019-03-13 14:06:42.592 [7f72b4b4e700] Error: GCM: Could not send message, HTTP Error

e-mail notifications also fail in this system.

My system is an APU-4c2 running:

  • Linux Arch
  • Linux version 4.19.20-1-lts
  • Docker version 18.09.1-ce, build 4c52b901c6
  • docker-compose version 1.23.2, build unknown

docker-compose script as follows:

 domoticz:
  image: joshuacox/mkdomoticz
  hostname: domoticz
  container_name: domoticz
  privileged: true
  volumes:
  - ./domoticz/config:/config
  ports:
   - "8081:8080"
  restart: always

Thanks in advance

Domoticz Error: SolarEdgeAPI: Error getting http data!

Hello,

I try to run Domoticz in docker (Docker GUI in openmediavault4 on a ARM-device).

I only use Domoticz for logging my SolarEdge-system ATM.
I've got only errors: Error: SolarEdgeAPI: Error getting http data! (it works on an other system, so the API I used is okay).

What can I do to solve this problem?

TIA
Frepke

telegram notifications do not work

To replicate follow instructions at https://www.domoticz.com/wiki/Telegram_Bot to create a telegram a/c, create a bot and get the API key, and then obtain the Chat ID.

In Domoticz Settings / Notifications tab, paste the API key and Chat ID into the Telegram settings (as the bottom of the page) and press Test. Message: "Notification Sent - should arrive at your device soon" pops up. No message arrives. Log error:

 2020-03-14 15:58:27.965 Status: Notification: Domoticz test
2020-03-14 15:58:28.016 Notification sent (telegram) => Failed
2020-03-14 15:58:28.024 Active notification Subsystems: email, telegram (2/13)
2020-03-14 15:58:28.016 Error: Telegram: 

There is no problem when sending a message via the CLI:
Open the Domoticz CLI in Portainer and connect. Paste the following (after inserting the API key and Chat ID):
curl --data chat_id=<CHAT ID> --data-urlencode "text=Some complex text $25 78%" "https://api.telegram.org/bot<API KEY>/sendMessage"
It returns:
{"ok":true,"result":{"message_id":67,"from":{"id":985736213,"is_bot":true,"first_name":"xxxxxxx","username":"xxxxxxxxx"},"chat":{"id":xxxxxxxxx,"first_name":"xxxxxx","username":"xxxxxx","type":"private"},"date":1584201822,"text":"Some complex text 5 78%"}}root@c826cdca9643:/#

Does the problem have the same issue as sending email?

404 Not found message after installation

Hi,

I did a pull and then the frist command to extract the config data to local dir, then i did:

docker run -d --name domoticz --privileged --cidfile="/mnt/docker_data/cids/domoticz-cid" -p 8080:8080/tcp -v pwd/mnt/docker_data/domoticz/config:/config -t joshuacox/mkdomoticz

The container runs but when i go to the sever_ip:8080 i'am getting a message 404 Not found. Only related topic regarding this is:

Domoticz topic

Logs say:
docker logs -f domoticz

2017-06-28 05:52:59.383 Domoticz V3.7502 (c)2012-2017 GizMoCuz
2017-06-28 05:52:59.383 Build Hash: fdc764ee, Date: 2017-05-23 11:06:41
2017-06-28 05:52:59.384 Startup Path: /usr/local/bin/
2017-06-28 05:52:59.387 BuildManifest: Created directory /usr/local/bin/plugins/
2017-06-28 05:52:59.403 PluginSystem: Started, Python version '3.5.3'.
2017-06-28 05:52:59.404 Active notification Subsystems: gcm, http (2/12)
2017-06-28 05:52:59.404 WebServer(HTTP) started on address: 0.0.0.0 with port 8080
2017-06-28 05:52:59.405 Error: WebServer(SSL) startup failed on address 0.0.0.0 with port: 443: use_certificate_chain_file: No such file or directory
2017-06-28 05:52:59.405 Error: WebServer(SSL) check privileges for opening ports below 1024
2017-06-28 05:52:59.405 Proxymanager started.
2017-06-28 05:52:59.405 Starting shared server on: 0.0.0.0:6144
2017-06-28 05:52:59.405 RxQueue: queue worker started...
2017-06-28 05:52:59.405 TCPServer: shared server started...
2017-06-28 05:53:01.407 EventSystem: reset all events...
2017-06-28 05:53:01.407 EventSystem: reset all device statuses...
2017-06-28 05:53:01.407 EventSystem: Started
2017-06-28 05:53:01.891 PluginSystem: Entering work loop.
2017-06-28 05:53:03.427 Incoming connection from: 192.168.0.4

Any advice to solve this?

Backup files are not outside the container

I run the latest stable version and have configured 2 mapped volumes:

\config (actual database)
\log

Domoticz make every hour an automatic backup (Configure via: Setup - Settings - System - Enable automatic backup)
In the log file I see the backup procedure is starting but the backup files are not outside the container in the folder \config.

2020-12-23 13:00:01.372  Status: Starting automatic database backup procedure...
2020-12-23 13:00:03.428  Status: Ending automatic database backup procedure...

The backup file is created in the folder: ./src/domoticz/backups/hourly/backup-hour-13-Domoticz.db in the container.

Is it possible to make a folder mapping outside the container for the backups?

update domoticz version

Is it possible to rebuild the image so the newest stable version from domoticz is used? Currently it is v4.10364 and latest stable is v4.10717

email notification not working

first - thanks for great job creating this Dockerfile :)

for me after dockerization domoticz stops sending email notifications to google... logging of domoticz not really good so no luck with real error message, and also unable to check error on google side for now.

2019-01-23 20:32:03.923 Error: SMTP Mailer: Error sending Email to: [email protected] !
2019-01-23 20:32:03.923 Error: Failed to send Email notification!

i think something with SSL... but not sure.. will investigate.

how to update to beta?

I'm coming from a pi and installed this docker. but when uploaden my database it's newer then the stable. how can I update this domoticz docker to the latest beta so that I can import my database?

dzVents script not working

Hi,

I pulled this docker container and I can't get dzVents scripts to work.

I've created a volume /home/domoticz/docker_data/Domoticz/scripts:/src/domoticz/scripts/dzVents/scripts and placed a demo.lua inside it.

return {
        on = {
                timer = {
                        'every 1 minute'
                }
        },
        active = true,
        execute = function(domoticz)
                domoticz.log('testing')
        end
}

I don't see any log and error messages. It seems scripts never gets triggered.

e-mail notifications do not work from docker container

Hello,

I used https://www.domoticz.com/wiki/Docker to install the docker container Domoitcz.
I works like a charm exept for the e-mail notifications.

My setup:
Raspberry PI 4B with Ubuntu Linux image VERSION="19.10 (Eoan Ermine)"
Server: Docker Engine - Community
Version: 19.03.3
API version: 1.40 (minimum version 1.12)
Go version: go1.12.10
Git commit: a872fc2
Built: Tue Oct 8 00:59:07 2019
OS/Arch: linux/arm64

Your docker container from Dockerhub
Domoticz V4.10364

Script to run the container:
docker run --name=domoticz_arm
--privileged
-d
--network ip32to63
-v /home/ubuntu/terraform/domoticz/datadir/config:/config
-t joshuacox/mkdomoticz:arm

Email notification errors from the Domoticz log:
2020-02-06 11:03:05.143 Notification sent (email) => Failed
2020-02-06 11:03:05.151 Active notification Subsystems: email (1/13)
2020-02-06 11:03:05.102 Status: Notification: Domoticz test
2020-02-06 11:03:05.143 Error: SMTP Mailer: Error sending Email to: [email protected] !
2020-02-06 11:03:05.143 Error: Failed to send Email notification!

I cannot get it to work with auth, without auth for local LAN.
not on port 25, not on SSL 465

To make sure the container is able to connect to my local SMTP mail server,
I connected to the container and installed telnet.
I was able to to connect to my mail server and send an email via telnet from the
container in the bash shell.

So I am kind of lost why it won't work from the Domoticz web interface.

Any help is appreciated.
Thanx in advance.

grtz,
Andre

Not really an issue: how to active ssl from DOMOTICZ_OPTS

Hi Joshua,

I've a sonos one with Alexa and i use your image to dockerize domoticz.
I'm a newbie in docker and i used the configuration by default on port 8080.
It's working nicely. But now i want to connect Alexa with domoticz and i need to use SSL port.
At my knowledge, only one skill work with Alexa, called Controlicz that only works with SSL.
I've tried " export DOMOTICZ_OPTS='-sslwww 443 -www 0' " before running docker without result
And after i used -p 443:433 in docker run.
Can you help me.
Thank for your reply.

PS: sorry for my english, i'm french.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.