qascade / yast

Yet Another Streaming Tool
BSD 3-Clause "New" or "Revised" License
33 stars 10 forks source link

wsl support for yast #51

Closed qascade closed 2 years ago

qascade commented 2 years ago

Description

yast currently only supports Unix environments. We need to test whether it is possible to install and run yast on WSL (Windows SubSystem for Linux) or not. If not? Is there a way to fix it? Do we need to make some changes to the code or provide additional documentation instructions for the different environments? This issue was brought to notice by @notafk-rajat in #28

Are you raising this issue under hacktoberfest?

Yes, I'm raising this issue under hacktoberfest 2022. This is a beginner issue, should only require small code changes and some documentation changes.

git-pixel22 commented 2 years ago

I have WSL installed, will check this in the morning tomorrow for sure and let you know what I observe, as I don't have college tomorrow. : )

git-pixel22 commented 2 years ago

Hey, @qascade I am working on this today, already made some progress but there are still some blocks, trying to clear them right now. You can assign this issue to me if you want.

git-pixel22 commented 2 years ago

Okay, so the things I have figured out till now :

  1. Firstly user has to update their WSL version to the latest one.
  2. Remove the already installed node.js cause we need to install it again using nvm.
  3. Install cURL(a tool used for downloading content from the internet in the command line)
  4. Install the latest nvm version using cURL
  5. Using nvm install node and npm.
  6. Finally install golang for WSL, windows one won't work here.
  7. We need to correctly set GOROOT, GOPATH, and PATH. (I'm stuck here atm)

Currently on doing go build ./... we will get errors like cannot find package "github.com/qascade/yast/cmd" in any of: /usr/src/github.com/qascade/yast/cmd (from $GOROOT) /home/rajat/go/src/github.com/qascade/yast/cmd (from $GOPATH)

The reason for this could be the way we are importing files in the code or we need to set up GOPATH differently.

Also in between of some the above-mentioned steps, we need to close the terminal(WSL) and open it again to see the changes.

I would try to go more in-depth maybe later in the day today if possible.

qascade commented 2 years ago

@notafk-rajat looks good. Keep going.

git-pixel22 commented 2 years ago

Hey @qascade, I feel stuck on this issue.

If I try on an IDE on windows ./yast --help gives an error like The term './yast' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

And if I try to do it via WSL, I can't even do go build I get the previously mentioned error ( this one - https://github.com/qascade/yast/issues/51#issuecomment-1268043866)

Can you guide me to some resources to fix this? I have already tried stack overflow and some random blogs.

qascade commented 2 years ago

On ide you are probably using windows cmd prompt. Check if yast is in the present working dir you are in the cmd prompt. As for WSL. Try building a simple Hello World program. If that is building then yast should not be a problem. If you are not able to build, then try tutorials on setting up Go environment in WSL.

git-pixel22 commented 2 years ago

Okay, I'll try this on WSL today, but something came to my mind last night. DOCKER !! Wouldn't using docker solve our problem of setting up Yast on different machines?

qascade commented 2 years ago

Yes, we can containerize yast. We will need two containers. 1 container packed with yast code and WebTorrent cli and second one be vlc. We will connect them using docker swarm or using a custom script somehow. One way is to put both containers on same volume, so that as WebTorrent downloads the movie, vlc is able to access it.

git-pixel22 commented 2 years ago

Yep If we can do that, we wouldn't have to worry about on what OS yast will be running and I think this will solve all three current issues of Wsl, Windows, and Linux.

qascade commented 2 years ago

I'll add a separate issue for that. What's the progress for current issue?

git-pixel22 commented 2 years ago

To be honest, I have no idea what I am doing right now. I did a lot of stuff, followed many blogs and tutorials, and reinstalled go many times, but now I'm not able to install even go at the moment. I have downloaded the zipped file but for some reason, it's not opening.

Before all this mishap I did create a HelloWorld program in go, it worked fine I was able to build and run it. But can't do the same for yast. On go build I get a previous error https://github.com/qascade/yast/issues/51#issuecomment-1268043866, I think the problem for sure is something with GOPATH and GOROOT cause I did notice when I tried to change them with the export command they remained the same.

git-pixel22 commented 2 years ago

I reinstalled Ubuntu and this worked https://github.com/qascade/yast/issues/52#issuecomment-1272352313.

I feel so bad, did so much stuff and all I had to do was to do go build instead of go build ./....

Everything works fine, it even says the stream is starting but nothing is showing on the screen. I selected vlc as the default player.

Screenshot 2022-10-11 124623

The above streaming thing worked once only, now on a search I'm receiving this error. I'll figure out now what this is and how it can be fixed.

image 3

I think the issue here is the same as #28, is it? @qascade

qascade commented 2 years ago

Use VPN, the panic will go away

qascade commented 2 years ago

I think it's better to update the docs as well. Just change go build ./... to go build

git-pixel22 commented 2 years ago

I think a PR is created for it already. And I did use the VPN, the one mentioned in doc. Also, the VPN is working fine, I used it to surf some websites that are not accessible without it.

git-pixel22 commented 2 years ago

Alright, I got the issue now with WSL, don't why but it is not using the VPN service because I'm doing the same stuff on windows PowerShell and I'm able to search there again and again without any issue.

qascade commented 2 years ago

Install cloudflare inside wsl and connect it using command line. wsl is most probably on a bridged network rather than a NAT network, so the requests generated by wsl won't be tunnelled through VPN enabled in windows.

git-pixel22 commented 2 years ago

@qascade seems like Cloudflare warp does not have wsl2 support yet.

Reference - https://community.cloudflare.com/t/warp-support-for-wsl2/382388

Maybe I'll need to find some other VPN for wsl2.

qascade commented 2 years ago

Ohh that's a bummer. Try openVPN. If that also doesn't work, just add a line that WSL2 will not be able to get yast support until we add targets that don't need a VPN.

git-pixel22 commented 2 years ago

Alright, I'll look into it in a while and let you know. Let's fix this issue today.

git-pixel22 commented 2 years ago

Okay so after researching for a while I came to know that WSL2 currently does not support VPN stuff. So to use a VPN user has to downgrade to WSL1 which might not be logical.

Also, there are some workarounds mentioned by people online, like configuring the VPN and Network settings in a way that works for WSL2 but there is no surety of them working, and were quite complex for someone like me.

Reference - https://superuser.com/questions/1715764/wsl2-has-no-connectivity-when-windows-is-connected-to-vpn

So I guess adding a point for WSL users in the note section would be better for now. We can work on the windows issue after this cause it might be better to run yast directly on windows without even going through WSL.

git-pixel22 commented 2 years ago

@qascade, Let me know if you're okay with it, if yes I'll make a PR adding a point for this in the note section.

qascade commented 2 years ago

Sure, thanks for your input and efforts. I don't think we should put that much effort into this. Nobody would like to do this much hassle just to get yast setup on wsl. It's better to add windows support. But what I feel is this might only be possible if we use terminal because I don't know if bubbletea will be able to render models on powershell. Last option is to give docker image as you suggested earlier.

git-pixel22 commented 2 years ago

Yep totally agree. So where do you plan to go from here? Try to bring windows support for yast or go with docker images. According to that, I'll add a point in the note section of the readme file.

I personally think it would be better if we do the docker thing.

qascade commented 2 years ago

Let's just mention that wsl will not be supported by yast due to reasons mentioned above. Let's just raise a PR here and close this issue. Let's try to create a docker image under the windows support issue.