rapiz1 / rathole

A lightweight and high-performance reverse proxy for NAT traversal, written in Rust. An alternative to frp and ngrok.
Apache License 2.0
9.44k stars 475 forks source link

Free Hosting Solutions ?/! #278

Closed fire17 closed 1 year ago

fire17 commented 1 year ago

Hey yo! was looking for a ngrok alternative that can i can self host and get a static and public address to my local machine happy to come across this project :)

was wondering, if anyone knows of a good way to free host and run the rathole server? if so, where, and how to configure/deploy it easily?

im gonna check out render, and others i find, and will update here how its going, but would love it if someone knows of a free way that just works Thanks a lot and all the best!

fernvenue commented 1 year ago

I don't think so, but maybe you can provide more specifically details about your service.

fire17 commented 1 year ago

I've managed to build and run rathole on render (will send my dockerfile soon if it works) but im getting hello errors

Jul 28 11:22:02 AM  #18 preparing build cache for export
Jul 28 11:22:30 AM  Pushing image to registry...
Jul 28 11:22:32 AM  Upload succeeded
Jul 28 11:22:32 AM  DONE
Jul 28 11:22:29 AM  #18 DONE 27.0s
Jul 28 11:22:40 AM  2023-07-28T08:22:40.456440Z  INFO rathole::server: Listening at 0.0.0.0:2333
Jul 28 11:22:40 AM  2023-07-28T08:22:40.456589Z  INFO config_watcher{path="/app/config.toml"}: rathole::config_watcher: Start watching the config
Jul 28 11:22:45 AM  2023-07-28T08:22:45.706838Z ERROR connection{addr=10.216.25.32:59672}: rathole::server: Failed to read hello: early eof
Jul 28 11:22:45 AM  2023-07-28T08:22:45.707043Z ERROR connection{addr=10.216.25.32:59676}: rathole::server: Failed to read hello: early eof
Jul 28 11:22:46 AM  Your service is live 🎉
Jul 28 11:22:48 AM  2023-07-28T08:22:48.267945Z ERROR connection{addr=127.0.0.1:45040}: rathole::server: Failed to deserialize hello: invalid value: integer `542393671`, expected variant index 0 <= i < 2
Jul 28 11:22:50 AM  2023-07-28T08:22:50.706394Z ERROR connection{addr=10.216.25.32:59678}: rathole::server: Failed to read hello: early eof
Jul 28 11:22:55 AM  2023-07-28T08:22:55.706177Z ERROR connection{addr=10.216.25.32:51450}: rathole::server: Failed to read hello: early eof
Jul 28 11:23:00 AM  2023-07-28T08:23:00.706217Z ERROR connection{addr=10.216.25.32:51466}: rathole::server: Failed to read hello: early eof
Jul 28 11:23:05 AM  2023-07-28T08:23:05.705821Z ERROR connection{addr=10.216.25.32:50042}: rathole::server: Failed to read hello: early eof
Jul 28 11:23:10 AM  2023-07-28T08:23:10.706462Z ERROR connection{addr=10.216.25.32:50052}: rathole::server: Failed to read hello: early eof
Jul 28 11:23:15 AM  2023-07-28T08:23:15.706586Z ERROR connection{addr=10.216.25.32:39632}: rathole::server: Failed to read hello: early eof
Jul 28 11:23:20 AM  2023-07-28T08:23:20.705760Z ERROR connection{addr=10.216.25.32:39640}: rathole::server: Failed to read hello: early eof
Jul 28 11:23:25 AM  2023-07-28T08:23:25.709567Z ERROR connection{addr=10.216.25.32:58160}: rathole::server: Failed to read hello: early eof
Jul 28 11:23:30 AM  2023-07-28T08:23:30.706330Z ERROR connection{addr=10.216.25.32:58172}: rathole::server: Failed to read hello: early eof

EDIT - Im pretty sure the erros are comming from Render.com internal services, so it's not really a problem The real problem - is that i cant connect to the server (though its running) meaning the ports are not open or exposed properly (fml)

fire17 commented 1 year ago

OK so, here is my progress first of all the dockerfile:

FROM rust:alpine as builder
RUN apk add --no-cache musl-dev openssl openssl-dev pkgconfig
WORKDIR /home/rust/src
COPY . .
# build rathole
RUN cargo build --locked --release --features client,server,noise,hot-reload
RUN mkdir -p build-out/
RUN cp target/release/rathole build-out/
# get config.toml
COPY examples/unified/config.toml build-out/
# setup files
FROM scratch
WORKDIR /app
COPY --from=builder /home/rust/src/build-out/rathole .
COPY --from=builder /home/rust/src/build-out/config.toml /app/config.toml
# final settings
USER 1000:1000
EXPOSE 2333 5202
ENTRYPOINT ["./rathole"]
CMD ["--server", "/app/config.toml"]

What was added:

# builder
COPY examples/unified/config.toml build-out/
# scratch
COPY --from=builder /home/rust/src/build-out/config.toml /app/config.toml
# finally
EXPOSE 2333 5202
CMD ["--server", "/app/config.toml"]

(IMPORTANT: remove /examles/ from .dockerignore - took me forever to realize this)

at this point, render does build and run! BUT i cant seem to connect with the client... maybe the ports are not exposed properly...

so, in render's project settings -> Docker Command: docker run -p 2333:2333 -p 5202:5202 -it --rm rathole --server /app/config.toml

i think it should do the job, but im getting an annoying error: ❌ There was a problem starting your server: "docker": executable file not found in $PATH this seems like a problem on Render.com's end ive opened an issue, hopefully they can show me how to setup the path correctly on their machines

HAS ANYONE ELSE FIGURED THIS OUT? im conviced for sure this is achievable

@fernvenue regarding your question about the service, its a simple backend, I want to host 2 frontends (one for production and one for dev) the production already goes to a hosted backend (direct without proxy) but the dev frontend should call the dev backend (which is local on my machine), i usually use ngrok, but i dont want to keep adjusting the endpoints, so i hope to setup rathole on a static url (my_dev_server.onrender.com) and connect with rathole client on my local dev machine, if i understand this correctly it should just forward trafic to my local server (behind NAT) which is what i want

please let me know what you think i should do... Thanks a lot and all the best!

fernvenue commented 1 year ago

Maybe you can try Cloudflare Tunnel.

By the way, this is not a bug report or a feature request, so maybe you should go to discussions instead of issues.