Skip to content

Commit

Permalink
Docker documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
kthoden committed Jun 9, 2020
1 parent 4d8e2e8 commit 0067b24
Showing 1 changed file with 144 additions and 0 deletions.
144 changes: 144 additions & 0 deletions docs/install_docker.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,147 @@
==========================
Installation with Docker
==========================

Docker is used to provide a consistent environment. Additional Python scripts are used for automisation of the installation process.

Dependencies to other git repositories are handled using `git_deps_py <https://github.molgen.mpg.de/EditionOpenAccess/git_deps_py>`_.

Configuration
=============
- Environment variables: see file ``.env``

These variables are available inside the ``docker-compose.yaml`` file and are also loaded into the Python scripts.
(The ``.env`` file is initially created with default settings by the ``init.py`` script)

- Django settings: see ``src/eoa/settings.py``

For further information please check the Django documentation.

Prerequisites
=============

- Python 3
- Docker, Docker Compose
- `git_deps_py <https://github.molgen.mpg.de/EditionOpenAccess/git_deps_py>`_

Initialise the Repository
=========================
Initialise the repository with the following commands::

$ git_deps_py
$ ./scripts/init.py --build

This will pull remote repositories and resources, initialize the database, etc.
The ``--build`` parameter forces the recreation of the docker image, e.g. if ``Dockerfile`` or ``requirements.txt`` have changed.

Import data
===========

Initialize CMS pages
--------------------
The dummy fixture contains the default setup for CMS pages.
Also a CMS superuser with username ``test`` and password ``test`` (don't use this in production !)::

$ cp fixtures/cms_dummy.json res/fixtures/
$ ./scripts/init.py --skip-db
$ ./scripts/run.py && ./scripts/exec_in_container.py
$ $ python manage.py loaddata $RES_DIR/fixtures/cms_dummy.json
$ $ exit
$ ./scripts/stop.py

Import Publications
-------------------

In order to publish a publication on the platform, the following steps are necessary:

#. Using the conversion workflow (`EOASkripts <https://github.molgen.mpg.de/EditionOpenAccess/EOASkripts>`_), produce a Django-XML version of a publication.

#. Import it into the EOA Publication Platform

For the example publication, this process goes as follows:

1. Compile the example

Compile the example file found in `eoa-publication-model <https://github.molgen.mpg.de/EditionOpenAccess/eoa-publication-model>`_. For other examples containing TEI-XML consult https://github.molgen.mpg.de/EditionOpenAccess/EOASkripts#the-tei-workflow-tei---pdf-django-epub::

$ cd example_import
$ git_deps_py --store-dir ../dependencies
$ cd dependencies/EOASkripts
$ ./scripts/run.py && ./scripts/exec_in_container.py
$ $ process_eoa_latex.py input/example/124_eoatex
$ $ exit
$ ./scripts/stop.py
$ cd ../../../

2. Import example into the platform

After the creation of Django-XML, import it into the platform::

$ mkdir res/publications
$ cp -r example_import/EOASkripts/runtime/output/124_eoatex/django res/publications/example
$ ./scripts/init.py --skip-db
$ ./scripts/run.py && ./scripts/exec_in_container.py
$ $ python manage.py publicationimport $RES_DIR/publications/example
$ $ exit

Visit http://localhost:8001/ for the main site and http://localhost:8001/studies/124/index.html for the example publication. Go to http://localhost:8001/admin/login/ to access the Django administration pages, using above credentials.

Stop the container with::

$ ./scripts/stop.py

Configure Project specific Information
--------------------------------------

In order to tweak the CMS pages, log in to the CMS and edit them.

To change the organisation information (name, logo, ...), edit the files in ``res/custom_config/*`` and then perform ::

$ ./scripts/init.py --skip-db

To add a logo and a favicon, copy the files into ``res/static/custom_static/``. Files in this directory overwrite default files with the same name::

$ cp <my_icon> res/static/custom_static/
$ ./scripts/init.py --skip-db


.. note::
The templates expect some pages to exist in the CMS:

- Introduction Page (id: ``introduction``)
- Contact (id: ``contact``)
- Imprint (id: ``imprint``)

Deleting those might break things.


Useful commands
===============
Run the Webserver::

$ ./scripts/run.py

The webpage can now be explored in your local browser.

Stop the Webserver::

$ ./scripts/stop.py

Run Command in the Webserver container::

$ ./scripts/exec_in_container.py '[ CMD ...]'

Clean the Repository::

$ ./scripts/exit.py

This should remove all remote repositories and resources not part of this repository.
Docker images are not deleted though.

Export Data
===========

In order to export CMS content, run::

$ ./scripts/run.py && ./scripts/exec_in_container.py 'python manage.py dump_cms'
$ cp runtime_data/fixtures/* fixtures/

0 comments on commit 0067b24

Please sign in to comment.