Apache and Ring Server

Apache ASF logo (by Apache Software Foundation (ASF). Licensed under Apache License 2.0 via Wikimedia Commons - https://commons.wikimedia.org/wiki/File:ASF-logo.svg#/media/File:ASF-logo.svg)

Now we have the MiniSeed files on the SD card, we would like to be able to access them easily. We will use two different servers to show the data.

One is a SeedLink server using Ring Server. This can be used to directly see the data within an application.

The other is a simple http file server using Apache. This can be accessed by any web browser to save the MiniSeed files to your computer.

Ring Server

First we must download the uncompiled package from IRIS. You can probably download the most recent version, but if it doesn't work use the one from 26 September - 269. Then unpack the file, using the command (once in the directory of the file):

tar xvzf ringserver-2014.269.tar.gz

Although if you are using a different version change the date to that. Then we must compile it, use the command in the unpacked directory:

make

Now wait as this will take a while. Once it has finished we need to make a file for the configuration, called 'ring.conf'. I would download the file in the Github project file, as it takes a while to write all the options out, putting it in the unpacked directory. Although then change the very last option — 'MSeedScan ...'. The second part, what should be at the moment 'piseis/mseed', to the directory where the MiniSeed files are written (this may be the correct already). Then save that.

Next we must make a couple of directories. In the unpacked directory make a folder called 'ringserver_store', in this new folder make two more, 'ring' and 'tlog'.

Finally we should make two shell scripts, for starting and stopping the server. This can be done with commands, but using scripts allows for log files which is very useful. You can download these from the Github project. If you want to write these out, just fill the files with the correct code, then change the permissions of them so you can execute them, using the command:

chmod 755 start_ringserver.sh

And also for stop, by just changing the filename (note you can also replace the 755 by a+x if you want).

Now the ring server is finished, so it should look like below:

ChangeLog  doc  libmseed  Makefile  mxml  pcre  README  ring.conf  ringserver  ringserver_store  src  start_ringserver.sh  stop_ringserver.sh

Check you have all these files, if you have extra, such as 'ring.conf~' then don't worry it doesn't matter. Otherwise the Ring Server is finished.

Apache

First we must install it, use the command:

sudo apt-get install apache2

Accept any messages with 'Y'. Note you need Internet to do this. Next go to the directory '/etc/apache2/sites-available/'. Then edit the file: '000-default.conf' (or it may be called 'default.conf') with any text editor, to change the line starting 'DocumentRoot', to change the '/var/www/html' to the directory of the MiniSeed files (e.g. '~/piseis/mseed'). Then just restart Apache to use your new configuration with:

sudo service apache2 restart

You may get an error about 'ServerName' but don't worry about that.

Starting the servers

Apache should already be running, so if you use the command 'ifconfig', and find 'inet addr', the number (like 192.168.x.x) after, this is the IP address, this is an identifier on the network for the computer. You can access the files from any other computer by typing in that number to the address bar, but the computer must be on the same Wi-Fi network. Write the this number down as we will need to use it elsewwhere.

We can start Ring Server next; go to its directory and run the command:

./start_ringserver.sh

If you want to check this is running fine, run the command: 'ps -ef'. Look for './ringserver ring.conf' in the right column, if it is there, it is running fine. Otherwise go into the ringserver directory, then 'log' and read the 'ringserver.log' file to diagnose it.

Otherwise it is all ready to read data. All we now need to do is run the python program, so go the location, e.g. '~/piseis/'. I would first comment out any print commands, as this slows the program down a lot. Then use the command:

nohup python2 seis5.py &

Replacing the 'seis5.py' with whatever you called it. The 'nohup' will allow you to logout if you want, and keeps the output in a file.'&' backgrounds the process.

Reading data

You probably now want to read the data, this can easily be done with a program called SeisGram2k. We will use Ver. 7.0, and a school version. Download SeisGram2k. You can use this on a separate computer, as long as it has Java. On a Linux distro, such as Ubuntu or on a Raspberry Pi, from the terminal, type:

java -jar SeisGram2K70_SCHOOL.jar

Then go to: File...Open SeedLink. In the first box type in the IP address of the Raspberry Pi we got earlier (similar to 192.168.x.x), then ':18000' (i.e. 192.168.2.10:18000). The rest we fill from the stats of our python code. Mine are: UK, RASPI, 00, BHZ. And if you didn't change anything in the stats, then they will be the same. You can leave the windows length and options, so just click open. You should now be able to see the seismic activity.

The other option is to save the data from the http server (Apache), then open it with the same program, instead going File...Select File, and locating the saved file. This won't instantly update though, so isn't as useful.

Next steps... other tasks, programs and programming

This concludes the programming but you may want to look at the following: