Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Docker? #1757

Closed
FezVrasta opened this issue Aug 16, 2019 · 37 comments
Closed

Migrate to Docker? #1757

FezVrasta opened this issue Aug 16, 2019 · 37 comments
Labels

Comments

@FezVrasta
Copy link

FezVrasta commented Aug 16, 2019

My RPi 4 (4GB) is finally arrived and I'm getting ready to migrate my old Home Assistant + DeCONZ setup to it.

I want to use Docker, since right now everything is installed on the host system and it's a hot mess.

I was wondering what's the procedure to migrate my DeCONZ config to my new RPI, considering I'm going to use Docker this time? I would really like not to have to re-pair all my devices again.

@manup
Copy link
Member

manup commented Aug 17, 2019

Re-pairing isn't necessary. Basically you just need to transfer the zll.db file to the Docker environment. The easiest way is to create a backup file in the Phoscon App with your current setup and reload this configuration in the Phoscon App of your new Docker setup.

If something doesn't work right away please don't reset anything.

@FezVrasta
Copy link
Author

FezVrasta commented Aug 18, 2019

Thanks.

I'm uploading the backup through the web UI but it's been stuck on the "Loading backup - This can take a moment..." for quite a few minutes already.

The process is running (2% CPU, 1% RAM)

What's the proper way to interrupt the process to try again?

@FezVrasta
Copy link
Author

This is what I see in the console:

image

@FezVrasta
Copy link
Author

FezVrasta commented Aug 18, 2019

I reloaded the page and tried again and I noticed this, I guess the backup restore process doesn't even start.

image

I tried with the old web UI and there at least it surfaces the error to the user:

image

@manup
Copy link
Member

manup commented Aug 18, 2019

Hmm that's odd, I'll forward it to the developer of the backup page.
The 503 is however suspicious, is your setup working otherwise and the Zigbee network operational?

@FezVrasta
Copy link
Author

FezVrasta commented Aug 18, 2019

I have no idea, I haven't tried to use it yet, I don't want to pair stuff manually ever again 😅

@manup
Copy link
Member

manup commented Aug 18, 2019

I mean is your Zigbee network working, are devices connected?

@FezVrasta

This comment has been minimized.

@FezVrasta

This comment has been minimized.

@manup
Copy link
Member

manup commented Aug 18, 2019

Oh my bad just seeing the issue is about import (on the new machine I guess) not export.
I would say due how it looks the RaspBee isn't correctly installed yet and therefore "Not connected" is shown.

Have you configured the serial interface as described in the installation instructions?
https://phoscon.de/en/raspbee/install#docker

@FezVrasta

This comment has been minimized.

@manup
Copy link
Member

manup commented Aug 18, 2019

I don't know about DietPi but the serial port should not be used for any system logging, as Raspbian does it per default. Does DietPi even provide the /dev/ttyAMA0 interface?

@manup
Copy link
Member

manup commented Aug 18, 2019

As a side note on Raspbian when the serial interface is configured properly /dev/ttyS0 is used instead of /dev/ttyAMA0.

@FezVrasta

This comment has been minimized.

@manup
Copy link
Member

manup commented Aug 18, 2019

this is what I see, so I think the ttyAMA0 and ttyS0 are okay

Not if the interface is still shared with the login shell, but I don't know if it is the case here. On Raspbian it needs to be explicitly disabled.

What is the output of ls -l /dev/ttyAMA0?

@FezVrasta

This comment has been minimized.

@manup
Copy link
Member

manup commented Aug 18, 2019

That's interesting :)
So unless you are running deCONZ as root it can't work.

You need to place your user into the tty group and give the /dev/ttyAMA0 group rw rights.

sudo gpasswd -a $USER tty
sudo chmod g+r /dev/ttyAMA0

Reboot afterwards. Still if the device is shared with the login shell it won't work.

@FezVrasta

This comment has been minimized.

@manup
Copy link
Member

manup commented Aug 18, 2019

I'm running everything as root since I'm using Docker to run the various services.

How do you start the container? Docker doesn't require to be run as root.

I was reading this issue, is shell and console the same thing?
MichaIng/DietPi#343

I guess so, following looks interesting:
MichaIng/DietPi#343 (comment)

@FezVrasta

This comment has been minimized.

@FezVrasta

This comment has been minimized.

@manup
Copy link
Member

manup commented Aug 18, 2019

It seems that the serial communication doesn't work. My guess is the above mentioned issue.
You can also check which programs are accessing the device:

sudo lsof /dev/ttyAMA0

Perhaps try to use /dev/ttyS0 as alternative.

@FezVrasta

This comment has been minimized.

@manup
Copy link
Member

manup commented Aug 18, 2019

https://linux.die.net/man/8/hciattach

hciattach is related to the bluetooth service.

I'm starting to think it may be easier to use Raspbian 🙄

I think it will work on DietPi but the setup requires extra steps which need to be figured out.

@FezVrasta

This comment has been minimized.

@manup
Copy link
Member

manup commented Aug 18, 2019

Bluetooth can be enabled, but it needs to be configured to use another serial interface.

@FezVrasta

This comment has been minimized.

@manup
Copy link
Member

manup commented Aug 18, 2019

Note you need to run lsof with sudo.

@FezVrasta

This comment has been minimized.

@FezVrasta

This comment has been minimized.

@FezVrasta
Copy link
Author

FezVrasta commented Aug 18, 2019

Oh dammit, I figured out I had a typo in the volume...

#1757 (comment)

It should have been:

- ./services/deconz/data/config:/root/.local/share/dresden-elektronik/deCONZ

Now it shows the firmware correctly, but still I can't restore the backup with that 503 error I reported above...

image

@FezVrasta
Copy link
Author

Don't ask me how, but the configuration now appeared in the web app... 🤷‍♂️

@FezVrasta
Copy link
Author

FezVrasta commented Aug 18, 2019

I restarted Docker and I lost all the configuration 🙄 I don't yet know if it's my fault, but the backup import is now again not working properly.

edit: I don't think it's my fault, because the /opt/docker-compose/services/deconz/data/config folder has some files in it, so the configuration should persist across restarts.

@FezVrasta FezVrasta reopened this Aug 18, 2019
@manup
Copy link
Member

manup commented Aug 19, 2019

I restarted Docker and I lost all the configuration

How do you see all configuration is lost, are there no devices shown anymore?

Are you sure that the volume configuration is correct?
Your docker-compose configuration says:

 deconz:
    image: marthoc/deconz
    container_name: deconz
    restart: unless-stopped
    network_mode: host
    environment:
      - DECONZ_WEB_PORT=8080
      - TZ=Europe/Budapest
      - DECONZ_UPNP=0
    devices:
      - /dev/ttyAMA0
    volumes:
      - ./services/deconz/data/config:/root/.local/share/dresden-elektronic/deCONZ

Shouldn't that be /opt/docker-compose/services/deconz/data/config:/root/.local/share/dresden-elektronic/deCONZ?

@FezVrasta
Copy link
Author

No, the volumes directive is correct, in fact I see files being written in the folder (I use the same format for all my containers).

I haven't restarted again, once I'll do so I'll see if it gets reset again.

Anyways, I'd keep this issue focused on the backup import feature which doesn't seem to work reliably. Is that okay to you?

@FezVrasta
Copy link
Author

I restarted the container and the config didn't get lost. So the only issue is the import backup feature.

@stale
Copy link

stale bot commented Dec 17, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants