Closed Final-Hawk closed 3 years ago
Interesting idea. I think that would work really well
Currently it uses /project/config https://github.com/delfick/photons/blob/main/apps/interactor/docker/harpoon.yml#L20
Is /data something you have control over? Also why does the working directory matter?
Once you have something working it should be easy to put it in Photons itself
On Mon, 21 Jun 2021, 9:01 pm Joshua, @.***> wrote:
Hi! I am trying looking to change the working directory of the docker image. I am wanting to do this so i can create a home assistant addon that just runs interactor.
I have gotten the base working and it works very well, but i cannot seem to figure out how to change the working directory to /data instead of /project (I think thats what i want). This is so i can save stuff to the database without it clearing on a reboot. Heres the docs for creating an addon if your interested .https://developers.home-assistant.io/docs/add-ons
A benefit of installing it though home assistant is well is if i can get the database working, i can easily create backups of it.
Thanks for the program!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/delfick/photons/issues/62, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2V5OV7PP5NO37V3JAZELTT4LYRANCNFSM47BK7EVA .
Cool. The reason my I thought /data would work is since it's labeled as
/data is a volume for persistent storage
I got that from here.
There is also a map function that also might work for this.
List of maps for additional Home Assistant folders. Possible values: config, ssl, addons, backup, share or media. Defaults to ro, which you can change by adding :rw to the end of the name.
This is my first try with homeassistnt addons so I would guess /data would work as it says, but I am not totally certain.
so what do you have so far?
you can just make another WORKDIR entry in your docker file
Also, ENV LIFX_CONFIG=/data/interactor.yml
will make it so that it gets configuration from /data/interactor.yml
This is what i have at the moment. https://github.com/Final-Hawk/homeassistant-photons-addon
As you suggested i tried the lifx config environment variable. I have also tried the work directory ones previously but annoyingly they didn't work either.
Your bigger problem is your docker file doesn't do anything :)
Yup. Thats what i am trying to figure out whats going on as well
hint: every docker file has a FROM line
Anyway, sleep time for me. goodnight!
On Mon, 21 Jun 2021, 10:56 pm Joshua, @.***> wrote:
Yup. Thats what i am trying to figure out whats going on as well
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/delfick/photons/issues/62#issuecomment-865009996, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2V5OEPRYSGGWCUVUZKBDTT4ZIPANCNFSM47BK7EVA .
I have managed to get the dockerfile partly working. It runs. However i need to either merge it into here, or somehow change the docker build context. This is because its trying to copy /modules and /apps which dont exist in my repo. Maybe git clone may work.
You can use the existing image as a FROM in your image for now and then everything will be available to you.
when you get something working then we can make the real image usable as a home assistant addon by itself.
On Tue, 22 Jun 2021, 7:37 am Joshua, @.***> wrote:
I have managed to get the dockerfile partly working. It runs. However i need to either merge it into here, or somehow change the docker build context. This is because its trying to copy /modules and /apps which dont exist in my repo. Maybe git clone may work.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/delfick/photons/issues/62#issuecomment-865362092, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2V5OPMHWP2D5A3Y7AJWLTT6WLHANCNFSM47BK7EVA .
I think your docker file just needs to be
FROM delfick/lifx-photons-interactor:0.8.5
WORKDIR /data
And it should just work. You don't want all of photons interactor to be in /data
Thanks! Just tried that and it works a charm!
Heres the repo https://github.com/Final-Hawk/homeassistant-photons-addon
@Djelibeybi do you have strong opinions on me making a new version of interactor that just changes the working dir in the container to /data?
@delfick I would consider that a breaking change. I currently mount a host directory to /project/config
inside the container. If the WORKDIR
changes, so do my containers.
IMO, it would be better to build the Photons add-on for Hass.io using the Hass.io base image.
@Final-Hawk your Dockerfile
is missing the required LABEL
definitions: https://developers.home-assistant.io/docs/add-ons/configuration/#add-on-dockerfile
Yeah, I agree it's a breaking change (the assessment is over likelihood of many people using current image :p) Should be easy though to have a separate docker image based on hass.io image that does the same thing and publish both when I make photons images. Would it need to be built for the same number of platforms?
I don't think changing the work directory is necessary. It might break more things than it adds for people, and changing it via the dockerfile isn't too difficult. I don't have too much experience with docker so take that with a grain of salt though. So far my running instance of photons through the addon is working great, and the database is saving correctly.
Thanks for letting me know about the labels as well Djelibeybi, I'll fix that up later.
Would it need to be built for the same number of platforms?
From my (very brief) review of the Hass.io add-ons, it looks like their build system does this, using the layout and structure documented for an add-on. I think it's a good idea, but it's not a case of "docker image and done".
I don't think changing the work directory is necessary
changing it means the default place the database goes is /data
changing it means the default place the database goes is /data
I know i opened the issue to do this, but now that we have managed to change the work directory i don't think it is necessary anymore. This is more just so it doesn't break peoples existing databases. I don't care either way though.
my limited understanding is that's the directory homeassistant mounts.
so unless you can get homeassistant to use /project/config, then you'd have to use /data to get persistence for config and database
On Tue, 22 Jun 2021, 1:28 pm Joshua, @.***> wrote:
changing it means the default place the database goes is /data
I know i opened the issue to do this, but now that we have managed to change the work directory i don't think it is necessary anymore. This is more just so it doesn't break peoples existing databases. I don't care either way though.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/delfick/photons/issues/62#issuecomment-865499917, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2V5LYUWHPACF5UHA4KVTTT77NLANCNFSM47BK7EVA .
Is there an icon i should use for the interactor @delfick? With no icon set it defaults to a puzzle piece.
I have zero icon making skillz, so nope
All good, me too. It was more just in case you had one that i didn't see.
Found this basic icon on google. I think it looks pretty good.
and when its stopped
Seems good enough :)
Note that once you have something that works, I'll want to put it in here before we distribute it to people.
Double-check that the image you found is not covered by copyright or a limited-use license. :)
Double-check that the image you found is not covered by copyright or a limited-use license. :)
I actually found an awesome icon but couldn't use it due to copyright, this one is free as long as you reference it, so i just put it at the bottom of the readme.
Note that once you have something that works, I'll want to put it in here before we distribute it to people.
Its seems to all working, database saves successfully and i have transferred over to using it personally for testing and so Home assistant can keep backups of its database. Have a look https://github.com/Final-Hawk/homeassistant-photons-addon
I did remember to add labels to the dockerfile like Djelibeybi pointed out. Just hope i did it correctly.
So how do you make home assistant aware of an addon? can you specify a folder in a github repo or does it have to be the root of the repo?
To add the addon just add the repo to the repo list in homeassistant. See pic below After the repo is added, it shows up in the list of addons so you can install it. You can keep all the config files in a folder, like i have, but a file called repositry.json needs to be in the root. See here
I made https://hub.docker.com/r/delfick/lifx-photons-interactor-homeassistant using https://github.com/delfick/photons/commit/a042673253422cbe09b55e5351dd3c1d8b683c6d
and made https://github.com/delfick/photons-homeassistant
If that works I'll merge that branch into main and add a page to docs with suggestions on how to use as per what I didn't copy from your repo.
Awesome. Thanks for doing this!
Hi! I am trying looking to change the working directory of the docker image. I am wanting to do this so i can create a home assistant addon that just runs interactor.
I have gotten the base working and it works very well, but i cannot seem to figure out how to change the working directory to /data instead of /project (I think thats what i want). This is so i can save stuff to the database without it clearing on a reboot. Heres the docs for creating an addon if your interested .https://developers.home-assistant.io/docs/add-ons
A benefit of installing it though home assistant is well is if i can get the database working, i can easily create backups of it.
Thanks for the program!