Rust on shared hosting?


#1

A couple of months ago I wanted to learn Node.js but I had to abandon it prematurely because it wouldn’t work on a hosting provider, and except for web development it’s not excessively useful…

Now I know that the “web” sector of rust is pretty barebones at the moment, and I am not saying that I am going to implement my website in Rust just yet :wink: But I was just wondering if Rust could run on a shared hosting?


#2

Honestly depends on what kind of shared hosting it is I would guess. Rust compiles down to a binary, so any host which allows you to run a binary application would allow running a rust program. If a host doesn’t allow Node.js or anything else though, it’s unlikely they would allow a raw binary.


#3

Actually I have no clue, I have a hostmonster shared hosting plan. I read through their terms and conditions and didn’t find any information about it. I may have missed it though. I read somewhere that they have gcc installed, so it must be possible I guess.


#4

It looks like they provide ssh access, so I would guess that it might be possible. It would definitely be possible with a vps, but it might be as well with the shared hosting. Just from the page showing “what you get”, it seems it might require proxying through apache2, but it would probably work.


#5

Thank you for taking a look!

I guess I will have to test it and hope that I don’t break one of their terms of agreement :smile:
With proxying, would that spawn a new thread for every request, like cgi?


#6

If they allow you to run a background process, then it wouldn’t start a new process or thread with each request unless the rust library has that built in. By proxying I mean the rust web server runs on some port like 8081, then apache2 just proxies all requests to port 80 on to port 8081.


#7

Ok, thank you for the explanation.
I’m not sure they would allow that though, I have heard that many shared hosting providers kill background processes repeatedly. I will have to contact them to make sure.