1activegeek / docker-airconnect

AirConnect container for turning Chromecast into Airplay targets
228 stars 27 forks source link

Can't use AIRCAST_VAR #24

Closed hipstersmoothie closed 2 years ago

hipstersmoothie commented 3 years ago

Hey! Thanks for the container.

I'm having trouble passing any options to airconnect using the AIRCAST_VAR variable.

Here is what my docker-compose config looks like. originally I was trying to us -x but switched to -d to try to debug.

version: '2'
services:
  airconnect:
    image: 1activegeek/airconnect:latest
    container_name: airconnect
    restart: always
    network_mode: host
    environment:
      - AIRCAST_VAR='-d all=debug'

Anytime I run docker-compose up airconnect (to debug) and have AIRCAST_VAR set to any of the flags I get the following output.

airconnect    | 2021-06-20 00:07:33,927 CRIT Supervisor running as root (no user in config file)
airconnect    | 2021-06-20 00:07:33,929 INFO supervisord started with pid 287
airconnect    | 2021-06-20 00:07:34,932 INFO spawned: 'airupnp-x86-64' with pid 293
airconnect    | 2021-06-20 00:07:34,934 INFO spawned: 'aircast-x86-64' with pid 294
airconnect    | 2021-06-20 00:07:34,940 INFO exited: aircast-x86-64 (exit status 1; not expected)
airconnect    | 2021-06-20 00:07:36,048 INFO success: airupnp-x86-64 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
airconnect    | 2021-06-20 00:07:36,050 INFO spawned: 'aircast-x86-64' with pid 308
airconnect    | 2021-06-20 00:07:36,056 INFO exited: aircast-x86-64 (exit status 1; not expected)
airconnect    | 2021-06-20 00:07:38,059 INFO spawned: 'aircast-x86-64' with pid 309
airconnect    | 2021-06-20 00:07:38,065 INFO exited: aircast-x86-64 (exit status 1; not expected)

Without using AIRCAT_VAR this is what I see

airconnect    | 2021-06-20 00:05:48,461 CRIT Supervisor running as root (no user in config file)
airconnect    | 2021-06-20 00:05:48,463 INFO supervisord started with pid 289
airconnect    | 2021-06-20 00:05:49,466 INFO spawned: 'airupnp-x86-64' with pid 293
airconnect    | 2021-06-20 00:05:49,468 INFO spawned: 'aircast-x86-64' with pid 294
airconnect    | 2021-06-20 00:05:50,594 INFO success: airupnp-x86-64 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
airconnect    | 2021-06-20 00:05:50,595 INFO success: aircast-x86-64 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

Everything runs fine if I docker exec into the container and run it normally.

NOTE: While I may be a dev with a decade of experience, I have <2 days of docker experience.

hipstersmoothie commented 3 years ago

More Context: Seems to only error out when I provide a file path?

Here I try what I saw in other issue in this repo and have the config files outside of the container.

CleanShot 2021-06-19 at 17 16 43@2x
services:
  airconnect:
    image: 1activegeek/airconnect:latest
    container_name: airconnect
    restart: always
    network_mode: host
    environment:
      - AIRCAST_VAR='-x /config/airconnect.xml'
    volumes:
      - /home/andrew/config:/config
hipstersmoothie commented 3 years ago

And you can see here it runs fine when running in the container manually

CleanShot 2021-06-19 at 17 18 59@2x
1activegeek commented 3 years ago

Interesting. Thanks for the ☕ BTW! My first 2 guesses would be permissions and/or formatting in the compose file. Just for giggles, can you try using a raw Docker command vs the compose and see if it has the same issues? So just drop into the term and use: docker run -d -e AIRCAST_VAR="-x /config/airconnect.xml" --net=host 1activegeek/airconnect and see what you come up with. I'll try and re-create on my own in the next day or so.

1activegeek commented 3 years ago

Oh and also, if you can - upload what you have in the airconnect.xml file (bleep out anything sensitive if necessary) and snap a quick view of the permissions in the folder its running from. Based on it having worked from inside the container tells me it shouldn't be the config, and it shouldn't be permissions. But permissions can still be a little whacky in docker and something else could be at play fixing the perms once the container launches vs prior to where the compose is erroring in its execution.

hipstersmoothie commented 3 years ago

So I ran this:

sudo docker run -d -e AIRCAST_VAR="-x /config/airconnect.xml" --net=host -v '/home/andrew/config':'/config' 1activegeek/airconnect

and it worked. But running docker-compose up airconnect I still get the same issue.

I don't really think it's the config file at this point but here is mine:

config ``` 1 0 0.5000 0 flc 1 1 info info warn -1 32 0:0 ? fff26e1911ec5943bab3894a95f3e96f Geek hau5 TV cc:cc:cc:f4:8d:21 1 49e9921c248127a4113cf0eb7674ece9 STR-DN1080 1CF324+ cc:cc:4f:35:f2:b5 0 54e732485cc8db228cb0da9e16200454 Master Bathroom Speaker cc:cc:de:db:81:eb 1 d7866ed77f81dd0165feffa9da9e9928 Garage TV cc:cc:0e:18:ff:b2 1 ```

Here are the permissions for the config folder:

CleanShot 2021-06-20 at 10 53 50@2x
1activegeek commented 3 years ago

Ok, so if it worked using the raw socket run command, then it's likely something to do with the compose file. Have you tried using " instead of ' for the variable?

EDIT: On second thought, try it with no quotes at all as well. I'm forgetting how this went, but I think the YAML was ok with spaces and such, as long as you don't put a new line char in there it should be fine. I just references some other compose file I have with ENV variables and I have NO quotes around them

1activegeek commented 3 years ago

Hey just checking in - any luck here? I should be able to make a mock up enviro to test on my own on Thur. Been a bit tied up with a training at work. Ends Thur, but I'll have more time overall as well. Let me know if it's still showing up with an issue.

1activegeek commented 3 years ago

@hipstersmoothie were you able to try the suggestion above? And/or did you get it working? I hadn't gotten a chance to check it out myself. If don't hear back by weekend, I'll close this out. You can always come back and re-open I believe if you're able to test further.

1activegeek commented 2 years ago

Closing due to stale status.

martinbrose commented 2 years ago

Just ran into the same problem and the solution is to put the whole environment statement into quotes, like below:

services:
  airconnect:
    container_name: airconnect
    image: "1activegeek/airconnect"
    restart: unless-stopped
    privileged: true
    network_mode: host
    volumes:
      - ./config:/config/airconnect
    environment:
      - "AIRCAST_VAR=-x /config/airconnect/aircast.xml"
      - "AIRUPNP_VAR=-x /config/airconnect/airupnp.xml"