Altitude Game: Forums

Altitude Game: Forums (http://altitudegame.com/forums/index.php)
-   Dedicated Server (http://altitudegame.com/forums/forumdisplay.php?f=7)
-   -   VPS (Virtual Private Server) Guide (http://altitudegame.com/forums/showthread.php?t=1547)

nesnl 11-06-2009 01:29 AM

VPS (Virtual Private Server) Guide
 
Here is my guide to setting up an Altitude Server (or multiple servers) on a VPS (Virtual Private Server). I don't really know all the intricate details about all of this stuff, so if anyone has anything to add or amend (or just flat out tell me I am wrong) then please do so. I will gladly amend the post to make it as accurate as possible. Also, Lam/Karl feel free just to edit it if you notice something that is wrong or if you want to include something else.

First, a VPS is something that costs money. So if you want to set up an Altitude Server using this method, unless you have access to a free VPS, it is going to cost a monthly fee. These fees can range from as little as a few dollars a month to some that are very expensive. Obviously, there is going to be different quality services. So just because you find a VPS service for 1.99/month doesn't mean that it is going to be the most reliable nor the best option and just because something costs 50.00/ month doesn't mean it is going to fit your needs the best. There are tons of VPS companies out there and a wide variety of options and locations. I recommend just searching on Google and then looking for reviews of various companies. There are VPS companies all over the world as well, so consider where the servers are located when selecting one as it will impact the ping the players have to the server.

A VPS can have many different operating systems, but I recommend using on that uses Linux as it is very easy to use. However, I am sure that a VPS that utilizes Windows will work as well.

Here is a link to a post that Karl made about different VPS companies he has dealt with. It is by no means a comprehensive list of VPS companies and if you are serious about this I would recommend doing some research before signing up for any specific company.

http://altitudegame.com/forums/showp...88&postcount=2

Next, you will need to know how to access your VPS host and be able to upload files, change server configurations, start and stop your servers, etc. To do this you will need two types of programs. You will need a terminal program in order to connect to the server using a SSH (Secure Shell). You will also need an SFTP (Secure File Transfer Protocol) program in order to transfer your files. Here is some links to programs that are free and can be used for these purposes.

Windows:

SSH - Putty - http://www.chiark.greenend.org.uk/~sgtatham/putty/
STFP - WinSCP - http://winscp.net/eng/index.php

Mac:

SSH - Terminal (this comes installed on a Mac and is located in the /Applications/Utilities folder)
SFTP - Cyberduck - http://cyberduck.ch/

Once you sign up for a VPS host you will either pick or be assigned a username and password. Both those, along with the VPS IP address, will be needed in order to connect to the server with the SSH program as well as the SFTP program.

Using the SFTP program should be fairly simple as most are drag and drop. Simple set up your program with the correct IP, Username and Password and then connect. Now, you will need a copy of Altitude to put on the server, but it needs to be one that runs on that specific operating system. That means if you have a Linux VPS then you need to get a copy of Altitude for Linux. Visit: http://altitudegame.com/download.html and make sure you get the correct copy of the game. If you download the Linux version of Altitude it is going to be Altitude.sh. Now drag and drop that file into your VPS using the SFTP program.

Next, using your terminal program you are going to connect to your VPS. This is done by typing: ssh username@xxx.xxx.xxx.xxx (where the xs are the ip address of your server and username is your specific username). You will be prompted for your password. Enter this and you are now logged into your VPS. Next, assuming you are using a Linux VPS, and are looking to install the Altitude Game (and have already transferred the installer onto the server using the SFTP program), type:

Code:

./Altitude.sh -c
This will then install Altitude onto the VPS using the downloaded installer you just transfered onto it.

You should be able to refresh your SFTP session and see the full game inside a folder named "Altitude" on your server. This is similar to the one that is installed on your own computer. This is also where you will need to transfer all your maps that you want the server to run by placing them into the "Maps" folder.

Now that Altitude is installed on the VPS you are going to learn how to start and stop your servers as well as specify what servers to run. First, open the Server Configurator program which is located in the Altitude folder on your LOCAL machine. Using this program is fairly simple and it allows you to add as many servers as you want to run at the same time. The quality of the VPS service you choose will dictate how many servers you can run at the same time and how many bots you can have in each server. Bots currently take up a lot of memory to run, so it is probably best to keep them to a minimum if used at all. Once you have set up all the servers you want in the Server Configurator then Exit and Save the file. On your local machine will be a new file: /Altitude/servers/launcher_config.xml. This file contains all the information about the servers you are going to run. Copy this file onto your VPS using the SFTP program by dragging and dropping it into the servers folder. Anytime you want to update the servers config file, open the server configurator on your local machine and make any changes you want and then overwrite the file on your VPS by dragging and dropping it into the servers folder using your SFTP program. To run the servers with the new file you must then stop your servers and restart them.

In order to start your servers you will need to run a shell script. Open a text document and copy and paste this into the text file and save it as: start_servers.sh (the important part is the sh, you can name it whatever you want otherwise):

Code:

#!/bin/bash
PRGDIR=`dirname "$0"`
cd ${PRGDIR}/altitude
./server_launcher > /dev/null 2>&1 &
ps ax --width=1000 | grep "[D]em.launch.path=launch-server-launcher.xml" | awk '{printf $1}' > server_launcher.pid
echo >> server_launcher.pid
exit 0

Now, drag and drop this file using your SFTP program into the same directory that the "Altitude" folder is located (note: not in the Altitude directory but along side it). To run the servers you are going to do the commands you did to install the Altitude game. Go to your SSH terminal and type:

Code:

./start_servers.sh
This will now run the script that will start your servers.

In order to stop your servers you will need to do it in the SSH terminal as well. Note that you will need to stop your servers every time you update the server config file. Once you are logged in using the SSH terminal type: ps ux (which means Process Status for all process owned by a specific user). This will then show a list of all the currently running processes. Assuming you are running servers you will see it on a list. The list will look something like this:

Code:

[username@vpsip ~]$ ps ux
USER ----- PID  %CPU  %MEM  VSZ  RSS TTY  STAT  START  TIME  COMMAND
username 1364 0.0 0.1 9888 1664 ? S 22:38 0:00 sshd: username@pts/0
username 1365 0.0 0.1 3612 1504 pts/0 Ss+ 22:38 0:00 -bash
username 10118 0.0 0.1 3560 1252 ? S 22:17 0:00 /bin/sh ./server_launcher
username 10129 1.2 9.7 284700 102740 ? Sl 22:17 0:31 /home/username/altitude/jre/bin/java -server -Dinstall4j.jvmDir=/home/username/altitude/jre -Dexe4j.moduleName=/home/username/altitude/server_launcher -Xms64M -Xmx128M -Djava.library.path=native -Dem.launch.path
username 26281 0.0 0.1 9888 1656 ? S 22:58 0:00 sshd: username@pts/1
username 26283 0.0 0.1 3608 1484 pts/1 Ss 22:58 0:00 -bash
username 28226 0.0 0.0 2432 916 pts/1 R+ 23:00 0:00 ps ux

The important column is the one that has the heading "PID" (which stands for Process Identification). You are going to use that PID to stop your servers. The process that is your server is the one that says "/home/username/altitude/jre/bin/java..." So you look at that line and then look at its PID. Then in the SSH terminal type:

Code:

kill <PID>
(where <PID> is the number from the list that ps ux gave you). Note that this number changes each time you launch the servers. So it might be 1023 one time and then 23789 the next time (or any number. In the example given the number is 10129. So you would type: kill 10129). So each time you want to stop the servers you need to type ps ux first and then get the correct PID number.

This pretty much covers the basics of setting up and running Altitude servers using a VPS service provider. I am sure someone with more knowledge on the subject could be more in depth, but this is all I know. Again, if you see errors or things that should be added, please let me know.

-Maimer

argonide 11-06-2009 07:44 AM

Thanks maimer, I was wondering how to install altitude without a gui. Here's a lazier shell script for your troubles: (not tested as is but it was from something else so it should work)

Code:

#! /bin/sh

case "$1" in
      start)
              cd <path to altitude dir>
              ./server_launcher > /dev/null 2>&1 &
              echo $! > /var/run/altitude.pid
                ;;
      stop)
                pid=`cat /var/run/altitude.pid`
                kill $pid
              ;;     
        restart)
              pid=`cat /var/run/altitude.pid`
              kill $pid
              cd <path to altitude dir>
              ./server_launcher > /dev/null 2>&1 &
              echo $! > /var/run/altitude.pid
              ;;
