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

Any way to add mapping to current instance to prevent un-graceful rebooting? #19

Open
Jafner opened this issue Aug 10, 2021 · 6 comments

Comments

@Jafner
Copy link

Jafner commented Aug 10, 2021

I run multiple servers for a small group of 10-20 friends. A couple users like to hop across modpacks.
I am frequently asked to spin up a new server (a very quick task, usually), but adding the new container to the mc-router via updating the mapping command in docker-compose.yml, then running docker-compose up -d (expectedly) causes all users connected to any server behind the proxy to be disconnected.

Is there any way to add a mapping to a running mc-router container without shutting it down and restarting it?

@itzg
Copy link
Owner

itzg commented Aug 10, 2021

Until #17 you will need to use the REST API or switch to Kubernetes service discovery.

@Jafner
Copy link
Author

Jafner commented Aug 10, 2021

Awesome, thanks for the clarification.

@Jafner
Copy link
Author

Jafner commented Aug 10, 2021

Can you give an example of how to interact with the REST API for users who may have never interacted with one before?

Is setting an API binding in the docker-compose file required, or does the container have internal tools capable of calling the API with docker exec?

@Jafner
Copy link
Author

Jafner commented Aug 10, 2021

With a command: of --mapping=e6.example.com=e6-056:25565,vanilla.example.com=vanilla:25565,tnp.example.com=tnp:25565 --api-binding=0.0.0.0:25566, I run curl <container-ip>:25566/routes from the host and get:
404 page not found

I do not have port 25566 mapped from the host to the container in the docker-compose file, should I?

@itzg
Copy link
Owner

itzg commented Aug 10, 2021

Since you addressed the curl operation with the container IP the mapping of the port isn't needed. As for the usage, I rediscovered that examples will be very helpful, since the GET operations need the Accept header, such as:

curl -H Accept:application/json localhost:25564/routes

and the POST operations need -H Content-Type:application/json.

@Jafner
Copy link
Author

Jafner commented Aug 10, 2021

Awesome! In my case, curl -H Accept:application/json 172.25.0.2:25566/routes worked great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants