@@ -33,7 +33,11 @@ with custom callbacks for automating things like mailing list subscriptions for
33
33
34
34
For Ubuntu 14.04 LTS
35
35
36
+ - Make sure your're using UTF-8 locale
37
+ - ` sudo locale-gen en_US.UTF-8 ; export LC_ALL=en_US.UTF-8 `
38
+ - You will want to make your system default locale is UTF-8 one too, see your distribution documentation.
36
39
- Add the original repo as upstream ` git remote add upstream https://github.com/hacklab-fi/asylum.git `
40
+ - Enter the "project" directory: ` cd asylum/project `
37
41
- Make a branch for your local changes ` git checkout -b myhackerspace `
38
42
- Install nodejs v4 first (needs PPA and key and stuff, nodesource has a handy script for this)
39
43
@@ -54,8 +58,9 @@ sudo apt-get install -y nodejs</code></pre>
54
58
- ` sudo su - postgres `
55
59
- ` createuser asylum && createdb -E utf-8 -T template0 -O asylum asylum && psql -U postgres -d postgres -c "alter user asylum with password 'asylum';" `
56
60
- Change at least the password,in createdb ` -O asylum ` is the user that owns the database.
61
+ - If installing for production create your ` .env ` file now.
57
62
- ` ./manage.py migrate `
58
- - ` find . -name '._*' | xargs rm ; for app in $( find . -path '*/locale' ); do (cd $(dirname $app) && ../manage.py compilemessages ); done `
63
+ - ` find . -name '._*' | xargs rm ; for app in $( find . -path '*/locale' | grep -v venv/ ); do (cd $(dirname $app) && ../manage.py compilemessages ); done `
59
64
- ` ./manage.py createinitialrevisions `
60
65
- ` ./manage.py createsuperuser `
61
66
- ` npm run build `
@@ -67,17 +72,24 @@ sudo apt-get install -y nodejs</code></pre>
67
72
- DJANGO_SENTRY_DSN
68
73
- https://hub.docker.com/_/sentry/
69
74
- https://docs.getsentry.com/hosted/
75
+ - OR set ` USE_SENTRY=False `
70
76
- DATABASE_URL (=postgres://pguser: pgpassword @localhost/dbname)
77
+ - DJANGO_SECRET_KEY
78
+ - DJANGO_ADMIN_URL (=admin/)
79
+ - DJANGO_ALLOWED_HOSTS (comma separated list)
71
80
- ` ./manage.py collectstatic --noinput `
72
81
- Setup uWSGI
73
82
- ` sudo apt-get install uwsgi-plugin-python3 uwsgi `
74
- - ` nano -w /etc/uwsgi/apps-available/asylum.ini ` (see below)
75
- - ` ln -s /etc/uwsgi/apps-available/asylum.ini /etc/uwsgi/apps-enabled/asylum.ini `
76
- - ` service uwsgi reload `
83
+ - ` sudo nano -w /etc/uwsgi/apps-available/asylum.ini` (see below)
84
+ - ` sudo ln -s /etc/uwsgi/apps-available/asylum.ini /etc/uwsgi/apps-enabled/asylum.ini`
85
+ - ` sudo service uwsgi restart `
77
86
- Setup Nginx
78
- - TODO: instructions
87
+ - ` sudo apt-get install nginx `
88
+ - ` sudo nano -w /etc/nginx/sites-available/asylum.ini ` (see below)
89
+ - ` sudo ln -s /etc/nginx/sites-available/asylum.ini /etc/nginx/sites-enabled/asylum.ini `
90
+ - ` sudo service nginx restart `
79
91
- Configure backups
80
- - TODO: instructions
92
+ - See the cronjobs below, offsite backups are recommended.
81
93
82
94
#### uWSGI config example
83
95
@@ -95,6 +107,27 @@ chdir = /home/myhackerspace/asylum/project
95
107
touch-reload = /home/myhackerspace/asylum/project/reload
96
108
env = DJANGO_SETTINGS_MODULE=config.settings.production</code ></pre >
97
109
110
+ #### Nginx config example
111
+
112
+ <pre ><code >upstream asylum {
113
+ server 127.0.0.1:9001 fail_timeout=0;
114
+ }
115
+ server {
116
+ listen 80;
117
+ server_name asylum.mylab.hacklab.fi;
118
+
119
+ root /usr/share/nginx/html;
120
+ index index.html index.htm;
121
+ client_max_body_size 50M;
122
+ keepalive_timeout 5;
123
+
124
+ location / {
125
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
126
+ proxy_set_header Host $http_host;
127
+ proxy_redirect off;
128
+ proxy_pass http://asylum;
129
+ }
130
+ }</code ></pre >
98
131
99
132
### Updating upstream changes
100
133
@@ -104,13 +137,13 @@ In the `project` dir of your checkout
104
137
git fetch upstream
105
138
git rebase upstream/master master
106
139
git checkout myhackerspace
107
- git rebase master
140
+ git merge master
108
141
source venv/bin/activate
109
142
pip install -r requirements/production.txt
110
143
./manage.py migrate
111
144
npm run build
112
145
./manage.py collectstatic --noinput
113
- for app in locale */locale; do (cd $(dirname $app) && ../manage.py compilemessages ); done
146
+ find . -name '._*' | xargs rm ; for app in $( find . -path ' */locale' | grep -v venv/ ) ; do (cd $(dirname $app) && ../manage.py compilemessages ); done
114
147
115
148
And assuming you have uWSGI configured ` touch reload `
116
149
@@ -131,8 +164,9 @@ Until we maybe decide on Celery for running various (timed or otherwise) tasks a
131
164
- ` npm run watch & ` If you want to develop the JS/LESS stuff this will autocompile them on change
132
165
- ` ./manage.py runserver 0.0.0.0:8000 `
133
166
- ` maildump -p ~/maildump.pid --stop `
134
- - Make localizations: ` find . -name '._*' | xargs rm ; for app in $( find . -path '*/locale' ); do (cd $(dirname $app) && ../manage.py makemessages ); done `
167
+ - Make localizations: ` find . -name '._*' | xargs rm ; for app in $( find . -path '*/locale' | grep -v venv/ ); do (cd $(dirname $app) && ../manage.py makemessages ); done `
135
168
- If you add your own apps, make sure to create the ` locale ` directory for them too.
169
+ - use ` npm run fix ` to run autopep8 and friends before committing.
136
170
137
171
If you need the special environment variables in scripts not run via manage.py, use ` set -o allexport ; source .env; set +o allexport ` to load them.
138
172
0 commit comments