Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best practice to do online game server upgrade?

Tags:

php

mysql

upgrade

Let's say I have an online game up and running, and its version 1.0.

I keep developing on staging server and bring new features into the game. The staging server is a separate server from the live server. (I am sure most of the people do it this way)

OK. I finish the new version 1.1. Now what is the best practise to do online game server upgrade?

Let's assume it is a simple game server PHP+MYSQL. So there are new php scripts or changed scripts, and new mysql tables, columns or modified columns. I hope not to do it manually - Manually do the same changes one by one on the live server. That's ugly and easy to make mistake, and have to remember every single changes you did.

Another way I can think of is make the staging server to be live, and import all existing database data over. I don't like it, seems mistake can happen any time.

What is the best way you can recommend?

like image 253
巫妖王 Avatar asked Jan 21 '13 02:01

巫妖王


People also ask

Does a gaming server need a GPU?

Most home servers don't require a dedicated GPU, but if you're looking to use your server for gaming or other graphically intensive tasks, it's something to consider. A dedicated graphics card is necessary for CPU-intensive tasks. This includes gaming, video editing, and 3D rendering.

What game has the longest running online servers?

The Realm (the “Online” was added later) might well be the world's oldest still-operating multiplayer online role playing game (MMORPG). It was first released in late 1996, by then industry giant, Sierra Games.

What is needed for a game server?

CPU with a minimum 2.5GHZ clock speed. 8GB of RAM (16GB or more is optimal). 1TB Solid State Drive (SSD) with high read and write speeds. 64-bit Windows or Linux OS (depending on game compatibility).

How do servers work in online games?

A Realtime server starts and stops game sessions, manages game and match data, and accepts client connections. The game server maintains a synchronized game session state by receiving game state information from each client and relaying it to other clients in the game session.

Can you make a multiplayer game without paying for servers?

Yes it is possible. You'd be creating a LAN game, or need to instruct users to manually set up port forwarding on their home router. Many mobile networks (most? all?) have you behind a NAT, so only provide your phone a private IP address that isn't accessible as a server.


2 Answers

  • Version Control - Use It!
  • Migrations - Use It!

Version Control (Git)

You should have a git server on the live server, as well, as on your testing/stage server. You would make commits for changes you make, then you would "push" those commits/changes to the server. Once your test server works, you would push it to your live server.

Migrations

Most modern PHP frameworks offer this feature. Basically, you would describe your database schema within code. With Laravel, you would run: artisan migrate or something which would push the schema to your database.

With only one database and one web server you might want to stop the public from accessing them until it's updated, this is mainly for the database, and would only last a few seconds but would prevent any errors while migrating. A simple git post hook would do the trick. There is a ton of info online about this.

like image 188
Daniel Avatar answered Oct 24 '22 10:10

Daniel


Create a database upgrade script. Preferably generate one using a tool.

Build a release package for version 1.0 if you have not already done so. Build an upgrade package plus deployment script for version 1.1 which will patch your production version from 1.0 to 1.1

For inspiration on how to update an existing deployment you could look at How Wordpress upgrades:

  1. Download the upgrade package and unzip it to a temporary directory
  2. Make sure the file unzipped!
  3. Put up a "Down for maintenance" message
  4. Copy over the new files. This is a straight copy/replace. Not delete.
  5. Upgrade the database if it is not yet up to date
  6. Delete the unzipped files from the temporary directory
  7. Remove the "Down for maintenance" message
  8. Remove the OLD files. Goes through a list of deprecated and unused files and deletes them.

Recreate your production machine on your staging environment using the 1.0 release package and test the deployment of your upgrade package there until you are satisfied, before you go live.

Backup production, upgrade production.

like image 22
flup Avatar answered Oct 24 '22 08:10

flup