Skip to content

Instantly share code, notes, and snippets.

@OnniSaarni
Last active June 2, 2024 08:48
Show Gist options
  • Save OnniSaarni/a3f840cef63335212ae085a3c6c10d5c to your computer and use it in GitHub Desktop.
Save OnniSaarni/a3f840cef63335212ae085a3c6c10d5c to your computer and use it in GitHub Desktop.
SPT MPT/Fika Server With Docker Ubuntu/Debian/Raspberry Pi

Setting up Fika SPT server with docker for Ubuntu/Debian/Raspberry Pi

This guide has now moved to here https://github.com/OnniSaarni/SPT-Fika-Docker-Guide

This gist can still be used for discussion if you'd like.

Feel free to make an issue or a pull request if you'd like to contribute by expanding some sections or just otherwise contributing something to the guide.

Scripts and automated tools are welcome too if you wish to have them in the repo.

@MonstraG
Copy link

👍

@dotmaxxx
Copy link

Hey im sorry if this is dumb question but I have a problem at the command where you need to replace the path to server its saying "No such image: fika:latest". Im just getting started with docker but am i missing something that i should have downloaded? (an image in this case)

@OnniSaarni
Copy link
Author

@dotmaxxx you ran the docker build command first right?

@dotmaxxx
Copy link

@OnniSaarni yes i did i ran it once more again Im also running this command from Fika folder, i tried server and container folders too. Does it matter where i run it from or i did something wrong while building the image?

@epicylon
Copy link

Easy way to update to latest fika with this?

@MonstraG
Copy link

MonstraG commented May 16, 2024

Did the following to update, played 5-minute raid alone, seems to have worked.

server side

  1. stopped server with docker stop fika
  2. backed up mods and profiles folders in /home/dockercontainers/containers/server/user
  3. deleted old image and container with docker rm and docker rmi
  4. replaced commit and branch versions in Dockerfile:
ARG FIKA=HEAD
ARG FIKA_BRANCH=main
ARG SPT=HEAD
ARG SPT_BRANCH=master

(top commits on stable branches in both repos)

  1. rebuilt:
docker build --no-cache --label FIKA -t fika .
  1. and re-started with very long command that begins with docker run.

client side

  1. found "Upgrading from 3.8.x" in https://dev.sp-tarkov.com/SPT-AKI/Stable-releases/releases and followed those instructions
  2. installed newest fika plugin from https://github.com/project-fika/Fika-Plugin/releases

@hanuriel
Copy link

hanuriel commented May 17, 2024

@MonstraG, You saved my life. Thank you so much.

@OnniSaarni
Copy link
Author

OnniSaarni commented May 18, 2024

Sorry I didn't see the comments. I'll do some updating to this guide this weekend probably. If anyone has any feedback/changes just let me know. Also if you have anything you want to add just comment it here and I'll add it to the guide. A modding guide could be helpful if anyone has any spare time. I'll work on it later though.

@MonstraG
Copy link

I would change docker run to

docker run --pull=never -v /home/dockercontainers/containers/server:/opt/server -p 6969:6969 -p 6970:6970 -p 6971:6971 -p 6972:6972 -it --name fika --log-opt max-size=10m --log-opt max-file=3 fika

The only change is the log opt's: we aren't using Oracle, only have 20gb of storage on our server, and logs ended up growing a bit too big for our taste

@lommy7
Copy link

lommy7 commented May 23, 2024

I keep running into an error at builder 9/18 RUN git checkout HEAD^: "The following untracked working tree files would be overwritten by checkout". This error occurs during the docker build process. Do you know how I can fix this?

EDIT: Resolved by changing url from https://dev.sp-tarkov.com/SPT-AKI/Server.git to https://dev.sp-tarkov.com/SPT/Server.git

@OnniSaarni
Copy link
Author

@lommy7 Thanks for the heads up!

@OnniSaarni
Copy link
Author

Guide updated!

@MonstraG
Copy link

MonstraG commented May 24, 2024

Turns out SPT recently updated to 3.9.0, and all of my mods are for 3.8.x, so everything broke.

Changing ARG SPT_BRANCH=3.8.3

