Skip to content
The BlitzHere server source code.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Git and Github


Git is a version control system: It tracks and keeps a history of the changes made to a directory of files on your computer. The changes can be reverted or fast forwarded as needed. Changes can be shared with collaborators, and collaborators can browse and modify files in the project and share back their changes.

The git version control system is freely available, open source, and was developed to help manage the source code of the hundreds of developers that contribute to the Linux operating system.

A more detailed introduction can can be found at the git website: Git: About Version Control.


Github is a company that hosts git repositories. The advantage of using Github to host our repositories is that it reduces the amount of administration time we have to spend hosting the service ourself, plus they have some nice value added tools for managing repositories.

About Github

Github Help

BlitzHere at Github

All the source files for building the apps, the server app, the web site, and the design and documentation are in private repositories on Github at the BlitzHere Github site.

The project repositories are split by function and their names are pretty self explanatory.

BlitzHere at Github

Blitz-Android The Android App
Blitz-Web The Website
Blitz-iOS The iOS App
Blitz-Server The Server App
Blitz-Design Documentation and design documents
Blitz-Legacy The original Java server code

Inviting new developers to the Github project

Invite a new user to the Blitz Github project here, at the Blitz Github project page

Setting up Github access on your local computer

Instructions for setting up git for Github can be found here, at the Github documentation.

Accessing the BlitzHere Server

The BlitzHere server contains all the public facing files for BlitzHere. It hosts the website, the database, and the server apps that communicate with the iOS and Android mobile apps.

The server is hosted by the Amazon AWS service: Amazon AWS.

Configuring your local computer to access the server

Access the server via ssh. The ~/.ssh/ directory on your local computer will contains these files among others, possibly:

File Name Purpose
authorized_keys Contains keys of users allowed to log in to the computer.
config Configuration file that tells ssh how to log into remote hosts.
known_hosts Signatures of known computers.
<something_rsa> Your private key file. Keep this secret and don't distribute it.
<something_rsa>.pub The corresponding public key file. This is the file you can share.

Edit your ~/.ssh/config file to make it easier to log in to the Blitz server. Add the lines below, replacing ~/.ssh/ with the name of your own private key file.

ServerAliveInterval 60

Host *blitzhere*
    User blitzhere
    IdentityFile ~/.ssh/
    Port 22

Now you should be able to access the server by typing ssh blitzhere from the command line, like this:

Clarity:Blitz-Server Edward$ ssh blitzhere
Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 3.13.0-100-generic x86_64)

 * Documentation:
 * Management:
 * Support:

  System information as of Sun Apr  2 13:38:27 PDT 2017

  System load:  0.02              Processes:           122
  Usage of /:   28.1% of 7.74GB   Users logged in:     1
  Memory usage: 9%                IP address for eth0:
  Swap usage:   0%

  Graph this data and manage this system at:

  Get cloud support with Ubuntu Advantage Cloud Guest:

0 packages can be updated.
0 updates are security updates.

Last login: Sun Apr  2 13:38:27 2017 from

Log out with the exit command:

blitzhere@blitzhere:~$ exit
Connection to closed.

Server Users and Files

There are three users on the server:

  • ubuntu
    • The super user account. In general, don't use this account. It's the master admin account.
  • sysadmin
    • The sysadmin account. This account is sudo capable and is mostly used for upgrading system software and configuring ssh, nginx, and the postgres database.
  • blitzhere
    • The is a basic, secure, regular user account that contains all the blitzhere files and the server apps run under.

Server Files

  • backups - Database backups
  • bin - The BlitzHere executable files
  • database - Database maintenance files and scripts
  • log - Server log files
  • www - The BlitzHere website files

Controlling the Server

The sc server control script

The sc command controls the server apps.

    sc  [ -f | --force ]  [ start | stop | restart | status ]  [ <server-app-name> | all ]

where <server-app-name> is one of BlitzLabs-Server, BlitzHere-Server, Status-Server. The --force option will force a server to start, stop, or restart if it isn't responding to normal server commands. When the --force option is used, the server isn't quit gracefully and some small amount of data may be lost.

The all option applies the command to all the server apps, so

   sc -f restart all

will force restart all the server apps.

Server Log Files

The server log files are found on the server in the log directory. You can use the command

    less -Rqni --follow-name +F log/BlitzLabs-Server.log

to watch the real-time status of the BlitzLabs-Server.

Building the Server App


You'll need to download and install some software on your local Mac or linux computer:

    brew install automake
    brew install autoconf
    brew install libtool
  • (All) Install the protocol buffer 2.6.1 compiler: Protocol Buffers v2.6.1.
    • Download and unzip the file.
    • Follow the instructions in the protobuf-2.6.1 file to install the files.
      • That is, cd to your protobuf-2.6.1 directory and ./, etc. etc.
  • (All) Build the objc protobuf compiler:
    git clone
    cd protobuf-objc

Building the Server

The server app is buit on your local computer and deployed to the server to run. The make utility is used to keep track of what needs to be built, how to build it, and how to deploy to the server.

In brief, clone the server project from GitHub to your local machine, cd into the directory, and make all the apps:

    git clone
    cd Blitz-Server
    git pull
    make all

make options

Make Command
make clean Remove all old intermediate build files.
make compile Compile all the server apps.
make deploy Deploy the server apps on the server.
make restart Restart the server apps.
make status Report the server status.
make all Do all of the above.

The simplest way to build and deploy the server is:

    make all

on the command line.

Multiple options can be included on the make command execution. So the command:

    make compile deploy restart

will compile the source, deploy it to the server, and restart the server app.

Server Project Files

The project contains these files:

File / Directory
Database Files for generating and controlling the database.
Protobuf Files for generating the protobuf scheme files. This readme file.
Server-Config Files for configuring ssh, nginx, etc on the server.
Staging Files staged for deployment on the server.
bin Intermediate server build files.
git-subtrees A script to pull / push git project subtrees.
makefile The file that controls the make utility.
pkg Intermediate server build files.
src The server app source files.

Server API Endpoints

The first API call to the Blitz service is the "Get Servers" call, which returns a list of server end points. Do a simple GET to and the Server.json file is returned.

The Server.json file is a JSON file that lists possible server API end points:

"format": "Servers-JSON-1",
    "apiURL":               "",
    "pushURL":                "wss://",
    "statusMessageURL":     "",
    "appUpdateURL":         ""
    "apiURL":               "",
    "pushURL":                "wss://",
    "statusMessageURL":     "",
    "appUpdateURL":         ""
    "apiURL":               "",
    "pushURL":                "wss://",
    "statusMessageURL":     "",
    "appUpdateURL":         ""

The "format": "Servers-JSON-1", key-value is the format, which you should check to make sure you're getting an expected format.

After the format, a dictionary of app identifiers is listed, each with a list of server end points. The app identifier distinguishes between various production and development environments. The app identifier com.blitzhere.blitzhere-lab2 contains our current development server end points.

The apiURL key value is the API server to which to POST protobuf (preferred) or JSON formed requests.

The pushURL key value is the web socket connection URL for chat messages.

The statusMessageURL key value is the URL of a web page that contains our current server state. The web page is suitable for showing to the user. This is not really used at the moment.

The appUpdateURL key value is the URL for iOS app to check for automatic iOS app updates.

We can add a URL for automatic Android updates too.

Server API Calls

All of the non-chat client/server messages are passed to the 'apiURL' end point.

The API calls are POSTed to the server as protobuf (or JSON) messages. The format POSTed determines the format returned: post JSON in, get JSON back.

You can’t perform that action at this time.