diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2021-05-03 22:47:57 +0100 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2021-05-03 22:47:57 +0100 |
commit | 8ad791c594c478eb08b346f2efefc9adb7e72246 (patch) | |
tree | 9aa4d3d717b8776adb78e106ad77ca474a162e14 /_deploy/docker | |
parent | e6adced39d08e2719fb000f5ce5fa89f395547fc (diff) | |
download | troggle-8ad791c594c478eb08b346f2efefc9adb7e72246.tar.gz troggle-8ad791c594c478eb08b346f2efefc9adb7e72246.tar.bz2 troggle-8ad791c594c478eb08b346f2efefc9adb7e72246.zip |
rearranged config files
Diffstat (limited to '_deploy/docker')
-rw-r--r-- | _deploy/docker/Dockerfile | 28 | ||||
-rw-r--r-- | _deploy/docker/Dockerfile-django-1.4.22-wheezy | 18 | ||||
-rw-r--r-- | _deploy/docker/Dockerfile-django-1.5.12-jessie | 26 | ||||
-rw-r--r-- | _deploy/docker/README.md | 84 | ||||
-rw-r--r-- | _deploy/docker/backports.list | 1 | ||||
-rw-r--r-- | _deploy/docker/compose/mysql.env | 5 | ||||
-rw-r--r-- | _deploy/docker/docker-cmd | 7 | ||||
-rw-r--r-- | _deploy/docker/docker-compose.yml | 21 | ||||
-rw-r--r-- | _deploy/docker/mysql.env | 5 | ||||
-rw-r--r-- | _deploy/docker/requirements.txt | 9 | ||||
-rw-r--r-- | _deploy/docker/requirements.txt.dj-1.4.22 | 7 | ||||
-rw-r--r-- | _deploy/docker/requirements.txt.dj-1.5.12 | 7 | ||||
-rw-r--r-- | _deploy/docker/requirements.txt.dj-1.6.11 | 7 | ||||
-rw-r--r-- | _deploy/docker/requirements.txt.dj-1.7.11 | 9 | ||||
-rw-r--r-- | _deploy/docker/requirements.txt.dj-1.8.19 | 7 |
15 files changed, 241 insertions, 0 deletions
diff --git a/_deploy/docker/Dockerfile b/_deploy/docker/Dockerfile new file mode 100644 index 0000000..5f45b8e --- /dev/null +++ b/_deploy/docker/Dockerfile @@ -0,0 +1,28 @@ +FROM python:2.7-stretch + +#COPY backports.list /etc/apt/sources.list.d/ + +RUN apt-get -y update && apt-get install -y mercurial fonts-freefont-ttf locales survex + +#RUN apt-get -y -t -backports install survex + +# Set the locale +RUN locale-gen en_GB.UTF-8 +ENV LANG en_GB.UTF-8 +ENV LANGUAGE en_GB:en +ENV LC_ALL en_GB.UTF-8 + +WORKDIR /opt/expo/troggle +COPY requirements.txt . + +RUN pip install --upgrade pip + +RUN pip install -r requirements.txt + +EXPOSE 8000 + +WORKDIR /expo/troggle + +#CMD ["python","manage.py","migrate"] + +ENTRYPOINT ["python","manage.py","runserver","0.0.0.0:8000"] diff --git a/_deploy/docker/Dockerfile-django-1.4.22-wheezy b/_deploy/docker/Dockerfile-django-1.4.22-wheezy new file mode 100644 index 0000000..f6d5554 --- /dev/null +++ b/_deploy/docker/Dockerfile-django-1.4.22-wheezy @@ -0,0 +1,18 @@ +FROM python:2.7-wheezy + +RUN apt-get -y update && apt-get install -y mercurial fonts-freefont-ttf survex locales + +# Set the locale +RUN locale-gen en_GB.UTF-8 +ENV LANG en_GB.UTF-8 +ENV LANGUAGE en_GB:en +ENV LC_ALL en_GB.UTF-8 + +WORKDIR /opt/expo/troggle +COPY requirements.txt . + +RUN pip install -r requirements.txt + +EXPOSE 8000 + +#CMD ["python","manage.py","runserver","0.0.0.0:8000"]
\ No newline at end of file diff --git a/_deploy/docker/Dockerfile-django-1.5.12-jessie b/_deploy/docker/Dockerfile-django-1.5.12-jessie new file mode 100644 index 0000000..2cf1a51 --- /dev/null +++ b/_deploy/docker/Dockerfile-django-1.5.12-jessie @@ -0,0 +1,26 @@ +FROM python:2.7-jessie + +COPY backports.list /etc/apt/sources.list.d/ + +RUN apt-get -y update && apt-get install -y mercurial fonts-freefont-ttf locales + +RUN apt-get -y -t jessie-backports install survex + +# Set the locale +RUN locale-gen en_GB.UTF-8 +ENV LANG en_GB.UTF-8 +ENV LANGUAGE en_GB:en +ENV LC_ALL en_GB.UTF-8 + +WORKDIR /opt/expo/troggle +COPY requirements.txt . + +RUN pip install --upgrade pip + +RUN pip install -r requirements.txt + +EXPOSE 8000 + +WORKDIR /expo/troggle + +#CMD ["python","manage.py","runserver","0.0.0.0:8000"]
\ No newline at end of file diff --git a/_deploy/docker/README.md b/_deploy/docker/README.md new file mode 100644 index 0000000..25ce966 --- /dev/null +++ b/_deploy/docker/README.md @@ -0,0 +1,84 @@ +# Running troggle on Docker + +These notes written by Sam Wenham in Feb., 2019. +These all pre-date the move to python3, later versions of Django (1.11.+) and debian. + +## 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/_deploy/docker/backports.list b/_deploy/docker/backports.list new file mode 100644 index 0000000..c29532b --- /dev/null +++ b/_deploy/docker/backports.list @@ -0,0 +1 @@ +deb http://ftp.debian.org/debian jessie-backports main
\ No newline at end of file diff --git a/_deploy/docker/compose/mysql.env b/_deploy/docker/compose/mysql.env new file mode 100644 index 0000000..9cebaa7 --- /dev/null +++ b/_deploy/docker/compose/mysql.env @@ -0,0 +1,5 @@ +MYSQL_ROOT_PASSWORD=expo123 +MYSQL_DATABASE=troggle +MYSQL_USER=troggleuser +MYSQL_PASSWORD=expo123 + diff --git a/_deploy/docker/docker-cmd b/_deploy/docker/docker-cmd new file mode 100644 index 0000000..2898a60 --- /dev/null +++ b/_deploy/docker/docker-cmd @@ -0,0 +1,7 @@ +cd docker + +docker run -it --name expo-mysql -e MYSQL_ROOT_PASSWORD=expo123 mariadb + +docker build -t expo/troggle:django-1.5.12 . + +docker run -it --rm --link expo-mysql:mysql -v /home/sam/expo:/expo expo/troggle:django-1.5.12 /bin/bash
\ No newline at end of file diff --git a/_deploy/docker/docker-compose.yml b/_deploy/docker/docker-compose.yml new file mode 100644 index 0000000..a4ab80c --- /dev/null +++ b/_deploy/docker/docker-compose.yml @@ -0,0 +1,21 @@ +version: '3' +services: + troggle: + restart: always + build: . + ports: + - "8000:8000" + volumes: + - ../..:/expo + links: + - expo-mysql + expo-mysql: + restart: always + image: "mariadb" + env_file: + - compose/mysql.env + volumes: + - expo-mysqldb:/var/lib/mysql + +volumes: + expo-mysqldb: diff --git a/_deploy/docker/mysql.env b/_deploy/docker/mysql.env new file mode 100644 index 0000000..9cebaa7 --- /dev/null +++ b/_deploy/docker/mysql.env @@ -0,0 +1,5 @@ +MYSQL_ROOT_PASSWORD=expo123 +MYSQL_DATABASE=troggle +MYSQL_USER=troggleuser +MYSQL_PASSWORD=expo123 + diff --git a/_deploy/docker/requirements.txt b/_deploy/docker/requirements.txt new file mode 100644 index 0000000..7a197bd --- /dev/null +++ b/_deploy/docker/requirements.txt @@ -0,0 +1,9 @@ +Django==1.7.11 +django-registration==2.1.2 +mysql +#imagekit +django-imagekit +Image +django-tinymce==2.7.0 +smartencoding +unidecode diff --git a/_deploy/docker/requirements.txt.dj-1.4.22 b/_deploy/docker/requirements.txt.dj-1.4.22 new file mode 100644 index 0000000..dac7b30 --- /dev/null +++ b/_deploy/docker/requirements.txt.dj-1.4.22 @@ -0,0 +1,7 @@ +Django==1.4.22 +django-registration==0.8 +mysql +imagekit +Image +django-tinymce==1.5.3 +smartencoding diff --git a/_deploy/docker/requirements.txt.dj-1.5.12 b/_deploy/docker/requirements.txt.dj-1.5.12 new file mode 100644 index 0000000..9f9b5ae --- /dev/null +++ b/_deploy/docker/requirements.txt.dj-1.5.12 @@ -0,0 +1,7 @@ +Django==1.5.12 +django-registration==1.0 +mysql +imagekit +Image +django-tinymce==1.5.3 +smartencoding diff --git a/_deploy/docker/requirements.txt.dj-1.6.11 b/_deploy/docker/requirements.txt.dj-1.6.11 new file mode 100644 index 0000000..b26bc10 --- /dev/null +++ b/_deploy/docker/requirements.txt.dj-1.6.11 @@ -0,0 +1,7 @@ +Django==1.6.11 +django-registration==1.0 +mysql +imagekit +Image +django-tinymce==1.5.3 +smartencoding diff --git a/_deploy/docker/requirements.txt.dj-1.7.11 b/_deploy/docker/requirements.txt.dj-1.7.11 new file mode 100644 index 0000000..7a197bd --- /dev/null +++ b/_deploy/docker/requirements.txt.dj-1.7.11 @@ -0,0 +1,9 @@ +Django==1.7.11 +django-registration==2.1.2 +mysql +#imagekit +django-imagekit +Image +django-tinymce==2.7.0 +smartencoding +unidecode diff --git a/_deploy/docker/requirements.txt.dj-1.8.19 b/_deploy/docker/requirements.txt.dj-1.8.19 new file mode 100644 index 0000000..6942998 --- /dev/null +++ b/_deploy/docker/requirements.txt.dj-1.8.19 @@ -0,0 +1,7 @@ +Django==1.8.19 +django-registration==2.1.2 +mysql +django-imagekit +Image +django-tinymce==2.7.0 +smartencoding |