Skip to content

Commit f225d23

Browse files
Merge pull request #483 from Arisamiga/master
Adding Alternative way to setup: Docker!!
2 parents 26a2210 + 386c4b4 commit f225d23

15 files changed

Lines changed: 316 additions & 2 deletions

DockerFiles/Dockerfile.game_server

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
FROM openjdk:21-jdk-slim
2+
3+
WORKDIR /app
4+
5+
# Install unzip for extracting files
6+
RUN apt-get update && apt-get install -y jq unzip screen && apt-get clean
7+
8+
# Download SkyBlockCore.jar
9+
ADD https://github.com/Swofty-Developments/HypixelSkyBlock/releases/download/latest/SkyBlockCore.jar SkyBlockCore.jar
10+
11+
# Download Services
12+
ADD https://github.com/Swofty-Developments/HypixelSkyBlock/releases/download/latest/ServiceAPI.jar ./ServiceAPI.jar
13+
ADD https://github.com/Swofty-Developments/HypixelSkyBlock/releases/download/latest/ServiceAuctionHouse.jar ./ServiceAuctionHouse.jar
14+
ADD https://github.com/Swofty-Developments/HypixelSkyBlock/releases/download/latest/ServiceBazaar.jar ./ServiceBazaar.jar
15+
ADD https://github.com/Swofty-Developments/HypixelSkyBlock/releases/download/latest/ServiceItemTracker.jar ./ServiceItemTracker.jar
16+
17+
# Copy configuration data
18+
COPY ./configuration /app/configuration_files
19+
20+
# Create configuration folder
21+
RUN mkdir -p configuration
22+
23+
RUN ls -la configuration_files/ > test.txt
24+
25+
# Copy resources.json
26+
RUN cp configuration_files/resources.json ./configuration/resources.json
27+
28+
RUN cp configuration_files/world.zip ./world.zip
29+
30+
RUN unzip world.zip -d ./configuration && rm world.zip
31+
32+
# Expose the required ports
33+
EXPOSE 25565 65535 8080 20000
34+
35+
# Copy NanoLimbo
36+
RUN cp configuration_files/NanoLimbo-1.8.1.jar ./NanoLimbo-1.8.1.jar
37+
38+
# Copy the Nano Config
39+
RUN cp configuration_files/settings.yml ./settings.yml
40+
41+
# Copy Songs Folder
42+
RUN cp -R configuration_files/songs ./configuration/songs
43+
44+
# Copy Collections
45+
RUN cp -R configuration_files/collections ./configuration/collections
46+
47+
# Copy Items
48+
RUN cp -R configuration_files/items ./configuration/items
49+
50+
# Copy SkyBlockPack
51+
RUN cp -R configuration_files/SkyBlockPack ./configuration/SkyBlockPack
52+
53+
# Copy pack_textures
54+
RUN cp -R configuration_files/pack_textures ./configuration/pack_textures
55+
56+
# Copy Entrypoint Script
57+
RUN cp configuration_files/entrypoint.sh ./entrypoint.sh
58+
59+
RUN chmod +x entrypoint.sh
60+
61+
# Run all services in the background and keep SkyBlockCore in the foreground
62+
CMD ["sh", "entrypoint.sh"]

DockerFiles/Dockerfile.proxy

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
FROM openjdk:21-jdk-slim
2+
3+
WORKDIR /app
4+
5+
# Install jq for JSON manipulation
6+
RUN apt-get update && apt-get install -y jq expect netcat-traditional && apt-get clean
7+
8+
9+
# Download Velocity proxy JAR
10+
ADD https://api.papermc.io/v2/projects/velocity/versions/3.4.0-SNAPSHOT/builds/463/downloads/velocity-3.4.0-SNAPSHOT-463.jar velocity.jar
11+
12+
# Download SkyBlockProxy.jar
13+
ADD https://github.com/Swofty-Developments/HypixelSkyBlock/releases/download/latest/SkyBlockProxy.jar plugins/SkyBlockProxy.jar
14+
15+
# Copy configuration data
16+
COPY ./configuration /app/configuration_files
17+
18+
19+
# Run Velocity and send "shutdown" to the console
20+
RUN expect <<EOF
21+
spawn java -jar velocity.jar
22+
expect ">"
23+
send "shutdown\r"
24+
expect eof
25+
EOF
26+
27+
# Remove velocity.toml
28+
RUN rm velocity.toml
29+
30+
# Add back our velocity.toml
31+
RUN cp configuration_files/velocity.toml velocity.toml
32+
33+
# Download resources.json
34+
RUN mkdir -p configuration
35+
36+
RUN cp configuration_files/resources.json ./configuration/resources.json
37+
38+
39+
# Get Contents of the forwarding secret and add it to resources.json
40+
RUN secret=$(cat forwarding.secret) && \
41+
jq --arg secret "$secret" '.["velocity-secret"] = $secret' ./configuration/resources.json > ./configuration/resources.json.tmp && \
42+
mv ./configuration/resources.json.tmp ./configuration/resources.json
43+
44+
# Expose the required port
45+
EXPOSE 25565
46+
47+
# Start the Velocity proxy and Copy the Forward.secret to the config files for use by other Dockerfiles
48+
CMD ["sh", "-c", "cp forwarding.secret /app/configuration_files/forwarding.secret && java -jar velocity.jar"]

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,65 @@ A video of me going through the guide [can be found here](https://www.youtube.co
7575
3. Run the packer JAR using `java -jar SkyBlockPacker.jar -v (Location of SkyBlockPack) -o (Output Directory) -t (Location of Pack Textures)`.
7676
4. Once this has finished, you should have a resource pack in the output directory you specified. Merely apply this on Minecraft and you'll be good to go.
7777

78+
79+
# 🐋 Running with Docker
80+
- Install the git repository using `git clone https://github.com/Swofty-Developments/HypixelSkyBlock.git
81+
82+
Most parts about downloading and setting up files will be automated for you but you will need to add the following files to the `configuration` folder:
83+
84+
- Download the [world files for the Hub and Island worlds.](https://www.mediafire.com/file/5oko5y8h7uj6i9z/world.zip/file). Make sure they are named as **world.zip**
85+
86+
- In your configuration file Remove the default `resources.json` and rename `resources.json.docker` to `resources.json`
87+
88+
## Running the contaniners!
89+
90+
- (Recommended) Install Docker Desktop from [here](https://www.docker.com/products/docker-desktop).
91+
- Open Docker Desktop/Docker and ensure that it is running.
92+
- Open a terminal and navigate to the directory where you cloned the repository.
93+
- Run the following command to build and run the containers (Your Server):
94+
95+
```bash
96+
docker-compose up --build
97+
```
98+
99+
- If you want to run the server in detached mode, you can use the `-d` flag:
100+
101+
```bash
102+
docker-compose up --build -d
103+
```
104+
> Note: If you have already runned the server before with `docker-compose up --build` you can just run `docker-compose up` to start the server without rebuilding the images making it faster.
105+
106+
- To stop the containers, you can use:
107+
108+
```bash
109+
docker-compose down
110+
```
111+
112+
Or click the stop button in Docker Desktop.
113+
114+
### How to add new servers using Docker?
115+
To add new servers like the Hub, Islands or Farming Island follow these steps:
116+
1. Open the `entrypoint.sh` file in the `configuration` folder.
117+
2. Add the following line to the end of the file, replacing `ServerType` with the type of server you want to add (e.g., `HUB`, `ISLAND`, etc.):
118+
119+
```bash
120+
screen -dmS SkyBlockCore_HUB java --enable-preview -jar SkyBlockCore.jar ServerType
121+
```
122+
123+
3. Save the file and run `docker-compose up --build` again to apply the changes.
124+
125+
126+
If you want to run services directly in the container you can attach to the container using:
127+
128+
```bash
129+
docker-compose exec game_server /bin/bash
130+
```
131+
132+
or go to the `exec` tab in Docker Desktop.
133+
134+
and then run the service command inside there. It will create its own screen session for you to run the service in.
135+
136+
78137
### Common Issues
79138
1. `redis.clients.jedis.exceptions.JedisConnectionException: Failed to connect to any host resolved for DNS name.`
80139

configuration/entrypoint.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
# Copy the Forwarding Secret
4+
cp configuration_files/forwarding.secret ./forwarding.secret
5+
6+
# Update resources.json with the forwarding secret
7+
secret=$(cat ./forwarding.secret)
8+
jq --arg secret "$secret" '.["velocity-secret"] = $secret' ./configuration/resources.json > ./configuration/resources.json.tmp
9+
mv ./configuration/resources.json.tmp ./configuration/resources.json
10+
11+
# Replace the secret in settings.yml
12+
sed -i "s/secret: '.*'/secret: '$secret'/" ./settings.yml
13+
14+
15+
# Clear any previously created Screens (Starting freshhh)
16+
screen -wipe
17+
18+
# Start services in separate screen sessions
19+
screen -dmS SkyBlockCore_ISLAND java --enable-preview -jar SkyBlockCore.jar ISLAND
20+
sleep 20
21+
screen -dmS SkyBlockCore_HUB java --enable-preview -jar SkyBlockCore.jar HUB
22+
screen -dmS SkyBlockCore_FARMING java --enable-preview -jar SkyBlockCore.jar THE_FARMING_ISLANDS
23+
screen -dmS NanoLimbo java -jar NanoLimbo-1.8.1.jar
24+
screen -dmS ServiceAPI java -jar ServiceAPI.jar
25+
screen -dmS ServiceAuctionHouse java -jar ServiceAuctionHouse.jar
26+
screen -dmS ServiceBazaar java -jar ServiceBazaar.jar
27+
screen -dmS ServiceItemTracker java -jar ServiceItemTracker.jar
28+
29+
echo "Started all services with a total of: $(screen -ls | grep -c 'Detached') screens"
30+
31+
# Keep the container running
32+
tail -f /dev/null

0 commit comments

Comments
 (0)