birjj / aws-minecraft-proxy Goto Github PK
View Code? Open in Web Editor NEWStart and stop a Minecraft server hosted on AWS automatically
Start and stop a Minecraft server hosted on AWS automatically
Every time you start the instance back up, the IP will be different than the IP baked into package.json
Using this shell command, it is possible to get the IP of a running instance with the instance ID, which stays static.
aws --region <region-name> \
ec2 describe-instances \
--filters \
"Name=instance-state-name,Values=running" \
"Name=instance-id,Values=<instance-name> \
--query 'Reservations[*].Instances[*].[PublicIpAddress]' \
--output text
Is it possible to use this to dynamically set the IP of the proxy each time a start command is issued?
Hi,
I have tried to set up the proxy, but unfortunately it cannot be brought to life. The AWS CLI command works but the service is immediately set to failed. All the info I have is in the code box below.
โ minecraft-proxy.service - Minecraft proxy that automatically starts an EC2 server when a connection is made
Loaded: loaded (/etc/systemd/system/minecraft-proxy.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Mon 2022-05-09 14:30:57 UTC; 3s ago
Process: 796 ExecStart=/usr/bin/node /home/ec2-user/aws-minecraft-proxy/src/index.js (code=exited, status=1/FAILURE)
Main PID: 796 (code=exited, status=1/FAILURE)
May 09 14:30:57 ip-172-31-33-176.eu-central-1.compute.internal systemd[1]: minecraft-proxy.service: main process exited, code=exited, status=1/FAILURE
May 09 14:30:57 ip-172-31-33-176.eu-central-1.compute.internal systemd[1]: Unit minecraft-proxy.service entered failed state.
May 09 14:30:57 ip-172-31-33-176.eu-central-1.compute.internal systemd[1]: minecraft-proxy.service failed.
May 09 14:30:57 ip-172-31-33-176.eu-central-1.compute.internal systemd[1]: minecraft-proxy.service holdoff time over, scheduling restart.
May 09 14:30:57 ip-172-31-33-176.eu-central-1.compute.internal systemd[1]: Stopped Minecraft proxy that automatically starts an EC2 server when a connection is made.
May 09 14:30:57 ip-172-31-33-176.eu-central-1.compute.internal systemd[1]: start request repeated too quickly for minecraft-proxy.service
May 09 14:30:57 ip-172-31-33-176.eu-central-1.compute.internal systemd[1]: Failed to start Minecraft proxy that automatically starts an EC2 server when a connection is made.
May 09 14:30:57 ip-172-31-33-176.eu-central-1.compute.internal systemd[1]: Unit minecraft-proxy.service entered failed state.
May 09 14:30:57 ip-172-31-33-176.eu-central-1.compute.internal systemd[1]: minecraft-proxy.service failed.```
Hi,
I've been using the proxy for about half a year now and I've rebuilt it once. Unfortunately, it is not accessible from the Minecraft launcher although the log shows a login attempt and should actually also start the server, nothing happens. Except that in Minecraft itself a "Failed to connect to the server! Disconnected" and the following log is written:
Dec 30 13:37:27 ip-xxx-xxx-xxx-xxx.eu-central-1.compute.internal systemd[1]: Stopping Minecraft proxy that automatically starts an EC2 server when a connection is made... Dec 30 13:37:27 ip-xxx-xxx-xxx-xxx.eu-central-1.compute.internal systemd[1]: Stopped Minecraft proxy that automatically starts an EC2 server when a connection is made. Dec 30 13:37:27 ip-xxx-xxx-xxx-xxx.eu-central-1.compute.internal systemd[1]: Started Minecraft proxy that automatically starts an EC2 server when a connection is made. Dec 30 13:37:28 ip-xxx-xxx-xxx-xxx.eu-central-1.compute.internal node[9074]: [info] Listening on :25565 Dec 30 13:37:41 ip-xxx-xxx-xxx-xxx.eu-central-1.compute.internal node[9074]: Chunk size is 28 but only 11 was read ; partial packet : {"name":"login_start","params":{"username":"Heptap0ds"}}; buffer :00094865707461 Dec 30 13:37:41 ip-xxx-xxx-xxx-xxx.eu-central-1.compute.internal node[9074]: [info] Client connection closed (xxx.xxx.xxx.xxx)
It is not due to the configuration of the securitygroups or the js version because the server is reachable and the js version is the same as the one from before when it worked. Also a ping on the console does not lead to the desired result.
Once the server has booted up and the player rejoins, the player is kicked after ~30 seconds and shown a disconnected message. This happens consistently every time.
I am running a MC 1.17.1 paperMC server.
After increasing the log level I noticed that the player is kicked after a emit message saying "login timeout" I therefore updated the minecraft-protocol dependency to 1.25 to try to fix the issue but that didn't work
After some trial and error I found a temporary fix by adding the kickTimeout parameter to the createServer function. The user is always kicked when this timeout ends therefore I have just set the timeout to 100000000 to prevent the issue.
/src/index.js Line 56
const server = new Server(25565, config.target.host, config.target.port, {kickTimeout: 100000000});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.