2021-10-23 19:07:16 +01:00
|
|
|
Updated 23 October 2021
|
2021-04-10 02:12:13 +01:00
|
|
|
|
2020-05-27 01:04:37 +01:00
|
|
|
Troggle is an application for caving expedition data management,
|
|
|
|
originally created for use on Cambridge University Caving Club (CUCC)expeditions
|
|
|
|
and licensed under the GNU Lesser General Public License.
|
2014-09-10 23:46:05 +01:00
|
|
|
|
2021-04-10 02:12:13 +01:00
|
|
|
Troggle has been forked into two projects. The original one is maintained by Aaron Curtis
|
2021-03-24 20:38:43 +00:00
|
|
|
and was used for Erebus caves. The CUCC variant uses files as the definitive data,
|
2020-05-27 01:04:37 +01:00
|
|
|
not the database and lives at http://expo.survex.com/repositories/troggle/.git/
|
2011-07-11 02:10:22 +01:00
|
|
|
|
2021-10-23 19:07:16 +01:00
|
|
|
For the server setup, see /_deploy/debian/wookey-exposerver-recipe.txt
|
2021-10-29 20:18:36 +01:00
|
|
|
and see http://expo.survex.com/handbook/troggle/serverconfig.html
|
|
|
|
|
|
|
|
Much material which was in this file has been moved to
|
|
|
|
http://expo.survex.com/handbook/troggle/serverconfig.html
|
2021-10-23 19:07:16 +01:00
|
|
|
|
2020-07-26 02:26:04 +01:00
|
|
|
See copyright notices in
|
|
|
|
http://expo.survex.com/handbook/computing/contribute.html
|
2021-10-29 20:18:36 +01:00
|
|
|
and for context see
|
|
|
|
http://expo.survex.com/handbook/computing/onlinesystems.html
|
2020-07-26 02:26:04 +01:00
|
|
|
|
2011-07-11 02:10:22 +01:00
|
|
|
Troggle setup
|
2020-05-27 01:04:37 +01:00
|
|
|
=============
|
2021-10-22 22:08:39 +01:00
|
|
|
0. read the very extensive online documentation and stop reading this README.
|
|
|
|
http://expo.survex.com/handbook/troggle/troglaptop.html
|
|
|
|
http://expo.survex.com/handbook/troggle/serverconfig.html
|
|
|
|
http://expo.survex.com/handbook/troggle/trogdangoup.html
|
|
|
|
and at troggle/debian/serversetup
|
2021-10-29 20:18:36 +01:00
|
|
|
1. set up the ssh key-exchange with the git server so you can clone troggle
|
|
|
|
http://expo.survex.com/handbook/computing/keyexchange.html
|
2021-04-10 02:12:13 +01:00
|
|
|
|
2020-05-27 01:04:37 +01:00
|
|
|
Setting up directories
|
|
|
|
----------------------
|
2021-10-29 20:18:36 +01:00
|
|
|
see http://expo.survex.com/handbook/troggle/troglaptop.html and
|
|
|
|
http://expo.survex.com/handbook/troggle/serverconfig.html
|
2020-05-27 01:04:37 +01:00
|
|
|
|
2021-05-03 22:47:57 +01:00
|
|
|
Next, you need to fill in your local settings. Copy _deploy/WSL/localsettingsWSL.py
|
2020-05-27 01:04:37 +01:00
|
|
|
to a new file called localsettings.py and edit it and settings.py to match
|
|
|
|
your machine's file locations.
|
|
|
|
Follow the instructions contained in the file to fill out your settings.
|
|
|
|
|
2021-05-03 22:47:57 +01:00
|
|
|
{ in _deploy/old/ we have these which are all very out of date:
|
|
|
|
localsettings-expo-live.py is the python2.7 settings for the server.
|
2020-05-27 01:04:37 +01:00
|
|
|
localsettingsubuntu.py
|
|
|
|
localsettingsdocker.py
|
|
|
|
localsettingswindows.py
|
|
|
|
localsettingspotatohut.py
|
|
|
|
}
|
|
|
|
|
|
|
|
Python3, Django, and Database setup
|
2011-07-11 02:10:22 +01:00
|
|
|
-----------------------------------
|
2021-05-03 22:47:57 +01:00
|
|
|
We are now using Django 2.2.19
|
2021-05-04 15:48:11 +01:00
|
|
|
We are installing with python3.7
|
2020-05-27 01:04:37 +01:00
|
|
|
|
2021-03-24 20:38:43 +00:00
|
|
|
Install Django using pip, not with apt, on your test system.
|
2021-10-29 20:18:36 +01:00
|
|
|
Conventionally on our main master expo server we install everything that we can as debian packages, not using pip.
|
2021-10-22 22:08:39 +01:00
|
|
|
|
|
|
|
[installation instructions removed - now in http://expo.survex.com/handbook/troggle/troglaptop.html ]
|
|
|
|
|
|
|
|
[venv description removed - read it in http://expo.survex.com/handbook/troggle/troglaptop.html ]
|
|
|
|
|
2020-06-18 21:50:16 +01:00
|
|
|
CSS and media files
|
|
|
|
-------------------
|
|
|
|
Temporarily we are not using the STATICFILES capability but are instead
|
|
|
|
serving css files from troggle/media/.. (see urls.py) using
|
|
|
|
view_surveys.cssfilessingle
|
|
|
|
i.e.
|
|
|
|
cssfilessingle() in core/view_surveys.py
|
2020-06-17 01:00:50 +01:00
|
|
|
|
2020-05-27 01:04:37 +01:00
|
|
|
Setting up survex
|
|
|
|
-----------------
|
2020-07-28 01:46:00 +01:00
|
|
|
You need to have survex installed as the command line tools 'cavern' is
|
2020-05-27 01:04:37 +01:00
|
|
|
used as part of the survex import process.
|
|
|
|
$ sudo apt install survex
|
|
|
|
|
|
|
|
Setting up tables and importing survey data
|
|
|
|
-------------------------------------------
|
|
|
|
Run
|
|
|
|
$ sudo python databaseReset.py
|
|
|
|
from the troggle directory will give you instructions.
|
|
|
|
|
|
|
|
[ NB Adding a new year/expedition requires adding a column to the
|
|
|
|
folk/folk.csv table - a year doesn't exist until that is done.]
|
|
|
|
|
|
|
|
Database
|
|
|
|
--------
|
|
|
|
If you want to use MySQL or Postgresql, download and install them.
|
2021-04-10 02:12:13 +01:00
|
|
|
However, you can also use Django with sqlite3
|
2020-05-27 01:04:37 +01:00
|
|
|
|
2020-05-14 19:37:46 +01:00
|
|
|
MariaDB database
|
|
|
|
----------------
|
|
|
|
Start it up with
|
|
|
|
$ sudo mysql -u -p
|
|
|
|
when it will prompt you to type in the password. Get this by reading the settings.py file in use on the server.
|
|
|
|
then
|
|
|
|
> CREATE DATABASE troggle;
|
|
|
|
> use troggle;
|
|
|
|
> exit;
|
2011-07-11 02:10:22 +01:00
|
|
|
|
2020-05-14 19:37:46 +01:00
|
|
|
Note the semicolons.
|
|
|
|
|
|
|
|
You can check the status of the db service:
|
|
|
|
$ sudo systemctl status mysql
|
|
|
|
|
|
|
|
You can start and stop the db service with
|
|
|
|
$ sudo systemctl restart mysql.service
|
|
|
|
$ sudo systemctl stop mysql.service
|
|
|
|
$ sudo systemctl start mysql.service
|
2011-07-11 02:10:22 +01:00
|
|
|
|
2021-04-16 01:56:43 +01:00
|
|
|
While logged in at a terminal session as expo on expo.survex.,com
|
|
|
|
|
|
|
|
$ mysql -h localhost -u expo -p<password>
|
|
|
|
will get you the MariasDb command prompt: https://www.hostwinds.com/guide/how-to-use-mysql-mariadb-from-command-line/
|
|
|
|
|
2021-04-25 01:48:03 +01:00
|
|
|
then (Note the SEMICOLONS !):
|
2021-04-16 01:56:43 +01:00
|
|
|
>drop database troggle;
|
|
|
|
>create database troggle;
|
|
|
|
>quit
|
|
|
|
Somewhere I have notes for the GRANT PRIVS type runes...
|
|
|
|
|
|
|
|
Ah yes:
|
|
|
|
CREATE DATABASE troggle;
|
|
|
|
GRANT ALL PRIVILEGES ON troggle.* TO 'expo'@'localhost' IDENTIFIED BY 'somepassword'; FLUSH PRIVILEGES; (at mysql root prompt)
|
|
|
|
|
|
|
|
(explained on https://chartio.com/resources/tutorials/how-to-grant-all-privileges-on-a-database-in-mysql/)
|
|
|
|
(but you need to create the database too)
|
|
|
|
|
2021-04-25 01:48:03 +01:00
|
|
|
The GRANT ALL PRIVILEGES bit requires you to logon in to MariaDB as root. sudo doesn't cut it.
|
|
|
|
these permissions are set in a different 'info' database which usually is untouched even if database troggle gets creamed.
|
|
|
|
|
|
|
|
|
|
|
|
PERMISSIONS
|
|
|
|
https://linuxize.com/post/usermod-command-in-linux/
|
|
|
|
|
|
|
|
sudo usermod -a expo www-data
|
|
|
|
adds expo to the www-data group which is what the webserver uses, and thus so the user troggle is acting as when
|
|
|
|
running live.
|
|
|
|
|
|
|
|
sudo usermod -a expo expocvs
|
|
|
|
the expocvs group is used for git & hg
|
|
|
|
|
|
|
|
all the users should bve in this group
|
2021-04-16 01:56:43 +01:00
|
|
|
|
2020-07-28 01:46:00 +01:00
|
|
|
|
2020-03-12 17:40:03 +00:00
|
|
|
Running a Troggle server with Apache
|
|
|
|
------------------------------------
|
|
|
|
Troggle also needs these aliases to be configured. These are set in
|
|
|
|
/home/expo/config/apache/expo.conf
|
|
|
|
on the expo server.
|
|
|
|
|
|
|
|
At least these need setting:
|
|
|
|
DocumentRoot /home/expo/expoweb
|
|
|
|
WSGIScriptAlias / /home/expo/troggle/wsgi.py
|
2020-03-14 20:08:44 +00:00
|
|
|
<Directory /home/expo/troggle>
|
|
|
|
<Files wsgi.py>
|
|
|
|
Require all granted
|
|
|
|
</Files>
|
|
|
|
</Directory>
|
|
|
|
|
2020-03-12 17:40:03 +00:00
|
|
|
Alias /expofiles /home/expo/expofiles
|
|
|
|
Alias /photos /home/expo/webphotos
|
|
|
|
Alias /map /home/expo/expoweb/map
|
|
|
|
Alias /javascript /usr/share/javascript
|
|
|
|
Alias /static/ /home/expo/static/
|
|
|
|
ScriptAlias /repositories /home/expo/config/apache/services/hgweb/hgweb.cgi
|
|
|
|
|
|
|
|
(The last is just for mercurial which will be remoived during 2020).
|
|
|
|
|
2020-06-06 23:03:37 +01:00
|
|
|
These two are not necessary as Django will serve these (see urls.py), but
|
2021-03-24 20:38:43 +00:00
|
|
|
it may be faster for apache to serve them first:
|
2020-06-06 23:03:37 +01:00
|
|
|
Alias /expofiles /home/expo/expofiles
|
|
|
|
Alias /static/ /home/expo/static/
|
|
|
|
|
|
|
|
|
2021-10-29 20:18:36 +01:00
|
|
|
Unlike the django "manage.py runserver" method, apache requires a restart before it will use
|
2020-03-12 17:40:03 +00:00
|
|
|
any changed files:
|
|
|
|
|
2020-07-21 02:48:41 +01:00
|
|
|
sudo service apache2 restart
|
|
|
|
|
|
|
|
Olly's comments 20 July 2020:
|
|
|
|
olly: looking at /lib/systemd/system/apache2.service suggests so
|
|
|
|
|
|
|
|
olly: ExecStart=/usr/sbin/apachectl start
|
|
|
|
olly: ExecStop=/usr/sbin/apachectl stop
|
|
|
|
olly: ExecReload=/usr/sbin/apachectl graceful
|
2020-05-27 01:04:37 +01:00
|
|
|
|
2021-10-29 20:18:36 +01:00
|
|
|
|
2020-05-27 01:04:37 +01:00
|
|
|
Experimental additions
|
|
|
|
----------------------
|
2021-04-10 02:12:13 +01:00
|
|
|
These are untried tools which help us document how troggle works.
|
2020-05-27 01:04:37 +01:00
|
|
|
|
|
|
|
pip install pygraphviz
|
|
|
|
pip install pyparsing pydot # installs fine
|
|
|
|
django extension graph_models # https://django-extensions.readthedocs.io/en/latest/graph_models.html
|