@OnniSaarni
Copy link
Author

@MonstraG I don't think 3.9.0 is out yet. At least it's not here yet https://dev.sp-tarkov.com/SPT/Stable-releases/releases

@MonstraG
Copy link

MonstraG commented May 25, 2024

According to their repo Readme, their master branch is for stable releases, and its 3.9.0 there

(although it seems that the repo is a bit old now)

@OnniSaarni
Copy link
Author

@MonstraG That's interesting...

@MonstraG
Copy link

@MonstraG That's interesting...

Sorry, readme is a bit old, not repo

@OnniSaarni
Copy link
Author

I was going to do some testing and turns out Aki_Data is now SPT_Data and also the exe name changed from Aki.Server.exe to SPT.Server.exe. Also the repository name had been changed. I'm going to update the fcpy.sh in a bit.

@lommy7
Copy link

lommy7 commented May 25, 2024

I noticed that file naming change as well when I was using the master branch for SPT but fika will state that it's not compatible with 3.9.0 during server initialization. IMO there isn't really much point in updating to 3.9.0 at this time given that no mods are compatible but when 3.9.0 goes live the guide will need an update.

@OnniSaarni
Copy link
Author

Yep. I'll have to edit the filenames once 3.9.0 comes out then.

@KavXd
Copy link

KavXd commented May 27, 2024

sorry for the newbie question, how would one go about adding mods? im using Oracle cloud service

@OnniSaarni
Copy link
Author

sorry for the newbie question, how would one go about adding mods? im using Oracle cloud service

@KavXd When you download a mod it can have a user folder or mods folder. Not all mods do have this folder but when they do you have to upload the files inside the mods folder to your server in the server/user/mods directory. BepinEx or Plugins folders go into your clients SPT installation folder. If the mod has both then you'll put the BepinEx files to the clients SPT installation and place the server/user/mods files onto the server. If you got any questions just let me know. I'll probably answer faster on Discord though.

@ahandleman
Copy link

Wrote a bash update script to help a friend of mine update his server that's configured on an Ubuntu instance running on Oracle. It stops the server, copies the mods and profiles to a backup folder (minus the fika-server mod which needs to get updated), modifies the dockerfile to use the arguments for fika_branch and spt_branch, removes the old image/container, then rebuilds the whole thing and copies mods/profiles back in.

Just copy the script into an update.sh and place it in your fika directory (same folder as the Dockerfile).

run it like this

./update.sh --fika_branch=2.1 --spt_branch=3.8.3
#!/bin/bash

# Default values
fika_branch="main"
spt_branch="master"

# Parse optional arguments
while [ $# -gt 0 ]; do
  case "$1" in
    --fika_branch=*)
      fika_branch="${1#*=}"
      ;;
    --spt_branch=*)
      spt_branch="${1#*=}"
      ;;
    *)
      echo "Invalid argument: $1"
      exit 1
  esac
  shift
done

if [ "$EUID" -ne 0 ]; then
  echo "Please run as root"
  exit 1
fi

# Print the values being used
echo "Using --fika_branch=$fika_branch"
echo "Using --spt_branch=$spt_branch"

# Stop the running server
echo "Stopping the running server..."
sudo -u dockercontainers docker stop fika

# Update Dockerfile
if [ -f Dockerfile ]; then
  echo "Updating Dockerfile..."
  sed -i "s/^ARG FIKA_BRANCH=.*/ARG FIKA_BRANCH=$fika_branch/" Dockerfile
  sed -i "s/^ARG SPT_BRANCH=.*/ARG SPT_BRANCH=$spt_branch/" Dockerfile
  echo "Dockerfile updated successfully."
else
  echo "Dockerfile not found!"
  exit 1
fi

# Back up mods and profiles folders
backup_dir="./update_backup"
echo "Backing up mods and profiles folders to $backup_dir..."
sudo -u dockercontainers mkdir -p $backup_dir
cp -rp ../server/user/mods $backup_dir/
cp -rp ../server/user/profiles $backup_dir/
rm -r $backup_dir/mods/fika-server
echo "Backup completed."

