layerindex-web/docker
Paul Eggleton d215e2899a Fix axes lockout not working
We use django-axes to lock out IP addresses after a set number of
attempts at logging in, and separately we use django-reversion to
record change history. As part of the history tracking, the default
behaviour of django-reversion is to wrap all POST requests in
"with transaction.atomic()", with the result that if an exception is
raised any changes get rolled back; unfortunately when authentication
fails for the final time, axes updates the database and then raises
PermissionDenied - with the result that the database changes are rolled
back, and the user's IP is not locked out, in fact it can never be
locked out. To work around this, disable the atomic mode on
ReversionMiddleware using a subclass. (I don't like having to do this,
but this is the quickest solution for now.)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-07-17 11:31:04 +12:00
..
certs dockersetup: add HTTPS support and use by default 2019-07-17 11:30:56 +12:00
.gitconfig docker: correct comment in .gitconfig 2018-08-29 21:42:02 +12:00
git-proxy Docker based environment setup 2015-10-07 11:34:34 +01:00
migrate.sh docker: use python3 in migrate script 2019-07-17 11:31:04 +12:00
nginx-ssl.conf docker: improve nginx https configuration security 2019-07-17 11:31:04 +12:00
nginx.conf docker: Increase nginx max upload size 2019-07-17 11:31:04 +12:00
README docker: add setup script 2019-07-17 11:30:56 +12:00
refreshlayers.sh docker: enhance example setup 2018-07-23 08:40:00 +02:00
settings.py Fix axes lockout not working 2019-07-17 11:31:04 +12:00
updatelayers.sh docker: don't reload in updatelayers.sh 2018-07-23 08:40:00 +02:00

Layerindex Docker Setup Instructions

The script setup.py will set up and configure a cluster of 5 docker containers:

  • layersapp: the application
  • layersdb: the database
  • layersweb: NGINX web server (as a proxy and for serving static content)
  • layerscelery: Celery (for running background jobs)
  • layersrabbit: RabbitMQ (required by Celery)

The script will edit all necessary configuration files, build and launch all containers, and do the initial database setup. It is advised that you start with a .sql database file to prepopulate your database. The following instructions will walk you through the setup.

  1. Install docker and docker-compose per instructions: https://docs.docker.com/compose/install/ ** Note: for latest docker-compose version follow the directions above, rather than using apt.

  2. Clone the repo and checkout appropriate branch: git clone https://github.intel.com/peggleto/layerindex-web.git git checkout origin/dev_snapshot

  3. Run the setup script (dockerstup.py). You can optionally supply your hostname, proxy settings, a sql database file of layer mappings to import, and a host to container port mapping. For more information, run: ./dockersetup.py -h

    Example command to run containers with a proxy and with a database to import: ./dockersetup.py -d ~/databasedump.sql -p http://proxy-chain.intel.com:911

    During the setup you will be asked for a username, email and password to set up a super user for the database. This will allow you to access the database later, should you need to.

  4. Once the script completes, open a web browser and navigate to :<mapped_port>/layerindex. If you haven't supplied hostname and/or port mapping, this will by default be localhost:8080.

  5. If you have chosen to not supply a prepopulated database and are instead starting fresh, you should now follow the instructions in the "Database Setup" section of the main README.

  6. If you need to rerun this script for any reason a second time, make sure to tear the containers down first with docker-compose down. Otherwise, your new automatically generated root database password will not match.

  7. To update the layers in the future, you can optionally do the following:

    Run the layer updates docker-compose run --rm layersapp /opt/layerindex/layerindex/update.py

    Or do a full refresh docker-compose run --rm layersapp /opt/layerindex/layerindex/update.py -r

TROUBLESHOOTING:

  • Network issues behind a proxy when building container: On some Ubuntu systems, /etc/resolv.conf is set to 127.0.0.x, rather than your local DNS server. Docker will look there for your DNS server, and when it fails to find it it will default to using a public one (frequently 8.8.8.8). Many corporate proxies blocks public DNS servers, so you will need to manually supply the DNS server to docker using /etc/docker/daemon.json: {"dns": ["xx.xx.xx.xx] }