|
@@ -0,0 +1,366 @@
|
|
1
|
+#!/bin/bash
|
|
2
|
+#
|
|
3
|
+# .---. . .
|
|
4
|
+# | | |
|
|
5
|
+# |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
|
|
6
|
+# | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
|
|
7
|
+# ' ' --' --' -' - -' ' ' -' -' -' ' - --'
|
|
8
|
+#
|
|
9
|
+# Freedom in the Cloud
|
|
10
|
+#
|
|
11
|
+# Mediagoblin application
|
|
12
|
+#
|
|
13
|
+# License
|
|
14
|
+# =======
|
|
15
|
+#
|
|
16
|
+# Copyright (C) 2016 Bob Mottram <bob@freedombone.net>
|
|
17
|
+#
|
|
18
|
+# This program is free software: you can redistribute it and/or modify
|
|
19
|
+# it under the terms of the GNU Affero General Public License as published by
|
|
20
|
+# the Free Software Foundation, either version 3 of the License, or
|
|
21
|
+# (at your option) any later version.
|
|
22
|
+#
|
|
23
|
+# This program is distributed in the hope that it will be useful,
|
|
24
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
25
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
26
|
+# GNU Affero General Public License for more details.
|
|
27
|
+#
|
|
28
|
+# You should have received a copy of the GNU Affero General Public License
|
|
29
|
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
30
|
+
|
|
31
|
+VARIANTS='full full-vim media'
|
|
32
|
+
|
|
33
|
+IN_DEFAULT_INSTALL=0
|
|
34
|
+SHOW_ON_ABOUT=1
|
|
35
|
+
|
|
36
|
+MEDIAGOBLIN_DOMAIN_NAME=
|
|
37
|
+MEDIAGOBLIN_ADMIN_PASSWORD=
|
|
38
|
+MEDIAGOBLIN_CODE=
|
|
39
|
+MEDIAGOBLIN_ONION_PORT=8108
|
|
40
|
+MEDIAGOBLIN_REPO="http://git.savannah.gnu.org/r/mediagoblin.git"
|
|
41
|
+MEDIAGOBLIN_BASE_DIR=/var/www/mediagoblin.local/htdocs
|
|
42
|
+
|
|
43
|
+mediagoblin_variables=(ONION_ONLY
|
|
44
|
+ MY_USERNAME
|
|
45
|
+ MEDIAGOBLIN_DOMAIN_NAME
|
|
46
|
+ MEDIAGOBLIN_CODE
|
|
47
|
+ DDNS_PROVIDER)
|
|
48
|
+
|
|
49
|
+function install_interactive_mediagoblin {
|
|
50
|
+ if [[ $ONION_ONLY != "no" ]]; then
|
|
51
|
+ MEDIAGOBLIN_DOMAIN_NAME='mediagoblin.local'
|
|
52
|
+ write_config_param "MEDIAGOBLIN_DOMAIN_NAME" "$MEDIAGOBLIN_DOMAIN_NAME"
|
|
53
|
+ else
|
|
54
|
+ function_check interactive_site_details
|
|
55
|
+ interactive_site_details "mediagoblin" "MEDIAGOBLIN_DOMAIN_NAME" "MEDIAGOBLIN_CODE"
|
|
56
|
+ fi
|
|
57
|
+ APP_INSTALLED=1
|
|
58
|
+}
|
|
59
|
+
|
|
60
|
+function change_password_mediagoblin {
|
|
61
|
+ curr_username="$1"
|
|
62
|
+ new_user_password="$2"
|
|
63
|
+}
|
|
64
|
+
|
|
65
|
+function add_user_mediagoblin {
|
|
66
|
+ new_username="$1"
|
|
67
|
+ new_user_password="$2"
|
|
68
|
+}
|
|
69
|
+
|
|
70
|
+function remove_user_mediagoblin {
|
|
71
|
+ remove_username="$1"
|
|
72
|
+}
|
|
73
|
+
|
|
74
|
+function reconfigure_mediagoblin {
|
|
75
|
+ echo -n ''
|
|
76
|
+}
|
|
77
|
+
|
|
78
|
+function upgrade_mediagoblin {
|
|
79
|
+ echo -n ''
|
|
80
|
+}
|
|
81
|
+
|
|
82
|
+function backup_local_mediagoblin {
|
|
83
|
+ MEDIAGOBLIN_BASE_DIR=/var/www/$MEDIAGOBLIN_DOMAIN_NAME/htdocs
|
|
84
|
+ source_directory=/var/lib/mediagoblin
|
|
85
|
+ if [ -d $source_directory ]; then
|
|
86
|
+ dest_directory=mediagoblin
|
|
87
|
+ function_check backup_directory_to_usb
|
|
88
|
+ backup_directory_to_usb $MEDIAGOBLIN_BASE_DIR $dest_directory
|
|
89
|
+ backup_directory_to_usb /var/lib/mediagoblin mediagoblindata
|
|
90
|
+ fi
|
|
91
|
+}
|
|
92
|
+
|
|
93
|
+function restore_local_mediagoblin {
|
|
94
|
+ MEDIAGOBLIN_BASE_DIR=/var/www/$MEDIAGOBLIN_DOMAIN_NAME/htdocs
|
|
95
|
+ if [ -d /var/lib/mediagoblin ]; then
|
|
96
|
+ echo $"Restoring Mediagoblin installation"
|
|
97
|
+ function_check get_completion_param
|
|
98
|
+ MEDIAGOBLIN_DOMAIN_NAME=$(get_completion_param "mediagoblin domain")
|
|
99
|
+ temp_restore_dir=/root/tempmediagoblin
|
|
100
|
+ function_check restore_directory_from_usb
|
|
101
|
+ restore_directory_from_usb ${temp_restore_dir} mediagoblin
|
|
102
|
+ cp -r ${temp_restore_dir}$MEDIAGOBLIN_BASE_DIR/* $MEDIAGOBLIN_BASE_DIR/
|
|
103
|
+ if [ ! "$?" = "0" ]; then
|
|
104
|
+ function_check restore_directory_from_usb
|
|
105
|
+ set_user_permissions
|
|
106
|
+ function_check backup_unmount_drive
|
|
107
|
+ backup_unmount_drive
|
|
108
|
+ exit 45327
|
|
109
|
+ fi
|
|
110
|
+ restore_directory_from_usb ${temp_restore_dir}2 mediagoblindata
|
|
111
|
+ cp -r ${temp_restore_dir}2/var/lib/mediagoblin/* /var/lib/mediagoblin/
|
|
112
|
+ if [ ! "$?" = "0" ]; then
|
|
113
|
+ function_check set_user_permissions
|
|
114
|
+ set_user_permissions
|
|
115
|
+ function_check backup_unmount_drive
|
|
116
|
+ backup_unmount_drive
|
|
117
|
+ exit 24529
|
|
118
|
+ fi
|
|
119
|
+ rm -rf ${temp_restore_dir}
|
|
120
|
+ rm -rf ${temp_restore_dir}2
|
|
121
|
+ chown -hR mediagoblin:mediagoblin /var/log/mediagoblin
|
|
122
|
+ chown -hR mediagoblin:www-data $MEDIAGOBLIN_BASE_DIR
|
|
123
|
+ fi
|
|
124
|
+}
|
|
125
|
+
|
|
126
|
+function backup_remote_mediagoblin {
|
|
127
|
+ MEDIAGOBLIN_BASE_DIR=/var/www/$MEDIAGOBLIN_DOMAIN_NAME/htdocs
|
|
128
|
+ if [ -d /etc/mediagoblin ]; then
|
|
129
|
+ echo $"Backing up mediagoblin"
|
|
130
|
+ backup_directory_to_friend $MEDIAGOBLIN_BASE_DIR mediagoblin
|
|
131
|
+ backup_directory_to_friend /var/lib/mediagoblin mediagoblindata
|
|
132
|
+ fi
|
|
133
|
+}
|
|
134
|
+
|
|
135
|
+function restore_remote_mediagoblin {
|
|
136
|
+ MEDIAGOBLIN_BASE_DIR=/var/www/$MEDIAGOBLIN_DOMAIN_NAME/htdocs
|
|
137
|
+ if [ -d $SERVER_DIRECTORY/backup/mediagoblin ]; then
|
|
138
|
+ function_check get_completion_param
|
|
139
|
+ MEDIAGOBLIN_DOMAIN_NAME=$(get_completion_param "mediagoblin domain")
|
|
140
|
+ function_check restore_directory_from_friend
|
|
141
|
+ restore_directory_from_friend /root/tempmediagoblin mediagoblin
|
|
142
|
+ cp -r /root/tempmediagoblin/var/lib/mediagoblin/* /var/lib/mediagoblin/
|
|
143
|
+ if [ ! "$?" = "0" ]; then
|
|
144
|
+ exit 264824
|
|
145
|
+ fi
|
|
146
|
+ restore_directory_from_friend /root/tempmediagoblin2 mediagoblindata
|
|
147
|
+ cp -r /root/tempmediagoblin/var/lib/mediagoblin/* /var/lib/mediagoblin/
|
|
148
|
+ if [ ! "$?" = "0" ]; then
|
|
149
|
+ exit 268492
|
|
150
|
+ fi
|
|
151
|
+ rm -rf /root/tempmediagoblin
|
|
152
|
+ rm -rf /root/tempmediagoblin2
|
|
153
|
+ chown -hR mediagoblin:mediagoblin /var/log/mediagoblin
|
|
154
|
+ chown -hR mediagoblin:www-data $MEDIAGOBLIN_BASE_DIR
|
|
155
|
+ fi
|
|
156
|
+}
|
|
157
|
+
|
|
158
|
+function remove_mediagoblin {
|
|
159
|
+ if [ ${#MEDIAGOBLIN_DOMAIN_NAME} -eq 0 ]; then
|
|
160
|
+ return
|
|
161
|
+ fi
|
|
162
|
+ MEDIAGOBLIN_BASE_DIR=/var/www/$MEDIAGOBLIN_DOMAIN_NAME/htdocs
|
|
163
|
+ function_check remove_onion_service
|
|
164
|
+ remove_onion_service mediagoblin ${MEDIAGOBLIN_ONION_PORT}
|
|
165
|
+ nginx_dissite $MEDIAGOBLIN_DOMAIN_NAME
|
|
166
|
+ remove_certs $MEDIAGOBLIN_DOMAIN_NAME
|
|
167
|
+ if [ -d /var/lib/mediagoblin ]; then
|
|
168
|
+ rm -rf /var/lib/mediagoblin
|
|
169
|
+ fi
|
|
170
|
+ if [ -d $MEDIAGOBLIN_BASE_DIR ]; then
|
|
171
|
+ rm -rf $MEDIAGOBLIN_BASE_DIR
|
|
172
|
+ fi
|
|
173
|
+ remove_completion_param "install_mediagoblin"
|
|
174
|
+ remove_completion_param "mediagoblin domain"
|
|
175
|
+ sed -i '/mediagoblin/d' $COMPLETION_FILE
|
|
176
|
+
|
|
177
|
+ remove_nodejs mediagoblin
|
|
178
|
+ deluser mediagoblin
|
|
179
|
+ delgroup mediagoblin
|
|
180
|
+
|
|
181
|
+ function_check remove_ddns_domain
|
|
182
|
+ remove_ddns_domain $MEDIAGOBLIN_DOMAIN_NAME
|
|
183
|
+}
|
|
184
|
+
|
|
185
|
+function install_mediagoblin {
|
|
186
|
+ if [ ! $MEDIAGOBLIN_DOMAIN_NAME ]; then
|
|
187
|
+ return
|
|
188
|
+ fi
|
|
189
|
+
|
|
190
|
+ MEDIAGOBLIN_BASE_DIR=/var/www/$MEDIAGOBLIN_DOMAIN_NAME/htdocs
|
|
191
|
+
|
|
192
|
+ function_check install_nodejs
|
|
193
|
+ install_nodejs mediagoblin
|
|
194
|
+
|
|
195
|
+ apt-get install -yq python python-dev python-lxml python-imaging python-virtualenv
|
|
196
|
+ apt-get install -yq automake perl
|
|
197
|
+ useradd -c "GNU MediaGoblin system account" -d /var/lib/mediagoblin -m -r -g www-data mediagoblin
|
|
198
|
+ groupadd mediagoblin
|
|
199
|
+ usermod --append -G mediagoblin mediagoblin
|
|
200
|
+ mkdir -p /var/log/mediagoblin
|
|
201
|
+ chown -hR mediagoblin:mediagoblin /var/log/mediagoblin
|
|
202
|
+ mkdir -p $MEDIAGOBLIN_BASE_DIR
|
|
203
|
+ chown -hR mediagoblin:www-data $MEDIAGOBLIN_BASE_DIR
|
|
204
|
+ su -c "cd $MEDIAGOBLIN_BASE_DIR && git clone $MEDIAGOBLIN_REPO $MEDIAGOBLIN_BASE_DIR/mediagoblin" - mediagoblin
|
|
205
|
+ su -c "cd $MEDIAGOBLIN_BASE_DIR/mediagoblin && mediagoblin git checkout stable" - mediagoblin
|
|
206
|
+ su -c "cd $MEDIAGOBLIN_BASE_DIR/mediagoblin && git submodule sync" - mediaGoblin
|
|
207
|
+ su -c "cd $MEDIAGOBLIN_BASE_DIR/mediagoblin && git submodule update --force --init --recursive" - mediagoblin
|
|
208
|
+ su -c "cd $MEDIAGOBLIN_BASE_DIR/mediagoblin && ./bootstrap.sh" -mediagoblin
|
|
209
|
+ su -c "cd $MEDIAGOBLIN_BASE_DIR/mediagoblin && ./configure" - mediagoblin
|
|
210
|
+ su -c "cd $MEDIAGOBLIN_BASE_DIR/mediagoblin && make" - mediagoblin
|
|
211
|
+ su -c "$MEDIAGOBLIN_BASE_DIR/mediagoblin && bin/easy_install flup==1.0.3.dev-20110405" - mediaGoblin
|
|
212
|
+ su -c "cd $MEDIAGOBLIN_BASE_DIR/mediagoblin && ln -s /var/lib/mediagoblin user_dev" - mediagoblin
|
|
213
|
+ su -c "cd $MEDIAGOBLIN_BASE_DIR/mediagoblin && bash -c 'cp -av mediagoblin.ini mediagoblin_local.ini && cp -av paste.ini paste_local.ini'" - mediagoblin
|
|
214
|
+ su -c "cd $MEDIAGOBLIN_BASE_DIR/mediagoblin && perl -pi -e 's|.*sql_engine = .*|sql_engine = sqlite:////var/lib/mediagoblin/mediagoblin.db|' mediagoblin_local.ini" - mediagoblin
|
|
215
|
+
|
|
216
|
+ # Video plugin
|
|
217
|
+ apt-get install -yq python-gi python3-gi \
|
|
218
|
+ gstreamer1.0-tools \
|
|
219
|
+ gir1.2-gstreamer-1.0 \
|
|
220
|
+ gir1.2-gst-plugins-base-1.0 \
|
|
221
|
+ gstreamer1.0-plugins-good \
|
|
222
|
+ gstreamer1.0-libav \
|
|
223
|
+ python-gst-1.0
|
|
224
|
+ cd $MEDIAGOBLIN_BASE_DIR/mediagoblin
|
|
225
|
+ su -c "echo '[[mediagoblin.media_types.video]]' | tee -a mediagoblin_local.ini" - mediagoblin
|
|
226
|
+
|
|
227
|
+ # Audio plugin
|
|
228
|
+ apt-get install -yq python-gst-1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-bad gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-libav libsndfile1-dev libasound2-dev libgstreamer-plugins-base1.0-dev python-numpy python-scipy
|
|
229
|
+ su -c "cd $MEDIAGOBLIN_BASE_DIR/mediagoblin && echo '[[mediagoblin.media_types.audio]]' | tee -a mediagoblin_local.ini" - mediagoblin
|
|
230
|
+ su -c "cd $MEDIAGOBLIN_BASE_DIR/mediagoblin && bin/pip install scikits.audiolab" - mediagoblin
|
|
231
|
+
|
|
232
|
+ if [ -f $IMAGE_PASSWORD_FILE ]; then
|
|
233
|
+ MEDIAGOBLIN_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
|
|
234
|
+ else
|
|
235
|
+ if [ ! $MEDIAGOBLIN_ADMIN_PASSWORD ]; then
|
|
236
|
+ MEDIAGOBLIN_ADMIN_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
|
|
237
|
+ fi
|
|
238
|
+ fi
|
|
239
|
+
|
|
240
|
+ MEDIAGOBLIN_ONION_HOSTNAME=$(add_onion_service mediagoblin 80 ${MEDIAGOBLIN_ONION_PORT})
|
|
241
|
+ set_completion_param "mediagoblin domain" "${MEDIAGOBLIN_DOMAIN_NAME}"
|
|
242
|
+
|
|
243
|
+ if [[ $ONION_ONLY == "no" ]]; then
|
|
244
|
+ function_check nginx_http_redirect
|
|
245
|
+ nginx_http_redirect $MEDIAGOBLIN_DOMAIN_NAME
|
|
246
|
+ echo 'server {' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
247
|
+ echo ' listen 443 ssl;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
248
|
+ echo ' listen [::]:443 ssl;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
249
|
+ echo ' include /etc/nginx/mime.types;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
250
|
+ echo '' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
251
|
+ echo ' autoindex off;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
252
|
+ echo ' default_type application/octet-stream;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
253
|
+ echo ' sendfile on;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
254
|
+ echo '' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
255
|
+ function_check nginx_ssl
|
|
256
|
+ nginx_ssl $MEDIAGOBLIN_DOMAIN_NAME
|
|
257
|
+ function_check nginx_disable_sniffing
|
|
258
|
+ nginx_disable_sniffing $MEDIAGOBLIN_DOMAIN_NAME
|
|
259
|
+ function_check nginx_limits
|
|
260
|
+ nginx_limits $MEDIAGOBLIN_DOMAIN_NAME
|
|
261
|
+ nginx_keybase $MEDIAGOBLIN_DOMAIN_NAME
|
|
262
|
+ echo '' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
263
|
+ echo ' gzip on;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
264
|
+ echo ' gzip_min_length 1024;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
265
|
+ echo ' gzip_buffers 4 32k;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
266
|
+ echo ' gzip_types text/plain application/x-javascript text/javascript text/xml text/css;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
267
|
+ echo '' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
268
|
+ echo " server_name $MEDIAGOBLIN_DOMAIN_NAME;" >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
269
|
+ echo ' access_log /dev/null;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
270
|
+ echo ' error_log /dev/null;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
271
|
+ echo '' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
272
|
+
|
|
273
|
+ echo ' location /mgoblin_static/ {' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
274
|
+ echo " alias $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin/static/;" >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
275
|
+ echo ' }' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
276
|
+ echo '' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
277
|
+ echo ' location /mgoblin_media/ {' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
278
|
+ echo " alias $MEDIAGOBLIN_BASE_DIR/mediagoblin/user_dev/media/public/;" >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
279
|
+ echo ' }' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
280
|
+ echo '' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
281
|
+ echo ' location /theme_static/ {' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
282
|
+ echo " alias $MEDIAGOBLIN_BASE_DIR/mediagoblin/user_dev/theme_static/;" >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
283
|
+ echo ' }' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
284
|
+ echo '' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
285
|
+ echo ' location /plugin_static/ {' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
286
|
+ echo " alias $MEDIAGOBLIN_BASE_DIR/mediagoblin/user_dev/plugin_static/;" >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
287
|
+ echo ' }' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
288
|
+ echo '' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
289
|
+ echo ' location / {' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
290
|
+ echo ' fastcgi_pass 127.0.0.1:26543;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
291
|
+ echo ' include /etc/nginx/fastcgi_params;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
292
|
+ echo ' fastcgi_param PATH_INFO $fastcgi_script_name;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
293
|
+ echo ' fastcgi_param SCRIPT_NAME "";' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
294
|
+ echo ' }' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
295
|
+ echo '}' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
296
|
+ else
|
|
297
|
+ echo -n '' > /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
298
|
+ fi
|
|
299
|
+ echo 'server {' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
300
|
+ echo " listen 127.0.0.1:${MEDIAGOBLIN_ONION_PORT} default_server;" >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
301
|
+ echo ' include /etc/nginx/mime.types;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
302
|
+ echo '' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
303
|
+ echo ' autoindex off;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
304
|
+ echo ' default_type application/octet-stream;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
305
|
+ echo ' sendfile on;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
306
|
+ echo '' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
307
|
+ function_check nginx_disable_sniffing
|
|
308
|
+ nginx_disable_sniffing $MEDIAGOBLIN_DOMAIN_NAME
|
|
309
|
+ function_check nginx_limits
|
|
310
|
+ nginx_limits $MEDIAGOBLIN_DOMAIN_NAME
|
|
311
|
+ echo '' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
312
|
+ echo ' gzip on;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
313
|
+ echo ' gzip_min_length 1024;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
314
|
+ echo ' gzip_buffers 4 32k;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
315
|
+ echo ' gzip_types text/plain application/x-javascript text/javascript text/xml text/css;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
316
|
+ echo '' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
317
|
+ echo " server_name $MEDIAGOBLIN_ONION_HOSTNAME;" >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
318
|
+ echo ' access_log /dev/null;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
319
|
+ echo ' error_log /dev/null;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
320
|
+ echo '' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
321
|
+
|
|
322
|
+ echo ' location /mgoblin_static/ {' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
323
|
+ echo " alias $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin/static/;" >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
324
|
+ echo ' }' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
325
|
+ echo '' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
326
|
+ echo ' location /mgoblin_media/ {' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
327
|
+ echo " alias $MEDIAGOBLIN_BASE_DIR/mediagoblin/user_dev/media/public/;" >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
328
|
+ echo ' }' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
329
|
+ echo '' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
330
|
+ echo ' location /theme_static/ {' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
331
|
+ echo " alias $MEDIAGOBLIN_BASE_DIR/mediagoblin/user_dev/theme_static/;" >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
332
|
+ echo ' }' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
333
|
+ echo '' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
334
|
+ echo ' location /plugin_static/ {' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
335
|
+ echo " alias $MEDIAGOBLIN_BASE_DIR/mediagoblin/user_dev/plugin_static/;" >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
336
|
+ echo ' }' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
337
|
+ echo '' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
338
|
+ echo ' location / {' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
339
|
+ echo ' fastcgi_pass 127.0.0.1:26543;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
340
|
+ echo ' include /etc/nginx/fastcgi_params;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
341
|
+ echo ' fastcgi_param PATH_INFO $fastcgi_script_name;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
342
|
+ echo ' fastcgi_param SCRIPT_NAME "";' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
343
|
+ echo ' }' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
344
|
+ echo '}' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+ function_check create_site_certificate
|
|
348
|
+ create_site_certificate $MEDIAGOBLIN_DOMAIN_NAME
|
|
349
|
+
|
|
350
|
+ function_check configure_php
|
|
351
|
+ configure_php
|
|
352
|
+
|
|
353
|
+ nginx_ensite $MEDIAGOBLIN_DOMAIN_NAME
|
|
354
|
+
|
|
355
|
+ systemctl restart php5-fpm
|
|
356
|
+ systemctl restart nginx
|
|
357
|
+
|
|
358
|
+ function_check add_ddns_domain
|
|
359
|
+ add_ddns_domain $MEDIAGOBLIN_DOMAIN_NAME
|
|
360
|
+
|
|
361
|
+ ${PROJECT_NAME}-pass -u $MY_USERNAME -a mediagoblin -p "$MEDIAGOBLIN_ADMIN_PASSWORD"
|
|
362
|
+
|
|
363
|
+ APP_INSTALLED=1
|
|
364
|
+}
|
|
365
|
+
|
|
366
|
+# NOTE: deliberately no exit 0
|