# Remove old Docker image and container
echo "Removing old Docker container and image..."
sudo -u dockercontainers docker rm fika
sudo -u dockercontainers docker rmi fika
echo "Old Docker container and image removed."

echo "Rebuilding Docker container..."
sudo -u dockercontainers docker build --no-cache --label FIKA -t fika .
echo "Docker container rebuilt."

echo "Restarting server..."
sudo -u dockercontainers docker run --pull=never -v /home/dockercontainers/containers/server:/opt/server -p 6969:6969 -p 6970:6970 -p 6971:6971 -p 6972:6972 -it --name fika --log-opt max-size=10m --log-opt max-file=3 fika
echo "Server restarted."

@OnniSaarni
Copy link
Author

@ahandleman that's really neat!

@lamduong33
Copy link

lamduong33 commented May 29, 2024

Hey guys, just wanted to say this was super helpful in setting up a Fika server on my Linux machine to let me play with my friends 24/7. I noticed that there are a lot of changes to the original gist already. Would it be beneficial for this to be a repo where we can pull code from and automatically run with any new changes?

@lommy7
Copy link

lommy7 commented May 29, 2024

@lamduong33 I'm not sure if this is exactly what you're referring to but Bude on Fika Discord in the Fika Development channel posted yesterday how he set up a git repository for his friends to be able to easily update their mods and configs based off the master. I think once the actually backend server is set up its not too bad to update with the bash script provided above (though I haven't tested it).

@OnniSaarni
Copy link
Author

OnniSaarni commented May 29, 2024

@lamduong33 I'm glad this guide helped you! I can setup something if you or other people actually want something like that. I think it's okay for now but I guess it wouldn't hurt and it also would allow commits. I might setup it tomorrow.

@ChrisyG6
Copy link

ChrisyG6 commented May 29, 2024

Would like to say a big thank-you for this guide. I've been struggling to install SPT Server to a raspberry pi running Ubuntu and this guide was super simple and I was up and running playing Co-Op with friends in uder an hour, great work, thank you :)

@VEDSetta
Copy link

What's the best Raspberry Pi model to run this on for cheap? I wanna run a 24/7 server for 4 people and the city I live in is pretty hot all the time, so I'm going to spoil the thing and get a protective case with a fan. I want to say I can run it on a Zero 2 W but I didn't see anything about different models on this page, and this'll also be my first time fiddling about with a Raspberry Pi at all, so any advice or recommendations would be greatly appreciated :3

@OnniSaarni
Copy link
Author

@VEDSetta You need to get a 64-bit Raspberry Pi. I haven't hosted this on a Raspberry Pi myself but the Fika staff/devs have said it can be done performance wise and as long as you're on 64-bit machine this guide should work. Not all Raspberry Pi machines are 64-bit though!

@ChrisyG6
Copy link

What's the best Raspberry Pi model to run this on for cheap? I wanna run a 24/7 server for 4 people and the city I live in is pretty hot all the time, so I'm going to spoil the thing and get a protective case with a fan. I want to say I can run it on a Zero 2 W but I didn't see anything about different models on this page, and this'll also be my first time fiddling about with a Raspberry Pi at all, so any advice or recommendations would be greatly appreciated :3

I'm using a Raspberry Pi 5, 64-Bit. Running Ubuntu 23.10 off an 512GB SD Card. I've had 3 friends connected to it without any in-game issues.

@HectorLeeYE
Copy link

@ChrisyG6

I'm interested in learning how to use a Raspberry pi too. For yours, how much Ram does your Raspberry Pi has, and did FIKA consume that much RAM? My understanding is that it's just a lightweight HTTP server that's being communicated with; most of the heavy computation is done on the host when the game is hosted and run.

Additionally, does the Raspberry PI heat up? Do I have to use like fans or some cooling option?

@OnniSaarni
Copy link
Author

OnniSaarni commented May 30, 2024

@HectorLeeYE yeah the server is just a pretty lightweight http server. The server should run fine on all Raspberry Pis. Excessive amounts of mods can affect performance a bit but not a lot.

@ChrisyG6
Copy link

@ChrisyG6

I'm interested in learning how to use a Raspberry pi too. For yours, how much Ram does your Raspberry Pi has, and did FIKA consume that much RAM? My understanding is that it's just a lightweight HTTP server that's being communicated with; most of the heavy computation is done on the host when the game is hosted and run.

Additionally, does the Raspberry PI heat up? Do I have to use like fans or some cooling option?

Its the Raspberry Pi 5, comes with 8GB RAM, I bought a case for it as it does get rather hot. I bought the Aluminium Passive Cooling Case Armour V5, which is silent in operation. I have it sat in the corner, out the way. The case keeps the temps moderate. The Pi is warm to the touch. Looking at the graphs it uses between 8-20% CPU and about 25% RAM. Even under load the CPU & RAM stay around the same, The CPU does spike to 60% for a secound when someone launches the game and it needs to download their data. But other than that it stays low.

Yes, so the SPT-Server is just a database, the heavy lifting is done by whoever is hosting a game. The server sends requests to the host to spawn AI for example. So whoever is hosting needs a good enough machine to support all the events happening in the raid.

@OnniSaarni
Copy link
Author

Hi everyone! I've made a repository for this guide. It's over at https://github.com/OnniSaarni/SPT-Fika-Docker-Guide Feel free to use this gist for discussion if you'd like. Also feel free to make an issue or a pull request if you have made scripts or something you think could be good to have in the repo/guide. Also if you want to add something or fix something in the guide feel free to contribute <3 !

@ChrisyG6
Copy link

I've been using Server Value Modifier [SVM] on my windows machine to make shuttle tweaks to make SPT more fun. Any idea how to import those changes into this build? Or how to get SVM installed working? Thanks.

@OnniSaarni
Copy link
Author

@ChrisyG6 I've just been downloading the server files and using SVM on my windows machine and then reuploading it to the server. You could maybe get it working with wine.

@HectorLeeYE
Copy link

@ChrisyG6
One last question for now: Did you use Port Forwarding, or did you use a VPN like ZeroTier's Linux API to manage connections?

Thanks in advance

@ChrisyG6
Copy link

@ChrisyG6 One last question for now: Did you use Port Forwarding, or did you use a VPN like ZeroTier's Linux API to manage connections?

Thanks in advance

I used port forwarding (port 6969) for the Raspberry Pi

@ChrisyG6
Copy link

ChrisyG6 commented May 31, 2024

@ChrisyG6 I've just been downloading the server files and using SVM on my windows machine and then reuploading it to the server. You could maybe get it working with wine.

Awesome, so did you copy SVM into the Mods folder on the Server? Open SVM on Windows machine, make the changes etc, then upload the Profile and Loader.json file up to the server in their relative folder names?

Can confirm (for those who need to know) this works :)

