Hi!
I'm not in a good health state now, but tried to deploy a working rocket app (localhost) into a Linode VPS. I couldn't.
For that, I ask for a guide to deploy in digital ocean, linode, or any VPS. Maybe is just an issue with the port 80.
Thanks in advance.
Here is my setup for my website. Not sure if it's relevant for your use case (I don't know if you have shell access, nginx configuration access...) but it might help you
[Unit]
Description=Bananium.rs
After=redis.service postgresql.service
[Service]
User=bananium
WorkingDirectory=/srv/http/bananium.rs
ExecStart=/srv/http/bananium.rs/target/release/web
[Install]
WantedBy=multi-user.target
[development]
address = "localhost"
port = 8069
workers = 8
log = "normal"
server {
listen 443 ssl ;
server_name bananium.fr;
location /static {
root /srv/http/bananium.rs;
expires 1d;
}
location / {
proxy_pass http://127.0.0.1:8069;
}
}
What issue did you have, exactly? Are you deploying Rocket behind a reverse proxy, like NGINX?
@SergioBenitez no, I'm deploying just with Rocket, that's what I want. I'm using ubuntu 16.04.2 LTS on my server. Trying to launch in production mode as root, on port 80 or 443 (rocket 0.3.0)
@freinn But what issue are you having? sudo ROCKET_ENV=prod cargo run --release should suffice.
By the way, it's highly recommended to run Rocket behind a reverse proxy like NGINX. This is because NGINX is async, so you'll get around many of the synchronous limitations of Rocket, and NGINX support HTTP2 as well as TLS >= 1.0.
Error: Failed to start server.
thread 'main' panicked at 'Address already in use (os error 98)', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/rocket-0.2.6/src/rocket.rs:555
0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::_print
at /checkout/src/libstd/sys_common/backtrace.rs:71
2: std::panicking::default_hook::{{closure}}
at /checkout/src/libstd/sys_common/backtrace.rs:60
at /checkout/src/libstd/panicking.rs:355
3: std::panicking::default_hook
at /checkout/src/libstd/panicking.rs:371
4: std::panicking::rust_panic_with_hook
at /checkout/src/libstd/panicking.rs:549
5: std::panicking::begin_panic
at /checkout/src/libstd/panicking.rs:511
6: std::panicking::begin_panic_fmt
at /checkout/src/libstd/panicking.rs:495
7: rocket::rocket::Rocket::launch
8: web::main
9: __rust_maybe_catch_panic
at /checkout/src/libpanic_unwind/lib.rs:98
10: std::rt::lang_start
at /checkout/src/libstd/panicking.rs:433
at /checkout/src/libstd/panic.rs:361
at /checkout/src/libstd/rt.rs:56
11: __libc_start_main
12: _start
I'm trying to understand nginx so I can use it with Rocket. Nginx was installed by default in digital ocean.
Now I have no errors and the message is:
Finished release [optimized] target(s) in 0.2 secs
Running `target/release/web`
But opening the port 80 doesn't seem to make it work, I'm going through nginx for now
The error you've posted contains all of the information: "Address already in use (os error 98)". Some other process on your VM is running on port 80. Use netstat or lsof to determine what it is, then kill it. Rocket should then launch successfully.
I've read this article but it's impossible to get it running. In production, I can't even know in which port its executing. Also I don't want to use supervisor.
This site can鈥檛 be reached
francisconebrera.com refused to connect.
Status: active
To Action From
-- ------ ----
22 ALLOW Anywhere
80 ALLOW Anywhere
8000 ALLOW Anywhere
22 (v6) ALLOW Anywhere (v6)
80 (v6) ALLOW Anywhere (v6)
8000 (v6) ALLOW Anywhere (v6)
tcp 0 0 127.0.0.1:80 0.0.0.0:* LISTEN 32672/web
I created a small guide to deploy rocket behind nginx with letsencrypt:
https://gist.github.com/belst/ff36c5f3883f7bf9b06c379d0a7bed9e
@belst Many thanks, with that guide and a friend help I have my website online. Some iptables fails because I have ufw installed but was almost perfect.
Awesome, glad to hear this has been resolved, @freinn. @belst Thank you for the guide! I'm hoping to have a deploying section in the guide for the next release, and I'll incorporate some of what you wrote there. :) Let's track a deploying guide in the existing docs issue, #171.
Most helpful comment
I created a small guide to deploy rocket behind nginx with letsencrypt:
https://gist.github.com/belst/ff36c5f3883f7bf9b06c379d0a7bed9e