Revision as of 15:50, 17 July 2019

This article explains how to run GeneWeb 7 as a cgi service on a home hosted webserver running on a Raspberry Pi. Finding a Linux web hosting provider that allows the flexibility needed to run GeneWeb 7 as cgi is neither easy nor cost efective. A Rasppberry Pi connected to your home internet connection is a viable alternative, in both flexibility and cost.

This tutorial assumes that you have sucessfully connected your Raspberry Pi to your home network so that it can be accessed from the internet, i.e. the outside world. This is done by a process called modem port forwarding. Specific instructions on how to do this vary according to the brand and model of your router. Do a search online - surely someone has done before.

Throughout this article, the IP address referred as 12.12.123.123, the ged file "jones.ged" and site domain name "mygeneweb.info" are meant to be examples and should be replaced as appropriate.

Start the Raspberry Pi and secure the installation by changing password for the user 'pi' and create a new password for root. Update system with sudo apt-get update and sudo apt-get upgrade. If using the latest version of Debian (Buster) the following may be required: sudo apt-get update --allow-releaseinfo-change.

Compiling GeneWeb 7

Before compiling Geneweb we need to download and install Opam, OCaml and Camlp5.

GeneWeb will process the ged file uploaded. After importing/processing the ged file, to ensure that GeneWeb 7 works correctly, keep the names of the GeneWeb database and the .gwf file, identical (example: jones.gwb and jones.gwf). If necessary, rename files manually.

Viewing the GeneWeb 7 site

On your browser type a URL with following syntax:

http://12.12.123.123/cgi-bin/gwd.sh?b=jones

Setting up a domain name

If you wish to share your database online, you will need a domain name to make your Raspberry Pi visible on the outside world.

You can use a free dynamic IP address forwarding service (such as noip.com that can provide you with a subdomain, such as http://jones.zapto.org, pointing to your Raspberry Pi's IP address. Historically, these free hosted subdomains have been harvested by trolls and are frequently bombarded with automated hacking attempts - you will soon see the Apache log files showing the intensity of these "attacks".

For this reason alone, it is advisable to register your own domain. You can register a .com, a .info or even a national domain (.fr or .de, for instance) for a few Euro per year. To register a domain, you will need to use the services of a registrar or an intermediary (such as godaddy.com). Whichever one you choose, make sure that they will allow you to set your own DNS servers for the new domain.

Register the domain using the default DNS server information. Once you have completed the domain name registration we need to set up the virtual host for that domain on the Raspberry Pi. For the purpose of this exercise, we are using the domain "mygeneweb.info".

Create the Virtual Host file for the domain. The file name has the domain name followed by a ".conf" extension.

sudo nano /etc/apache2/sites-available/mygeneweb.info.conf

Type the following text, replacing all instances of "mygeneweb.info" with your own domain name.

To have your domain name resolve to your Raspberry Pi hosted GeneWeb site, you need to map the domain name to the IP address of the Raspberry Pi. This is done through a DNS file. For security reasons, we should try to keep this information as obfuscated as possible. As such, we'll use an intermediary service - Cloudflare - between your domain name registrar and your home network where the Raspberry Pi webserver sits.

Go to Cloudflare and create an account. Choose the free plan, valid for one domain. Enter your domain name. Cloudflare will display the minimum information required for the new DNS file for your domain. On the first line starting with "Type A" click on the "points to ..." cell and change the IP number displayed with the IP address for your Raspberry Pi. Click continue to save.

DNS IMAGE

Clouldflare will now display the names of the nameservers where the information for your site resides: adrian.ns.cloudflare.com and dean.ns.cloudflare.com. Go to the site where you manage your domain name and change the nameserver information for your domain with the Cloudflare's nameservers.

On the Clouldflare site confirm that you have changed the nameserver information. Cloudflare will queue your site for verification. Once it has verified the updated nameserver information, the site will be active on Cloudflare.

Enabling encription

As we are using Cloudflare for the nameservers and as intermediary between internet users and our home Raspberry Pi webserver, the easiest way to encrypt the GeneWeb site, is to encrypt the traffic between the outside world and Cloudflare. The traffic from Cloudflare to our home server (and vice-versa) is unencrypted. Visitors to the GeneWeb site will still see the site marked with a padlock next to the URL, meaning that is encrypted.

To enable this option, log in to Cloudflare, choose your domain, click on the icon "Crypto" and on the first option "SSL", choose "Flexible" from the dropdown menu. Your site will show as encrypted.

Ctrl-X to save the file. Make sure that there are no other index.html or index.htm files in the same directory.

Your domain name should now load the GeneWeb 7 automatically!

Disclaimer: Like everything involving computers, software, programming languages and the internet, the above procedure has been tested and deemed accurate at the time of writing (July 2019). It is meant to serve as a guide and it may need to be adjusted in the future to take into account any changes to software or services offered by the third parties referred.