wouterdebie / locast2tuner

Locast to Emby/Plex/Channels server
https://wouterdebie.github.io/locast2tuner/
MIT License
52 stars 8 forks source link

Trouble with Docker on Windows 10 #29

Closed Croq360 closed 3 years ago

Croq360 commented 3 years ago

Followed the instructions in the README (changing $HOME to the %USERPROFILE% variable which is what it is in Windows). I got it into Docker fine, but when I try to run it, I get the following:

config selected = /app/config/config.ini
thread 'main' panicked at 'Username required', src/config.rs:70:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Could not load selected file Syntax

Note that I edited the config.ini that's in my .locast2tuner folder. Maybe it's not using that, based on the error message? Perhaps there's a config.ini somewhere else I need to be editing. Any ideas or tips?

eiddor commented 3 years ago

@Croq360 I suspect you'll have to Windowsify things a bit with Docker, starting with maybe not using a dot directory.

Are you using the docker run command or docker-compose?

It might also be a CR/LF issue.

Try these steps:

    volumes:
      - .:/app/config

Paying attention to spacing, since it's YAML.

I have a headless Windows box that I'll fire-up and test with here in a few minutes.

eiddor commented 3 years ago

Oh goody, finally a reason to install WSL2.

eiddor commented 3 years ago

Yeah, it's a CR/LF/newline/whatever issue. Grr.

Run dos2unix on your config file before you launch the container and you should be fine.

Croq360 commented 3 years ago

Ok, will give that a try. Running the exe directly and pointing to a config file that's like what was on locast2dvr works fine. I'll use my VS Code editor or notepad++ to save the config that I downloaded and edited with my info and put into .locast2tuner folder. Will report back on that.

eiddor commented 3 years ago

Yeah, that makes sense - The EXE is fine reading the ^Ms in the file put there by Windows, but the Docker version is technically running in Linux, so it chokes on them.

Either of those editors should be capable of saving in Unix format and stripping the CRs, so you should be ok. That's all dos2unix does.

I added a note to the documentation.

Croq360 commented 3 years ago

So I've tried checking the config.ini file, and it already has Unix end of lines (LF only). I even tried saving with DOS (CR/LF) and then back to Unix (LF) format. No good.

So, now I'm playing around with using WinSW to install it as a service. Whenever I'm running there though, I'm getting the following error: Child process 'locast2tuner (4368)' finished with code 101.

I have to do some more digging around I guess... :)

Croq360 commented 3 years ago

I changed the backslashes ("\") in the paths to forward slashes ("/") in the XML config for WinSW, and the service is running now.

eiddor commented 3 years ago

Wow, interesting - I had the exact issue as you did with "Could not load file syntax" and removing the CRs got rid of it. I did have to massage my docker-compose.yml file to adjust the volume location, too.

Glad you got it working! Might be worth documenting in README.md or for @wouterdebie to use for the Windows package.

Croq360 commented 3 years ago

Yeah, once the service runs for a while and I confirm everything is working okay, I'll share my configuration for the service along with notes/comments. One thing I want to try is to reboot the computer it's running on and make sure everything starts back up as it should.

wouterdebie commented 3 years ago

Great work! Just for my understanding, you are running a Linux Docker image on Windows?

In the case of a windows executable, I'd like to accompany that with making locast2tuner run as a service.

Croq360 commented 3 years ago

In my case, I was trying to use the Linux Docker image on Windows (which it should be able to do). I'm pretty sure when I did that with locast2plex, it ran in a Linux container.

Regarding the Windows executable/service, for Windows users, I can put together some documentation on getting locast2tuner executable running as a service using WinSW (https://github.com/winsw/winsw). I'm using it instead of NSSM since I had some issues with NSSM and locast2dvr locking up after a while and being totally unresponsive after a time. I should know in a few days if it looks like WinSW will be the option to go with.

Croq360 commented 3 years ago

I think I see the problem. When I ran the Windows equivalent for the curl command, "curl -o %USERPROFILE%.locast2tuner\config.ini https://github.com/wouterdebie/locast2tuner/blob/main/assets/config.ini.example", it tacked on a TON of extra HTML tagging. When I look at the example file here, it just has the entries called out (like "username=abc"). When I look at my resulting config.ini file, it's nearly 1200 lines long, with the "config" stuff put into an html table like this:

<table class="highlight tab-size js-file-line-container" data-tab-size="8" data-paste-markdown-skip>
      <tr>
        <td id="L1" class="blob-num js-line-number" data-line-number="1"></td>
        <td id="LC1" class="blob-code blob-code-inner js-file-line"># Mandatory configuration</td>
      </tr>
      <tr>
        <td id="L2" class="blob-num js-line-number" data-line-number="2"></td>
        <td id="LC2" class="blob-code blob-code-inner js-file-line">username=&quot;my_locast@username&quot;</td>
      </tr>
      <tr>
        <td id="L3" class="blob-num js-line-number" data-line-number="3"></td>
        <td id="LC3" class="blob-code blob-code-inner js-file-line">password=&quot;very_secret_password&quot;</td>
      </tr>
      <tr>
        <td id="L4" class="blob-num js-line-number" data-line-number="4"></td>
        <td id="LC4" class="blob-code blob-code-inner js-file-line">
</td>
      </tr>
      <tr>
        <td id="L5" class="blob-num js-line-number" data-line-number="5"></td>
        <td id="LC5" class="blob-code blob-code-inner js-file-line"># Optional configuration</td>
      </tr>
      <!-- more table rows -->
</table>
wouterdebie commented 3 years ago

My bad.. the link should have been to the raw file, which I just fixed in commit c7f1d0a.

Croq360 commented 3 years ago

Awesome, thanks!