1. When making a thread, please tag your thread accordingly using the menu to the left of the textfield where you name your thread where applicable. Server Advertisements and Mod Releases should be contained to their respective subforums.

Tutorial Guide - Installing StarryPy3k on Ubuntu

Discussion in 'Multiplayer' started by zoycite, Jul 29, 2016.

  1. zoycite

    zoycite Orbital Explorer

    Alright this guide is going to assume you can already run, update, and even connect to your dedicated starbound server, but want to get the python wrapper StarryPy3k. There is not a lot of documentation to do this, so I will explain:

    For this guide my version is Ubuntu 14.04 Server Edition. This is a somewhat intermediate user guide. But if you have the capability to deploy a good working server to a Ubuntu server, then you should be able to get it working.

    STEP ONE BEFORE ANYTHING
    update all packages currently via apt-get
    Code:
    sudo apt-get update -y
    sudo apt-get upgrade -y
    
    All modern linux distros come with python installed in some form or another. Modern Ubuntu is convenient because it comes with Python 2.7 and Python 3.4. Unfortunately the version is often the main problem here... How do we get the right one? At the time of this writing Python 3.4.5 is the version that works the best. The asyncio libraries in 3.4.3 are not compatible at the time of this writing with the StarryPy3k due to changes in the library asyncio between 3.4.3 and 3.4.4. The reason you want 3.4.5 is for some of the plugins that are core to the functioning of StarryPy3k require it as well.

    So now determine what your version of python3 is, usually this is done via
    Code:
    $ python3 --version
    Python 3.4.3
    
    If you version says Python 3.4.5 you do not need to install python. congratulations, you can proceed to the install StarryPy3k step.

    STEP TWO UPDATING PYTHON
    We want to update python, but we don't want to break anything already there. So we need to create what is an alt install. You can also lookup how to do virtualenv also, but since I am hosting a dedicated server, which the purpose of it is to host the starbound server application, I went with altinstall.

    1) Install pre-requisites to build python
    Code:
    $ sudo apt-get install build-essential checkinstall
    $ sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
    
    2) Download Python 3.4.5
    Code:
    $ cd /usr/src
    $ sudo wget https://www.python.org/ftp/python/3.4.5/Python-3.4.5.tgz
    
    3) Unzip source package
    Code:
    $ sudo tar xzf Python-3.4.5.tgz
    4) Install Python
    Code:
    $ cd Python-3.4.5
    $ sudo ./configure
    $ sudo make altinstall
    
    5) Check Installed Version
    Code:
    $ python3.4 --version
    Python 3.4.5
    
    STEP THREE INSTALLING StarryPy3k
    You are going to need git to install this.

    PREREQUISITE: Install git.
    Code:
    $ sudo apt-get install git
    
    1) Change to your home directory (or alternatively a place to install StarryPy3k)
    Code:
    $ cd
    
    2) Clone the git repo
    For the Latest committed Developmental/Developer Version (i.e. 1.0 compatible) but could be unstable
    Code:
    $ git clone https://github.com/kharidiron/StarryPy3k.git
    
    3) You need to modify some server configuration but most importantly the StarryPy3k config. Make sure your config.json matches the contents of config.json below in code section:
    Code:
    $ cd StarryPy3k/config
    $ cp config.json.default config.json
    
    Contents of: config.json:
    {
        "listen_port": 21025,
        "min_cache_size": 16,
        "packet_reap_time": 600,
        "plugin_path": "./plugins",
        "plugins": {},
        "upstream_host": "localhost",
        "upstream_port": 21024
    }
    
    4) We are going to assume that you are by default hosting your dedicated starbound server right now on on port 21025 which is the default. So StarryPy3k Needs to be hosted on that port, so make sure you are using that for the listen_port. The upstream_port is going to be the new port for your starbound server to run on. You will want to implement a firewall to prevent incoming connections on the new actual starbound server port (that is the upstream port), to prevent people from bypassing your wrapper. However doing so is well beyond the scope of this guide as the default Ubuntu 14.04 Server install does not ship with a firewall.

    Connections to the server will be like this:
    Code:
    
    Internet Player ->     (Firewall)     ->    StarryPy3k     ->   starbound_server
                                                     Port: 21025           Port: 21024
    
    Make sure your Firewall is blocking the upstream port to outside connections. You could have a dedicated box for this or not. If you do not implement some form of firewall to the upstream port people can just bypass all the server wrapper and the server wrapper will be unable to tell if the user connected directly on the port is connected; therefore cannot ban them.
    
    5) Ok so step 4) really important. It is the hard part. The easy part is updating the starbound game server port in the starbound config.
    Code:
    - Stop your starbound server
    $ cd /path/to/your/server/storage
    for me this is: /home/starbound/server/storage
    
    edit the file and change:
    "gameServerPort" : 21025,
    to
    "gameServerPort" : 21024,
    
    - Start your server
    
    6) if you have done everything correctly at this point if you try to connect to your starbound server you should NOT be able to connect to it, because StarryPy3k is not running. So...
    Code:
    Change to the StarryPy3k install directory you got via git earlier
    
    $ cd /home/starbound/StarryPy3k
    $ python3.4 server.py
    
    7) That should be it. If you get errors it is possible you do not have the right verison of StarryPy3k or it is unstable. But this should get you pretty far in the install process. Hopefully once there is a released version for 1.0 we don't need to use unstable developer commits, but such is life. Enjoy.
     
    Last edited: Jul 30, 2016
  2. Gadgetroch

    Gadgetroch Void-Bound Voyager

    Compatible 1.0 starbound ? I can't execute command when i launch it.
     
  3. zoycite

    zoycite Orbital Explorer

    You had to run it once for it populate the config file, then you have to get your uuid either from the database it creates or the log file the first time you log in using the wrapper. Set this as the owner_id field in the config.json. You have to shut down the server any time you manually change the config.json file.

    Definitely have it working from a straight clone of the repo on ubuntu 14.04 and python 3.4.5; so yoursetup must be notas described in the post or you have missed a step
     
  4. AntithezX

    AntithezX Yeah, You!

    I didn't find if we can add commands for motd, starting items,etc...in this starrypy3k version . The config.json file contains just some basics settings
     
  5. mattmonkey24

    mattmonkey24 Void-Bound Voyager

    This is a good beginning tutorial.

    I was considering writing one including how to make a systemd unit to run starbound on start and help manage it, but I ran into a roadblock myself.

    kharidiron, iirc, actually recommends Python 3.5, i've been using it with no problems I actually have 3.5.2 . It's also recommended to use a python environment for starrypy3k so that you can make changes and download new modules without affecting your main python install
     
  6. ReNNoN

    ReNNoN Void-Bound Voyager

    Hi,

    how to activate plugins? for example: planet protection, and others.

    where i can see a list of commands for StarryPy3k?

    thanks
     
  7. Sprvrn

    Sprvrn Title Not Found

    Here's a list of commands: https://github.com/StarryPy/StarryPy3k/blob/master/Chat Commands.md

    I have a similar question though: how can i set the /claims plugin to work for every user (new users include)?

    thanks

    edit: i figured it out, but i'm not sure that a "clean way": i removed all "role=Registered," in the @Command() in claims.py
    not very handy if there's a new version of the file, but it works...
     
    Last edited: Oct 2, 2016

Share This Page