Setting up the API Linux(Debian) - DaemonForge/DayZ-UniveralApi GitHub Wiki
It is recomended to use a VPS(Virtual Private Server) as close as you can get to your servers, but if you have servers in multiple regions you can pick a place somewhere in the middle
If your provider doesn't offer VPSs or they are too expensive you can use my recommendation Vultr Referal Link For Vultr if use this link to get 100$ in credits for your first month, it also gives me 25$ in credits at the same time 👍
If you are using Vultr See the steps below on how to buy a VPS from Vultr If you are using another provider follow the steps below to install on Debian 10
- Buying a server from Vultr
- Setting up a Linux server
- Securing the Linux Server
- Installing the Database (MongoDB)
- Installing the API Service
Setting up a Linux server from Vultr(or other providers that don't have SSH enabled by default)
- If you already have access to the server via SSH skip to Setting up continued
- If you already know how to set up a Linux server just skip down to Installing MongoDB
- Add a user this way its harder for people to hack inrun
adduser dayza
and enter a secure password
- run
adduser dayz sudo
Disable root from logging in
3. nano /etc/ssh/sshd_config
edit PermitRootLogin to be no
PermitRootLogin no
- run
service sshd restart
Setting up continued
Connect to the server via putty Putty Download
Run all updates
sudo apt update && sudo apt upgrade -y
Securing your Linux server
-
sudo apt install ufw -
sudo ufw allow sshDON'T MISS THIS STEP -
sudo ufw enableenter y for yes
Installing Fail2Ban
(this is optional but recommended for larger communities that might see people trying to hack into their API)
If someone is trying to hack into it should block there IP for about 10 minutes, you can edit this in the config
sudo apt install fail2bansudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.localsudo service fail2ban restart
Installing the Database (mongodb)
(Scroll up if you need instruction on how to set up a Linux server)
If you are using a lower core or cheaper VPS I recommend skipping the installation of MongoDB and using the free Tier of Atlas
These are the steps for installing on Debian 10 if using a different operating system reference Mongo DB official Documentaion
- Install
sudo apt-get install -y gnupg sudo wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -sudo echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.4 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.listsudo apt-get updatesudo apt-get install -y mongodb-orgsudo systemctl start mongodsudo systemctl daemon-reloadsudo systemctl enable mongodsudo systemctl status mongod
Installing the API Service
sudo mkdir /var/opt/DayZWebApicd /var/opt/DayZWebApisudo wget https://github.com/daemonforge/DayZ-UniveralApi/releases/download/Latest-Linux/dayzwebservice-linuxsudo chmod +x dayzwebservice-linuxsudo nano /etc/systemd/system/DayZWebService.servicecopy and paste the below into the terminal thenctr - x
[Unit]
Description=DayZ Webservice
[Service]
ExecStart=/var/opt/DayZWebApi/dayzwebservice-linux
Restart=always
User=root
# Note Debian/Ubuntu uses 'nogroup', RHEL/Fedora uses 'nobody'
Group=nogroup
Environment=PATH=/usr/bin:/usr/local/bin
Environment=NODE_ENV=production
WorkingDirectory=/var/opt/DayZWebApi
[Install]
WantedBy=multi-user.target
sudo systemctl start DayZWebServicesudo systemctl enable DayZWebServicesudo journalctl -xe -u DayZWebService- make sure you see
API Webservice listening on port "443"! Go to https://localhost:443/For your first run you should also see the default config that was generated, you can also load this by editing it by calling sudo cat /var/opt/DayZWebApi/config.json
Open the port to the API
sudo ufw allow 443
Check your API
- reqbin.com - Change to POST and use your server
https://[SERVERIP]/Status
- if you see this then it is working!
{
"Status": "ok",
"Error": "noauth"
}