Skip to content

Commit

Permalink
#1637: Move env files to new etc folder, move Lando docs to docs, fix…
Browse files Browse the repository at this point in the history
… unrelated/minor docs formatting issue
  • Loading branch information
hardyoyo authored and ajrbyers committed Aug 4, 2020
1 parent 75df21e commit 58e449c
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 39 deletions.
6 changes: 3 additions & 3 deletions .lando.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: janeway

# CAREFUL with this env file, Docker env files don't support interpolation!
env_file:
- defaults.env
- local.env
- etc/defaults.env
- etc/local.env

services:
appserver:
Expand All @@ -14,7 +14,7 @@ services:
- grep '^deb ' /etc/apt/sources.list | perl -pe 's/deb /deb-src /' >> /etc/apt/sources.list
- apt-get update -qq && apt-get install -y python3-lxml pylint libxml2-dev libxslt1-dev python3-dev zlib1g-dev lib32z1-dev libffi-dev libssl-dev libjpeg-dev && apt-get build-dep -y lxml
build:
- cd /app && pip install --upgrade pip && pip install Cython && pip install -r requirements.txt && pip install -r dev-requirements.txt
- cd /app && pip install --upgrade pip && pip install Cython && pip install psycopg2 && pip install -r requirements.txt && pip install -r dev-requirements.txt
scanner: true
overrides:
ports:
Expand Down
33 changes: 1 addition & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Janeway is written in Python (3.5+) and utilises the Django framework (1.11 LTS)


