kaichaosun / rlt

Localtunnel implementation in Rust, expose local API to the public.
MIT License
87 stars 11 forks source link

What about docker version of server? #27

Open metya opened 1 year ago

metya commented 1 year ago

Great work! But what about creating a docker version of a server-side application?

kaichaosun commented 1 year ago

I like your idea! It would be great if someone know docker/ops better than me to implement it.

Krystex commented 1 year ago

I'm on it, see pull request #28

metya commented 1 year ago

It's excellent to have Dockerfile to build a container for any use, but how to configure the docker run for server use in docker-compose for example?

I mean, I could write Dockerfile and compose files myself, but I lack understanding of how to run it properly with the localtunnel. For example, what proxy-port mean? Sorry for the dumb questions, but I can't understand why my setup doesn't work without documentation.

Is it possible to use a localtunnel server without a domain? Just use an IP address. If so, what IP address I should use for running a localtunnel server?

I'm trying to start a server with --domain 0.0.0.0 for example, but it doesn't work. When I'm trying to connect to the server on the IP address of the server, the connection refuses.

I planned to use it in docker with https://github.com/nginx-proxy/nginx-proxy, on my server, there I have configured the domain, but I want to make it work without too. And there is also the question about proxy-port, cause inside the docker container without --net=host you can publish only several ports outside of the container.

Anyway, I can't even start the localtunnel server without docker. It doesn't connect.

Sorry again for the dumb question :))

Krystex commented 1 year ago

There are no dumb questions, it's a complex topic! Don't worry.

The Dockerfile is there, but I'm currently in the process of deploying it on my own server. It's also not working for me right now, but I'm figuring it out.

You pretty much need a domain for this application. The whole point is to route different applications with different subdomains.

This is my current stage (not fully working):

You need a image the localtunnel:

docker build -t localtunnel .

And here is my current docker-compose file, but as I said, it's not working right now for me.

services:
  localtunnel:
    image: localtunnel
    container_name: localtunnel
    restart: always
    command: localtunnel server --domain localtunnel.YOURDOMAIN.com --port 3000 --proxy-port 3001
    ports:
      - "3000:3000"
      - "3001:3001"

As far as I understand, the localtunnel client connects to the port (or proxy-port?) and requests a subdomain. After that you can tunnel your local port to your localtunnel server.

I will let you know when my setup is working.

kaichaosun commented 1 year ago

Sorry for closing the issue incidentally!

what proxy-port mean?

This is the help info for proxy-port with localtunnel-cli The port to accept user request for proxying..

but I can't understand why my setup doesn't work without documentation

This is a doc for my deployment, hope it's helpful for you.

As far as I understand, the localtunnel client connects to the port (or proxy-port?)

It's port, but definitely need a better name, I'm struggling what to name it at the time.

Thanks you for improving the tool!