esac
exit 0


judas 12-09-2009 08:13 PM

This guide helped me a lot. I didn't get that start script to work though.
The thing is i installed altitute to "/altitude"

So when i want to start the server i fire up putty in ssh and enter

"/altitude/server_launcher"

This works fine but when i exit putty, the server also closes as the "console" exits. Is there a way i can run my server_launcher as a service?

I didnt install like the install said in /opt ect and didnt use symlinks (because I dont know what they are).

I havent used linux for ages so im no good with any console commands :)

Logisticz 12-11-2009 02:49 PM

Thanks alot for that well written guide - i have only one major problem

I have an VPS without any GUI interface, so i cant start the server tool in any way :(

and we, from blacksun-gaming.de clan want to setup several servers and maybe go into the league...

can anyone help me with that issue? i would really appreciate it.

thanks alot in advance
Gretingzzzzzzzzzz
Logi

nesnl 12-11-2009 02:55 PM

Logisticz,

Assuming your VPS uses linux, the instructions on how to launch the server launcher are explained in this guide. Look at the part written about the shell script and hopefully it will make sense. If not, tell me what you are having a problem with and hopefully someone can help you.

Logisticz 12-11-2009 06:25 PM

Quote:

Originally Posted by nesnl (Post 25061)
Logisticz,

Assuming your VPS uses linux, the instructions on how to launch the server launcher are explained in this guide. Look at the part written about the shell script and hopefully it will make sense. If not, tell me what you are having a problem with and hopefully someone can help you.

shame on me - i hestiated when i read it :D

thanks alot mate!
works fine as its meant to be ;)

mutra 12-17-2009 07:30 PM

Could you provide more help with the Terminal way of setting up a VPS?

Thanks the rest was a lot of help, I just think it would be easier to do it through Terminal. ( I have a mac)

Swiftee 01-04-2010 12:31 PM

I was wondering how much bandwidth a 18 slot busy server would roughly use on a VPS, Most have 500-1000mb bandwidth limit.

Karl 01-04-2010 06:48 PM

2-3KB/s for each user.

So (i think i did this correctly):
3KB/s * 18 * 2629743seconds/month=
(3 (KB / s)) * 18 * (2 629 743 s) = 135.427591 gigabytes/month

so assuming all 18 slots were always occupied you would need 135GB/month of bandwidth... but it would most like be something like 18 slots are occupied 25% or less of the time so you really only need like 30GB/month of bandwidth.

Swiftee 01-04-2010 07:36 PM

ah thats really good then

gren00b 01-31-2010 04:49 PM

I was looking at vpslink.com, for like $6.62 per month they offer:
2.5 GB of Disk Space
100GB Bandwith
64MB of RAM

I'm planning to use primarily with my friends or if I get into a clan, so I don't think it'll ever exceed 100GB, and obviously Altitude isn't more than 2.5GB, but my concern is with the RAM--does an Altitude server need more than that or will that be enough?

Edit: I just read another thread and it appears as though 64MB will not be nearly enough. :(

Varonth 01-31-2010 06:20 PM

I would also like to mention that theres no need to upload the altitude installer via SFTP.

Code:

wget http://installer.altitudegame.com/0.0.1/altitude.sh
will do the same thing, just a way faster, and without blocking your internet connection.
Wget will download the file from the given source..

TRUEPAiN 02-04-2010 09:27 PM

If anyone does get a vps. Be sure it has close to 512 Mbs of ram. You need about 256 to execute the installer. Then running a server it pushes a little above 300. 1 gb would probably be ideal. Dedicated servers would be better but vps does the job just fine I suppose.

phong 02-13-2010 07:16 PM

I find it's easier to just run altitude in it's own screen session. Helpful for debugging and such.

York 04-09-2010 09:21 PM

Quote:

Originally Posted by nesnl (Post 19836)
Code:

./Altitude.sh -c
This will then install Altitude onto the VPS using the downloaded installer you just transfered onto it.

and i i didnt use linux?

York 04-09-2010 09:54 PM

-bash: ./start_servers.sh: Permission denied



what is that?!?!?!

nobodyhome 04-09-2010 10:26 PM

try typing:

chmod u+x ./start_servers.sh

basically i think that in unix files are not "runnable" (executable) by default, and the above command changes it for that file.

York 04-09-2010 11:10 PM

I put my entire altitude folder into my SFTP.
I put my launcher_config.xml into my SFTP.
I put my start_server.sh into my SFTP.

I am now lost.

TRUEPAiN 04-10-2010 08:41 AM

You're using putty right?

I think the command is..

Code:

wget http://installer.altitudegame.com/0.0.1/altitude.sh
wget will download a file into whatever directory you're in or viewing..

after that execute the installer

then setup your configs, upload your maps, etc.

After that execute the server_launcher, let it update, then check the server list for your IP.

If it doesn't work, post a log and the forum peeps can help you with their helpfulness.

^_^


<3

nesnl 04-10-2010 09:23 AM

Quote:

Originally Posted by York (Post 45939)
I put my entire altitude folder into my SFTP.
I put my launcher_config.xml into my SFTP.
I put my start_server.sh into my SFTP.

I am now lost.

It sounds like you might be trying to move an already installed version of Altitude (for maybe windows or mac) and then putting it on a Linux machine. Just get the linux installer and then install it fresh on the machine.

York 04-10-2010 12:53 PM

:p:o:rolleyes:

Yea it was already installed onto my computer. I just dragged my folder over.

So re-download Alitude as Linux, Altitude.sh.

Then drag just that over?

Also, I am using Cyberduck and Terminal.

Then run the download command?

nesnl 04-10-2010 03:16 PM

Quote:

Originally Posted by York (Post 46033)
:p:o:rolleyes:

Yea it was already installed onto my computer. I just dragged my folder over.

So re-download Alitude as Linux, Altitude.sh.

Then drag just that over?

Also, I am using Cyberduck and Terminal.

Then run the download command?

Well you don't need to run the download command if you already downloaded the linux installer and copied it over using your SFTP. All you need to do is install it once you copy over the installer, which is outlined in this guide.

York 04-10-2010 04:39 PM

I will take a screen shot of what I have in the SFTP

ofna01 08-05-2010 11:57 PM

Hey,guys,im trying to put up a server,but it keeps saying my server is behind a firewall.i looked at the page for this,did what it said,and it still displays the same message.Any ideas? :confused:

Cider 09-14-2010 02:46 AM

Thanks for this guide, worked like a charm.

Jordonak 11-14-2012 02:51 PM

Thanks for the advice, helped me a lot of your advice!


All times are GMT. The time now is 12:55 AM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
2008 Nimbly Games LLC