# Installation instructions
Developer installation [instructions are available on our Wiki](https://github.com/BirkbeckCTP/janeway/wiki/Installation).
Developer installation [instructions are available in our documentation site](https://janeway.readthedocs.io/en/feature-documentation/installation.html#installation-guide).

A guide for installing on the live environment with [apache and mod_wsgi](https://github.com/BirkbeckCTP/janeway/wiki/Janeway%2C-Apache-and-WSGI) is also available.

Expand All @@ -24,37 +24,6 @@ In order to run a different RDBMS, the environment variable ``DB_VENDOR`` can be

Uninstalling Janeway is as simple as running ``make uninstall`` which will delete all related containers as well as wipe the database volume.

# Using Lando for an alternative development environment (optional)

Lando provides a simple-to-use alternative to managing a development environment, while maintaining future flexibility to alter different aspects of the environment. Here are the steps required to get the app running on your local machine, with Lando
1. Make sure [Lando](https://lando.dev/) is installed
> Lando comes bundled with Docker Desktop, if you already have Docker Desktop installed, don't re-install it, just ensure you have the same (or newer) version as what is bundled with Lando.
2. Copy `local.env.example` to `local.env` and customize as appropriate (the database configuration is done with environment variables, so pay attention to `local.env` if it's important to you--however, the `defaults.env` file should be sufficient to get started)
3. `lando poweroff` (defensively ensure no other Lando environments are running, probably not necessary, but a good habit)
4. `lando rebuild`
5. When you see the big "Boomshakala" message from Lando, you're ready to proceed
6. `lando django-admin check` will validate the installation is working
7. Revise your src/core/settings.py file as directed in the [Installation](https://janeway.readthedocs.io/en/feature-documentation/installation.html#database-setup-and-final-installation) instructions
8. `lando logs -f` will show you the log output from Django, though when you're getting started, `lando django-admin check` will help you find configuration errors much faster than sifting through log file output
9. `lando manage <command>` will send commands to the src/core/manage.py script, run `lando manage -h` to see more info
10. `lando manage install_janeway` will continue your installation of Janeway
11. `lando manage test` will run the Janeway unit test suite
11. `lando python <command>` will send Python commands to the appserver
12. Browse to `http://localhost:8000` to see the site in action
13. run `lando` to see what other Lando tooling commands are available.

# Lando Tooling
* `lando psql` Drops into the PostgreSQL client running on the database service
* `lando db-import <file>` Imports a dump file into the database service
* `lando ssh` Drops into a shell on the application service, runs commands
* `lando start` Starts the Janeway app
* `lando stop` Stops the Janeway app
* `lando rebuild` Rebuilds the Janeway app
* `lando restart` Simply starts and stops the Janeway app
* `lando destroy` Removes all traces of the Janeway dev environment's containers, useful if you need to ensure a fresh start

More Lando [tooling](https://docs.lando.dev/config/tooling.html) can be added easily.

# Janeway design principles
1. No code should appear to work "by magic". Readability is key.

Expand Down
44 changes: 43 additions & 1 deletion docs/source/installation.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Installation Guide
==================

Janeway includes and environment setup script that will install virtual
Janeway includes an environment setup script that will install virtual
environment, its apt requirements and pip requirements. Please read the
script to ensure it wont cause any issues with your current install. The
command can be called directly from the command line:
Expand All @@ -17,6 +17,48 @@ This command has been tested in 14.04, 15.04 and 16.04
You should now proceed to “Database Setup and Final Installation”,
below.

Using Lando for a development environment (optional)
-----------------------------------------------------------------

`Lando <https://lando.dev/>`_ can be used to construct and manage a local a
development environment. Here are the steps required to get Janeway running on
your local machine, using Lando:

.. note:: Lando comes bundled with Docker Desktop, if you already have Docker
Desktop installed, don't re-install it. You should instead ensure you have the
same (or newer) version as what is bundled with Lando.

1. Make sure `Lando <https://lando.dev/>`_ is installed
2. Optionally, copy ``local.env.example`` to ``local.env`` and customize as appropriate (the
database configuration is done with environment variables, so pay attention to
``local.env`` if it's important to you)
3. ``lando poweroff`` (defensively ensure no other Lando environments are running, probably not necessary, but a good habit)
4. ``lando rebuild``
5. When you see the big "Boomshakala" message from Lando, you're ready to proceed
6. ``lando django-admin check`` will confirm the installation is working, and notify you of any misconfigurations
7. Revise your src/core/settings.py file as directed in the `Database Setup and Final Installation`_ instructions below
8. ``lando logs -f`` will show you the log output from Django, though when you're getting started, `lando django-admin check` will help you find configuration errors much faster than sifting through log file output
9. ``lando manage <command>`` will send commands to the src/core/manage.py script, run `lando manage -h` to see more info
10. ``lando manage install_janeway`` will continue your installation of Janeway
11. ``lando manage test`` will run the Janeway unit test suite
12. ``lando python <command>`` will send Python commands to the appserver
13. Browse to `http://localhost:8000` to see the site in action
14. run ``lando`` to see what other Lando tooling commands are available.

Lando Tooling
-------------

* ``lando psql`` Drops into the PostgreSQL client running on the database service
* ``lando db-import <file>`` Imports a dump file into the database service
* ``lando ssh`` Drops into a shell on the application service, runs commands
* ``lando start`` Starts the Janeway app
* ``lando stop`` Stops the Janeway app
* ``lando rebuild`` Rebuilds the Janeway app
* ``lando restart`` Starts and stops the Janeway app, useful for forcing the app to use new configurations
* ``lando destroy`` Removes all traces of the Janeway dev environment's containers, useful if you need to ensure a fresh start

More Lando `tooling <https://docs.lando.dev/config/tooling.html>`_ can be added, if you need it.

Manual Install
--------------

Expand Down
4 changes: 2 additions & 2 deletions docs/source/styling/image_guidelines.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Image guidelines
================
.. _imageguidelines:
This section describes the different images that can be uploaded in Janeway to customise the look and feel of your journal,
as well as the recommended sizes/aspec ratios for each of theme.
This section describes the different images that can be uploaded in Janeway to customise the look and feel of your journal,
as well as the recommended sizes/aspec ratios for each of theme.

Header Image
-------------------
Expand Down
22 changes: 22 additions & 0 deletions etc/defaults.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# DEFAULTS.ENV is a Docker .env file for configuring cores aspects of Janeway
#
# here are the Docker-Compose env file rules: https://docs.docker.com/compose/env-file/
# here are the Lando env file rules: https://docs.lando.dev/config/env.html
#
# NOTE that Lando allows more than one env file to be used, which lets you
# override certain variables while leaving defaults in place. Consider using an
# override instead of modifying the defaults here.
#
# To override the defaults set below, copy the local.env.example file to
# local.env and then set the values in local.env appropriately.
#
###############################################################################
# Database

DB_VENDOR=postgres
DB_NAME=janeway
DB_USER=postgres
DB_PASSWORD=
DB_HOST=db.janeway.internal
DB_PORT=5432

22 changes: 22 additions & 0 deletions etc/local.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# LOCAL.ENV is a Docker .env file for configuring cores aspects of Janeway
#
# here are the Docker-Compose env file rules: https://docs.docker.com/compose/env-file/
# here are the Lando env file rules: https://docs.lando.dev/config/env.html
#
# NOTE that Lando allows more than one env file to be used, which lets you
# override certain variables while leaving defaults in place. Consider using an
# override instead of modifying the defaults here.
#
# To override the defaults set below, copy the local.env.example file to
# local.env and then set the values in local.env appropriately.
#
###############################################################################
# Database

DB_VENDOR=postgres
DB_NAME=janeway
DB_USER=postgres
DB_PASSWORD=
DB_HOST=db.janeway.internal
DB_PORT=5432

1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ mock
mysqlclient==1.3.12
pdfkit
Pillow==6.2.0
psycopg2
psycopg2-binary
pyasn1==0.1.9
pycparser==2.14
Expand Down

0 comments on commit 58e449c

Please sign in to comment.