Compare commits
170
Commits
build-server
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d452101164 | ||
|
|
698dc94bb6 | ||
|
|
7f3f010574 | ||
|
|
89bb1c5ec4 | ||
|
|
057d7761ef | ||
|
|
cd1d9d70ce | ||
|
|
81562d7d0d | ||
|
|
c5f276cc59 | ||
|
|
1d5ca167c6 | ||
|
|
e4395a8cb7 | ||
|
|
5002ba5dd2 | ||
|
|
86f8c38a55 | ||
|
|
f2439bd22e | ||
|
|
78d0a0f2f6 | ||
|
|
a6973ec997 | ||
|
|
879768d121 | ||
|
|
3b98ed883b | ||
|
|
3497cde9b2 | ||
|
|
ff007aded7 | ||
|
|
7eab189f79 | ||
|
|
4a4094e253 | ||
|
|
2d7f2d37d9 | ||
|
|
9db2129e0c | ||
|
|
b0b3caf632 | ||
|
|
c93ea996c2 | ||
|
|
2f2d584159 | ||
|
|
aa18b753a3 | ||
|
|
daf1a0019c | ||
|
|
70a8dd8d2e | ||
|
|
6ea0b9fb34 | ||
|
|
0fb5b73aeb | ||
|
|
125a118938 | ||
|
|
39a71076c0 | ||
|
|
4ecd0e69a9 | ||
|
|
99589af9ad | ||
|
|
74cd0b5bb2 | ||
|
|
f5ede67568 | ||
|
|
ab726bedc9 | ||
|
|
864062b178 | ||
|
|
d58c32fb5c | ||
|
|
277cf599cf | ||
|
|
02ed1772ce | ||
|
|
a0b50b09d2 | ||
|
|
9c696f7920 | ||
|
|
ce5079969e | ||
|
|
c13766827c | ||
|
|
03c6884f0f | ||
|
|
ed390dd3dc | ||
|
|
d21e5ca6dd | ||
|
|
4b7fdf59fe | ||
|
|
d3417773b8 | ||
|
|
791e9b7c48 | ||
|
|
b37f6936d1 | ||
|
|
2d81ab8f90 | ||
|
|
e44b12f26e | ||
|
|
bf7e754e81 | ||
|
|
c3110979a1 | ||
|
|
1145e40d08 | ||
|
|
9eb203bd47 | ||
|
|
e8dc20eacc | ||
|
|
68d63fec74 | ||
|
|
88137ab0d5 | ||
|
|
ed63deec0b | ||
|
|
14c37d1e66 | ||
|
|
a09fe6326b | ||
|
|
211d66b353 | ||
|
|
2d46ec0f7c | ||
|
|
83441fe6ce | ||
|
|
9790e7dbd9 | ||
|
|
d7c7d743fe | ||
|
|
847d73e539 | ||
|
|
905fce1f66 | ||
|
|
3d8511dc08 | ||
|
|
c8c1c3a2ca | ||
|
|
ef0edf8895 | ||
|
|
407a1a1315 | ||
|
|
01c9827f1b | ||
|
|
6f9ba1c115 | ||
|
|
7b02303bf2 | ||
|
|
c4639298ae | ||
|
|
21788f57ec | ||
|
|
ad396a5204 | ||
|
|
ba0b3d3eeb | ||
|
|
6daadba60a | ||
|
|
fe60ed03ab | ||
|
|
f0039144d9 | ||
|
|
00cc703d0d | ||
|
|
40d7767451 | ||
|
|
969cff7202 | ||
|
|
e486a92ced | ||
|
|
08fbb9eafe | ||
|
|
65be6ada1d | ||
|
|
8d0c6f14e2 | ||
|
|
bbc275c4be | ||
|
|
af8cec2453 | ||
|
|
226352c379 | ||
|
|
8b9151a579 | ||
|
|
a5d54f4e3e | ||
|
|
47d8368998 | ||
|
|
f0a849f480 | ||
|
|
b8d89408e5 | ||
|
|
f1dc987e77 | ||
|
|
f02b227bf4 | ||
|
|
138d3e7ed9 | ||
|
|
8e161f7a40 | ||
|
|
ec73ae3864 | ||
|
|
287554c8db | ||
|
|
c5ea318821 | ||
|
|
eabe05a52a | ||
|
|
7cf032026e | ||
|
|
5656ed4d3c | ||
|
|
d090be121f | ||
|
|
8a59e1d5cc | ||
|
|
ed71777c8e | ||
|
|
43d74606ab | ||
|
|
d089895735 | ||
|
|
bf30c3d751 | ||
|
|
2e6216b408 | ||
|
|
9140cdc977 | ||
|
|
ed38744fdd | ||
|
|
1a52c32b15 | ||
|
|
dce5619772 | ||
|
|
58f369b126 | ||
|
|
da1ba3f3a4 | ||
|
|
55d21c6ade | ||
|
|
1ae67a3a32 | ||
|
|
ddd077cd50 | ||
|
|
f6008814da | ||
|
|
7984e09ce4 | ||
|
|
260237725d | ||
|
|
5437039cc5 | ||
|
|
ffecc45bbd | ||
|
|
e13bf15531 | ||
|
|
f88c0c61d4 | ||
|
|
f0308d6b2c | ||
|
|
e2fe2134d6 | ||
|
|
8ccd7c739e | ||
|
|
1ccccb415c | ||
|
|
497d940bb6 | ||
|
|
cd748987c5 | ||
|
|
273eb59cf9 | ||
|
|
083019b963 | ||
|
|
a74040d8f7 | ||
|
|
c454a5b150 | ||
|
|
65d652de21 | ||
|
|
b5bb46dd56 | ||
|
|
b9011ee98e | ||
|
|
943cb1f00b | ||
|
|
5e75e61e1d | ||
|
|
03cef0b7d9 | ||
|
|
4bf3fe33cc | ||
|
|
7a604563db | ||
|
|
c2d154da14 | ||
|
|
24666a27cf | ||
|
|
7e498d75d5 | ||
|
|
d0eb17faab | ||
|
|
10e9ec152d | ||
|
|
53fe9497cc | ||
|
|
25566a4054 | ||
|
|
7889b24857 | ||
|
|
de7ac116cd | ||
|
|
d6a70c3d0f | ||
|
|
24f6710960 | ||
|
|
9a2bb1f47d | ||
|
|
1e97f45b9f | ||
|
|
534e9677ad | ||
|
|
dea041989d | ||
|
|
01c130f9e3 | ||
|
|
4545c231c9 | ||
|
|
fb2df94d47 |
@@ -1 +0,0 @@
|
||||
gitea.fithwum.tech/fithwum/debian-base@sha256:6e9a0586293c4f349f59037b5f34ebc76f48a41de5ae8e06984e17404733dc93
|
||||
@@ -1,4 +1,4 @@
|
||||
name: vintage-story-build-server
|
||||
name: vintage-story-build-latest
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -6,13 +6,13 @@ on:
|
||||
- main
|
||||
paths:
|
||||
- '.gitea/workflows/vintage-story-build-server.yml'
|
||||
- 'server/Dockerfile'
|
||||
- 'server/*.sh'
|
||||
- 'latest/Dockerfile'
|
||||
- 'latest/*.sh'
|
||||
- '!.cache/*'
|
||||
- '!server/CHANGES.md'
|
||||
- '!server/build-info.json'
|
||||
- '!latest/CHANGES.md'
|
||||
- '!latest/build-info.json'
|
||||
schedule:
|
||||
- cron: '5 22 * * 0'
|
||||
- cron: '10 22 * * 0'
|
||||
|
||||
env:
|
||||
IMAGE_REGISTRY: gitea.fithwum.tech
|
||||
@@ -21,7 +21,7 @@ env:
|
||||
IMAGE_REPO_VINTAGE_STORY: vintage-story
|
||||
IMAGE_TAG_DEBIAN: bookworm
|
||||
DIGEST_FILE: .cache/debian-base.digest
|
||||
VERSIONS: server
|
||||
VERSIONS: latest
|
||||
|
||||
jobs:
|
||||
docker-prune:
|
||||
@@ -38,113 +38,12 @@ jobs:
|
||||
echo "[INFO] Pruning Docker images on ${{ matrix.runner }}..."
|
||||
docker image prune -a -f || true
|
||||
|
||||
poll-debian-base-and-detect-changes:
|
||||
runs-on: vm-docker-build2
|
||||
needs: docker-prune
|
||||
outputs:
|
||||
digest_changed: ${{ steps.compare_digest.outputs.changed }}
|
||||
versions_changed: ${{ steps.check_changed_versions.outputs.versions_changed }}
|
||||
new_versions: ${{ steps.check_new_versions.outputs.new_versions }}
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Ensure .cache exists
|
||||
run: mkdir -p .cache && touch .cache/.gitkeep
|
||||
|
||||
- name: Log in to Gitea Registry
|
||||
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login gitea.fithwum.tech -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
|
||||
|
||||
- name: Get current digest of debian-base image
|
||||
id: get_digest
|
||||
run: |
|
||||
IMAGE="${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_ORG }}/${{ env.IMAGE_REPO_DEBIAN }}:${{ env.IMAGE_TAG_DEBIAN }}"
|
||||
docker pull "$IMAGE" > /dev/null
|
||||
DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' "$IMAGE")
|
||||
echo "digest=$DIGEST" >> $GITHUB_OUTPUT
|
||||
echo "$DIGEST" > .cache/debian-base.digest.new
|
||||
|
||||
- name: Compare with stored digest
|
||||
id: compare_digest
|
||||
run: |
|
||||
CURRENT_DIGEST="${{ steps.get_digest.outputs.digest }}"
|
||||
LAST_DIGEST="$(cat ${{ env.DIGEST_FILE }} 2>/dev/null || echo '')"
|
||||
|
||||
if [ "$CURRENT_DIGEST" = "$LAST_DIGEST" ]; then
|
||||
echo "[INFO] Digest unchanged"
|
||||
echo "changed=false" >> $GITHUB_OUTPUT
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "[INFO] Digest changed → updating cache"
|
||||
echo "$CURRENT_DIGEST" > ${{ env.DIGEST_FILE }}
|
||||
|
||||
git config user.name "${{ secrets.GIT_USERNAME }}"
|
||||
git config user.email "${{ secrets.GIT_EMAIL }}"
|
||||
|
||||
git add ${{ env.DIGEST_FILE }}
|
||||
git commit -m "Update base digest to $CURRENT_DIGEST" || true
|
||||
|
||||
# --- Safe rebase with auto conflict resolution ---
|
||||
git fetch origin main
|
||||
if ! git rebase --strategy-option=theirs origin/main; then
|
||||
echo "[WARN] Rebase conflict, auto-resolving by preferring local digest"
|
||||
git rebase --abort
|
||||
git fetch origin main
|
||||
git reset --hard origin/main
|
||||
echo "$CURRENT_DIGEST" > ${{ env.DIGEST_FILE }}
|
||||
git add ${{ env.DIGEST_FILE }}
|
||||
git commit -m "Force-update base digest to $CURRENT_DIGEST (auto-resolved)"
|
||||
fi
|
||||
|
||||
git push origin HEAD:main
|
||||
echo "changed=true" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Detect changed vintage-story versions
|
||||
id: check_changed_versions
|
||||
run: |
|
||||
BEFORE_COMMIT="${{ github.event.before }}"
|
||||
if [ -z "$BEFORE_COMMIT" ] || ! git cat-file -e "$BEFORE_COMMIT^{commit}" 2>/dev/null; then
|
||||
BEFORE_COMMIT=$(git rev-parse HEAD~1)
|
||||
fi
|
||||
CHANGED=$(git diff --name-only "$BEFORE_COMMIT" HEAD || true)
|
||||
CHANGED_VERSIONS=""
|
||||
for version in $VERSIONS; do
|
||||
echo "$CHANGED" | grep -q "^$version/.*\.\(sh\|Dockerfile\)$" && CHANGED_VERSIONS="$CHANGED_VERSIONS $version"
|
||||
done
|
||||
CHANGED_VERSIONS=$(echo "$CHANGED_VERSIONS" | xargs) # trim whitespace
|
||||
echo "versions_changed=$CHANGED_VERSIONS" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Detect vintage-story versions without build-info
|
||||
id: check_new_versions
|
||||
run: |
|
||||
NEW_VERSIONS=""
|
||||
GIT_CREDENTIAL="${{ secrets.GIT_TOKEN || secrets.GIT_PASSWORD }}"
|
||||
git clone --depth=1 "https://${{ secrets.GIT_USERNAME }}:${GIT_CREDENTIAL}@gitea.fithwum.tech/fithwum/vintage-story.git" upload-repo
|
||||
|
||||
for version in $VERSIONS; do
|
||||
if [ ! -f "upload-repo/$version/build-info.json" ]; then
|
||||
echo "[INFO] No build-info.json for $version → treating as new"
|
||||
NEW_VERSIONS="$NEW_VERSIONS $version"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "new_versions=$NEW_VERSIONS" >> $GITHUB_OUTPUT
|
||||
|
||||
build-vintage-story-images:
|
||||
runs-on: vm-docker-build2
|
||||
needs:
|
||||
- docker-prune
|
||||
- poll-debian-base-and-detect-changes
|
||||
if: |
|
||||
needs.poll-debian-base-and-detect-changes.outputs.digest_changed == 'true' ||
|
||||
needs.poll-debian-base-and-detect-changes.outputs.versions_changed != '' ||
|
||||
needs.poll-debian-base-and-detect-changes.outputs.new_versions != ''
|
||||
needs: docker-prune
|
||||
strategy:
|
||||
matrix:
|
||||
version: [server]
|
||||
version: [latest]
|
||||
name: Build and Push ${{ matrix.version }}
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
@@ -166,10 +65,15 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Clear all build caches
|
||||
run: |
|
||||
docker builder prune -af || true
|
||||
docker buildx prune -af || true
|
||||
|
||||
- name: Build and push image
|
||||
run: |
|
||||
IMAGE="$IMAGE_REGISTRY/$IMAGE_ORG/$IMAGE_REPO_VINTAGE_STORY:${{ matrix.version }}"
|
||||
docker buildx build --platform linux/amd64 --push -t "$IMAGE" "./${{ matrix.version }}"
|
||||
docker buildx build --platform linux/amd64 --pull --no-cache --push -t "$IMAGE" "./${{ matrix.version }}"
|
||||
|
||||
generate-changelogs:
|
||||
needs: build-vintage-story-images
|
||||
|
||||
@@ -0,0 +1,309 @@
|
||||
name: vintage-story-build-testing
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- '.gitea/workflows/vintage-story-build-testing.yml'
|
||||
- 'testing/Dockerfile'
|
||||
- 'testing/*.sh'
|
||||
- '!.cache/*'
|
||||
- '!testing/CHANGES.md'
|
||||
- '!testing/build-info.json'
|
||||
schedule:
|
||||
- cron: '5 22 * * 0'
|
||||
|
||||
env:
|
||||
IMAGE_REGISTRY: gitea.fithwum.tech
|
||||
IMAGE_ORG: fithwum
|
||||
IMAGE_REPO_DEBIAN: debian-base
|
||||
IMAGE_REPO_VINTAGE_STORY: vintage-story
|
||||
IMAGE_TAG_DEBIAN: bookworm
|
||||
DIGEST_FILE: .cache/debian-base.digest
|
||||
VERSIONS: testing
|
||||
|
||||
jobs:
|
||||
docker-prune:
|
||||
name: Docker prune (${{ matrix.runner }})
|
||||
runs-on: ${{ matrix.runner }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
runner:
|
||||
- vm-docker-build2
|
||||
steps:
|
||||
- name: Prune unused Docker images
|
||||
run: |
|
||||
echo "[INFO] Pruning Docker images on ${{ matrix.runner }}..."
|
||||
docker image prune -a -f || true
|
||||
|
||||
build-vintage-story-images:
|
||||
runs-on: vm-docker-build2
|
||||
needs: docker-prune
|
||||
strategy:
|
||||
matrix:
|
||||
version: [testing]
|
||||
name: Build and Push ${{ matrix.version }}
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Log in to Gitea Registry
|
||||
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login gitea.fithwum.tech -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
|
||||
|
||||
- name: Clone vintage-story repo (with retries)
|
||||
run: |
|
||||
GIT_CREDENTIAL="${{ secrets.GIT_TOKEN || secrets.GIT_PASSWORD }}"
|
||||
for i in {1..5}; do
|
||||
git clone "https://${{ secrets.GIT_USERNAME }}:${GIT_CREDENTIAL}@gitea.fithwum.tech/fithwum/vintage-story.git" upload-repo && break
|
||||
echo "[WARN] Clone attempt $i failed. Retrying in 10s..."
|
||||
sleep 10
|
||||
done
|
||||
if [ ! -d upload-repo ]; then
|
||||
echo "[ERROR] Failed to clone vintage-story repo after retries."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Clear all build caches
|
||||
run: |
|
||||
docker builder prune -af || true
|
||||
docker buildx prune -af || true
|
||||
|
||||
- name: Build and push image
|
||||
run: |
|
||||
IMAGE="$IMAGE_REGISTRY/$IMAGE_ORG/$IMAGE_REPO_VINTAGE_STORY:${{ matrix.version }}"
|
||||
docker buildx build --platform linux/amd64 --pull --no-cache --push -t "$IMAGE" "./${{ matrix.version }}"
|
||||
|
||||
generate-changelogs:
|
||||
needs: build-vintage-story-images
|
||||
runs-on: vm-docker-build2
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Create temporary changelog workspace
|
||||
run: mkdir -p changelogs
|
||||
|
||||
- name: Clone vintage-story repo
|
||||
run: |
|
||||
GIT_CREDENTIAL="${{ secrets.GIT_TOKEN || secrets.GIT_PASSWORD }}"
|
||||
git clone --depth=3 "https://${{ secrets.GIT_USERNAME }}:${GIT_CREDENTIAL}@gitea.fithwum.tech/fithwum/vintage-story.git" upload-repo
|
||||
|
||||
- name: Generate changelogs
|
||||
run: |
|
||||
for version in $VERSIONS; do
|
||||
echo "[INFO] Generating changelog for $version"
|
||||
changelog="changelogs/$version/CHANGES.md"
|
||||
mkdir -p "$(dirname "$changelog")"
|
||||
touch "$changelog"
|
||||
|
||||
cd upload-repo
|
||||
infofile="$version/build-info.json"
|
||||
last_commit=""
|
||||
if [ -f "$infofile" ]; then
|
||||
last_commit=$(jq -r '.commit' "$infofile")
|
||||
fi
|
||||
|
||||
echo -e "## $(date -u +'%Y-%m-%dT%H:%M:%SZ')\n" > "../$changelog"
|
||||
if [ -n "$last_commit" ]; then
|
||||
COMMITS=$(git log "${last_commit}..HEAD" --pretty=format:"- %s (%an)" || true)
|
||||
fi
|
||||
if [ -z "$COMMITS" ]; then
|
||||
echo "[INFO] No new commits since last build. Showing latest 5 instead."
|
||||
COMMITS=$(git log -n 5 --pretty=format:"- %s (%an)" || true)
|
||||
fi
|
||||
echo "$COMMITS" >> "../$changelog"
|
||||
cd ..
|
||||
done
|
||||
|
||||
- name: Copy changelogs into repo
|
||||
run: |
|
||||
for version in $VERSIONS; do
|
||||
mkdir -p upload-repo/$version
|
||||
cp changelogs/$version/CHANGES.md upload-repo/$version/
|
||||
done
|
||||
|
||||
- name: Commit and push changelogs (temp branch)
|
||||
run: |
|
||||
cd upload-repo
|
||||
|
||||
git config user.name "${{ secrets.GIT_USERNAME }}"
|
||||
git config user.email "${{ secrets.GIT_EMAIL }}"
|
||||
|
||||
TEMP_BRANCH="tmp-changelog-$(date +%s)"
|
||||
|
||||
# Create temporary branch
|
||||
git checkout -b "$TEMP_BRANCH"
|
||||
|
||||
# Stage changes
|
||||
git add */CHANGES.md
|
||||
|
||||
# Nothing changed?
|
||||
if git diff --cached --quiet; then
|
||||
echo "[INFO] No changelog changes."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git commit -m "Update changelogs on $(date -u +'%Y-%m-%dT%H:%M:%SZ') [skip ci]"
|
||||
|
||||
# Push temporary branch
|
||||
git push origin HEAD:$TEMP_BRANCH
|
||||
|
||||
# Rebase temp branch onto latest main
|
||||
git fetch origin main
|
||||
|
||||
git checkout "$TEMP_BRANCH"
|
||||
|
||||
if ! git rebase origin/main; then
|
||||
echo "[WARN] Rebase failed, using merge instead."
|
||||
git rebase --abort || true
|
||||
git merge origin/main --no-edit
|
||||
fi
|
||||
|
||||
git push origin HEAD:$TEMP_BRANCH --force
|
||||
|
||||
# Fast-forward main
|
||||
git checkout main
|
||||
git reset --hard origin/main
|
||||
|
||||
git merge --no-ff "$TEMP_BRANCH" \
|
||||
-m "Merge changelog updates"
|
||||
|
||||
git push origin main
|
||||
|
||||
git push origin --delete "$TEMP_BRANCH" || true
|
||||
|
||||
generate-build-info:
|
||||
needs: generate-changelogs
|
||||
runs-on: vm-docker-build2
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare temporary build-info workspace
|
||||
run: mkdir -p buildinfo
|
||||
|
||||
- name: Clone vintage-story repo
|
||||
run: |
|
||||
GIT_CREDENTIAL="${{ secrets.GIT_TOKEN || secrets.GIT_PASSWORD }}"
|
||||
git clone --depth=1 "https://${{ secrets.GIT_USERNAME }}:${GIT_CREDENTIAL}@gitea.fithwum.tech/fithwum/vintage-story.git" upload-repo
|
||||
|
||||
- name: Generate build-info files
|
||||
run: |
|
||||
human_size() {
|
||||
local b=$1 d='' s=0 S=(B KB MB GB TB)
|
||||
while ((b >= 1024 && s < ${#S[@]}-1)); do
|
||||
d=$((b % 1024)); b=$((b / 1024)); s=$((s + 1))
|
||||
done
|
||||
printf "%s%s\n" "$b" "${S[$s]}"
|
||||
}
|
||||
|
||||
for version in $VERSIONS; do
|
||||
echo "[INFO] Generating build-info.json for $version"
|
||||
image="${IMAGE_REGISTRY}/${IMAGE_ORG}/${IMAGE_REPO_VINTAGE_STORY}:$version"
|
||||
infofile="buildinfo/$version/build-info.json"
|
||||
mkdir -p "$(dirname "$infofile")"
|
||||
|
||||
if ! docker pull "$image"; then
|
||||
echo "[WARN] Failed to pull $image — setting fields to unknown/0"
|
||||
digest="unknown"
|
||||
size_bytes=0
|
||||
else
|
||||
digest=$(docker inspect --format='{{if .RepoDigests}}{{index .RepoDigests 0}}{{else}}unknown{{end}}' "$image" 2>/dev/null || echo "unknown")
|
||||
size_bytes=$(docker image inspect "$image" --format='{{.Size}}' 2>/dev/null || echo "0")
|
||||
size_bytes=${size_bytes//[^0-9]/}
|
||||
if [[ -z "$size_bytes" ]]; then size_bytes=0; fi
|
||||
fi
|
||||
|
||||
size_human=$(human_size "$size_bytes")
|
||||
|
||||
cd upload-repo
|
||||
commit=$(git rev-parse HEAD)
|
||||
cd ..
|
||||
|
||||
jq -n \
|
||||
--arg version "$version" \
|
||||
--arg commit "$commit" \
|
||||
--arg build_time "$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
|
||||
--arg image_tag "$image" \
|
||||
--arg digest "$digest" \
|
||||
--arg image_size "$size_human" \
|
||||
--argjson image_size_bytes "$size_bytes" \
|
||||
'{
|
||||
version: $version,
|
||||
commit: $commit,
|
||||
build_time: $build_time,
|
||||
image_tag: $image_tag,
|
||||
digest: $digest,
|
||||
image_size: $image_size,
|
||||
image_size_bytes: $image_size_bytes
|
||||
}' > "$infofile"
|
||||
done
|
||||
|
||||
- name: Copy build-info.json into repo
|
||||
run: |
|
||||
for version in $VERSIONS; do
|
||||
mkdir -p upload-repo/$version
|
||||
cp "buildinfo/$version/build-info.json" "upload-repo/$version/"
|
||||
done
|
||||
|
||||
- name: Commit and push build-info (temp branch)
|
||||
run: |
|
||||
cd upload-repo
|
||||
|
||||
git config user.name "${{ secrets.GIT_USERNAME }}"
|
||||
git config user.email "${{ secrets.GIT_EMAIL }}"
|
||||
|
||||
TEMP_BRANCH="tmp-buildinfo-$(date +%s)"
|
||||
|
||||
# Create temporary branch
|
||||
git checkout -b "$TEMP_BRANCH"
|
||||
|
||||
# Stage changes
|
||||
git add */build-info.json
|
||||
|
||||
# Nothing changed?
|
||||
if git diff --cached --quiet; then
|
||||
echo "[INFO] No build-info changes."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git commit -m "Update build-info on $(date -u +'%Y-%m-%dT%H:%M:%SZ') [skip ci]"
|
||||
|
||||
# Push temporary branch
|
||||
git push origin HEAD:$TEMP_BRANCH
|
||||
|
||||
# Rebase temp branch onto latest main
|
||||
git fetch origin main
|
||||
|
||||
git checkout "$TEMP_BRANCH"
|
||||
|
||||
if ! git rebase origin/main; then
|
||||
echo "[WARN] Rebase failed, using merge instead."
|
||||
git rebase --abort || true
|
||||
git merge origin/main --no-edit
|
||||
fi
|
||||
|
||||
git push origin HEAD:$TEMP_BRANCH --force
|
||||
|
||||
# Merge into main
|
||||
git checkout main
|
||||
git reset --hard origin/main
|
||||
|
||||
git merge --no-ff "$TEMP_BRANCH" \
|
||||
-m "Merge build-info updates"
|
||||
|
||||
git push origin main
|
||||
|
||||
git push origin --delete "$TEMP_BRANCH" || true
|
||||
|
||||
for version in $VERSIONS; do
|
||||
TAG="build-$version"
|
||||
|
||||
git tag -d "$TAG" 2>/dev/null || true
|
||||
git push origin ":refs/tags/$TAG" 2>/dev/null || true
|
||||
|
||||
git tag "$TAG"
|
||||
git push origin "$TAG" --force
|
||||
done
|
||||
@@ -1,8 +1,5 @@
|
||||
# Vintage Story
|
||||
|
||||
[](https://gitea.fithwum.tech/fithwum/vintage-story/actions?workflow=vintage-story-build-server.yml)
|
||||
|
||||
|
||||
## Getting started
|
||||
|
||||
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
# Copyright (c) 2023 fithwum
|
||||
# All rights reserved
|
||||
|
||||
docker build --pull --rm -f "server/Dockerfile" -t gitea.fithwum.tech/fithwum/vintage-story:server "server"
|
||||
docker build --pull --rm -f "latest/Dockerfile" -t gitea.fithwum.tech/fithwum/vintage-story:latest "latest"
|
||||
docker build --pull --rm -f "testing/Dockerfile" -t gitea.fithwum.tech/fithwum/vintage-story:testing "testing"
|
||||
docker push -a gitea.fithwum.tech/fithwum/vintage-story
|
||||
@@ -0,0 +1,7 @@
|
||||
## 2026-08-09T22:11:52Z
|
||||
|
||||
- Merge build-info updates (fithwum)
|
||||
- Update build-info on 2026-08-09T22:06:54Z [skip ci] (fithwum)
|
||||
- Merge changelog updates (fithwum)
|
||||
- Update changelogs on 2026-08-09T22:06:43Z [skip ci] (fithwum)
|
||||
- Merge build-info updates (fithwum)
|
||||
@@ -4,11 +4,10 @@ LABEL maintainer="fithwum"
|
||||
# Environment Variables
|
||||
ENV VS_CHANNEL=""
|
||||
ENV VS_VERSION=""
|
||||
ENV USERNAME=""
|
||||
ENV DOTNET_VERSION=""
|
||||
|
||||
# URL's for files
|
||||
ARG INSTALL_SCRIPT=https://gitea.fithwum.tech/fithwum/vintage-story/raw/branch/main/server/install_script.sh
|
||||
ARG INSTALL_SCRIPT=https://gitea.fithwum.tech/fithwum/vintage-story/raw/branch/main/latest/install_script.sh
|
||||
|
||||
# Install Dependencies.
|
||||
RUN apt-get -y update && apt-get autoclean && apt-get autoremove \
|
||||
@@ -19,7 +18,7 @@ RUN apt-get -y update && apt-get autoclean && apt-get autoremove \
|
||||
&& update-ca-certificates -f;
|
||||
|
||||
# Folder creation.
|
||||
RUN mkdir -p /vs_server /vs_server/server /vs_server/data /vstemp /vstemp/files \
|
||||
RUN mkdir -p /vs_server /vs_server/server /vs_server/server/data /vstemp /vstemp/files \
|
||||
&& chmod 777 -R /vs_server /vstemp \
|
||||
&& chown 99:100 -R /vs_server /vstemp
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"version": "latest",
|
||||
"commit": "7f3f010574ff84f850b0cca9598a0e49319bb5ea",
|
||||
"build_time": "2026-08-09T22:12:03Z",
|
||||
"image_tag": "gitea.fithwum.tech/fithwum/vintage-story:latest",
|
||||
"digest": "gitea.fithwum.tech/fithwum/vintage-story@sha256:21664ac16465bad37f3a9b6a6e00660ba0cac91f26fe1e323c1d7779fcbfc749",
|
||||
"image_size": "410MB",
|
||||
"image_size_bytes": 430959352
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2026 fithwum
|
||||
# All rights reserved
|
||||
|
||||
VS_SERVER_DIR=/vs_server/server
|
||||
VS_DATA_DIR=/vs_server/server/data
|
||||
LOG_FILE=$VS_DATA_DIR/Logs/server-main.log
|
||||
MARKER_FILE=$VS_SERVER_DIR/.setup_done
|
||||
INSTALLED_VERSION=$VS_SERVER_DIR/installed-$TARGET_VERSION
|
||||
START_FILE=$VS_SERVER_DIR/server.sh
|
||||
MS_REPO_URL=https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb
|
||||
USERNAME=adduser vintagestory
|
||||
|
||||
# DOTnet install
|
||||
if [ $DOTNET_VERSION = "8.0" ]; then
|
||||
echo "INFO ! dotnet-sdk-$DOTNET_VERSION Selected"
|
||||
if [ dpkg -s dotnet-sdk-8.0 &> /dev/null ]
|
||||
then
|
||||
echo "INFO ! dotnet-sdk-8.0 installed ... moving on."
|
||||
else
|
||||
echo " "
|
||||
echo "WARNING ! dotnet-sdk-8.0 not installed ... will install now."
|
||||
wget --no-cache --show-progress --progress=bar:force:noscroll $MS_REPO_URL -O packages-microsoft-prod.deb
|
||||
dpkg -i packages-microsoft-prod.deb
|
||||
rm packages-microsoft-prod.deb
|
||||
apt-get -y update
|
||||
apt-get install -y dotnet-sdk-8.0
|
||||
fi
|
||||
elif [ $DOTNET_VERSION = "9.0" ]; then
|
||||
echo "INFO ! dotnet-sdk-$DOTNET_VERSION Selected"
|
||||
if [ dpkg -s dotnet-sdk-9.0 &> /dev/null ]
|
||||
then
|
||||
echo "INFO ! dotnet-sdk-9.0 installed ... moving on."
|
||||
else
|
||||
echo " "
|
||||
echo "WARNING ! dotnet-sdk-9.0 not installed ... will install now."
|
||||
wget --no-cache --show-progress --progress=bar:force:noscroll $MS_REPO_URL -O packages-microsoft-prod.deb
|
||||
dpkg -i packages-microsoft-prod.deb
|
||||
rm packages-microsoft-prod.deb
|
||||
apt-get -y update
|
||||
apt-get install -y dotnet-sdk-9.0
|
||||
fi
|
||||
elif [ $DOTNET_VERSION = "10.0" ]; then
|
||||
echo "INFO ! dotnet-sdk-$DOTNET_VERSION Selected"
|
||||
if [ dpkg -s dotnet-sdk-10.0 &> /dev/null ]
|
||||
then
|
||||
echo "INFO ! dotnet-sdk-10.0 installed ... moving on."
|
||||
else
|
||||
echo " "
|
||||
echo "WARNING ! dotnet-sdk-10.0 not installed ... will install now."
|
||||
wget --no-cache --show-progress --progress=bar:force:noscroll $MS_REPO_URL -O packages-microsoft-prod.deb
|
||||
dpkg -i packages-microsoft-prod.deb
|
||||
rm packages-microsoft-prod.deb
|
||||
apt-get -y update
|
||||
apt-get install -y dotnet-sdk-10.0
|
||||
fi
|
||||
else
|
||||
echo "ERROR ! Dotnet version must be set first run"
|
||||
sleep infinity
|
||||
fi
|
||||
|
||||
# Main install & auto update.
|
||||
# Check for server files and download if needed.
|
||||
# Fallback to stable channel if VS_CHANNEL is blank
|
||||
: "${VS_CHANNEL:=stable}"
|
||||
echo "Using channel: $VS_CHANNEL"
|
||||
|
||||
# Get the currently installed version from filesystem
|
||||
CUR_V=$(find "$VS_SERVER_DIR" -name "installed-*" | cut -d - -f2-)
|
||||
echo "Current local version: '${CUR_V:-None}'"
|
||||
|
||||
# Fetch the API JSON cleanly
|
||||
API_URL="http://api.vintagestory.at/${VS_CHANNEL}.json"
|
||||
JSON=$(wget -qO- "$API_URL")
|
||||
|
||||
# Validate that we actually received valid JSON
|
||||
if [ -z "$JSON" ] || ! echo "$JSON" | jq . >/dev/null 2>&1; then
|
||||
echo "Error: Failed to fetch valid JSON from $API_URL"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Resolve the target version dynamically from the JSON Object keys
|
||||
if [ ! -z "$VS_VERSION" ] && [ "$VS_VERSION" != "latest" ]; then
|
||||
# User specified an exact version. Check if it exists as a key in the object
|
||||
TARGET_VERSION=$(echo "$JSON" | jq -r --arg version "$VS_VERSION" 'if .[$version] then $version else "" end')
|
||||
if [ -z "$TARGET_VERSION" ]; then
|
||||
echo "Error: Specified version '$VS_VERSION' not found in the $VS_CHANNEL channel API."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# No version specified or "latest" chosen. Get the very first key from the object
|
||||
TARGET_VERSION=$(echo "$JSON" | jq -r 'keys_unsorted | .[0]')
|
||||
fi
|
||||
echo "Target version determined: '$TARGET_VERSION'"
|
||||
|
||||
# Compare versions and only download if they do NOT match
|
||||
if [ "$CUR_V" != "$TARGET_VERSION" ]; then
|
||||
echo "Versions differ ($CUR_V vs $TARGET_VERSION). Fetching CDN download URL..."
|
||||
# Extract the CDN download link using the valid object key structure
|
||||
VS_SERVER_FILE=$(echo "$JSON" | jq -r --arg version "$TARGET_VERSION" '.[$version].linuxserver.urls.cdn')
|
||||
if [ "$VS_SERVER_FILE" == "null" ] || [ -z "$VS_SERVER_FILE" ]; then
|
||||
echo "Error: Download URL not found for version $TARGET_VERSION"
|
||||
exit 1
|
||||
fi
|
||||
echo "Ready to download: $VS_SERVER_FILE"
|
||||
echo " "
|
||||
echo "INFO ! Cleaning old files."
|
||||
mkdir -pv $VS_SERVER_DIR/old-server-versions/
|
||||
mv *.sh $VS_SERVER_DIR/old-server-versions/
|
||||
rm -fr $VS_SERVER_DIR/assets $VS_SERVER_DIR/Lib $VS_SERVER_DIR/Mods
|
||||
rm -fr $VS_SERVER_DIR/VintagestoryServer $VS_SERVER_DIR/*.dll $VS_SERVER_DIR/*.pdb $VS_SERVER_DIR/*.json $VS_SERVER_DIR/*.xml $VS_SERVER_DIR/*.txt
|
||||
wget --no-cache --show-progress --progress=bar:force:noscroll $VS_SERVER_FILE -O /vstemp/vs_server_linux-x64_$TARGET_VERSION.tar.gz
|
||||
tar -xzf /vstemp/vs_server_linux-x64_$TARGET_VERSION.tar.gz -C /vstemp/files
|
||||
rm -fr /vstemp/*.tar.gz
|
||||
mv -uf /vstemp/files/* $VS_SERVER_DIR/
|
||||
chmod +x $START_FILE
|
||||
touch $INSTALLED_VERSION
|
||||
else
|
||||
echo "No update required. Local version matches target version."
|
||||
fi
|
||||
|
||||
echo "INFO ! Setting server path."
|
||||
sed -i -E "s|^VSPATH='/home/vintagestory/server'|VSPATH='$VS_SERVER_DIR'|" $START_FILE
|
||||
echo "INFO ! Setting data path."
|
||||
sed -i -E "s|^DATAPATH='/var/vintagestory/data'|DATAPATH='$VS_DATA_DIR'|" $START_FILE
|
||||
|
||||
# Set permissions.
|
||||
chown 99:100 -R $VS_SERVER_DIR
|
||||
chmod 776 -R $VS_SERVER_DIR
|
||||
|
||||
# Setup the server
|
||||
if [ ! -f $MARKER_FILE ]; then
|
||||
echo "First time run: Setting up server environment..."
|
||||
yes y | $VS_SERVER_DIR/server.sh setup $USERNAME $VS_DATA_DIR
|
||||
touch $MARKER_FILE
|
||||
echo "Setup successfully completed."
|
||||
fi
|
||||
|
||||
# Run vintage-story server.
|
||||
echo " "
|
||||
echo "INFO ! Starting vintage-story Server $VS_VERSION"
|
||||
.$START_FILE start
|
||||
|
||||
echo "Waiting for the server log file to be created..."
|
||||
# Loop indefinitely until the log file actually exists on disk
|
||||
until [ -f "$LOG_FILE" ]; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo "Log file found! Streaming server console now..."
|
||||
# Hand off PID 1 to tail, keeping the container active permanently
|
||||
exec tail -f "$LOG_FILE"
|
||||
|
||||
exit
|
||||
@@ -1,5 +0,0 @@
|
||||
## 2026-07-28T14:23:27Z
|
||||
|
||||
- test (fithwum)
|
||||
- Merge build-info updates (fithwum)
|
||||
- Update build-info on 2026-07-28T14:22:40Z [skip ci] (fithwum)
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"version": "server",
|
||||
"commit": "c9503c494301224e227b0ab6d100998052fe1d50",
|
||||
"build_time": "2026-07-28T14:23:38Z",
|
||||
"image_tag": "gitea.fithwum.tech/fithwum/vintage-story:server",
|
||||
"digest": "gitea.fithwum.tech/fithwum/vintage-story@sha256:a65be1a794331206ad944f402935cb5968cb41659391fb43acfc87a517640b82",
|
||||
"image_size": "410MB",
|
||||
"image_size_bytes": 430942270
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2026 fithwum
|
||||
# All rights reserved
|
||||
|
||||
MARKER_FILE=$VS_SERVER_DIR/.setup_done
|
||||
VS_SERVER_DIR=/vs_server/server
|
||||
VS_DATA_DIR=/vs_server/data
|
||||
START_FILE=$VS_SERVER_DIR/server-$VS_VERSION.sh
|
||||
VS_SERVER_FILE=https://cdn.vintagestory.at/gamefiles/$VS_CHANNEL/vs_server_linux-x64_$VS_VERSION.tar.gz
|
||||
|
||||
# DOTnet install
|
||||
if [ dpkg -s dotnet-sdk-$DOTNET_VERSION &> /dev/null ]
|
||||
then
|
||||
echo "INFO ! dotnet-sdk-$DOTNET_VERSION installed ... moving on."
|
||||
else
|
||||
echo " "
|
||||
echo "WARNING ! dotnet-sdk-$DOTNET_VERSION not installed ... will install now."
|
||||
wget --no-cache --show-progress --progress=bar:force:noscroll https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
|
||||
dpkg -i packages-microsoft-prod.deb
|
||||
rm packages-microsoft-prod.deb
|
||||
apt-get -y update
|
||||
apt-get install -y dotnet-sdk-$DOTNET_VERSION
|
||||
fi
|
||||
|
||||
# Main install (Debian).
|
||||
# Check for server files and download if needed.
|
||||
if [ -e $START_FILE ]
|
||||
then
|
||||
echo " "
|
||||
echo "INFO ! server-$VS_VERSION.sh found starting now."
|
||||
else
|
||||
echo " "
|
||||
echo "WARNING ! server-$VS_VERSION.sh is out of date/missing ... will download now."
|
||||
echo " "
|
||||
echo "INFO ! Cleaning old files."
|
||||
mkdir -pv $VS_SERVER_DIR/old-server-versions/
|
||||
mv *.sh $VS_SERVER_DIR/old-server-versions/
|
||||
rm -fr $VS_SERVER_DIR/assets $VS_SERVER_DIR/Lib $VS_SERVER_DIR/Mods
|
||||
rm -fr $VS_SERVER_DIR/VintagestoryServer $VS_SERVER_DIR/*.dll $VS_SERVER_DIR/*.pdb $VS_SERVER_DIR/*.json $VS_SERVER_DIR/*.xml $VS_SERVER_DIR/*.txt
|
||||
wget --no-cache --show-progress --progress=bar:force:noscroll $VS_SERVER_FILE -O /vstemp/vs_server_linux-x64_$VS_VERSION.tar.gz
|
||||
tar -xzf /vstemp/vs_server_linux-x64_$VS_VERSION.tar.gz -C /vstemp/files
|
||||
rm -fr /vstemp/*.tar.gz
|
||||
mv -uf /vstemp/files/* $VS_SERVER_DIR/
|
||||
mv $VS_SERVER_DIR/server.sh $START_FILE
|
||||
chmod +x $START_FILE
|
||||
fi
|
||||
|
||||
echo "INFO ! Setting server path."
|
||||
sed -i -E "s|^VSPATH='/home/vintagestory/server'|VSPATH='$VS_SERVER_DIR'|" $START_FILE
|
||||
echo "INFO ! Setting data path."
|
||||
sed -i -E "s|^DATAPATH='/var/vintagestory/data'|DATAPATH='$VS_DATA_DIR'|" $START_FILE
|
||||
echo "INFO ! Setting username."
|
||||
sed -i -E "s|^USERNAME='vintagestory'|USERNAME='$USERNAME'|" $START_FILE
|
||||
|
||||
# Set permissions.
|
||||
chown 99:100 -R /vs_server
|
||||
chmod 776 -R /vs_server
|
||||
|
||||
# Setup the server
|
||||
if [ ! -f $MARKER_FILE ]; then
|
||||
echo "First time run: Setting up server environment..."
|
||||
yes y | $VS_SERVER_DIR/server-1.21.5.sh setup $USERNAME $VS_SERVER_DIR && touch $MARKER_FILE
|
||||
echo "Setup successfully completed."
|
||||
fi
|
||||
|
||||
# Run vintage-story server.
|
||||
echo " "
|
||||
echo "INFO ! Starting vintage-story Server $VS_VERSION"
|
||||
exec $VS_SERVER_DIR/server-$VS_VERSION.sh start
|
||||
|
||||
exit
|
||||
@@ -0,0 +1,7 @@
|
||||
## 2026-08-09T22:06:43Z
|
||||
|
||||
- Merge build-info updates (fithwum)
|
||||
- Update build-info on 2026-08-02T22:11:31Z [skip ci] (fithwum)
|
||||
- Merge changelog updates (fithwum)
|
||||
- Update changelogs on 2026-08-02T22:11:21Z [skip ci] (fithwum)
|
||||
- Merge build-info updates (fithwum)
|
||||
@@ -0,0 +1,32 @@
|
||||
FROM gitea.fithwum.tech/fithwum/debian-base:bookworm
|
||||
LABEL maintainer="fithwum"
|
||||
|
||||
# Environment Variables
|
||||
ENV VS_CHANNEL=""
|
||||
ENV VS_VERSION=""
|
||||
ENV DOTNET_VERSION=""
|
||||
|
||||
# URL's for files
|
||||
ARG INSTALL_SCRIPT=https://gitea.fithwum.tech/fithwum/vintage-story/raw/branch/main/testing/install_script.sh
|
||||
|
||||
# Install Dependencies.
|
||||
RUN apt-get -y update && apt-get autoclean && apt-get autoremove \
|
||||
&& apt-get -y update && apt-get install -y bzip2 jq wget procps pcregrep screen \
|
||||
&& adduser vintagestory \
|
||||
&& apt-get -y --fix-broken install \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& update-ca-certificates -f;
|
||||
|
||||
# Folder creation.
|
||||
RUN mkdir -p /vs_server /vs_server/server /vs_server/server/data /vstemp /vstemp/files \
|
||||
&& chmod 777 -R /vs_server /vstemp \
|
||||
&& chown 99:100 -R /vs_server /vstemp
|
||||
|
||||
RUN wget --no-cache "$INSTALL_SCRIPT" -O /vstemp/install_script.sh \
|
||||
&& chmod +x /vstemp/install_script.sh
|
||||
|
||||
# Directory where data is stored
|
||||
VOLUME /vs_server
|
||||
|
||||
# Run command
|
||||
CMD [ "/bin/bash", "./vstemp/install_script.sh" ]
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"version": "testing",
|
||||
"commit": "81562d7d0d445e89ea0a121933f30da6e9a090a7",
|
||||
"build_time": "2026-08-09T22:06:53Z",
|
||||
"image_tag": "gitea.fithwum.tech/fithwum/vintage-story:testing",
|
||||
"digest": "gitea.fithwum.tech/fithwum/vintage-story@sha256:6998b6e2c7af46f5671cbb9a73274d3accb1bc4820784dc39e178c6014cdbcf8",
|
||||
"image_size": "410MB",
|
||||
"image_size_bytes": 430945892
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2026 fithwum
|
||||
# All rights reserved
|
||||
|
||||
VS_SERVER_DIR=/vs_server/server
|
||||
VS_DATA_DIR=/vs_server/server/data
|
||||
LOG_FILE=$VS_DATA_DIR/Logs/server-main.log
|
||||
MARKER_FILE=$VS_SERVER_DIR/.setup_done
|
||||
INSTALLED_VERSION=$VS_SERVER_DIR/installed-$TARGET_VERSION
|
||||
START_FILE_1=$VS_SERVER_DIR/server.sh
|
||||
START_FILE_2=https://gitea.fithwum.tech/fithwum/vintage-story/raw/branch/main/testing/start.sh
|
||||
MS_REPO_URL=https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb
|
||||
USERNAME=adduser vintagestory
|
||||
|
||||
# DOTnet install
|
||||
if [ $DOTNET_VERSION = "8.0" ]; then
|
||||
echo "INFO ! dotnet-sdk-$DOTNET_VERSION Selected"
|
||||
if [ dpkg -s dotnet-sdk-8.0 &> /dev/null ]
|
||||
then
|
||||
echo "INFO ! dotnet-sdk-8.0 installed ... moving on."
|
||||
else
|
||||
echo " "
|
||||
echo "WARNING ! dotnet-sdk-8.0 not installed ... will install now."
|
||||
wget --no-cache --show-progress --progress=bar:force:noscroll $MS_REPO_URL -O packages-microsoft-prod.deb
|
||||
dpkg -i packages-microsoft-prod.deb
|
||||
rm packages-microsoft-prod.deb
|
||||
apt-get -y update
|
||||
apt-get install -y dotnet-sdk-8.0
|
||||
fi
|
||||
elif [ $DOTNET_VERSION = "9.0" ]; then
|
||||
echo "INFO ! dotnet-sdk-$DOTNET_VERSION Selected"
|
||||
if [ dpkg -s dotnet-sdk-9.0 &> /dev/null ]
|
||||
then
|
||||
echo "INFO ! dotnet-sdk-9.0 installed ... moving on."
|
||||
else
|
||||
echo " "
|
||||
echo "WARNING ! dotnet-sdk-9.0 not installed ... will install now."
|
||||
wget --no-cache --show-progress --progress=bar:force:noscroll $MS_REPO_URL -O packages-microsoft-prod.deb
|
||||
dpkg -i packages-microsoft-prod.deb
|
||||
rm packages-microsoft-prod.deb
|
||||
apt-get -y update
|
||||
apt-get install -y dotnet-sdk-9.0
|
||||
fi
|
||||
elif [ $DOTNET_VERSION = "10.0" ]; then
|
||||
echo "INFO ! dotnet-sdk-$DOTNET_VERSION Selected"
|
||||
if [ dpkg -s dotnet-sdk-10.0 &> /dev/null ]
|
||||
then
|
||||
echo "INFO ! dotnet-sdk-10.0 installed ... moving on."
|
||||
else
|
||||
echo " "
|
||||
echo "WARNING ! dotnet-sdk-10.0 not installed ... will install now."
|
||||
wget --no-cache --show-progress --progress=bar:force:noscroll $MS_REPO_URL -O packages-microsoft-prod.deb
|
||||
dpkg -i packages-microsoft-prod.deb
|
||||
rm packages-microsoft-prod.deb
|
||||
apt-get -y update
|
||||
apt-get install -y dotnet-sdk-10.0
|
||||
fi
|
||||
else
|
||||
echo "ERROR ! Dotnet version must be set first run"
|
||||
sleep infinity
|
||||
fi
|
||||
|
||||
# Main install & auto update.
|
||||
# Check for server files and download if needed.
|
||||
# Fallback to stable channel if VS_CHANNEL is blank
|
||||
: "${VS_CHANNEL:=stable}"
|
||||
echo "Using channel: $VS_CHANNEL"
|
||||
|
||||
# Get the currently installed version from filesystem
|
||||
CUR_V=$(find "$VS_SERVER_DIR" -name "installed-*" | cut -d - -f2-)
|
||||
echo "Current local version: '${CUR_V:-None}'"
|
||||
|
||||
# Fetch the API JSON cleanly
|
||||
API_URL="http://api.vintagestory.at/$VS_CHANNEL.json"
|
||||
JSON=$(wget -qO- "$API_URL")
|
||||
|
||||
# Validate that we actually received valid JSON
|
||||
if [ -z "$JSON" ] || ! echo "$JSON" | jq . >/dev/null 2>&1; then
|
||||
echo "Error: Failed to fetch valid JSON from $API_URL"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Resolve the target version dynamically from the JSON Object keys
|
||||
if [ ! -z "$VS_VERSION" ] && [ "$VS_VERSION" != "latest" ]; then
|
||||
# User specified an exact version. Check if it exists as a key in the object
|
||||
TARGET_VERSION=$(echo "$JSON" | jq -r --arg version "$VS_VERSION" 'if .[$version] then $version else "" end')
|
||||
if [ -z "$TARGET_VERSION" ]; then
|
||||
echo "Error: Specified version '$VS_VERSION' not found in the $VS_CHANNEL channel API."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# No version specified or "latest" chosen. Get the very first key from the object
|
||||
TARGET_VERSION=$(echo "$JSON" | jq -r 'keys_unsorted | .[0]')
|
||||
fi
|
||||
echo "Target version determined: '$TARGET_VERSION'"
|
||||
|
||||
# Compare versions and only download if they do NOT match
|
||||
if [ "$CUR_V" != "$TARGET_VERSION" ]; then
|
||||
echo "Versions differ ($CUR_V vs $TARGET_VERSION). Fetching CDN download URL..."
|
||||
# Extract the CDN download link using the valid object key structure
|
||||
VS_SERVER_FILE=$(echo "$JSON" | jq -r --arg version "$TARGET_VERSION" '.[$version].linuxserver.urls.cdn')
|
||||
if [ "$VS_SERVER_FILE" == "null" ] || [ -z "$VS_SERVER_FILE" ]; then
|
||||
echo "Error: Download URL not found for version $TARGET_VERSION"
|
||||
exit 1
|
||||
fi
|
||||
echo "Ready to download: $VS_SERVER_FILE"
|
||||
echo " "
|
||||
echo "INFO ! Cleaning old files."
|
||||
mkdir -pv $VS_SERVER_DIR/old-server-versions/
|
||||
mv $VS_SERVER_DIR/*.sh $VS_SERVER_DIR/old-server-versions/
|
||||
rm -fr $VS_SERVER_DIR/assets $VS_SERVER_DIR/Lib $VS_SERVER_DIR/Mods
|
||||
rm -fr $VS_SERVER_DIR/VintagestoryServer $VS_SERVER_DIR/*.dll $VS_SERVER_DIR/*.pdb $VS_SERVER_DIR/*.json $VS_SERVER_DIR/*.xml $VS_SERVER_DIR/*.txt $VS_SERVER_DIR/installed-*
|
||||
wget --no-cache --show-progress --progress=bar:force:noscroll $VS_SERVER_FILE -O /vstemp/vs_server_linux-x64_$TARGET_VERSION.tar.gz
|
||||
tar -xzf /vstemp/vs_server_linux-x64_$TARGET_VERSION.tar.gz -C /vstemp/files
|
||||
rm -fr /vstemp/*.tar.gz
|
||||
mv -uf /vstemp/files/* $VS_SERVER_DIR/
|
||||
chmod +x $START_FILE_1
|
||||
touch $INSTALLED_VERSION
|
||||
else
|
||||
echo "No update required. Local version matches target version."
|
||||
fi
|
||||
|
||||
echo "INFO ! Setting server path."
|
||||
sed -i -E "s|^VSPATH='/home/vintagestory/server'|VSPATH='$VS_SERVER_DIR'|" $START_FILE_1
|
||||
echo "INFO ! Setting data path."
|
||||
sed -i -E "s|^DATAPATH='/var/vintagestory/data'|DATAPATH='$VS_DATA_DIR'|" $START_FILE_1
|
||||
|
||||
# Set permissions.
|
||||
chown 99:100 -R $VS_SERVER_DIR
|
||||
chmod 776 -R $VS_SERVER_DIR
|
||||
|
||||
# Setup the server
|
||||
if [ ! -f $MARKER_FILE ]; then
|
||||
echo "First time run: Setting up server environment..."
|
||||
yes y | $VS_SERVER_DIR/server.sh setup $USERNAME $VS_DATA_DIR
|
||||
touch $MARKER_FILE
|
||||
echo "Setup successfully completed."
|
||||
fi
|
||||
|
||||
# Download the start file for the screen session
|
||||
if [ -f $START_FILE_2 ]; then
|
||||
echo "INFO ! start.sh found ... moving on."
|
||||
else
|
||||
echo "WARNING ! start.sh missing ... downloading default file."
|
||||
wget --no-cache --show-progress --progress=bar:force:noscroll $START_FILE_2 -O $VS_SERVER_DIR/start.sh
|
||||
chmod +x $VS_SERVER_DIR/start.sh
|
||||
fi
|
||||
|
||||
# Run vintage-story server.
|
||||
exec $VS_SERVER_DIR/start.sh
|
||||
|
||||
# echo " "
|
||||
# echo "INFO ! Starting vintage-story Server $VS_VERSION"
|
||||
# .$START_FILE_1 start
|
||||
|
||||
# echo "Waiting for the server log file to be created..."
|
||||
# # Loop indefinitely until the log file actually exists on disk
|
||||
# until [ -f "$LOG_FILE" ]; do
|
||||
# sleep 1
|
||||
# done
|
||||
|
||||
# echo "Log file found! Streaming server console now..."
|
||||
# # Hand off PID 1 to tail, keeping the container active permanently
|
||||
# exec tail -f "$LOG_FILE"
|
||||
|
||||
exit
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2026 fithwum
|
||||
# All rights reserved
|
||||
|
||||
LOG_FILE=/vs_server/server/data/Logs/server-main.log
|
||||
SESSION=server
|
||||
|
||||
echo "INFO ! A screen session for the Vintage-Story server is already running."
|
||||
cleanup() {
|
||||
echo "[INFO] Stopping Vintage-Story ..."
|
||||
screen -S "$SESSION" -X $SESSION "stop$(printf '\r')"
|
||||
# Wait up to 60 seconds
|
||||
for i in {1..60}; do
|
||||
if ! screen -list | grep -q "$SESSION"; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# Kill it if it's still alive
|
||||
screen -S "$SESSION" -X quit 2>/dev/null || true
|
||||
exit 0
|
||||
}
|
||||
trap cleanup SIGINT SIGTERM
|
||||
|
||||
# Start the Minecraft server in a detached screen session
|
||||
echo "INFO ! Starting Vintage-Story Server in a screen session."
|
||||
touch "$LOG_FILE"
|
||||
screen -L -Logfile "$LOG_FILE" -dmS "$SESSION" bash -c dotnet /vs_server/server/VintagestoryServer.dll --data-path /vs_server/server/data
|
||||
exec tail -F "$LOG_FILE"
|
||||
@@ -1,34 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<Container version="2">
|
||||
<Name>Vintage-Story</Name>
|
||||
<Repository>gitea.fithwum.tech/fithwum/vintage-story:server</Repository>
|
||||
<Registry>https://hub.docker.com/r/fithwum/vintage-story/</Registry>
|
||||
<Network>host</Network>
|
||||
<MyIP/>
|
||||
<Shell>sh</Shell>
|
||||
<Privileged>false</Privileged>
|
||||
<Support>https://forums.unraid.net/topic/125134-support-fithwum-vintage-story-server/</Support>
|
||||
<Project>https://www.vintagestory.at</Project>
|
||||
<ReadMe/>
|
||||
<Overview>This docker will run a Vintage-Story server.</Overview>
|
||||
<Category>GameServers:</Category>
|
||||
<WebUI/>
|
||||
<TemplateURL>https://github.com/fithwum/files-for-dockers/templates/vintage-story_server_unraid.xml</TemplateURL>
|
||||
<Icon>https://gitea.fithwum.tech/fithwum/files-for-dockers/raw/branch/master/icons/vintage-story.png</Icon>
|
||||
<ExtraParams/>
|
||||
<PostArgs/>
|
||||
<CPUset/>
|
||||
<DateInstalled>1784389857</DateInstalled>
|
||||
<DonateText>Buy me a coffee if you like.</DonateText>
|
||||
<DonateLink>https://checkout.square.site/pay/340d93c602a042b8a223a2f7c184a6a2</DonateLink>
|
||||
<Requires/>
|
||||
<Config Name="Vintage Story Release Channel" Target="VS_CHANNEL" Default="stable|unstable" Mode="" Description="Select which release channel you want to use." Type="Variable" Display="always" Required="true" Mask="false"></Config>
|
||||
<Config Name="vintage-story Version" Target="VS_VERSION" Default="" Mode="" Description="Pick your vintage-story version." Type="Variable" Display="always" Required="true" Mask="false">1.21.5</Config>
|
||||
<Config Name="Username" Target="USERNAME" Default="vintagestory" Mode="" Description="Set username." Type="Variable" Display="always" Required="true" Mask="false">fithwum</Config>
|
||||
<Config Name="Dotnet Version" Target="DOTNET_VERSION" Default="8.0|9.0|10.0" Mode="" Description="Select Dotnet version." Type="Variable" Display="always" Required="true" Mask="false"></Config>
|
||||
<Config Name="Save Data" Target="/VSserver/data/" Default="" Mode="rw" Description="Save data path" Type="Path" Display="always" Required="true" Mask="false">/mnt/user/Games/Saves/vintagestory/</Config>
|
||||
<Config Name="AppData Config Path" Target="/VSserver/server" Default="/mnt/user/appdata/vintage-story-server" Mode="rw" Description="Appdata path" Type="Path" Display="advanced-hide" Required="true" Mask="false">/mnt/user/Games/Servers/vintage-story-server</Config>
|
||||
<Config Name="Key 2" Target="PUID" Default="99" Mode="" Description="" Type="Variable" Display="advanced-hide" Required="false" Mask="false">99</Config>
|
||||
<Config Name="Key 3" Target="PGID" Default="100" Mode="" Description="" Type="Variable" Display="advanced-hide" Required="false" Mask="false">100</Config>
|
||||
<TailscaleStateDir/>
|
||||
</Container>
|
||||
Reference in New Issue
Block a user