@OnniSaarni
Copy link
Author

@ChrisyG6 I've just been downloading the server files and using SVM on my windows machine and then reuploading it to the server. You could maybe get it working with wine.

Awesome, so did you copy SVM into the Mods folder on the Server? Open SVM on Windows machine, make the changes etc, then upload the Profile and Loader.json file up to the server in their relative folder names?

Can confirm (for those who need to know) this works :)

Yeah SVM goes into user/mods folder. That's how I've been using SVM. Kind of sucks having to transfer it to windows when using it but I don't edit it too often so it doesn't matter really.

@lommy7
Copy link

lommy7 commented May 31, 2024

I've noticed for SVM that you can manually edit the profile json and change the settings on the Linux machine there as long as you have that profile selected to be loaded in loader config file.

@lommy7
Copy link

lommy7 commented May 31, 2024

@HectorLeeYE I'm using Tailscale as my VPN due to the network I'm on and my friends and I haven't had any issues though ideally I'd prefer to port forward.

@HectorLeeYE
Copy link

@lommy7 I understand since port forwarding is better than VPNs mostly due to the increased speed. The issue is that my router is placed in a really inaccessible location, so I'm honestly quite lazy to get it down.

Does Tailscale only allow 3 people to connect (aka play at once)? Personal pricing states that its up to 3 users with public domains and up to 100 devices, but what does that exactly mean? Also, I assume that you used the API for TailScale since you mentioned Linux, instead of the GUI, right?

@B0d4
Copy link

