Page 1 of 2

Backing up, updating, and preserving custom settings

Posted: Fri Aug 29, 2014 12:49 am
by Irako
What is the most efficient and safe way of going about updating a server, while saving all character data and edits made to settings.lua, map_darkstar.conf, etc? Is there a way to backup everything in case something terrible happens? Apologies if this info has been posted elsewhere, I just want to make sure I'm doing it correctly so I don't go butchering my server.

thanks in advance.

Re: Backing up, updating, and preserving custom settings

Posted: Fri Aug 29, 2014 2:12 am
by kjLotus
fork the dsp repo on git and make a branch

Re: Backing up, updating, and preserving custom settings

Posted: Fri Aug 29, 2014 6:14 am
by xelloss
Also use File History or a sync program to keep a copy of the DS server files somewhere else, esp. when you are testing offline.

For updating the SQL, I use a PS script to combine all sql into one huge sql file and then just batch add it with Navi:

Code: Select all

## Preprocessing ##

# Setup variables
$SQLTEMP = "path\to\temp"
New-Item -ItemType directory $SQLTEMP -force
$SEHOME = "\path\to\darkstar\root\folder"
$SQLHOME = "\path\to\darkstar\sql\folder"
$SQLLIST = Get-ChildItem -Path $SQLHOME -Exclude *account*,auction_house.sql,blacklist.sql,*char_*,chars.sql,delivery_box.sql,linkshells.sql
$DATE = (Get-Date).ToString("yyyyMMdd")
$NFN = "$date-AIO.sql"

## Processing ##

# Move files
foreach ($file in $SQLLIST)
{
    $CopyPath = Join-Path $SQLTEMP $file.FullName.Substring($SQLHOME.length)
    Copy-Item $file.FullName -Destination $CopyPath
}

# Combine files for upload
New-Item -ItemType file "$SEHOME\$NFN" –force
Get-Content $SQLTEMP\*.sql | Out-File $SEHOME\$NFN
Remove-Item -Recurse -Force $SQLTEMP
This code will create a temporary working folder at $SQLTEMP and delete it when finished, $SEHOME can be whatever you want really I just put it in the same location as darkstar ( this will be where the combined sql is output ), and $SQLHOME is where the darkstar sql files are located. The output file will be with date, you can modify the code to add timestamps as well if you are doing multiple per day.

You will still have to see if a table is changed that is excluded in your update script though, and update it manually to prevent loss of character data while preserving game integrity.



Use your own custom SQL batch files to update server regards; for example Server IP in Zone and any custom modifications ( ie I have a lot of item mods shifted around, rather than update item_basic, item_mods, etc by hand each time I just let them get overwritten and reapply my 'patch' custom sql file ). Esp. useful for quick changing music in zones during festivities, the sql for that is posted elsewhere on the forum.

Re: Backing up, updating, and preserving custom settings

Posted: Fri Aug 29, 2014 10:52 am
by Irako
xelloss wrote:Also use File History or a sync program to keep a copy of the DS server files somewhere else, esp. when you are testing offline.

For updating the SQL, I use a PS script to combine all sql into one huge sql file and then just batch add it with Navi:
So if I'm understanding correctly, you use a sync program (any recommendations?) to backup all the server files before updating, then pull with Git, then use that script to update all sql files at once?

I think what I'm most unclear on is the Git side of things as I'm new to it and to running a server in general. Luckily, I have a test server I can experiment with before I go and make changes to the play server. I'll go try this out and if I run into any issues I'll post again.

Re: Backing up, updating, and preserving custom settings

Posted: Fri Aug 29, 2014 12:03 pm
by atom0s
Upgrading the repository for the source files:
- If you do not make any source changes to your personal server, just git pull the latest repo to overwrite all the source files.
- If you do make changes to the source, stash your changes before you pull to keep them. Then reapply your stash. (http://git-scm.com/book/en/Git-Tools-Stashing)
- Once done, recompile all 3 servers.

Upgrading the MySQL database:
- Always create a backup before performing an update just in case. You can use mysqldump (which comes with the server software) to backup the database from the command line.
- Determine what has changed since the last time you updated, I typically do this manually by looking at the commit log. Also looking at the file change dates.
- Force update all non-player SQL tables entirely since they contain no sensitive data (unless you alter things for custom changes).
- Manually update character data tables by hand if the columns have changed etc.

The following tables contain sensitive data that you should be updating manually:
- accounts.sql
- accounts_banned.sql
- auction_house
- blacklist
- char_* (Anything that starts with char_)
- chars
- delivery_box
- linkshells
- server_variables (Can keep if you want certain things to retain after an update.)
- zone_settings (Can keep if you want to not have to deal with fixing the IP address each update. But be sure to check if any columns have changed.)

Tools I use when I do this process:
- git / TortoiseGit
- MySQL Workbench
- mysqldump
- Notepad++

Re: Backing up, updating, and preserving custom settings

Posted: Fri Aug 29, 2014 12:13 pm
by xelloss
I don't use a backup process for updates, I use a backup process because your hardware will eventually fail, it is not a question of if but of when.

Git will always allow you to start fresh, so there is no real need for a backup of a majority of the files. As a version control system, you can fork your own developments off the master branch and allow GIT to update / revise them without any additionally 3rd party sync programs.

Sync programs let you specify which files you want saved elsewhere, often times without using non-native software on clients. I have a license for GoodSync Server which supports a crapload of protocols and delivery systems, but you may not want to spend the money on something with that kind of featureset. That's why I also brought up File History; Windows itself has a simple version control tool so if you're just worried about stuff getting overwritten and you don't want to learn GIT's features you can just point File History to the configuration folders you're running DarkStar from and configure the update periodicity to whatever you're comfortable with. If you screw up or an update goes bad just revert as needed.

Of course, File History is not an indepth solution nor is it a backup solution. If you already have DropBox or MediaFire or something similar you could also use that to sync your files in the event your machine goes down, provided that you don't already have some other backup solution in place ( you do, right? ) or you don't want to sign up for a GIT account and maintain the files for your fork that way in case your machine takes a dump.

Re: Backing up, updating, and preserving custom settings

Posted: Mon Sep 01, 2014 10:19 am
by Irako
Thanks for the info guys.

I decided getting familiar with git would probably be my best bet, so I decided to start from scratch with my test server. After some trial and error, I think I have the gist of it down, but there are things I'm still uncertain about.

So far I've:
- Forked the dsp repo on github.
- Cloned the fork onto my machine and made a branch.
- Made custom edits to some of the files.
- Comitted those changes, and pushed them to my fork.

Am I doing this correctly? Should I be cloning my fork or the actual dsp repo, or does it matter? I feel like I am either missing something or just making things too complicated for myself. Any and all advice is appreciated.

Re: Backing up, updating, and preserving custom settings

Posted: Mon Sep 01, 2014 2:52 pm
by kjLotus
so far so good, the next steps you have to take are:
- pulling changes from dsp to your fork (master branch)
- merging the changes from master to your branch

and that should take care of everything

Re: Backing up, updating, and preserving custom settings

Posted: Sat Oct 18, 2014 2:13 pm
by Silverwolf
How do you fork the dsp repo on github?

Re: Backing up, updating, and preserving custom settings

Posted: Sat Oct 18, 2014 2:24 pm
by kjLotus