From b31026c89650e286c6ac7df22285b75c52b1d735 Mon Sep 17 00:00:00 2001 From: nathaniel smith Date: Wed, 14 Dec 2016 00:30:47 -0800 Subject: [PATCH] notes about server; switch to pgsql; update setup --- serversetup.md | 23 +++++++++++++++++++++++ setup.py | 3 ++- ttadmin/settings.py | 9 +++++++-- 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 serversetup.md diff --git a/serversetup.md b/serversetup.md new file mode 100644 index 0000000..aef158e --- /dev/null +++ b/serversetup.md @@ -0,0 +1,23 @@ +# server setup for ttadmin + +## stuff to install + +* autoconf? +* python3-dev +* postgresql-server-dev-9.5 +* python 3.4+ +* postgresql +* virtualenv +* nginx + +## steps + +* create ttadmin user +* ttadmin db user (or just rely on ident..?) / database created +* add to sudoers: + + ttadmin ALL=(ALL)NOPASSWD:/usr/sbin/adduser,/usr/sbin/deluser,/usr/sbin/delgroup + +* have virtualenv with python 3.5+ ready, install tildetown-admin package into it +* run django app as wsgi container through gunicorn as the ttadmin user with venv active +* nginx proxy pass at /ttadmin diff --git a/setup.py b/setup.py index 8d2ae67..494e73d 100644 --- a/setup.py +++ b/setup.py @@ -16,6 +16,7 @@ setup( ], packages=['ttadmin'], install_requires = ['Django==1.10.2', - 'sshpubkeys==2.2.0',], + 'sshpubkeys==2.2.0', + 'psycopg2==2.6.2',], include_package_data = True, ) diff --git a/ttadmin/settings.py b/ttadmin/settings.py index fe333fc..b3949e8 100644 --- a/ttadmin/settings.py +++ b/ttadmin/settings.py @@ -76,10 +76,15 @@ WSGI_APPLICATION = 'wsgi.application' # Database # https://docs.djangoproject.com/en/1.10/ref/settings/#databases +# TODO switch to postgres; use it locally and overwrite password live DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': 'ttadmin', + 'USER': 'ttadmin', + 'PASSWORD': 'ttadmin', + 'HOST': 'localhost', + 'PORT': '', } }