- bootstrap script streamlined, removed useless functions
- added defaults to all environment variables, now they are all optional for the user - added a docker composer file - easier instructions for the free oracle cloud installation
This commit is contained in:
parent
d836ad936a
commit
a66fb3a3fb
77
README.md
77
README.md
|
|
@ -1,73 +1,34 @@
|
||||||
# pi4valheim
|
# Varmheim
|
||||||
Experimental Docker file to run a Valheim server in a Raspberry Pi4.
|
#### Valheim in Arm!
|
||||||
|
|
||||||
The valheim.Dockerfile is based on the stardart repositories of box86 and box64.
|
Experimental Docker file to run a Valheim server in aarch64
|
||||||
|
|
||||||
|
It was tested on ubuntu 20.04 aarch64 running in Oracle Cloud Always Free Tier
|
||||||
|
|
||||||
|
valheim.Dockerfile is based on the stardard repositories of box86 and box64.
|
||||||
|
|
||||||
## Compiled image:
|
## Compiled image:
|
||||||
You can find in the docker hub the image to run directly: https://hub.docker.com/repository/docker/tranko/pi4valheim
|
You can find in the docker hub the image to run directly: https://hub.docker.com/repository/docker/nosklo/varmheim
|
||||||
|
|
||||||
## Requeriments:
|
## Requeriments:
|
||||||
Raspberry Pi4: I only tested on a 8GB of RAM with the next requirements:
|
Install oracle cloud always free tier VM.Standard.A1.Flex instance
|
||||||
- [RaspianOs 64 Bits](https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2020-05-28/) updated.
|
Install docker and docker-composer
|
||||||
- Upgrade the distribution to Debian BullsEye (change the repositories to):
|
|
||||||
|
|
||||||
```
|
run it:
|
||||||
deb http://deb.debian.org/debian bullseye main contrib non-free
|
|
||||||
deb http://deb.debian.org/debian-security/ bullseye-security main contrib non-free
|
|
||||||
deb http://deb.debian.org/debian bullseye-updates main contrib non-free
|
|
||||||
```
|
|
||||||
|
|
||||||
Then run the typical upgrade of Debian:
|
$ docker-compose up -d --no-build
|
||||||
```
|
|
||||||
sudo apt update & sudo apt upgrade & sudo apt dist-upgrade
|
|
||||||
```
|
|
||||||
|
|
||||||
- Install [Podman](https://podman.io/getting-started/installation) v3.3.1 (The version that is in the Debian repository is old (3.0.1) and it does not work correctly in my case).
|
you can use environment variables to change the defaults:
|
||||||
- Install [Docker](https://docs.docker.com/engine/install/debian/) (Tested on version 20.10.9)
|
|
||||||
|
|
||||||
## Create the image (it will take around 1-2 hours)
|
|
||||||
|
|
||||||
If you use podman:
|
|
||||||
|
|
||||||
podman build -f valheim.Dockerfile
|
|
||||||
podman image tag c44a18e4e67d valheim-base:v1
|
|
||||||
|
|
||||||
If you use docker:
|
|
||||||
|
|
||||||
docker build --no-cache --tag valheim-base -f Valheim.dockerfile .
|
|
||||||
|
|
||||||
## Execute the container
|
|
||||||
|
|
||||||
### First step configure the env.world file:
|
|
||||||
|
|
||||||
This values don't be changed. Only if they change in the future:
|
|
||||||
|
|
||||||
STEAMAPPID=892970
|
|
||||||
BOX64_LD_LIBRARY_PATH=./linux64:/root/steam/linux32:$BOX64_LD_LIBRARY_PATH
|
|
||||||
BOX64_LOG=1
|
|
||||||
BOX64_TRACE_FILE=/root/valheim_data/output.log
|
|
||||||
BOX64_TRACE=1
|
|
||||||
|
|
||||||
This values are the real ones for yoru server:
|
|
||||||
|
|
||||||
PUBLIC=0 # 0 private / 1 public
|
PUBLIC=0 # 0 private / 1 public
|
||||||
PORT=2456 # Don't change if don't know what are you doing.
|
PORT=2456 # The port that you want valheim server to listen
|
||||||
NAME=YourServerName # Your amazing name of your server.
|
NAME="Docker Valheim" # Your amazing name of your server.
|
||||||
WORLD=YourWorldName # Your unique name of your world.
|
WORLD=Docker # Your unique name of your world.
|
||||||
SAVEDIR=/root/valheim_data # Where to save your data.
|
SAVEDIR=/vhsave # Where to save your data.
|
||||||
PASSWORD=YourUniquePassw0rd # You can leave blank and it will not have password
|
PASSWORD=nopassword
|
||||||
# NOT recommended for public servers.
|
|
||||||
|
|
||||||
### Second step, run the container (example with Docker):
|
|
||||||
|
|
||||||
docker run --rm --name valheim -p 2456-2457:2456-2457/udp -v /home/pi/ssd/valheim_data:/root/valheim_data:rw --env-file env.tardis valheim-base
|
## Thanks to those projects for making it possible:
|
||||||
|
|
||||||
## Considerations:
|
|
||||||
Pi4 has a limited hardware, it this is emulating x86_64 over arm64, so don't expect so high performance. It works, I didn't have any problems playing some hours.
|
|
||||||
When the game saves it freeze all connections during some seconds, take it into account!!!!! Several times it does not start correctly and fail (the emulator is not yet finished and it does not work all the times). In that cases, you need to stop the process killing the process.
|
|
||||||
|
|
||||||
## This experiment can be done for the next projects:
|
|
||||||
- [box86](https://github.com/ptitSeb/box86)
|
- [box86](https://github.com/ptitSeb/box86)
|
||||||
- [box64](https://github.com/ptitSeb/box64)
|
- [box64](https://github.com/ptitSeb/box64)
|
||||||
- [docker](docker.com)
|
- [docker](docker.com)
|
||||||
- [podman](podman.io)
|
|
||||||
|
|
|
||||||
93
bootstrap
93
bootstrap
|
|
@ -1,57 +1,27 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Get parameters function
|
|
||||||
# This function will check all the parameters
|
|
||||||
# Return:
|
|
||||||
# string: params to run the server
|
|
||||||
# int: -1 is something is wrong.
|
|
||||||
|
|
||||||
getparams() {
|
|
||||||
# Basic + default params values:
|
|
||||||
# -nographics: basic param for the valheim documentation. MANDATORY.
|
|
||||||
# -batchmode: bacic param for the valheim documentation. MANDATORY.
|
|
||||||
# -public: used the value of the param if defined, if not it will be a private server (0) MANDATORY.
|
|
||||||
# -port: used the value of the param if defined, if not it will use standard port (2456) MANDATORY.
|
|
||||||
params="-nographics -batchmode"
|
|
||||||
params="$params -public ${PUBLIC:-0}"
|
|
||||||
params="$params -port ${PORT:-2456}"
|
|
||||||
|
|
||||||
# Specific params values, if they are not defined, return error:
|
|
||||||
## Name of the server MANDATORY:
|
|
||||||
if [[ -z "${NAME}" ]]; then
|
|
||||||
echo "The variable NAME is not defined. Please, fix and run again."
|
|
||||||
return -1
|
|
||||||
else
|
|
||||||
params="$params -name ${NAME}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Name of the world MANDATORY
|
|
||||||
if [[ -z "${WORLD}" ]]; then
|
|
||||||
echo "The variable WORLD is not defined. Fixed and run again."
|
|
||||||
return -1
|
|
||||||
else
|
|
||||||
params="$params -world ${WORLD}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Save folder for the data (if not defined can run, but the world will be saved on the container, bad idea):
|
|
||||||
if [[ -z "${SAVEDIR}" ]] ; then
|
if [[ -z "${SAVEDIR}" ]] ; then
|
||||||
echo "The variable SAVEDIR is not defined. Fixed and run again."
|
SAVEDIR=/vhsave
|
||||||
return -1
|
|
||||||
else
|
|
||||||
params="$params -savedir ${SAVEDIR}"
|
|
||||||
fi
|
fi
|
||||||
|
mkdir -p "$SAVEDIR"
|
||||||
|
|
||||||
## Password for the server, if not defined, no password = free access:
|
export STEAMAPPID=${STEAMAPPID:-892970}
|
||||||
if [[ -z "${PASSWORD}" ]]; then
|
|
||||||
echo "The variable PASSWORD is not defined. Running WITHOUT password."
|
if [[ -z "${BOX64_LD_LIBRARY_PATH}" ]]; then
|
||||||
else
|
export BOX64_LD_LIBRARY_PATH="./linux64:/root/steam/linux32"
|
||||||
params="$params -password ${PASSWORD}"
|
|
||||||
fi
|
fi
|
||||||
}
|
export BOX64_LOG=${BOX64_LOG:-0}
|
||||||
|
|
||||||
|
if [[ -z "${BOX64_TRACE_FILE}" ]]; then
|
||||||
|
export BOX64_TRACE_FILE="$SAVEDIR/output.log"
|
||||||
|
fi
|
||||||
|
export BOX64_TRACE=${BOX64_TRACE:-0}
|
||||||
|
|
||||||
|
# RUN SERVER
|
||||||
|
export templdpath="${LD_LIBRARY_PATH}"
|
||||||
|
export LD_LIBRARY_PATH=./linux64:"${LD_LIBRARY_PATH}"
|
||||||
|
export SteamAppId=${STEAMAPPID}
|
||||||
|
|
||||||
# Main function
|
|
||||||
main() {
|
|
||||||
# Basic export for the BOX64 emulator
|
|
||||||
echo "##############################"
|
echo "##############################"
|
||||||
echo "Basic variables running box64:"
|
echo "Basic variables running box64:"
|
||||||
echo "BOX64_LD_LIBRARY_PATH: ${BOX64_LD_LIBRARY_PATH}"
|
echo "BOX64_LD_LIBRARY_PATH: ${BOX64_LD_LIBRARY_PATH}"
|
||||||
|
|
@ -59,23 +29,24 @@ main() {
|
||||||
echo "BOX64_TRACE_FILE: ${BOX64_TRACE_FILE}"
|
echo "BOX64_TRACE_FILE: ${BOX64_TRACE_FILE}"
|
||||||
echo "BOX64_TRACE: ${BOX64_TRACE}"
|
echo "BOX64_TRACE: ${BOX64_TRACE}"
|
||||||
echo "##############################"
|
echo "##############################"
|
||||||
|
echo "COMMAND:" box64 ./valheim_server.x86_64 -nographics -batchmode \
|
||||||
# Part of the standar code startup of the server:
|
-public "${PUBLIC:-0}" \
|
||||||
export templdpath="${LD_LIBRARY_PATH}"
|
-port "${PORT:-2456}" \
|
||||||
export LD_LIBRARY_PATH=./linux64:"${LD_LIBRARY_PATH}"
|
-name "${NAME:-Docker Valheim}" \
|
||||||
export SteamAppId=${STEAMAPPID}
|
-world "${WORLD:-Docker}" \
|
||||||
|
-savedir "${SAVEDIR}" \
|
||||||
|
-password "${PASSWORD:-nopassword}"
|
||||||
|
echo "##############################"
|
||||||
|
|
||||||
# Move to the execution folder
|
# Move to the execution folder
|
||||||
cd /root/valheim_server
|
cd /root/valheim_server
|
||||||
|
|
||||||
## Checking the final parameters to use:
|
|
||||||
echo "##############################"
|
|
||||||
echo "Final Valheim parameters to run: $params"
|
|
||||||
echo "##############################"
|
|
||||||
|
|
||||||
# Starting the server:
|
# Starting the server:
|
||||||
box64 ./valheim_server.x86_64 $params
|
box64 ./valheim_server.x86_64 -nographics -batchmode \
|
||||||
}
|
-public "${PUBLIC:-0}" \
|
||||||
|
-port "${PORT:-2456}" \
|
||||||
|
-name "${NAME:-Docker Valheim}" \
|
||||||
|
-world "${WORLD:-Docker}" \
|
||||||
|
-savedir "${SAVEDIR}" \
|
||||||
|
-password "${PASSWORD:-nopassword}"
|
||||||
|
|
||||||
getparams
|
|
||||||
main
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
---
|
||||||
|
version: "3.7"
|
||||||
|
|
||||||
|
|
||||||
|
services:
|
||||||
|
vhserver:
|
||||||
|
network_mode: host
|
||||||
|
image: "nosklo/valheim-base"
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: valheim.Dockerfile
|
||||||
|
# environment:
|
||||||
|
# NAME: New Server Name
|
||||||
|
# WORLD: ServerWorldFilename
|
||||||
|
# PASSWORD: nopassword
|
||||||
|
# SAVEDIR: /vhsave
|
||||||
|
# PUBLIC: 0
|
||||||
|
# PORT: 2456
|
||||||
|
ports:
|
||||||
|
- "2456-2457:2456-2457/udp"
|
||||||
|
volumes:
|
||||||
|
- "gameserver:/vhsave"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
gameserver:
|
||||||
11
env.world
11
env.world
|
|
@ -1,11 +0,0 @@
|
||||||
STEAMAPPID=892970
|
|
||||||
BOX64_LD_LIBRARY_PATH=./linux64:/root/steam/linux32:$BOX64_LD_LIBRARY_PATH
|
|
||||||
BOX64_LOG=1
|
|
||||||
BOX64_TRACE_FILE=/root/valheim_data/output.log
|
|
||||||
BOX64_TRACE=1
|
|
||||||
PUBLIC=0
|
|
||||||
PORT=2456
|
|
||||||
NAME=YourServerName
|
|
||||||
WORLD=YourWorldName
|
|
||||||
SAVEDIR=/root/valheim_data
|
|
||||||
PASSWORD=YourUniquePassw0rd
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
FROM debian
|
FROM ubuntu:20.04
|
||||||
|
|
||||||
LABEL maintainer="Tranko"
|
LABEL maintainer="NoskLo"
|
||||||
|
|
||||||
# Install tools required for the project
|
# Install tools required for the project
|
||||||
# Run 'docker build --no-cache .' to udpate dependencies
|
# Run 'docker build --no-cache .' to udpate dependencies
|
||||||
RUN dpkg --add-architecture armhf
|
RUN dpkg --add-architecture armhf
|
||||||
RUN apt update && apt full-upgrade -y
|
RUN apt update && apt full-upgrade -y
|
||||||
|
RUN apt install -y tzdata && apt clean
|
||||||
RUN apt install -y \
|
RUN apt install -y \
|
||||||
gcc-arm-linux-gnueabihf \
|
gcc-arm-linux-gnueabihf \
|
||||||
git \
|
git \
|
||||||
|
|
@ -14,19 +15,23 @@ RUN apt install -y \
|
||||||
python3 \
|
python3 \
|
||||||
curl \
|
curl \
|
||||||
libsdl2-2.0-0 \
|
libsdl2-2.0-0 \
|
||||||
nano
|
nano \
|
||||||
RUN apt install -y \
|
|
||||||
libc6:armhf \
|
libc6:armhf \
|
||||||
libncurses5:armhf \
|
libncurses5:armhf \
|
||||||
libstdc++6:armhf
|
libstdc++6:armhf \
|
||||||
|
&& apt clean \
|
||||||
|
&& apt purge -y wget
|
||||||
|
|
||||||
# Install the box86 to emulate x86 platform (for steamcmd cliente)
|
# Install the box86 to emulate x86 platform (for steamcmd cliente)
|
||||||
WORKDIR /root
|
WORKDIR /root
|
||||||
RUN git clone https://github.com/ptitSeb/box86
|
RUN git clone https://github.com/ptitSeb/box86 \
|
||||||
WORKDIR /root/box86/build
|
&& mkdir -p /root/box86/build \
|
||||||
RUN cmake .. -DRPI4ARM64=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
|
&& cd /root/box86/build \
|
||||||
RUN make -j4;
|
&& cmake .. -DRPI4ARM64=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||||
RUN make install
|
&& make -j4 \
|
||||||
|
&& make install \
|
||||||
|
&& cd /root \
|
||||||
|
&& rm -rf /root/box86
|
||||||
|
|
||||||
# Install steamcmd and download the valheim server:
|
# Install steamcmd and download the valheim server:
|
||||||
WORKDIR /root/steam
|
WORKDIR /root/steam
|
||||||
|
|
@ -38,16 +43,14 @@ RUN ./steamcmd.sh +@sSteamCmdForcePlatformType linux +login anonymous +force_ins
|
||||||
|
|
||||||
## Box64 installation
|
## Box64 installation
|
||||||
WORKDIR /root
|
WORKDIR /root
|
||||||
RUN git clone https://github.com/ptitSeb/box64
|
RUN git clone https://github.com/ptitSeb/box64 \
|
||||||
WORKDIR /root/box64/build
|
&& mkdir -p /root/box64/build \
|
||||||
RUN cmake .. -DRPI4ARM64=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
|
&& cd /root/box64/build \
|
||||||
RUN make -j4;
|
&& cmake .. -DRPI4ARM64=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||||
RUN make install
|
&& make -j4 \
|
||||||
|
&& make install \
|
||||||
# Cleaning the image
|
&& cd /root \
|
||||||
RUN apt-get purge -y wget
|
&& rm -rf /root/box64
|
||||||
RUN rm -r /root/box86
|
|
||||||
RUN rm -r /root/box64
|
|
||||||
|
|
||||||
# Specific for run Valheim server
|
# Specific for run Valheim server
|
||||||
EXPOSE 2456-2457/udp
|
EXPOSE 2456-2457/udp
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue