Difference between revisions of "CGI"
Line 90: | Line 90: | ||
It contains the following definitions: | It contains the following definitions: | ||
− | * DIR points to the {{c|gw}} folder holding the various executables files of GeneWeb. | + | * DIR points to the {{c|gw}} folder holding the various executables files of GeneWeb (see [[#The gw folder|below]]. |
* BASE_DIR points to the folder holding your genealogy bases. | * BASE_DIR points to the folder holding your genealogy bases. | ||
* OPTIONS holds the set of start parameters for '''gwd''', see [[gwd]] for details. | * OPTIONS holds the set of start parameters for '''gwd''', see [[gwd]] for details. |
Revision as of 14:58, 24 November 2016
![]() |
English • français |
---|
When daemon mode of GeneWeb is forbidden or cannot be activated, you must use CGI mode. It's mostly the case on a shared hosting account.
When running in CGI mode, GeneWeb sits behind a general purpose HTTP server such as Apache, and is launched by the server as a CGI command. As such, the first step in installing GeneWeb consists in verifying the operation of the HTTP server and of its CGI calling function.
The second step is to install GeneWeb itself in a folder organisation adapted to your environment. You must indeed Download the GeneWeb version corresponding to your machine architecture (processor, 32/64 bits, OS).
Verifying Web and CGI service
Web service is verified by displaying from a web browser the content of index.html:
(server):~#ls -al index.html -rwxr-xr-x 1 username usergroup 290 Nov 22 22:29 index.html (server):~#cat index.html <!DOCTYPE html"> <html xmlns="http://www.w3.org/1999/xhtml"> <body> This is a minimal index.html page </body> </html> (server):~#
Typing the following in your browser window:
http://my_server_address/index.html
should display
This is a minimal index.html page
CGI service is verified by executing the file test-cgi.sh
(server):~#cd cgi-bin (server):~/cgi-bin#ls -al test-cgi.sh -rwxr-xr-x 1 username usergroup 290 Nov 22 22:29 test-cgi.sh (server):~/cgi-bin#cat test-cgi.sh #!/bin/sh echo 'Content-type: text/html' echo echo '<!DOCTYPE html">' echo '<html xmlns="http://www.w3.org/1999/xhtml">' echo '<body>' echo 'This is a test for cgi commands' echo '</body>' echo '</html>' (server):~/cgi-bin#
Typing the following in your browser window:
http://my_server_address/cgi-bin/test-cgi.sh
should display
This is a test for cgi commands
Note the ownership and read/write/execute characteristics if these files. See #Access rights and protection for a more detailed analysis.
Service specific comments:
Depending on your hosting service, the location of the system root (where you end up if you execute cd
), web root and cgi-bin folders may vary!
- OVH-Webm: (Web hosting) The server and web roots are at
www
and the cgi-bin folder is atwww/cgi-bin
. - OVH-VPS: (Cloud service) The server root is at
/root
, the web root at/var/www
and the cgi-bin forlder is at/usr/lib/cgi-bin
- 1&1: The server and web roots are at
~
and the cgi-bin folder is at~/cgi-bin
(to be continued)
The cgi_bin folder
The cgi-bin
folder contains the cgi commands launching the gwd server software for each request from a browser client.
(server):~ > cd cgi-bin/
(server):~/cgi-bin > ls -al
total 144
drwxr-xr-x 3 username usergroup 4096 Oct 7 06:58 .
drwx---r-t 23 username usergroup 4096 Oct 7 06:58 ..
-rwx---r-x 1 username usergroup 183 Jan 12 2015 gwd-7.00.sh
-rwx---r-x 1 username usergroup 183 Jan 15 2015 test-cgi.sh
(server):~/cgi-bin > cat gwd-7.00
#!/bin/sh
BIN_DIR=~/gw-7.00-alpha-linux/gw
BASE_DIR=~/bases
OPTIONS="-robot_xcl 19,60 -allowed_tags ./tags.txt -hd ./"
$BIN_DIR/gwd -cgi $OPTIONS -bd $BASE_DIR > ./gwd.log 2>&1
The gwd-7.00.sh
file is a shell script that launches gwd
with the appropriate parameters:
It contains the following definitions:
- DIR points to the
gw
folder holding the various executables files of GeneWeb (see below. - BASE_DIR points to the folder holding your genealogy bases.
- OPTIONS holds the set of start parameters for gwd, see gwd for details.
You may maintain in this folder several gwd-xx.sh
files pointing to their respective DIR
location holding different versions of GeneWeb, or starting with a different set of OPTIONS
parameters.
As discussed in ???, the set of gwd start parameters can also be provided through a file named gwd.arg
sitting in the gw
forder. Note that in this file, the parameter and its value are on two separate lines.
(server):~ > cat ./gw-7.00-alpha-linux/gw/gwd.arg -cgi -bd ~/bases -hd ./ -robot_xcl 19,60 -allowed_tags ./tags.txt (server):~ >
The gw folders
Download the appropriate version of GeneWeb to your root folder. In this folder, expand the file into a GeneWeb folder:
(server):~#cd (server):~#ls -al gw-7.00-alpha-linux.tgz -rw-r--r-- 1 username usergroup 5616960 Nov 24 14:21 gw-7.00-alpha-linux.tgz gw-7.00-alpha-linux/ gw-7.00-alpha-linux/gw/ gw-7.00-alpha-linux/gw/gwd.arg gw-7.00-alpha-linux/gw/convert_hist .... gw-7.00-alpha-linux/gwsetup (server):~#ls -al gw-7.00-alpha-linux drwxr-xr-x 3 username usergroup 4096 Sep 4 2014 . drwx---r-x 10 username usergroup 4096 Nov 24 14:21 .. -rw-r--r-- 1 username usergroup 160302 Sep 4 2014 CHANGES.txt drwxr-xr-x 8 username usergroup 4096 Sep 4 2014 gw -rwxr-xr-x 1 username usergroup 64 Sep 4 2014 gwd -rwxr-xr-x 1 username usergroup 68 Sep 4 2014 gwsetup -rw-r--r-- 1 username usergroup 18007 Sep 4 2014 LICENSE.txt -rw-r--r-- 1 username usergroup 10345 Sep 4 2014 START.htm
You may rename the gw-7.00-alpha-linux
folder to any name of your choice. You may also maintain several versions of GeneWeb in different folders.
The bases folders
1&1 hosting, GeneWeb 5 and 6
(Kept here for historical reasons)
The following applies to 1&1 hosting, and may differ on other hostings. On this web site, we can easily switch between two versions of GeneWeb: 5.00 and 6.00.
Directories and files
-
mybases: The bases directory, beside the CGI-root directory.
-
root: The CGI-root directory.
basesxg: An alternative bases directory.
css: A copy of the gw/css directory. This directory is used by the Apache server.
gw: The gw directory of the GeneWeb distribution.
gwenv: The gw directory of the Geneweb-5 distribution.
igw: The images directory for Geneweb-5.
images: A directory with copies of
gw/images/gwback.jpg
andgw/images/gwlogo_bas.png
pub: A directory where are readable copies of the CGI scripts (this website is a demo site).
gw6.cgi: The CGI script which launches GenWeb-6.
gw5.cgi: The CGI script which launches GenWeb-5.
issue6.cgi: A test script which displays information about the environment of the server and checks size and md5sum for the gwd binary file.
-
issue5.cgi: The same script, but for the GeneWeb-5 version
You need the “exec” permission on the files gw/gwd
, gw/gwsetup
, and files used by gwsetup (gw/gwc*, gw/gwu,gw/consang, gw/update_nldb). The gwd.arg
file is empty.
The databases folder bases
must be protected either by a .htaccess file, either by a location out of the HTTP server scope. It does not need to be accessible by the HTTP server.
Description of the CGI script
Main parameters:
PWD=$(pwd)
LNG="fr"
GENEWEBSHARE=$PWD/gw
GENEWEBDOC=$PWD/gw/doc
GENEWEBDB=$PWD/../bases
DAEMON=$GENEWEBSHARE/gwd
LOGFILE=$GENEWEBDB/gw.log
|
The CGI working directory.
The language for the user interface.
The programs folder.
The documentation folder (obsolete).
The databases folder.
The program gwd itself.
Gwd log file, it helps to solve problems.
|
Note that although called DAEMON, gwd does not run in -daemon
mode but in -cgi
mode.
Be carefull when using a log file, its size can increase quickly, don’t forget to delete it from time to time.
OPTIONS="-blang -robot_xcl 40,70 -max_clients 15 -conn_tmout 120 -min_disp_req 30 -images_url http://myserver.net/gw/images"
# -allowed_tags $GENEWEBDB/tags.txt
cd $GENEWEBSHARE
$DAEMON -hd$GENEWEBSHARE -dd$GENEWEBDOC -bd$GENEWEBDB -lang$LNG -log$LOGFILE -cgi $OPTIONS 2>/dev/null
Misc. options:
- robot_xcl: To protect your data from HTTrack or WebSite Extractor.
- conn_tmout: For statistics on the bottom line.
- images_url: Icons and images are not sent by GeneWeb, but by your HTTP server (not CGI).
- allowed_tags: Usefull option if you use HTML tags not in default_good_tag_list.
Windows
Under Windows calling a CGI script using batch and cmd.exe can be tricky. An alternative is to directly call a copy of gwd.exe
with its arguments file gwd.arg
in Apache /cgi-bin/ directory file.
Gwd will work behind Apache calling http://localhost/cgi-bin/gwd.exe.
Edit gwd.arg
to point your local GeneWeb installation, for example if it is C:\Program Files (x86)\geneweb\
:
-hd C:\Program Files (x86)\geneweb\gw -bd C:\Program Files (x86)\geneweb\bases -log C:\Program Files (x86)\geneweb\geneweb.log -images_dir C:\Program Files (x86)\geneweb\gw\images -cgi
Problems to solve: - Portrait (all images with m=IMH) are not shown or are corrupted (#103). - Minor problems in 7.00 with loading of new .css/.js files, specialy for templm (#356).
Images missing
-images_dir
parameter create links to local image files like file:///c:\path\to\myimage.jpg
that are not shown for security reason under some browser (like Chrome for ex.). An alternative to previous configuration is to switch to -images_url
parameter so that gwd uses relatives paths for images and to create a virtual directory in your httpd server.
In gwd.arg, modify:
-images_url /images
If you use Apache, edit httpd.conf to have those lines, then restart httpd.exe:
LoadModule access_compat_module modules/mod_access_compat.so LoadModule alias_module modules/mod_alias.so Alias /images " C:\Program Files (x86)\geneweb\gw\images" <Directory " C:\Program Files (x86)\geneweb\gw\images"> Options None AllowOverride All Order allow,deny Allow from all </Directory>
An alternative installation on 1&1 (and OVH)
(OVH differences will be noted between parenthesis). (As of today (nov 23) only the OVH-VPS solution is documented).
One important thing is to understand the difference between the root of your server (where you "land" when you connect) and the Web root (where the Apache server finds your files). These two roots may or may not be the same depending on your hosting service.
- OVH
- Root:
/root
- Web root:
/var/www
- Root:
- 1&1
- (to be clarified - I dont have an account anymore)!
Installing GeneWeb on a remote shared server is a little bit (but not that much) more complex than on a personal computer. GeneWeb is a totally self-contained package, therefore does not depend on additional libraires. On a server, GeneWeb cannot execute in daemon mode (Unix aficionados will understand), and must be launched in CGI mode. To that extent, a server based installation requires prior installation of a (standard) HTTP server (typically Apache), access to the CGI repository of this server and some control over the access rights to the various folders and files. Installing or verifying your HTTP server is not part of this discussion.
A second restriction of GeneWeb on a server is that gwsetup cannot be used (mainly for security reasons). It is therefore necessary to use command lines on the remote server through a ssh
window or any other remote access tool of your choice.
It is also necessary to have access to an upload mechanism from your personal machine to the server through classical Unix/Linux command lines, or through a ftp
client such as Filezilla. A section below will describe in detail a shell script performing upload to the server of a complete fresh copy of a base sitting on your personal computer.
Folders and files
The first important file for your installation is the welcome page of your HTTP server, by default index.html
sitting at the Web root of your server (OVH: /var/www). After personalization of this welcome page, you should verify that you can view it by typing the name (or IP address) of your server in the URL window of your browser.
The second important item is the CGI folder containing the executable files invoqued through URLs.
This folder is typically called cgi-bin
and also sits at the root of your HTTP server
(OVH: /usr/lib/cgi-bin).
Another possibility (it all depends on your hosting service) is that your CGI files must have extension .cgi
, in which case, replace .sh
by .cgi
in the example below.
If cgi-bin
contains an executable file named test-cgi.sh
as shown below:
(uiserver):u723:~ > cd cgi-bin (uiserver):u723:~/cgi-bin > cat test-cgi.sh #!/bin/sh echo 'Content-type: text/html' echo echo '<!DOCTYPE html">' echo '<html xmlns="http://www.w3.org/1999/xhtml">' echo '<body>' echo 'This is a test for cgi commands' echo '</body>' echo '</html>'
Make sure this file is executable:
(uiserver):u723:~/cgi-bin > chmod 755 test-cgi.sh
and test it from your terminal window:
(uiserver):u723:~/cgi-bin >./test-cgi.sh Content-type: text/html <!DOCTYPE html"> <body> This is a test for cgi commands </body> </html> (uiserver):u723:~/cgi-bin >
then typing in the URL window of your browser the following text
your_server_name/cgi-bin/test-cgi.sh
should result in the text This is a test for cgi commands appearing in your browser window.
You must reach this level of functionality to proceed.
At the root of your server, create two additional folders GeneWeb
and Documents
.
- The first folder will contain all GeneWeb related files (binaries, bases, images, ...) and need not or should not be accessible with the HTTP server,
- The second folder will contain any other documents that you may want to share with the visitors of your site.
At this time, we have the following situation:
(uiserver):u723:~ > cd (uiserver):u723:~ > ls -al total 554088 drwx---r-t 23 u723 ftpusers 4096 Oct 7 06:58 . drwxr-xr-t 7 root root 4096 Oct 23 00:21 .. -rw------- 1 u723 ftpusers 8319 Oct 10 09:30 .bash_history drwxr-xr-x 3 u723 ftpusers 4096 Sep 24 21:24 Documents drwxr-xr-x 10 u723 ftpusers 4096 Sep 24 21:24 GeneWeb drwxr-xr-x 3 u723 ftpusers 4096 Oct 7 06:58 cgi-bin -rw-r--r-- 1 u723 ftpusers 3535 May 22 14:30 index.html -rw-r--r-- 1 u723 ftpusers 27 Nov 6 2013 robots.txt (uiserver):u723:~ >
The GeneWeb folder
The GeneWeb folder contains one or more versions of GeneWeb (geneweb-6.08
and geneweb-7.00
in our example), and the bases
folder.
Each geneweb-x.yy
folder has the same structure, containing a copy of the distribution
folder resulting from the compilation of GeneWeb. You can upload with ftp
this folder, or you can compile yourself GeneWeb directly on your server, but this necessitates the installation of Ocaml and camlp5 (see Ocaml).
(uiserver):u723:~/GeneWeb > cd geneweb-6.08 (uiserver):u723:~/GeneWeb/geneweb-6.08 > ls -al total 204 drwx---r-x 3 u723 ftpusers 82 Jan 12 2015 . drwxr-xr-x 10 u723 ftpusers 4096 Sep 24 21:24 .. -rw----r-- 1 u723 ftpusers 160302 Jan 12 2015 CHANGES.txt -rw----r-- 1 u723 ftpusers 18007 Jan 12 2015 LICENSE.txt -rw----r-- 1 u723 ftpusers 10345 Jan 12 2015 START.htm drwx---r-x 8 u723 ftpusers 4096 Dec 17 2014 gw -rw---r-x 1 u723 ftpusers 108 Dec 17 2014 gwd.command -rw---r-x 1 u723 ftpusers 1117 Dec 17 2014 gwsetup.command (uiserver):u723:~/GeneWeb/geneweb-6.08 > (uiserver):u723:~/GeneWeb/geneweb-6.08 > cd gw (uiserver):u723:~/GeneWeb/geneweb-6.08/gw > ls -al total 13268 drwx---r-x 8 u723 ftpusers 4096 Dec 17 2014 . drwx---r-x 3 u723 ftpusers 82 Jan 12 2015 .. -rw----r-- 1 u723 ftpusers 15280 Jan 12 2015 a.gwf -rwx---r-x 1 u723 ftpusers 529764 Jan 12 2015 consang drwx---r-x 12 u723 ftpusers 4096 Dec 2 2014 etc -rwx---r-x 1 u723 ftpusers 1182404 Jan 12 2015 ged2gwb -rwx---r-x 1 u723 ftpusers 1200900 Jan 12 2015 ged2gwb2 -rwx---r-x 1 u723 ftpusers 552100 Jan 12 2015 gwb2ged -rwx---r-x 1 u723 ftpusers 631844 Jan 12 2015 gwc -rwx---r-x 1 u723 ftpusers 861434 Jan 12 2015 gwc1 -rwx---r-x 1 u723 ftpusers 630084 Jan 12 2015 gwc2 -rwx---r-x 1 u723 ftpusers 2422372 Jan 12 2015 gwd -rw----r-- 1 u723 ftpusers 12 Jan 12 2015 gwd.arg -rw----r-- 1 u723 ftpusers 0 Jan 12 2015 gwd.log -rw----r-- 1 u723 ftpusers 42 Oct 10 2014 gwd.xcl -rw----r-- 1 u723 ftpusers 3851203 Jan 12 2015 gwdl.log -rwx---r-x 1 u723 ftpusers 358308 Jan 12 2015 gwsetup drwx---r-x 3 u723 ftpusers 68 Jan 3 2015 gwtp_tmp -rwx---r-x 1 u723 ftpusers 589028 Jan 12 2015 gwu drwx---r-x 3 u723 ftpusers 4096 Nov 20 2014 images drwx---r-x 2 u723 ftpusers 140 Jan 12 2015 lang drwx---r-x 2 u723 ftpusers 6 Sep 24 2014 old -rw----r-- 1 u723 ftpusers 10 Jan 12 2015 only.txt drwx---r-x 3 u723 ftpusers 33 Sep 24 2014 setup -rw----r-- 1 u723 ftpusers 104 Dec 17 2014 tags.txt -rwx---r-x 1 u723 ftpusers 497028 Jan 12 2015 update_nldb (uiserver):u723:~/GeneWeb/geneweb-6.08/gw >
The cgi folder
The cgi-bin
folder contains the cgi commands launching the gwd server software for each request from a browser client.
(uiserver):u723:~ > cd cgi-bin/ (uiserver):u723:~/cgi-bin > ls -al total 144 drwxr-xr-x 3 u723 ftpusers 4096 Oct 7 06:58 . drwx---r-t 23 u723 ftpusers 4096 Oct 7 06:58 .. lrwxrwxrwx 1 u723 ftpusers 8 Jan 12 2015 Gwd -> Gwd-7.00 -rwxr-xr-x 1 u723 ftpusers 183 Oct 10 2014 Gwd-6.08 -rwx---r-x 1 u723 ftpusers 183 Jan 12 2015 Gwd-7.00 -rwx---r-x 1 u723 ftpusers 183 Jan 15 2015 test-cgi.sh (uiserver):u723:~/cgi-bin >
Gwd
is a symbolic link to the current version of GeneWeb (7.00 in our example).
Each of the gwd-x.yy
file is a shell script that launches gwd
with the appropriate parameters:
#!/bin/sh
DIR=~/GeneWeb/geneweb-6.08/gw
BASE_DIR=~/GeneWeb/bases
OPTIONS="-robot_xcl 19,60 -allowed_tags ./tags.txt -hd ./"
cd $DIR
./gwd -cgi $OPTIONS -bd ../../bases > ./gwd.log 2>&1
To change your server to another version of GeneWeb (7.00 for instance), you should do the following:
cd cgi-bin rm -f Gwd ln -s Gwd-7.00 Gwd
The bases folder
The base folder should contain the same information structure as in the case of installation on a personal computer:
- one or several base.gwb folders.
- one or several base.gwf files.
- cnt containing access count data.
- etc containing template text files used in priority over the generic
gw/etc
files (see header). - images containing for each base photos associated with each person (
first_name.occ.last_name.jpg
). - lang containing some base specific language relates template text files (lexicon for instance).
- src containing for each base text files and image files inserted in notes with the m=SRC command.
- wiz.auth as many wizards and friends authorization files as specified for each base in their respective .gwf parameter file.
(Note that the picture on the right has been taken off a personnal computer where the bases are stored in a folder names GeneWeb-Bases
, as opposed to bases
in the remote server structure proposed here).
Some OVH specific issues
As the root and Web root are different in the OVH setup, you have to provide a mechanism for gwd to load through Apache the various style files. This mechanism is provided by creating a link between the Web root space and the root itself.
root@vps265730:/var/www# ls -al total 660 drwxr-xr-x 7 root root 4096 Sep 25 18:40 . drwxr-xr-x 12 root root 4096 Apr 16 2016 .. drwxr-xr-x 4 root root 4096 Nov 23 15:41 css_link -rw-r--r-- 1 root root 3514 Jun 23 13:19 index.html drwxr-xr-x 2 root root 4096 Apr 16 2016 private drwxr-xr-x 2 root root 4096 Apr 16 2016 public -rw-r--r-- 1 root root 27 Apr 28 2016 robot.txt root@vps265730:/var/www#
and
root@vps265730:/var/www# ls -al css_link total 20 drwxr-xr-x 4 root root 4096 Nov 23 15:41 . drwxr-xr-x 7 root root 4096 Sep 25 18:40 .. drwxr-xr-x 2 root root 4096 Nov 23 15:32 bases lrwxrwxrwx 1 root root 39 Nov 23 15:41 gw -> /root/GW/GeneWeb-7.00/gw root@vps265730:/var/www#
In order to instruct gwd to use this path to the js
and css
files, you must add in your .gwf
configuration file the following variable:
static_path=../css_link/gw/etc
Script to upload a copy of a base
(Test and report for errors or improvements are welcome.)
The script base-upload.sh
(download it) takes a base_name
as an argument, and optionally images
or src
. It uploads a fresh base on your server, or a fresh copy of the images/base
or src/base
folders. It performs the following steps:
- creates a fresh base.gw file from the base on your personal computer.
- extracts a listing of the content of
bases/images/base
bases/src/base
andbases/src/base/images
in threels-xxx.txt
files. - creates a
remote.sh
file (see below). - creates a tar file containing $BASE.gw, history remote.sh and the three
ls-*.txt
files above. - sends the tar file to the remote server.
- triggers on the remote server unfolding of the tar file and execution of
remote.sh
. The result of this remote execution should be a mail containing theremote.log
and three diff between images folders.
This procedure saves the previous folder of the base or its images and src folders with a "yyyy-mm-dd-hh:mm:ss" date tag. As time progresses, you may want to clean-up this accumulation of saves.
remote.sh for base update
The shell script below is executed on your remote server, and installs your base at the proper location (according to the overall set-up described here).
#!/bin/sh
# BASE BASES_SERVER BIN_DIR_SERVER and ADDRESS will be replaced by the appropriate values by sed
cd
DATE=$(date +"%Y-%m-%d-%T")
echo 'Error log of update for base: BASE' > ~/remote.log
echo $DATE >> ~/remote.log
# Save current version
cd BASES_SERVER 2>> ~/remote.log
if [ -d ./BASE.gwb ] # do it only if folder exists
then
mv ./BASE.gwb ./BASE-$DATE.gwb 2>> ~/remote.log
fi
# Extract new base from .tar file
tar xf ~/BASE.tar 2>> ~/remote.log
# rebuild BASE from .gw file
BIN_DIR_SERVER/gwc1 -f -o BASE BASE.gw 2>> ~/remote.log
BIN_DIR_SERVER/updnldb BASE 2>> ~/remote.log
if [ -f ./BASE-$DATE.gwb/history ] # do it only if file exists
then
cp -f ./BASE-$DATE.gwb/history ./BASE.gwb 2>> ~/remote.log
fi
if [ -f ./BASE-$DATE.gwb/forum ] # do it only if file exists
then
cp -f ./BASE-$DATE.gwb/forum ./BASE.gwb 2>> ~/remote.log
fi
# done
cd >> ~/remote.log
# Create a link to css.txt in the bases/src folder
ln -s -f ~/GeneWeb/geneweb-$VERS/gw/etc/css.txt BASES_SERVER/src/BASE/css.txt 2>> ~/remote.log
# compute diffs between server and personal computer for image folders
echo '' >> ~/remote.log
if [ -d BASES_SERVER/images/BASE ] # do it only if folder exists
then
ls BASES_SERVER/images/BASE > ./ls-personnes-serveur.txt
echo 'Personnes diff serveur vs local' >> ~/remote.log
diff ./ls-personnes-serveur.txt ./ls-personnes.txt >> ~/remote.log
else
echo "No folder BASES_SERVER/images/BASE" >> ~/remote.log
fi
echo '' >> ~/remote.log
if [ -d BASES_SERVER/src/BASE/ ] # do it only if folder exists
then
ls BASES_SERVER/src/BASE > ./ls-src-files-serveur.txt
echo 'Src files diff serveur vs local' >> ~/remote.log
diff ./ls-src-files-serveur.txt ./ls-src-files.txt >> ~/remote.log
else
echo "No folder BASES_SERVER/src/BASE" >> ~/remote.log
fi
echo '' >> ~/remote.log
if [ -d BASES_SERVER/src/BASE/images ] # do it only if folder exists
then
ls BASES_SERVER/src/BASE/images > ./ls-images-serveur.txt
echo 'Images diff serveur vs local' >> ~/remote.log
diff ./ls-images-serveur.txt ./ls-images.txt >> ~/remote.log
else
echo "No folder BASES_SERVER/src/BASE/images" >> ~/remote.log
fi
rm ./ls-*.txt
/usr/bin/mail -s 'Update error log' 'ADDRESS' < ~/remote.log
rm -f ~/remote.*
remote.sh for images or src update
The shell script below is executed on your remote server, and installs the images
or src/images
folders for your base at the proper location (according to the overall set-up described here).
Depending on the size of your images folders, and on the number of new images requiring upload, you may prefer to upload images individually with your preferred ftp
client rather than doing the bulk upload proposed here. Remember that the base upload script performs a comparison between the images folders on your personal computer and your server.
#!/bin/sh
# BASE BASES_SERVER and ADDRESS will be replaced by the appropriate values by sed
DATE=$(date +"%Y-%m-%d-%T")
if [ -e ./images.tmp ]
then
FILES="images"
rm -f ./images.tmp
fi
if [ -e ./src.tmp ]
then
FILES="src"
rm -f ./src.tmp
fi
echo "Error log of update for $FILES of base: BASE" > ~/remote.log
echo "`date`" >> ~/remote.log
# Save current version then move new version
if [ -d BASES_SERVER/$FILES/BASE ] # do it only if folder exists
then
mv BASES_SERVER/$FILES/BASE BASES_SERVER/$FILES/BASE-$DATE 2>> ~/remote.log
fi
mv ./BASE BASES_SERVER/$FILES 2>> ~/remote.log
/usr/bin/mail -s 'Update error log' 'ADDRESS' < ~/remote.log
rm -f ~/remote.*
Debugging your remote server
Debugging your remote server may be tricky, but some systematic approach and several tools will help.
- Verify first that your HTTP server works properly. This is achieved by typing
your_server_name
in the URL window of your browser which should return the content ofindex.html
. - Verify that the cgi mechanism works. This is achieved by typing
your_server_name/cgi-bin/test-cgi.sh
as seen above (see #Folders and files).
- If your server returns a "Internal server error", several hypothesis should be examined:
- Your script test-cgi.sh does not work properly. Run it directly on a terminal window by typing
./test-cgi.sh
(see #Folders and files). - Your server accepts only files with extension
.cgi
. Renametest-cgi.sh
intotest-cgi.cgi
and try again. - The first two lines returned by your test-cgi.sh script are not exactly as shown (the second one should be a blank line, Note also that "Content-type text/html\n\n" did not work in my tests).
- You also may want to verify that your "End-of-Lines" are correct for your server environment. Remember that there are three different such
EOL
encoding for Windows, Mac, and Linux!! - Examine the HTTP server log file on your server by typing:
tail ~/logs/access.logs.current
- (your environment may store access logs somewhere else, but this is the most likely place)
- Examination of the log file may give you a hint as to the nature of your problem.
- Your script test-cgi.sh does not work properly. Run it directly on a terminal window by typing
- Another typical issue is that of ownership of the various files associated with GeneWeb. In the case described here, ownership is
user
and group ownership isftpusers
. Depending on the specific method you have used to install GeneWeb, this may vary. Some discussions on the Yahoo! group forum about GeneWeb mentions geneweb for group ownership! - You may also want to look at the gwd log file if your GeneWeb server works only partially (welcome page is ok, but other pages do not work properly). This log file is specified in the gwd launch command. In our example, it sits at
$DIR/gwd.log
where $DIR depends on the specific version of GeneWeb you are currently running (see details in #The cgi folder section above). - You may end up in a situation where GeneWeb works only partially, in particular it may miss some css style sheet or JavaScript files. One way of debugging this kind of problem consists in exploring the HTML source file produced by GeneWeb (your browser offers this capability addressed to "developers"). Is such source files, you will find reference to css and JavaScript files whose source should appear in your browser if you click on the link. In case of bad configuration, you will obtain an error messages such as "File not found" or "You do not have permission"…
- Remember that some of the files needed for proper display are fetched by the HTTP server rather than by GeneWeb.
Access rights and protections
In CGI mode, gwd runs behind a standard HTTP server, typically Apache. As such, the owner of the gwd process is the owner of the HTTP server. For instance, with Apache, this owner is defined in the http.conf file and its default value is set to user: _www
and group: —www
. When running within a hosting environment, such as 1&1, you typically do not have access to this parameter. You must therefore organise the protection level of the various folders involved with GeneWeb appropriately:
- read access is usually allowed by default
- for wizards, gwd needs write access to
bases/cnt/actlog
,bases/cnt/robot
(if you have activated the -robot_xcl parameter) - and when modifications are performed, gwd needs write access to
bases/basename.lck
,bases/basename.gwd/notes_link
and tobases/basename.gwd/patches
Creating those files, and doing a sudo chown _www filename
seems to be sufficient.
Access problems are reported in the HTTP error log file, unfortunately not always available in the case of shared hosting services!!
Access to various files through your hosted HTTP server is also controlled by your hosting service and through .htaccess files spread across your folders. Managing a coherent set of .htaccess files is not trivial and error prone!! The examples below apply to Apache version 2.4 only (earlier versions have different directives!!).
Options +FollowSymLinks
should allow following symbolic links
Require all denied
prevents access to this folder to all users.
Require all granted
allows access to this folder to all users.
AllowOverride AuthConfig AuthType Basic AuthName "Username/Password required" AuthUserFile /Users/Name/SomeFolder/htfriends.auth Require valid-user
should restrict access to this folder to users supplying a valid password as defined by the htfriends.auth
file.
htpasswd /Users/Name/SomeFolder/htfriends.auth UserName
will trigger the process to add a new user to the list.
GeneWeb Manual
- Download and install GeneWeb program under GNU/Linux, Mac OS X, Microsoft Windows, FreeBSD; on Mac OS X, Linux or Windows using Docker; or in CGI mode behind a web server.
- Understand GeneWeb server, homonym, consanguinity.
Use and manage genealogical databases
- Import Gedcom
.ged
or GeneWeb.gw
files with gwsetup or in command-line. - Update datas (add/remove individuals and families), merge duplicates, type dates.
- Use wikitext syntax, macros, keyboard shortcuts.
- Clean, recover, rename, save, archive a database.
- Merge and split multiples databases.
Technical annex
- Personalize CSS, header and trailer, templates, lexicon and declension.
- Configuration file
.gwf
(for templm), wizard notes, passwords for friends/wizards and access restrictions to databases. - Add images in notes, further remarks for experts.