-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:merforga/gw2raidar
- Loading branch information
Showing
199 changed files
with
18,913 additions
and
513 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,28 @@ | ||
# compiled Python files | ||
*.pyc | ||
db.sqlite3 | ||
TestLogs | ||
.idea | ||
|
||
# dev database | ||
/db.sqlite3 | ||
|
||
# test data | ||
/TestLogs | ||
|
||
# soloraidar output | ||
/Output | ||
|
||
# IntelliJ IDEA | ||
.idea | ||
|
||
# iPython | ||
.ipynb_checkpoints | ||
*.ipynb | ||
|
||
# Local settings, possibly with sensitive info | ||
# (copy from `gw2raidar/settings_local.py.example`) | ||
/gw2raidar/settings_local.py | ||
|
||
# result of `python3 manage.py collectstatic --noinput` | ||
/static | ||
|
||
# secret stuff | ||
/credentials |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
How to pull off the WSGI+PostgreSQL deploy | ||
|
||
``` | ||
apt install python3-dev python3-pip apache2 apache2-dev git postgresql-9.6 | ||
``` | ||
|
||
Create the postgres user | ||
|
||
``` | ||
sudo -u postgres psql | ||
CREATE ROLE [user] LOGIN PASSWORD '[password]'; | ||
CREATE DATABASE [database] WITH OWNER = [user]; | ||
``` | ||
|
||
Download `mod_wsgi` source | ||
|
||
``` | ||
sudo su - | ||
wget [mod_wsgi_url] | ||
tar xzf [mod_wsgi].tar.gz | ||
cd [mod_wsgi_dir] | ||
./configure --with-python=`which python3` | ||
make | ||
make install | ||
``` | ||
|
||
|
||
create `/etc/apache2/mods-available/wsgi.load`: | ||
|
||
``` | ||
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so | ||
WSGIApplicationGroup %{GLOBAL} | ||
``` | ||
|
||
Then | ||
|
||
``` | ||
a2enmod wsgi | ||
certbot --apache | ||
``` | ||
|
||
Assume the app will be called `gw2r-test`. | ||
Put the following into `/etc/apache2/sites-enabled/000-default-le-ssl.conf`, somewhere inside `VirtualHost`: | ||
|
||
``` | ||
Alias /gw2r-test/static/ /var/www/apps/gw2r-test/static/ | ||
WSGIDaemonProcess gw2r-test processes=2 threads=15 display-name=%{GROUP} python-path=/var/www/apps/gw2r-test | ||
WSGIProcessGroup gw2r-test | ||
WSGIScriptAlias /gw2r-test /var/www/apps/gw2r-test/gw2raidar/wsgi.py process-group=gw2r-test | ||
<Directory /var/www/apps/gw2r-test/gw2raidar> | ||
<Files wsgi.py> | ||
Require all granted | ||
</Files> | ||
</Directory> | ||
``` | ||
|
||
Get GW2Raidar (assuming `develop` branch): | ||
|
||
``` | ||
mkdir /var/www/apps | ||
cd /var/www/apps | ||
git clone [email protected]:merforga/gw2raidar.git -b develop gw2r-test | ||
cd gw2r-test | ||
cp gw2raidar/settings_local.py.example gw2raidar/settings_local.py | ||
``` | ||
|
||
Edit `gw2raidar/settings_local.py` to prepare for WSGI: | ||
|
||
``` | ||
DEBUG = False | ||
# When DEBUG is False (must for production), | ||
# this needs to be set for the app's host, like so: | ||
ALLOWED_HOSTS = ['139.162.68.156'] | ||
# This needs to be secret and can't be committed to the repository | ||
SECRET_KEY = '[secretkey]' | ||
# Database | ||
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases | ||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.postgresql', | ||
'NAME': 'gw2r_test', | ||
'USER': 'gw2raidar', | ||
'PASSWORD': '[password]', | ||
'HOST': '127.0.0.1', | ||
'PORT': '5432', | ||
} | ||
} | ||
EMAIL_SUBJECT_PREFIX = '[gw2raidar] ' | ||
# normal mail (like password reset), to users | ||
DEFAULT_FROM_EMAIL = '[email protected]' | ||
# error emails, to admins | ||
SERVER_EMAIL = '[email protected]' # | ||
# the abovementioned admins | ||
# ADMINS = [ | ||
# ('Admin1', '[email protected]'), | ||
# ('Admin2', '[email protected]'), | ||
# ] | ||
# SMTP server | ||
# You can use a fake SMTPD that will print any "sent" emails to console: | ||
# | ||
# python -m smtpd -n -c DebuggingServer localhost:1025 | ||
# | ||
# This would require 'EMAIL_PORT = 1025`. | ||
# Obviously, in production, point it to a real SMTP server, where the default | ||
# `EMAIL_PORT = 25` should be okay. | ||
EMAIL_HOST = 'localhost' | ||
# EMAIL_PORT = 1025 | ||
STATIC_URL = '/gw2r-test/static/' | ||
STATIC_ROOT = '/var/www/apps/gw2r-test/static/' | ||
``` | ||
|
||
|
||
# Adding a user | ||
|
||
``` | ||
useradd -m amadan | ||
passwd amadan | ||
mkdir ~amadan/.ssh | ||
cd ~amadan/.ssh | ||
cat > authorized_hosts | ||
chown amadan:amadan . authorized_hosts | ||
chmod og-rwx . authorized_hosts | ||
usermod -aG sudo amadan | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.