Skip to content

Commit

Permalink
add migrate.sh to support migrate from an existing server
Browse files Browse the repository at this point in the history
  • Loading branch information
Ericwww committed Jan 25, 2024
1 parent aaf8ef5 commit 74f1679
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,29 @@ For a more detailed list of explanations of server settings go to: [shockbyte](h
> If the `<mount_folder>/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini` is empty,
> delete the file and restart the server, a new file with content will be created.
## Migrate From Existing Server

1. Find a directory which is named by game server name and contains all saved game data, usually it will at `~/Steam/steamapps/common/PalServer/Pal/Saved/SaveGames/0/`
2. Make sure `migration/migrate.sh`, saved game data directory and mounted volume (e.g. `palworld/`) are in the same directory. Like this:
```shell
ubuntu@VM-4-5-ubuntu:~/test-pal-migrate$ ll
total 24
drwxrwxr-x 4 ubuntu ubuntu 4096 Jan 26 03:31 ./
drwxr-x--- 12 ubuntu ubuntu 4096 Jan 26 03:31 ../
drwxr-xr-x 2 ubuntu ubuntu 4096 Jan 26 03:30 74406BE1D7B54114AA5984CCF1236865/
-rw-r--r-- 1 ubuntu ubuntu 840 Jan 25 05:51 docker-compose.yml
-rw-rw-r-- 1 ubuntu ubuntu 848 Jan 26 03:31 migrate.sh
drwxrwxr-x 7 ubuntu ubuntu 4096 Jan 26 03:31 palworld/
```
3. Run `migrate.sh` like this
```shell
./migrate.sh {CONTAINER_NAME} {SERVER_NAME}
```
For example,
```shell
./migrate.sh test-pal-migrate 74406BE1D7B54114AA5984CCF1236865
```

Check failure on line 200 in README.md

View workflow job for this annotation

GitHub Actions / markdownlint

Line length

README.md:200:121 MD013/line-length Line length [Expected: 120; Actual: 138] https://github.com/DavidAnson/markdownlint/blob/v0.33.0/doc/md013.md

Check failure on line 201 in README.md

View workflow job for this annotation

GitHub Actions / markdownlint

Fenced code blocks should be surrounded by blank lines

README.md:201 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```shell"] https://github.com/DavidAnson/markdownlint/blob/v0.33.0/doc/md031.md
## Reporting Issues/Feature Requests

Issues/Feature requests can be submitted by using [this link](https://github.com/thijsvanloef/palworld-server-docker/issues/new/choose).
Expand Down
29 changes: 29 additions & 0 deletions migration/migrate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
set -e

CONTAINER_NAME=$1
MIGRATION_SERVER_NAME=$2

if [ ! -d ./"${MIGRATION_SERVER_NAME}" ]; then
echo "can not find ${MIGRATION_SERVER_NAME} dir at current dir"
exit 1
fi

if [ ! -d ./palworld ]; then
echo "can not find palworld dir at current dir"
exit 1
fi

CONTAINER_ID=$(docker ps --filter name="${CONTAINER_NAME}" --format '{{.ID}}')

echo "########## STOPPING CONTAINER ${CONTAINER_NAME} NOW ##########"
docker stop "${CONTAINER_ID}"

cp -r ./"${MIGRATION_SERVER_NAME}" ./palworld/Pal/Saved/SaveGames/0/"${MIGRATION_SERVER_NAME}"/

sed -i "s/DedicatedServerName=.*/DedicatedServerName=${MIGRATION_SERVER_NAME}/" ./palworld/Pal/Saved/Config/LinuxServer/GameUserSettings.ini

echo "########## STARTING CONTAINER ${CONTAINER_NAME} NOW ##########"
docker start "${CONTAINER_ID}"


0 comments on commit 74f1679

Please sign in to comment.