B0d4 commented May 31, 2024

I installed this docker on my Ubuntu VPS, everything works great but when I want to connect with a friend for the rally there is an error. If I can not share the port in the router, how to create a network using LogMeIn Hamachi, where to enter the IP from this network since the luncher is connected to a VPS. IP Force remains or in this way it will not work? I don't have the opportunity to test yet, so I ask.

IMG_2372

@OnniSaarni
Copy link
Author

@B0d4 this is not a server issue but you'll have to port forward 25565 udp or use a VPN with your friends. You'll also have to add the windows firewall rules manually or with the tool in the Fika discord #faq. For further support please go to the #questions or #support channels.

@B0d4
Copy link

B0d4 commented Jun 1, 2024

@OnniSaarni Thanks for the answer, I created a thread on discord but it wasn't exhausted as much as I wanted. I understand everything, but how to make the server with data remain on the VPS to make progress in the cloud, but when I connect with a friend to a joint raid, how can I add it so that the game is redirected to me, but after the end we are on the VPS in the cloud? When I use this VPN, do I also open port 25565 or does it remain intact due to the VPN but the Windows firewall has been unblocked?

@OnniSaarni
Copy link
Author

@OnniSaarni Thanks for the answer, I created a thread on discord but it wasn't exhausted as much as I wanted. I understand everything, but how to make the server with data remain on the VPS to make progress in the cloud, but when I connect with a friend to a joint raid, how can I add it so that the game is redirected to me, but after the end we are on the VPS in the cloud? When I use this VPN, do I also open port 25565 or does it remain intact due to the VPN but the Windows firewall has been unblocked?

So when starting the game you set the launcher URL to your vps ip and then you're connected to the server. Now if you want to host a raid you either port forward 25565 or use a VPN like radmin and connect to your friend trough that. You also have to change your ip in the F12 Fika setting force ip to the raid hosts ip. I would recommend using the firewall fixer tool in the discord if you already haven't.

The server on the VPS handles only your hideout and stash stuff. As long as you start your game trough the launcher with the VPS ip as the URL you should be connected to the VPS server. The raids on the other hand are handled by your pc.

This is not a problem with this guide or your VPS setup if you can start the game with the url as the vps ip. For further support please go to the discord. This is a common problem among players and you'll find a solution by just doing some searching or making a support post.

@lommy7
Copy link

lommy7 commented Jun 1, 2024

@HectorLeeYE I haven't ran into issues with the 3 user limit (but only 3 people currently play on my server anyways). I will say I don't think the user limit applies for this case as hosting via tailscale is just sharing the one device from your tailnet out to your friends but I could be wrong.

@B0d4
Copy link

B0d4 commented Jun 2, 2024

@OnniSaarni I had the opportunity to test everything works very well, VPS and stores in the cloud save and the rally runs the host. Beautiful job! Now we are waiting for the entire Linux server to be able to put 🤞🏻

@HectorLeeYE
Copy link

Sorry for those who helped answer my Raspberry PI questions but I couldn't use a raspberry pi in the end as I couldn't find a coupon to get a discount on a raspberry pi from a shop in my country (Singapore) 😅

With that said, for anyone who is googling this, I can confirm that this works on a Linux VPS. That said, as I've stated (and checked by others), this server is a HTTP server. It's not that lightweight (meaning that the cheapest VPS will not allow you to get away), but the second VPS should be fine.

I've kindly attached an image to show how much RAM you generally need (You do this by running free -h in terminal. Note: If you're using a windows VPS, you might need to RDP inside as I am very sure that this command does not work inside windows cmd
** I am running a few server side mods (AI Spawning, bot brains)
NeedRamGithub

Perhaps @OnniSaarni could add a small section to your github docker repo page detailing that you'll need 1GB Minimum, and that this isn't really recommended because there could be a spike? I'll edit this comment again if there are any issues with spikes since I honestly have not tested system scalability stats according to number of players connecting

@OnniSaarni
Copy link
Author

@HectorLeeYE I would consider it pretty lightweight if it only uses 1gb of ram. Other game servers use a lot more resources. I'll probably add some minimum system requirements on the page soon. Thanks for the suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment