mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-23 11:56:36 +11:00
Document Docker installation
This commit is contained in:
parent
f86f298a03
commit
101060e6e5
3 changed files with 32 additions and 4 deletions
28
README.rst
28
README.rst
|
@ -35,5 +35,33 @@ please create an *Issue* there.
|
||||||
|
|
||||||
⚠️ dpaste requires at a minimum Python 3.6 and Django 2.2.
|
⚠️ 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/
|
.. _dpaste.de: https://dpaste.de/
|
||||||
.. _pastebin: https://en.wikipedia.org/wiki/Pastebin
|
.. _pastebin: https://en.wikipedia.org/wiki/Pastebin
|
||||||
|
.. _Docker Hub: https://hub.docker.com/repository/docker/barttc/dpaste
|
||||||
|
|
|
@ -89,7 +89,7 @@ INSTALLED_APPS = [
|
||||||
"dpaste.apps.dpasteAppConfig",
|
"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 = {
|
DATABASES = {
|
||||||
"default": dj_database_url.config(default="sqlite:///dpaste.sqlite")
|
"default": dj_database_url.config(default="sqlite:///dpaste.sqlite")
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ DATABASES = {
|
||||||
try:
|
try:
|
||||||
import django_webserver
|
import django_webserver
|
||||||
INSTALLED_APPS.append('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:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,11 @@ def main():
|
||||||
import dpaste.settings.local
|
import dpaste.settings.local
|
||||||
|
|
||||||
settings = "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:
|
except ImportError:
|
||||||
settings = "dpaste.settings.base"
|
settings = "dpaste.settings.base"
|
||||||
sys.stdout.write(
|
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)
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings)
|
||||||
|
|
Loading…
Reference in a new issue