Tokipo commited on
Commit
abd5fbb
·
verified ·
1 Parent(s): b19bc53

Upload 7 files

Browse files
Files changed (6) hide show
  1. .gitattributes +1 -0
  2. Dockerfile +40 -0
  3. download_world.py +129 -0
  4. server.jar +3 -0
  5. server.properties +60 -0
  6. start.sh +38 -0
.gitattributes CHANGED
@@ -35,3 +35,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  purpur.jar filter=lfs diff=lfs merge=lfs -text
37
  plugins/connect-spigot.jar filter=lfs diff=lfs merge=lfs -text
 
 
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  purpur.jar filter=lfs diff=lfs merge=lfs -text
37
  plugins/connect-spigot.jar filter=lfs diff=lfs merge=lfs -text
38
+ server.jar filter=lfs diff=lfs merge=lfs -text
Dockerfile ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM debian:stable
2
+
3
+ ENV DEBIAN_FRONTEND=noninteractive
4
+
5
+ # Install dependencies including procps for ps command
6
+ RUN apt-get update && \
7
+ apt-get install -y wget gnupg git python3 python3-pip python3-venv unzip curl procps && \
8
+ rm -rf /var/lib/apt/lists/*
9
+
10
+ # Install Playit.gg using the exact commands you provided
11
+ RUN curl -SsL https://playit-cloud.github.io/ppa/key.gpg | gpg --dearmor | tee /etc/apt/trusted.gpg.d/playit.gpg >/dev/null && \
12
+ echo "deb [signed-by=/etc/apt/trusted.gpg.d/playit.gpg] https://playit-cloud.github.io/ppa/data ./" | tee /etc/apt/sources.list.d/playit-cloud.list && \
13
+ apt-get update && \
14
+ apt-get install -y playit
15
+
16
+ # Add Amazon Corretto and install Java 21
17
+ RUN wget -O- https://apt.corretto.aws/corretto.key | gpg --dearmor > /usr/share/keyrings/corretto-archive-keyring.gpg && \
18
+ echo "deb [signed-by=/usr/share/keyrings/corretto-archive-keyring.gpg] https://apt.corretto.aws stable main" > /etc/apt/sources.list.d/corretto.list && \
19
+ apt-get update && \
20
+ apt-get install -y java-21-amazon-corretto-jdk && \
21
+ rm -rf /var/lib/apt/lists/*
22
+
23
+ # Install Python packages
24
+ RUN pip3 install --no-cache-dir --break-system-packages gdown
25
+
26
+ # Set working directory
27
+ WORKDIR /app
28
+
29
+ # Copy application files
30
+ COPY . /app
31
+
32
+ # Set permissions
33
+ RUN chmod -R 777 /app && \
34
+ chmod +x /app/start.sh
35
+
36
+ # Expose Minecraft port
37
+ EXPOSE 7860
38
+
39
+ # Set default command
40
+ CMD ["sh", "start.sh"]
download_world.py ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+
3
+ import os
4
+ import shutil
5
+ import zipfile
6
+ import sys
7
+ import gdown
8
+
9
+ # Get environment variable for Google Drive folder URL
10
+ FOLDER_URL = os.getenv("FOLDER_URL")
11
+
12
+ # Directories for downloading and extracting
13
+ DOWNLOAD_DIR = "/tmp/gdrive_download"
14
+ EXTRACT_DIR = "/tmp/extracted_world"
15
+ APP_DIR = "/app"
16
+
17
+ def download_and_extract():
18
+ """Download world files from Google Drive and extract them"""
19
+
20
+ print(">>> Starting world download from Google Drive...")
21
+
22
+ # Check if FOLDER_URL is set
23
+ if not FOLDER_URL:
24
+ print("⚠️ FOLDER_URL environment variable not set. Skipping download.")
25
+ print(">>> Minecraft will create a default world.")
26
+ return False
27
+
28
+ try:
29
+ # Clean up and create directories
30
+ shutil.rmtree(DOWNLOAD_DIR, ignore_errors=True)
31
+ shutil.rmtree(EXTRACT_DIR, ignore_errors=True)
32
+ os.makedirs(DOWNLOAD_DIR, exist_ok=True)
33
+ os.makedirs(EXTRACT_DIR, exist_ok=True)
34
+
35
+ print(f">>> Downloading from: {FOLDER_URL}")
36
+
37
+ # Download from Google Drive
38
+ try:
39
+ gdown.download_folder(
40
+ url=FOLDER_URL,
41
+ output=DOWNLOAD_DIR,
42
+ use_cookies=False,
43
+ quiet=False,
44
+ remaining_ok=True
45
+ )
46
+ print("✅ Downloaded from Google Drive")
47
+ except Exception as e:
48
+ print(f"❌ Failed to download folder: {e}")
49
+ print(">>> Make sure the folder is public (Anyone with link)")
50
+ print(">>> Minecraft will create a default world.")
51
+ return False
52
+
53
+ # Check if any files were downloaded
54
+ if not os.listdir(DOWNLOAD_DIR):
55
+ print("⚠️ No files found in Google Drive folder")
56
+ print(">>> Minecraft will create a default world.")
57
+ return False
58
+
59
+ # Extract all zip files
60
+ zip_found = False
61
+ for root, _, files in os.walk(DOWNLOAD_DIR):
62
+ for f in files:
63
+ if f.endswith(".zip"):
64
+ zip_found = True
65
+ zip_path = os.path.join(root, f)
66
+ print(f">>> Extracting: {f}")
67
+ with zipfile.ZipFile(zip_path, 'r') as z:
68
+ z.extractall(EXTRACT_DIR)
69
+ print(f"✅ Extracted: {f}")
70
+
71
+ if not zip_found:
72
+ print("⚠️ No zip files found in download")
73
+ # Try to copy non-zip files directly
74
+ for item in os.listdir(DOWNLOAD_DIR):
75
+ src = os.path.join(DOWNLOAD_DIR, item)
76
+ dst = os.path.join(EXTRACT_DIR, item)
77
+ if os.path.isdir(src):
78
+ shutil.copytree(src, dst)
79
+ else:
80
+ shutil.copy2(src, dst)
81
+
82
+ # Fix common typo in world_nether folder name
83
+ bad_nether = os.path.join(EXTRACT_DIR, "world_nither")
84
+ good_nether = os.path.join(EXTRACT_DIR, "world_nether")
85
+ if os.path.exists(bad_nether) and not os.path.exists(good_nether):
86
+ os.rename(bad_nether, good_nether)
87
+ print("✅ Fixed world_nether folder name typo")
88
+
89
+ # Copy world folders to app directory
90
+ world_folders = {
91
+ "world": os.path.join(EXTRACT_DIR, "world"),
92
+ "world_nether": os.path.join(EXTRACT_DIR, "world_nether"),
93
+ "world_the_end": os.path.join(EXTRACT_DIR, "world_the_end"),
94
+ "plugins": os.path.join(EXTRACT_DIR, "plugins")
95
+ }
96
+
97
+ copied_any = False
98
+ for name, src_path in world_folders.items():
99
+ if os.path.exists(src_path):
100
+ dst_path = os.path.join(APP_DIR, name)
101
+ # Remove existing folder if it exists
102
+ if os.path.exists(dst_path):
103
+ shutil.rmtree(dst_path)
104
+ shutil.copytree(src_path, dst_path)
105
+ print(f"✅ Copied {name} to /app/")
106
+ copied_any = True
107
+ else:
108
+ print(f"⚠️ {name} not found in extracted files")
109
+
110
+ # Clean up temporary directories
111
+ shutil.rmtree(DOWNLOAD_DIR, ignore_errors=True)
112
+ shutil.rmtree(EXTRACT_DIR, ignore_errors=True)
113
+
114
+ if copied_any:
115
+ print("✅ World data setup complete!")
116
+ return True
117
+ else:
118
+ print("⚠️ No world folders found in extracted files")
119
+ print(">>> Minecraft will create a default world.")
120
+ return False
121
+
122
+ except Exception as e:
123
+ print(f"❌ Error during download/extraction: {e}")
124
+ print(">>> Minecraft will create a default world.")
125
+ return False
126
+
127
+ if __name__ == "__main__":
128
+ success = download_and_extract()
129
+ sys.exit(0 if success else 1)
server.jar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3062934c2194f669485264ace9755582f01fd528fa87fbf7fcbf3686452e17eb
3
+ size 5705203
server.properties ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #Minecraft server properties
2
+ #Mon Apr 10 06:12:17 MSK 2023
3
+ allow-flight=false
4
+ allow-nether=true
5
+ broadcast-console-to-ops=true
6
+ broadcast-rcon-to-ops=true
7
+ debug=false
8
+ difficulty=hard
9
+ enable-command-block=false
10
+ enable-jmx-monitoring=false
11
+ enable-query=false
12
+ enable-rcon=false
13
+ enable-status=true
14
+ enforce-secure-profile=true
15
+ enforce-whitelist=true
16
+ entity-broadcast-range-percentage=100
17
+ force-gamemode=false
18
+ function-permission-level=2
19
+ gamemode=survival
20
+ generate-structures=true
21
+ generator-settings={}
22
+ hardcore=false
23
+ hide-online-players=false
24
+ level-name=world
25
+ level-seed=
26
+ level-type=minecraft\:normal
27
+ max-chained-neighbor-updates=1000000
28
+ max-players=20
29
+ max-tick-time=60000
30
+ max-world-size=29999984
31
+ motd=§bWelcome to Orbit§r\n§fAre You White-listed?...
32
+ network-compression-threshold=512
33
+ online-mode=true
34
+ op-permission-level=4
35
+ player-idle-timeout=0
36
+ prevent-proxy-connections=false
37
+ previews-chat=false
38
+ pvp=true
39
+ query.port=7860
40
+ rate-limit=0
41
+ rcon.password=huggingface
42
+ rcon.port=25575
43
+ require-resource-pack=false
44
+ resource-pack=
45
+ resource-pack-prompt=
46
+ resource-pack-sha1=
47
+ server-ip=
48
+ server-name=Orbit
49
+ server-port=7860
50
+ simulation-distance=5
51
+ spawn-animals=true
52
+ spawn-monsters=true
53
+ spawn-npcs=true
54
+ spawn-protection=0
55
+ sync-chunk-writes=false
56
+ text-filtering-config=
57
+ use-native-transport=true
58
+ view-distance=7
59
+ white-list=true
60
+ enable-cheats=true
start.sh ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ if [ ! -z "$PLAYIT_SECRET" ]; then
5
+ playit --secret "$PLAYIT_SECRET" > /dev/null 2>&1 &
6
+ sleep 5
7
+ fi
8
+
9
+ if [ -f "download_world.py" ]; then
10
+ python3 download_world.py 2>&1 || true
11
+ fi
12
+
13
+ chmod -R 777 /app 2>/dev/null || true
14
+
15
+ echo "🚀 Starting Minecraft Server"
16
+
17
+ exec java -server -Xmx8G -Xms8G \
18
+ -XX:+UseG1GC \
19
+ -XX:+ParallelRefProcEnabled \
20
+ -XX:MaxGCPauseMillis=200 \
21
+ -XX:+UnlockExperimentalVMOptions \
22
+ -XX:+DisableExplicitGC \
23
+ -XX:+AlwaysPreTouch \
24
+ -XX:G1NewSizePercent=30 \
25
+ -XX:G1MaxNewSizePercent=40 \
26
+ -XX:G1HeapRegionSize=16M \
27
+ -XX:G1ReservePercent=15 \
28
+ -XX:G1HeapWastePercent=5 \
29
+ -XX:G1MixedGCCountTarget=4 \
30
+ -XX:InitiatingHeapOccupancyPercent=20 \
31
+ -XX:G1MixedGCLiveThresholdPercent=90 \
32
+ -XX:G1RSetUpdatingPauseTimePercent=5 \
33
+ -XX:SurvivorRatio=32 \
34
+ -XX:+PerfDisableSharedMem \
35
+ -XX:MaxTenuringThreshold=1 \
36
+ -Dusing.aikars.flags=https://mcflags.emc.gs \
37
+ -Daikars.new.flags=true \
38
+ -jar server.jar --nogui