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

heroku deploy not working #6

Closed
omgbox opened this issue Sep 30, 2020 · 16 comments
Closed

heroku deploy not working #6

omgbox opened this issue Sep 30, 2020 · 16 comments
Labels
bug Something isn't working

Comments

@omgbox
Copy link

omgbox commented Sep 30, 2020

hi , i am trying to deploy to heroku, but it seems to show Application error, port is set on 80, if you can check what the problem is, because i have no idea :(

@omgbox
Copy link
Author

omgbox commented Sep 30, 2020

looks like this is the error,

npm ERR! Failed at the [email protected] start script.

maybe a compatible startup script would fix it.

@KiraLT
Copy link
Owner

KiraLT commented Oct 16, 2020

Hello,

According to heroku (the same thing is with Google App Engine), the app should start the port specified by the PORT environment variable (process.env.PORT).

I added PORT env variable support with the last commit - it should fix it. Please make sure that you don't overwrite the port in config.json file.

I also added the default NodeJs version in package JSON (check this).

Finally, I tested by deploying to Heroku. I created a new Heroku project with the name torrent-stream-server and executed the following in this git repo:

  1. heroku login
  2. heroku git:clone -a torrent-stream-server
  3. git push heroku master

And it successfully deployed to Heroku. If you have any more issues, please describe your deployment procedure.

P. S. I didn't use any Procfile and my config.json was empty

@KiraLT KiraLT added the question Further information is requested label Oct 16, 2020
@omgbox
Copy link
Author

omgbox commented Oct 16, 2020

I'm probably doing something wrong, was not able to test it

the steps i taken, created project called torrent-stream-server

next i did

git clone https://github.com/KiraLT/torrent-stream-server.git

cd torrent-stream-server , next i did ~/torrent-stream-server$ heroku git:clone -a torrent-stream-server

returned result,

fatal: destination path 'torrent-stream-server' already exists and is not an empty directory.

when i ls directory i can see all the files are there. not sure what the problem is. i also tried to deploy from heroku's Deployment method github method. it builds, but i do not see anything on the page.

@KiraLT
Copy link
Owner

KiraLT commented Oct 17, 2020

Regarding the first error, you are using the wrong command. You execute git:clone, but you need git:remote if you are already in a git repo! If you wish to use a clone, which clones repository from heroku, you will need to execute it in a clean directory, copy & commit files, and only then push (deploy).

I tested the following setup with a clean project named torrent-stream-server7:

  • git clone https://github.com/KiraLT/torrent-stream-server.git (this should be your fork URL)
  • cd torrent-stream-server/
  • heroku login
  • heroku git:remote -a torrent-stream-server7
  • git push heroku master

But it only works for you if you have to write access to this repo. So this only work in you is in your fork.

If you wish to deploy without a fork, you can clone git, reset, and add only heroku remote:

  • git clone https://github.com/KiraLT/torrent-stream-server.git
  • cd torrent-stream-server/
  • heroku login
  • rm -rf .git - remove all git files
  • git init - init clean git repo
  • heroku git:remote -a torrent-stream-server7
  • git push heroku master

Make sure you are working with a clean heroku project - delete the old one or create a new one.

Also, about GitHub deployment, if you are deploying your fork, make sure you have this commit. I see that you used 80 port, but Heroku may require a different port. Heroku passes the PORT environment variable, so you need to set the port according to this env variable.

@KiraLT KiraLT closed this as completed Oct 26, 2020
@pataquets
Copy link
Contributor

pataquets commented Oct 27, 2020

For the record, I've been able to deploy on Heroku without problems. Even I've not needed to write any Procfile.
However, as a warning everything I've added a magnet, everything looked to work OK, but soon thereafter I've received an automated mail from Heroku stating that my app has been suspended. I've even used a legit torrent magnet, but happens anyway.
I guess the cause to be either:

  • Some overzealous outgoing firewall, since it's not unlikely that they have set limitations in place to avoid misusing their resources for piracy.
  • The execution time for the process(es) exceeded some limit I'm unaware of.

Maybe it's some other limit or behaviour I still don't know but, since I've ruled out Heroku for hosting it anyway, I've not gone deeper.

@KiraLT
Copy link
Owner

KiraLT commented Oct 28, 2020

Well, it may be because of legal reasons. I found that Heroku scans code dependencies and we have a lot of "interesting" dependencies. I will reopen this issue cause Heroku deployment can be very helpful - I will need to investigate why Heroku block this app and how can we solve it.

@KiraLT KiraLT reopened this Oct 28, 2020
@KiraLT KiraLT added bug Something isn't working and removed question Further information is requested labels Oct 28, 2020
@pataquets
Copy link
Contributor

Yes, my first bet was something related to piracy.
Furthermore, all the npm audits that I've been indirectly run lately do complain about insecure libs. Maybe Heroku also has a policy about that. Not my best bet, but let's keep this in mind, anyway.

Also, once #10 is sorted out, we can deploy on Heroku using the Docker buildpack.

@omgbox
Copy link
Author

omgbox commented Nov 4, 2020

Well, it may be because of legal reasons. I found that Heroku scans code dependencies and we have a lot of "interesting" dependencies. I will reopen this issue cause Heroku deployment can be very helpful - I will need to investigate why Heroku block this app and how can we solve it.

tried to deploy again with clean, install same issue, the app gets automatically suspended after build. you should probably check live-torrent-server project on github and see how this guy got the modules installed. located here, , i have this project running and working really good, with a cdn77 and bunnycdn, you could stream torrents within few seconds, range requests also work.

also i like to note, heroku free , users should save data into tmp /app location, free heroku restarts your app every 24 hours i believe. so data gets deleted which is a good idea. you could constantly on demand stream bt videos.

@pataquets
Copy link
Contributor

Browsing the dependency graph, I've found a security issue in one of the dependencies of torrent-stream. See mafintosh/torrent-stream#191, for which there is an open PR, albeit stale.
Torrent-stream needs some serious dependency upgrading.

I guess there might be more packages with security issues.

@omgbox
Copy link
Author

omgbox commented Nov 5, 2020

torrent-stream

Dependency Status out of date

9 modules are out of date

https://david-dm.org/mafintosh/torrent-stream#info=devDependencies

something else to share, ffmpeg in wasm . encode videos in your browser. interesting since many people are using h265, our browsers do not support decoder native . so using this would be interesting.

https://ffmpegwasm.github.io/

@KiraLT
Copy link
Owner

KiraLT commented Nov 5, 2020

@pataquets @omgbox torrent-stream has a lot of deprecated dependencies + it hasn't been updated for a long time. With my recent commit I replaced it with webtorrent- it has a larger community and better performance. I will need to do further testing to make sure that everything works perfectly.

@omgbox it looks nice, we should try including it.

@KiraLT
Copy link
Owner

KiraLT commented Nov 5, 2020

I tried deploying to Heroku again and it deployed successfully & it was not suspended. All previous deployments were instant suspended, so it's something new.

I deployed using:
Deploy

Let's see how long it will last.

@omgbox
Copy link
Author

omgbox commented Nov 6, 2020

I tried deploying to Heroku again and it deployed successfully & it was not suspended. All previous deployments were instant suspended, so it's something new.

I deployed using:
Deploy

Let's see how long it will last.

great news, its working perfectly , nyaa working 👍

how would I stream from outside of the interface for example, on my terminal this only works if i use the full url with the filename.

this work
mpv "https://example.herokuapp.com/stream?torrent=841BC22850387BB471D948472A971C85B6D3157A&file=%EB%A7%9B%EC%9E%88%EB%8A%94%20%EB%85%80%EC%84%9D%EB%93%A4.E298.201106.720p-NEXT.mp4"

but this is not working.
mpv "https://example.herokuapp.com/stream?torrent=841BC22850387BB471D948472A971C85B6D3157A/"

does the api filter selector which method to automatically select video without appending the full file name.

something like this would be cool

mpv "https://example.herokuapp.com/stream?torrent=841BC22850387BB471D948472A971C85B6D3157A/:video"

/:video will select the largest video file in torrent.
/:1,2,3,4,5 number selectors could be the index numbers on the torrent. to pick from.

@KiraLT
Copy link
Owner

KiraLT commented Nov 6, 2020

@omgbox at the moment it is possible to select only by filename. Could you create a new issue and describe which selectors should be useful?

@KiraLT
Copy link
Owner

KiraLT commented Nov 7, 2020

Heroku seems working fine for several days, so I can close this issue. The only thing I noticed that it sometimes crash because of high download speed (one time it reached 40MB/s), but we have a separate issue for that: #15.

@KiraLT KiraLT closed this as completed Nov 7, 2020
@pataquets
Copy link
Contributor

Watch out #32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants