Jump to content

pveronneau

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by pveronneau

  1. Sorry to resurrect the thread, however this is the first topic Google finds on the subject.  

     

    I wanted to provide a simple method for people to manage their Linux based rAthena servers.

     

    Modern Linux systems have moved away from the old system-v-init system and have now started to use systemd.  Setting up rAthena correctly using systemd is actually very easy.

     

    For this example, I assume that you are using mysql as a database.  I also assume that you run all services (login, character and map) and the database on the same system.  

     

    The logic we want to use is as follows:

     

    Wait until the system goes multi user -> make sure networking has started -> verify the database has started -> start the login server -> start the character server -> start the map server.

     

    You need to make sure your rAthena setup is working correctly, and starts with the "./athena-start start" command before setting this up.  Be sure to stop the rAthena before setting this up.

     

     

    ** NOTE ** All these commands are done as root.

     

    Step 1 - Set your working path to the systemd services directory.

    cd /lib/systemd/system/
    

    ** Warning ** this directory may change based on your distribution!  Most use this path, however some may use a different location.  Refer to your Linux distribution documentation for the correct path.  This path should be correct for Fedora and Debian, possibly others.

     

    Step 2 - Create the service file for the login server.

    Using the editor of your choice (vi, emacs, nano) create the following file. You need to modify it to set your install path and the rathena user.

     

    rathena-login.service

    [Unit]
    Description=rAthena login server
    After=syslog.target network.target mysqld.service
    
    [Service]
    WorkingDirectory=<rAthena install directory>
    User=rathena
    ExecStart=<rAthena install directory>/login-server
    ExecReload=/bin/kill -HUP $MAINPID
    KillMode=process
    Restart=on-failure
    RestartSec=42s
    
    [Install]
    WantedBy=multi-user.target
    

    Step 3 - Create the service file for the character server

    Using the editor of your choice (vi, emacs, nano) create the following file.  You need to modify it to set your install path and the rathena user.

     

     

    rathena-char.service

    [Unit]
    Description=rAthena character server
    After=syslog.target network.target mysqld.service rathena-login.service
    
    [Service]
    WorkingDirectory=<rAthena install directory>
    User=rathena
    ExecStart=<rAthena install directory>/char-server
    ExecReload=/bin/kill -HUP $MAINPID
    KillMode=process
    Restart=on-failure
    RestartSec=42s
    
    [Install]
    WantedBy=multi-user.target
    

    Step 4 - Create the service file for the map server

    Using the editor of your choice (vi, emacs, nano) create the following file.  You need to modify it to set your install path and the rathena user.

     

     

    rathena-map.service

    [Unit]
    Description=rAthena map server
    After=syslog.target network.target mysqld.service rathena-login.service rathena-char.service
    
    [Service]
    WorkingDirectory=<rAthena install directory>
    User=rathena
    ExecStart=<rAthena install directory>/map-server
    ExecReload=/bin/kill -HUP $MAINPID
    KillMode=process
    Restart=on-failure
    RestartSec=42s
    
    [Install]
    WantedBy=multi-user.target
    

    Step 5 - Restart systemd

    systemctl daemon-reload
    

    *If you modify the service files, you need to run this step again.

     

    Step 6 - Start the services and verify they are running

    systemctl start rathena-login.service
    systemctl start rathena-char.service
    systemctl start rathena-map.service
    
    systemctl status rathena-login.service
    systemctl status rathena-char.service
    systemctl status rathena-map.service
    

    Verify each service correctly started.  If you have a failure, verify your paths in the services file and retry.

     

    Step 7 - Enable the services on boot

    ** WARNING ** Do not do this step until you have verified services are running properly in step 6.  Failure to do so *may* result in your system hanging on boot.

    systemctl enable rathena-login.service
    systemctl enable rathena-char.service
    systemctl enable rathena-map.service
    

    That's it, your now running a fully daemonized rAthena server.  With this configuration systemd will watch the services, and if they crash will automatically restart them after 42 seconds.

     

    Here are the commands to manage your server.

     

    Start the server

    systemctl start rathena-login.service
    systemctl start rathena-char.service
    systemctl start rathena-map.service
    

    Stop the server

    systemctl stop rathena-login.service
    systemctl stop rathena-char.service
    systemctl stop rathena-map.service
    

    Restart the server

    systemctl restart rathena-login.service
    systemctl restart rathena-char.service
    systemctl restart rathena-map.service
    

    Additonal notes:

     

    If you use a different database server such as Maria or PostgreSQL, be sure to change the

    After=syslog.target network.target mysqld.service
    

    Line to read

    After=syslog.target network.target mariadb.service ...
    
    or
    
    After=syslog.target network.target postgresql.service ...
    

    If you have split the servers onto different machines, you also need to modify this line to remove the load dependency.

     

    This currently will not work on CentOS!

    CentOS 6 still uses the old SystemVinit system.  CentOS 7 is rumored to have systemd support, however after the acquisition by Redhat the projects future is uncertain.  I suggest you move over to Fedora for all the new hotness, or wait for RHEL7 if you need an enterprise grade Linux distribution.

     

    If your absolutely stuck on CentOS, you need to look into writing a proper init script.  See https://blog.hazrulnizam.com/create-init-script-centos-6/ for an example on how to do this.  Knowledge of shell scripting is required.

     

    Can't I just have one service?

    Short anwser, no.

     

    rAthena runs under three process threads and need to be monitored by systemd independently.  If you ran all services under one script, process failures could not be detected/logged correctly.

    If your really lazy, I think you can do a "systemctl status rathena*" to do all three processes at once.  It just doesn't work 100% of the time.  Best practice is not to be lazy, and call all services independently.

     

    Does this work with other emulators?

    Yes, it should work just fine with Hercules and eathena.

    • Upvote 2
    • Love 1
  2. Is there a problem with SSO login using the 2013-08-07 client against the 20131112 rathena server?

     

    I can't seem to use any SSO login method.  Aka loki launcher/rolex/rocred.

     

    The client is using the following patches and the diff is done against the latest (2013-08-07aRagexe.xdiff) :

    Custom Window Title
    Disable Ragexe Filename Check
    Disable HShield
    Disable Packet Encryption
    Disable Swear Filter
    EnableDNSSupport
    Enable Multiple GRFs
    @ Bug Fix (Recommended)
    Ignore Missing File Error
    Ignore Missing Palette Error
    Increase Headgear ViewID to 5000
    Increase Zoom Out 50%
    Load ItemInfo.lua before lub
    Read Data Folder First
    Read msgstringtable.txt
    Read questid2display.txt
    Remove GM Sprites
    Skip License Screen
    Use SSO Login Packet
    Translate Client In English
    Use Normal Guild Brackets
    Use Ragnarok Icon
    eXtract MsgStringTable.txt
    eXtract txt file strings
    

    This results in a login failure, response 3, Rejected from server.

     

    I setup another executable, remove:

     

    Use SSO Login Packet

     

    Then add:

     

    Restore Login Window

    Disable 1rag1 type parameters

     

    This results in a success.  No issues whatsoever.

     

    I was wondering if it as a problem with the external authentication client sending traffic server side, but a tcpdump proves that doesn't seem to be the case.  The authentication packet arrives just fine, however the server rejects it for some reason.  

     

    Any idea on the reason behind this?

×
×
  • Create New...