From 101060e6e5be1af53bf98a17ea1cfd1716ae6c02 Mon Sep 17 00:00:00 2001 From: Martin Mahner Date: Sat, 7 Dec 2019 13:03:18 +0100 Subject: [PATCH] Document Docker installation --- README.rst | 28 ++++++++++++++++++++++++++++ dpaste/settings/base.py | 4 ++-- manage.py | 4 ++-- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index e7184ca..c860c41 100644 --- a/README.rst +++ b/README.rst @@ -35,5 +35,33 @@ please create an *Issue* there. āš ļø dpaste requires at a minimum Python 3.6 and Django 2.2. +Run dpaste using Docker: +======================== + +Docker images are in `Docker Hub`_. + +You can try the latest of dpaste using Docker. This will store the snippet +database in a SQLite file in a Docker volume: + +.. code:: bash + + $ docker run --rm -p 8000:8000 barttc/dpaste:latest + +If you want to run it in production-like environments, it's encouraged to +use an external database. See the example below for all available options, +specifically ``DATABASE_URL``: + +.. code:: bash + + $ docker run --rm --name db1 --detach postgres:latest + $ docker run --rm -p 12345:12345 \ + --link db1 \ + -e DATABASE_URL=postgres://postgres@db1:5432/postgres \ + -e DEBUG=True \ + -e SECRET_KEY=very-secret-key \ + -e PORT=12345 \ + barttc/dpaste:latest + .. _dpaste.de: https://dpaste.de/ .. _pastebin: https://en.wikipedia.org/wiki/Pastebin +.. _Docker Hub: https://hub.docker.com/repository/docker/barttc/dpaste diff --git a/dpaste/settings/base.py b/dpaste/settings/base.py index 3e883e5..95bfcdf 100644 --- a/dpaste/settings/base.py +++ b/dpaste/settings/base.py @@ -89,7 +89,7 @@ INSTALLED_APPS = [ "dpaste.apps.dpasteAppConfig", ] -sys.stdout.write(f"šŸ˜ Database URL is: {env('DATABASE_URL')}") +sys.stdout.write(f"\nšŸ˜ Database URL is: {env('DATABASE_URL')}\n") DATABASES = { "default": dj_database_url.config(default="sqlite:///dpaste.sqlite") } @@ -103,7 +103,7 @@ DATABASES = { try: import django_webserver INSTALLED_APPS.append('django_webserver') - sys.stdout.write(f'šŸš€ Production webserver installed. Will run on port {env("PORT")}\n\n') + sys.stdout.write(f'\nšŸš€ Production webserver installed. Will run on port {env("PORT")}\n') except ImportError: pass diff --git a/manage.py b/manage.py index caa4cd5..262ca66 100755 --- a/manage.py +++ b/manage.py @@ -10,11 +10,11 @@ def main(): import dpaste.settings.local settings = "dpaste.settings.local" - sys.stdout.write("\nšŸ§ Using local.py settings file.\n\n") + sys.stdout.write("\nšŸ§ Using local.py settings file.\n") except ImportError: settings = "dpaste.settings.base" sys.stdout.write( - "\nāš ļø local.py settings not found. Using default settings file.\n\n" + "\nāš ļø local.py settings not found. Using default settings file.\n" ) os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings)