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

[Bug fix] - Fix docker #61

Merged
merged 6 commits into from
Mar 23, 2023
Merged

[Bug fix] - Fix docker #61

merged 6 commits into from
Mar 23, 2023

Conversation

jenslys
Copy link
Owner

@jenslys jenslys commented Mar 21, 2023

Fixes #55

I am very new to Docker, so these changes might be bad practice and very hacky, but I seem to have gotten it working.

Changes made:

  • Check if /.dockerenv exists, if so that means the script is running inside Docker (Docker creates a .dockerenv file at the root of the directory tree inside container)
    • if it is detected as inside docker it will set the STREAMER_NAME variable when running the docker run command: (docker run -d autovod streamerNameHere)
    • else if will use the fetchArgs func
  • Added curl to depdencies
  • Bump Alpine version
  • Bump youtubeuploader version
  • Fix stream state detection by checking if the fetched API result is "inital_title" and not just null

Tested console output

2023-03-21 15:08:20 | Docker detected
2023-03-21 15:08:20 | Selected streamer: xqc
2023-03-21 15:08:20 | Found config file
2023-03-21 15:08:20 | Starting AutoVOD
2023-03-21 15:08:20 | Loading xqc.config
2023-03-21 15:08:20 |
2023-03-21 15:08:20 | Trying to fetch stream metadata
2023-03-21 15:08:21 | Stream seems offline, not able to fetch metadata.
2023-03-21 15:08:21 |
2023-03-21 15:08:21 | Checking twitch.tv/xqc for a stream
2023-03-21 15:08:23 | Trying again in 1 minute
2023-03-21 15:08:23 | error: No playable streams found on this URL: twitch.tv/xqc

@jenslys jenslys added type: documentation Improvements or additions to documentation type: enhancement New feature help wanted Extra attention is needed labels Mar 21, 2023
@jenslys jenslys marked this pull request as ready for review March 21, 2023 15:23
@jenslys jenslys changed the title Fix docker [Bug fix] - Fix docker Mar 21, 2023
@totallyparity
Copy link

totallyparity commented Mar 23, 2023

Hey, It's Parity. I tried to verify if the script works for a while: I could definitely say that the answer is yes, but with a little bit of changes needed. Apologies for late response as well.

0|cohhcarn | 21:07:53| Docker not detected
0|cohhcarn | 21:07:53| Selected streamer: cohhcarnage
0|cohhcarn | 21:07:53| Found config file
0|cohhcarn | 21:07:53| Starting AutoVOD
0|cohhcarn | 21:07:53| Loading cohhcarnage.config
0|cohhcarn | 
0|cohhcarn | 21:07:53| Trying to fetch stream metadata
0|cohhcarn | 21:07:55| Stream is online!
0|cohhcarn | 21:07:55| Current Title: !Store is now OPEN - Game news & trailers then we'll see what's next! - !LEThoughts (Last Epoch) / !D4Thoughts / !GameStore / !MobileApp
0|cohhcarn | 21:07:55| Current Game: Just Chatting
0|cohhcarn | 
0|cohhcarn | 21:07:55| Checking twitch.tv/cohhcarnage for a stream
0|cohhcarn | 21:07:55| All required files found

Logs above is from running from Linux Mint(Ubuntu basically), x86_64. Script detected that /.dockerenv isn't present, so it's running properly.

12:13:28| Docker detected
12:13:28| Selected streamer: qbunnytv
12:13:28| Found config file
12:13:28| Starting AutoVOD
12:13:28| Loading qbunnytv.config
12:13:28| Trying to fetch stream metadata
12:13:32| Stream is online!
12:13:32| Current Title: Welcome all! Feed the BUNNIES, PIGGIES & FISHES with bits or channel points! (!how !status !socials !song)
12:13:32| Current Game: Animals, Aquariums, and Zoos
12:13:32| Checking twitch.tv/qbunnytv for a stream
12:13:32| All required files found

And logs above is from Docker, installed on Raspberry Pi 3B(ARM64). Script detected that /.dockerenv is present here.

One thing to note:

In Linux environment, everything is case-sensitive. Is Both and both same in Linux? No, apparently I discovered that's not the case because while jumbling around with config files, I discovered that if you want to use a config file named QBunnyTV.config for example:

cp default.config QBunnyTV.config
pm2 start AutoVOD.sh --name QBunnyTV

Letter case from name of the config file must be exactly the same until the very last step so that the script detects the config file properly or else script would stop working. Same goes for Docker installation as well. Maybe add some detail on this in README.md ? (This is not really a problem if you're familiar with Linux, but who knows. Up to you.)

That's all from me for now. I will write further in case I discover something else.

AutoVOD.sh Outdated Show resolved Hide resolved
@jenslys
Copy link
Owner Author

jenslys commented Mar 23, 2023

@totallyparity I really appreciate the review 😄
I will try to figure out a better way of detecting docker and make the dockerfile better as it may not work on all systems or services, for example, docker running inside Kubernetes.

This is more of a hotfix for Docker

@jenslys jenslys merged commit fa513cb into master Mar 23, 2023
@jenslys jenslys deleted the fix/docker branch March 23, 2023 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed type: documentation Improvements or additions to documentation type: enhancement New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] - Docker target channel issue
2 participants