summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam <sam@wenhams.co.uk>2019-02-26 19:19:01 +0000
committerSam <sam@wenhams.co.uk>2019-02-26 19:19:01 +0000
commit7e1aa80551004c88bccc599cf807f67904976589 (patch)
treed063f0fddafe26abf2dda6454bc0046e50a48dd1
parent0afb21a09313cb6786b9a790a749b5ff51287866 (diff)
downloadtroggle-7e1aa80551004c88bccc599cf807f67904976589.tar.gz
troggle-7e1aa80551004c88bccc599cf807f67904976589.tar.bz2
troggle-7e1aa80551004c88bccc599cf807f67904976589.zip
Add docker readme, settings and update compose file
Fix views_logbooks.py
-rw-r--r--core/views_logbooks.py8
-rw-r--r--docker/README.md81
-rw-r--r--docker/docker-compose.yml4
-rw-r--r--localsettingsdocker.py65
4 files changed, 152 insertions, 6 deletions
diff --git a/core/views_logbooks.py b/core/views_logbooks.py
index 5ecb792..9fcc3eb 100644
--- a/core/views_logbooks.py
+++ b/core/views_logbooks.py
@@ -77,11 +77,11 @@ def expedition(request, expeditionname):
message = ""
if "reload" in request.GET:
- message = LoadLogbookForExpedition(expedition)
- return render_with_context(request,'expedition.html', {'expedition': expedition, 'expeditions':expeditions, 'personexpeditiondays':personexpeditiondays, 'message':message, 'settings':settings, 'dateditems': dateditems })
+ message = LoadLogbookForExpedition(this_expedition)
+ return render_with_context(request,'expedition.html', {'expedition': this_expedition, 'expeditions':expeditions, 'personexpeditiondays':personexpeditiondays, 'message':message, 'settings':settings, 'dateditems': dateditems })
- def get_absolute_url(self):
- return ('expedition', (expedition.year))
+def get_absolute_url(self):
+ return ('expedition', (expedition.year))
class ExpeditionListView(ListView):
diff --git a/docker/README.md b/docker/README.md
new file mode 100644
index 0000000..86028fd
--- /dev/null
+++ b/docker/README.md
@@ -0,0 +1,81 @@
+# Running troggle on Docker
+
+## Install
+First you need to install
+ - [docker-ce](https://docs.docker.com/install/)
+ - [docker-compose](https://docs.docker.com/compose/install/)
+
+If you don't want to type sudo for every docker command (you don't) you need to add your user to the docker group.
+
+To do this
+
+- Create the docker group.
+ ```bash
+ $ sudo groupadd docker
+ ```
+
+- Add your user to the docker group.
+ ```bash
+ $ sudo usermod -aG docker $USER
+ ```
+## Setup
+
+Checkout all 4 of the expo repos into one folder ([see here for repo cloning instructions](http://expo.survex.com/handbook/manual.html#quickstart)) eg.
+```
+$ ~/expo/loser
+ /troggle
+ /expoweb
+ /tunnel
+```
+In the troggle dir copy localsettingsdocker.py to localsettings.py
+
+In the folder you checked out all the repos into (expo in this example) create a folder called `expofiles` and in that a folder called `surveyscans` eg
+
+```bash
+cd ~/expo
+mkdir -p expofiles/surveyscans
+```
+
+## Starting the containers
+
+To start the containers run
+```bash
+$ docker-compose up
+```
+You will now have a working troggle but with no data. To import the data you need to access the container run
+```bash
+$ docker exec -it docker_troggle_1 /bin/bash
+```
+This will give you a shell inside the troggle container
+
+(You may get a warning like `bash: warning: setlocale: LC_ALL: cannot change locale (en_GB.UTF-8)` this can be ignored)
+
+To import the data into troggle now run
+```bash
+$ python databaseReset.py reset
+```
+and wait .... this takes a while.
+The MySQL database is stored in a docker volume so once run through once the database will remain full of expo data even if you restart the containers.
+
+## Using your new dev setup
+Even whilst the import is running you can browse to [http://localhost:8000]
+
+Any chnages made to files in your checkouts will be automatically loaded in the container and served. Somtimes changes to the python files will require the system to reload so refresh a couple of times before declaring you have broken something.
+
+If you edit files from within the container they will have their ownership changed to root and may become un editable to your user (you will have to become root to fix this) so don't do this!
+
+## Stopping the containers
+To stop the running containers press Ctrl-c
+
+## Killing it all
+If you get it in some state you want to start again run
+```bash
+$ docker-compose down
+```
+to destroy the containers
+and
+```bash
+$ docker volume ls
+$ docker volume rm docker_expo-mysqldb
+```
+ to remove the database volume \ No newline at end of file
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index 08b969e..a4ab80c 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -15,7 +15,7 @@ services:
env_file:
- compose/mysql.env
volumes:
- - mysqldb:/var/lib/mysql
+ - expo-mysqldb:/var/lib/mysql
volumes:
- mysqldb: \ No newline at end of file
+ expo-mysqldb:
diff --git a/localsettingsdocker.py b/localsettingsdocker.py
new file mode 100644
index 0000000..331d23e
--- /dev/null
+++ b/localsettingsdocker.py
@@ -0,0 +1,65 @@
+import sys
+# link localsettings to this file for use on expo computer in austria
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.mysql', # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
+ 'NAME' : 'troggle', # Or path to database file if using sqlite3.
+ 'USER' : 'troggleuser', # Not used with sqlite3.
+ 'PASSWORD' : 'expo123', # Not used with sqlite3.
+ 'HOST' : 'expo-mysql', # Set to empty string for localhost. Not used with sqlite3.
+ 'PORT' : '', # Set to empty string for default. Not used with sqlite3.
+ }
+}
+
+EXPOUSER = 'expo'
+EXPOUSERPASS = 'somepasshere'
+EXPOUSER_EMAIL = 'wookey@wookware.org'
+
+REPOS_ROOT_PATH = '/expo/'
+sys.path.append(REPOS_ROOT_PATH)
+sys.path.append(REPOS_ROOT_PATH + 'troggle')
+
+PUBLIC_SITE = False
+
+SURVEX_DATA = REPOS_ROOT_PATH + 'loser/'
+TUNNEL_DATA = REPOS_ROOT_PATH + 'tunneldata/'
+
+CAVERN = 'cavern'
+THREEDTOPOS = '3dtopos'
+EXPOWEB = REPOS_ROOT_PATH + 'expoweb/'
+SURVEYS = REPOS_ROOT_PATH
+SURVEY_SCANS = REPOS_ROOT_PATH + 'expofiles/'
+FILES = REPOS_ROOT_PATH + 'expofiles'
+
+CACHEDIR = REPOS_ROOT_PATH + 'expowebcache/'
+THREEDCACHEDIR = CACHEDIR + '3d/'
+THUMBNAILCACHE = CACHEDIR + 'thumbs'
+
+PYTHON_PATH = REPOS_ROOT_PATH + 'troggle/'
+
+URL_ROOT = 'http://127.0.0.1:8000/'
+DIR_ROOT = ''#this should end in / if a value is given
+EXPOWEB_URL = '/'
+SURVEYS_URL = '/survey_scans/'
+
+MEDIA_URL = URL_ROOT + DIR_ROOT + 'site_media/'
+MEDIA_ROOT = REPOS_ROOT_PATH + '/troggle/media/'
+MEDIA_ADMIN_DIR = '/usr/lib/python2.7/site-packages/django/contrib/admin/media/'
+
+STATIC_URL = URL_ROOT
+STATIC_ROOT = DIR_ROOT
+
+JSLIB_URL = URL_ROOT + 'javascript/'
+
+TINY_MCE_MEDIA_ROOT = '/usr/share/tinymce/www/'
+TINY_MCE_MEDIA_URL = URL_ROOT + DIR_ROOT + '/tinymce_media/'
+
+TEMPLATE_DIRS = (
+ PYTHON_PATH + "templates",
+ # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
+ # Always use forward slashes, even on Windows.
+ # Don't forget to use absolute paths, not relative paths.
+)
+
+LOGFILE = PYTHON_PATH + 'troggle_log.txt'