mairlist / streammonitor

An Icecast/Shoutcast stream monitor and silence detector
30 stars 15 forks source link

Unable to use CURL/LAME #5

Closed Chris-The-Tuner closed 8 months ago

Chris-The-Tuner commented 8 months ago

Hi Torben, i tried and tried but i can't seem to fix the issue i have with your coffe script.

Since the script tries to run curl and lame like that: /bin/sh -c curl -s http://10.0.0.80:8000/pgm | lame --quiet --mp3input -

This is not working i get an error from curl: curl: try 'curl --help' or 'curl --manual' for more information

If it set the part behind -c in " like that: /bin/sh -c "curl -s http://10.0.0.80:8000/pgm | lame --quiet --mp3input -"

it works (at least in my Terminal. But with the Script i'm unable to get it to work. My JS Skills (or better coffe skills) are non-existent and i'm screaming for a fix for that one since every dependency is installes, the command outside of the Docker Container works without any issuse but the container barfs:

Stream monitor for http://10.0.0.80:8000/pgm started on port 8000 Process started, pid=14 Process exited with code 127 Process started, pid=17 Process exited with code 127 Process started, pid=20 Process exited with code 127 Process started, pid=23 Process exited with code 127 etc. etc.....

tweibert commented 8 months ago

Hi,

I must admit that I haven't worked on (or used) this piece of software in years. Just did quick test, built the container and started it with the parameters from the README:

docker build -t mairlist/streammonitor .
docker run -p 8000:8000 -e STREAM_URL=http://sender.eldoradio.de:8000/192 \
                        -e SILENCE_THRESHOLD=-20 -e CHECK_INTERVAL=1000 \
                        mairlist/streammonitor

This works for me. No errors or such. Can you try that first?

Chris-The-Tuner commented 8 months ago

Hi Torben, i know since this is quite a Stale Repo.

I did install right as shown, sadly i run into this issue. I had it running on different Hardware just 2 Days ago but the Server bit the dust hence the switch to newer Hardware. Running still under Debian (now V12 Bookworm). I get the feeling this Issue may be caused by Proxmox (the new Server is just a Container running on one Host, the Old one was in a pure VM) Trying to compile it with coffee -c app.coffee leads to a JS file node will not run (require coffefile fails).

If you know an easy way to use this Software without docker (i'm really no good with docker) this could help debug this issue for me.

tweibert commented 8 months ago

Look at the script - it expects all configuration (STREAM_URL etc.) to be passed via the environment:

streamUrl = process.env.STREAM_URL
silenceThreshold = process.env.SILENCE_THRESHOLD or -20
httpPort = process.env.HTTP_PORT or 8000
checkInterval = process.env.CHECK_INTERVAL or 1000

So you if you want to run it without docker, you must set at least STREAM_URL as environment variable before doing so.

Chris-The-Tuner commented 8 months ago

I tried and still the error was still there.

Sadly trying to build this Docker image results in:

The command '/bin/sh -c npm -g --production install coffeescript && apk --no-cache add lame curl && rm -rf /tmp/ /var/cache/apk/' returned a non-zero code: 1

I did run these commands by hand on the System so everything is installed correctly lame and curl are there and working.

I did remove the RUN command from Dockerfile (just so if finishes to build) but still no luck :(

tweibert commented 8 months ago

It doesn't matter of the dependencies are installed on your host system - the important thing ist, they must be installed in the container. This is done by the Dockerfile.

For me, it builds just fine:

tw@twmini:~/projects/streammonitor$ docker build -t mairlist/streammonitor .
[+] Building 13.0s (10/10) FINISHED                                                                              docker:desktop-linux
 => [internal] load .dockerignore                                                                                                0.0s
 => => transferring context: 57B                                                                                                 0.0s
 => [internal] load build definition from Dockerfile                                                                             0.0s
 => => transferring dockerfile: 316B                                                                                             0.0s
 => [internal] load metadata for docker.io/library/node:14-alpine                                                                1.9s
 => [1/5] FROM docker.io/library/node:14-alpine@sha256:434215b487a329c9e867202ff89e704d3a75e554822e07f3e0c0f9e606121b33          4.5s
 => => resolve docker.io/library/node:14-alpine@sha256:434215b487a329c9e867202ff89e704d3a75e554822e07f3e0c0f9e606121b33          0.0s
 => => sha256:434215b487a329c9e867202ff89e704d3a75e554822e07f3e0c0f9e606121b33 1.43kB / 1.43kB                                   0.0s
 => => sha256:4e84c956cd276af9ed14a8b2939a734364c2b0042485e90e1b97175e73dfd548 1.16kB / 1.16kB                                   0.0s
 => => sha256:0dac3dc27b1ad570e6c3a7f7cd29e88e7130ff0cad31b2ec5a0f222fbe971bdb 6.44kB / 6.44kB                                   0.0s
 => => sha256:f56be85fc22e46face30e2c3de3f7fe7c15f8fd7c4e5add29d7f64b87abdaa09 3.37MB / 3.37MB                                   0.4s
 => => sha256:8f665685b215c7daf9164545f1bbdd74d800af77d0d267db31fe0345c0c8fb8b 37.17MB / 37.17MB                                 1.1s
 => => sha256:e5fca6c395a62ec277102af9e5283f6edb43b3e4f20f798e3ce7e425be226ba6 2.37MB / 2.37MB                                   0.5s
 => => extracting sha256:f56be85fc22e46face30e2c3de3f7fe7c15f8fd7c4e5add29d7f64b87abdaa09                                        0.1s
 => => sha256:561cb69653d56a9725be56e02128e4e96fb434a8b4b4decf2bdeb479a225feaf 448B / 448B                                       0.6s
 => => extracting sha256:8f665685b215c7daf9164545f1bbdd74d800af77d0d267db31fe0345c0c8fb8b                                        3.1s
 => => extracting sha256:e5fca6c395a62ec277102af9e5283f6edb43b3e4f20f798e3ce7e425be226ba6                                        0.1s
 => => extracting sha256:561cb69653d56a9725be56e02128e4e96fb434a8b4b4decf2bdeb479a225feaf                                        0.0s
 => [internal] load build context                                                                                                0.0s
 => => transferring context: 3.25kB                                                                                              0.0s
 => [2/5] RUN npm -g --production install coffeescript &&     apk --no-cache add lame curl &&     rm -rf /tmp/* /var/cache/apk/  2.7s
 => [3/5] WORKDIR /app                                                                                                           0.0s
 => [4/5] ADD app /app                                                                                                           0.0s
 => [5/5] RUN npm install                                                                                                        3.6s
 => exporting to image                                                                                                           0.1s 
 => => exporting layers                                                                                                          0.1s 
 => => writing image sha256:10d1804f66917accd1bdaf719b2cb5683980bbde8ffdaaf958cd01fa660a5262                                     0.0s 
 => => naming to docker.io/mairlist/streammonitor                                                                                0.0s 

Make sure there is no "garbage" in the app directory that might accidentally be included in the build. Running

git reset --hard
git clean -f

might be a good idea.

Chris-The-Tuner commented 8 months ago

I tried, removed everything and cloned the repo again and just tried to build with the result being the error above.

Seems to be a Problem with Docker using /bin/sh in an LXC Container. Does not work sadly. I wish i had a way to use your coffee app without docker, this should fix the Problem but i'm wayyyy to bad at JS for this.

Chris-The-Tuner commented 8 months ago

Well look at that, i got it working ! I modified app.coffe to give it a different Port (since 8000 is used by Icecast2 already) and gave it the StreamURL within the script. Works without issues now without Docker.