Open lazydino opened 6 years ago
Perhaps this will work docker run --add-host=host:172.17.0.7(your host ip address) .... then use "host" in your config file
Thanks. The example IP of 172.17.0.7 is the IP of 'eth0' of my container which hosts the game server and the pomelo chat server, so I presume "host" is the public routable IP address of my linux server, the host IP address that runs the docker application.
I run a heroku-like continue delivery system (dokku) that generates docker image on demand, and I might not be able to determine IP in advance directly and pass it with "add-host" command. Any way, just for the sake of testing the idea, I manually add an /etc/hosts entry like "X.Y.Z.W(my public IP) 172.17.0.7", and use X.Y.Z.W in game server config. This should make my public IP work as an alias in the container, which I think is the idea behind your suggestion of 'add-host' .
Unfortunately, the fix doesn't work, and it won't react to the client at all. When I use the container IP of 172.17.0.7 in game config, at least the console prompt would print something when I initiate contact to the gate server ( in my case when I hit 'join' button of pomelo chat server ).
I've also considered the possibility of creating an additional custom network interface in docker (docker create network ... ) , and map that network interface with the public IP via add-host. What do you think? The manual modification of etc/host won't work, would creating extra IP help?
Any idea? Could Pomelo frontend work with docker? In my opinion, connector plays an important role not only for performance but also regarding user experience. It is much easier to manage deployment scaling issues for admin/op if it could work with docker.
Thank you.
Hi,
I am testing to see if I could wrap up pomelo servers as docker container running in my digital ocean server, and access it via public website. The test works fine via chat server running out side of container, but once I put them in the container, web page could not find the servers.
Here is what I did with the config/servers.json when 'pomelo start' is running outside of the container... { "development": { "connector": [ { "id": "connector-server-1", "host": "(VPS public IP)", "port": 4050, "clientPort": 3050, "frontend": true }, { "id": "connector-server-2", "host": "(VPS public IP)", "port": 4051, "clientPort": 3051, "frontend": true }, { "id": "connector-server-3", "host": "(VPS public IP)", "port": 4052, "clientPort": 3052, "frontend": true } ], "chat": [ { "id": "chat-server-1", "host": "127.0.0.1", "port": 6050 }, { "id": "chat-server-2", "host": "127.0.0.1", "port": 6051 }, { "id": "chat-server-3", "host": "127.0.0.1", "port": 6052 } ], "gate": [ { "id": "gate-server-1", "host": "(VPS public IP)", "clientPort": 3014, "frontend": true } ] }, }
This config won't work with container since the public IP is not available inside the container. so what I did is publishing 3050-3052 and 3014 with -p option, and set the connector and gatway IP to the virtual IPs assigned by docker like ( 172.17.0.7 ) instead of my digital ocean server public IP. Web page client seems to reach the gateway, but it trys to make persistent websocket connection with the unreachable docker virtual IP. What needs to be done here to make the servers running in the docker container accessible via gate?