|
@@ -38,9 +38,6 @@ GHOST_DOMAIN_NAME=
|
38
|
38
|
GHOST_CODE=
|
39
|
39
|
GHOST_ONION_PORT=8104
|
40
|
40
|
GHOST_PORT=2368
|
41
|
|
-GHOST_VERSION='0.11.10'
|
42
|
|
-GHOST_HASH='cccdf02d46112f1671739696f2b1888a90a5c3bdf2fae45e8e81d538a8e0f487'
|
43
|
|
-GHOST_DOWNLOAD_URL="https://github.com/TryGhost/Ghost/releases/download/${GHOST_VERSION}/Ghost-${GHOST_VERSION}.zip"
|
44
|
41
|
|
45
|
42
|
ghost_variables=(GHOST_DOMAIN_NAME
|
46
|
43
|
GHOST_CODE
|
|
@@ -58,23 +55,36 @@ function logging_off_ghost {
|
58
|
55
|
}
|
59
|
56
|
|
60
|
57
|
function ghost_replace_jquery {
|
61
|
|
- sed -i "s|code.jquery.com/jquery-${previous_jquery_version}.min.js|$GHOST_DOMAIN_NAME/jquery-${jquery_version}.js|g" content/themes/casper/default.hbs
|
62
|
|
- sed -i "s|code.jquery.com/jquery-${previous_jquery_version}.min.js|$GHOST_DOMAIN_NAME/jquery-${jquery_version}.js|g" core/server/data/migration/fixtures/004/01-move-jquery-with-alert.js
|
63
|
|
- sed -i "s|code.jquery.com/jquery-${previous_jquery_version}.min.js|$GHOST_DOMAIN_NAME/jquery-${jquery_version}.js|g" node_modules/gscan/app/tpl/layouts/default.hbs
|
|
58
|
+ curr_domain="https://$GHOST_DOMAIN_NAME"
|
|
59
|
+ if [[ "$ONION_ONLY" != 'no' ]]; then
|
|
60
|
+ curr_domain="http://$GHOST_ONION_HOSTNAME"
|
|
61
|
+ fi
|
|
62
|
+
|
|
63
|
+ sed -i "s|src=\"https://code.jquery.com/jquery-.*|src=\"$curr_domain/jquery-${jquery_version}.js\"|g" current/content/themes/casper/default.hbs
|
|
64
|
+ sed -i "s|src=\"https://code.jquery.com/jquery-.*|src=\"$curr_domain/jquery-${jquery_version}.js\"></script>|g" current/node_modules/gscan/app/tpl/layouts/default.hbs
|
|
65
|
+ sed -i "s|http://code.jquery.com/jquery.js|$curr_domain/jquery-${jquery_version}.js|g" current/node_modules/jsdom/README.md
|
|
66
|
+ sed -i "s|https://code.jquery.com/jquery.js|$curr_domain/jquery-${jquery_version}.js|g" current/node_modules/jsdom/README.md
|
|
67
|
+
|
|
68
|
+ cd /var/www/${GHOST_DOMAIN_NAME}/htdocs/current
|
|
69
|
+ find ./ -type f -exec sed -i -e 's|https://code.jquery.com|$curr_domain|g' {} \;
|
|
70
|
+ find ./ -type f -exec sed -i -e 's|http://code.jquery.com|$curr_domain|g' {} \;
|
64
|
71
|
}
|
65
|
72
|
|
66
|
73
|
function ghost_remove_offsite_links {
|
67
|
|
- cd /var/www/$GHOST_DOMAIN_NAME/htdocs
|
|
74
|
+ curr_domain="$GHOST_DOMAIN_NAME"
|
|
75
|
+ if [[ "$ONION_ONLY" != 'no' ]]; then
|
|
76
|
+ curr_domain="$GHOST_ONION_HOSTNAME"
|
|
77
|
+ fi
|
68
|
78
|
|
69
|
79
|
# remove google font links
|
70
|
|
- # Note that the privacy options in config.js aren't sufficient to remove Google's tentacles
|
71
|
|
- sed -i "s/fonts.googleapis.com/$GHOST_DOMAIN_NAME/g" content/themes/casper/default.hbs
|
72
|
|
- sed -i "s/fonts.googleapis.com/$GHOST_DOMAIN_NAME/g" core/server/apps/amp/lib/views/amp.hbs
|
|
80
|
+ cd /var/www/$GHOST_DOMAIN_NAME/htdocs/current
|
|
81
|
+ find ./ -type f -exec sed -i -e 's/fonts.googleapis.com/$curr_domain/g' {} \;
|
73
|
82
|
|
74
|
83
|
# copy jquery locally
|
75
|
84
|
previous_jquery_version='1.12.0'
|
76
|
85
|
jquery_version='1.12.4'
|
77
|
86
|
if [ ! -f /var/www/$GHOST_DOMAIN_NAME/htdocs/jquery-${jquery_version}.js ]; then
|
|
87
|
+ cd /var/www/$GHOST_DOMAIN_NAME/htdocs
|
78
|
88
|
wget https://code.jquery.com/jquery-${jquery_version}.js
|
79
|
89
|
jquery_hash=$(sha256sum jquery-${jquery_version}.js | awk -F ' ' '{print $1}')
|
80
|
90
|
if [[ "$jquery_hash" != '430f36f9b5f21aae8cc9dca6a81c4d3d84da5175eaedcf2fdc2c226302cb3575' ]]; then
|
|
@@ -112,8 +122,6 @@ function ghost_replace_proprietary_services {
|
112
|
122
|
}
|
113
|
123
|
|
114
|
124
|
function ghost_replace_services {
|
115
|
|
- ghost_replace_proprietary_services /var/www/${GHOST_DOMAIN_NAME}/htdocs/core/built/assets/ghost.js
|
116
|
|
- ghost_replace_proprietary_services /var/www/${GHOST_DOMAIN_NAME}/htdocs/core/built/assets/ghost.min.js
|
117
|
125
|
ghost_replace_proprietary_services /var/www/${GHOST_DOMAIN_NAME}/htdocs/content/themes/casper/post.hbs
|
118
|
126
|
}
|
119
|
127
|
|
|
@@ -166,52 +174,11 @@ function upgrade_ghost {
|
166
|
174
|
if [ ! -d /var/www/$GHOST_DOMAIN_NAME/htdocs ]; then
|
167
|
175
|
return
|
168
|
176
|
fi
|
169
|
|
-
|
170
|
|
- if ! grep -q "ghost version:" $COMPLETION_FILE; then
|
171
|
|
- CURR_GHOST_VERSION=${GHOST_VERSION}b
|
172
|
|
- else
|
173
|
|
- CURR_GHOST_VERSION=$(get_completion_param "ghost version")
|
174
|
|
- fi
|
175
|
|
-
|
176
|
|
- if [[ "$GHOST_VERSION" == "$CURR_GHOST_VERSION" ]]; then
|
177
|
|
- return
|
178
|
|
- fi
|
179
|
|
-
|
180
|
|
- read_config_param "GHOST_DOMAIN_NAME"
|
181
|
|
-
|
182
|
|
- GHOST_PATH=/var/www/$GHOST_DOMAIN_NAME/htdocs
|
183
|
|
-
|
184
|
|
- cd $GHOST_PATH
|
185
|
|
- if [ ! -f Ghost-${GHOST_VERSION}.zip ]; then
|
186
|
|
- wget ${GHOST_DOWNLOAD_URL}
|
187
|
|
- fi
|
188
|
|
- if [ ! -f Ghost-${GHOST_VERSION}.zip ]; then
|
189
|
|
- echo $'Unable to download ghost'
|
190
|
|
- exit 367245
|
191
|
|
- fi
|
192
|
|
-
|
193
|
|
- # check the hash
|
194
|
|
- hash=$(sha256sum Ghost-${GHOST_VERSION}.zip | awk -F ' ' '{print $1}')
|
195
|
|
- if [[ "$hash" != "$GHOST_HASH" ]]; then
|
196
|
|
- echo $'ghost hash does not match'
|
197
|
|
- exit 729856
|
198
|
|
- fi
|
199
|
|
-
|
200
|
|
- unzip -o Ghost-${GHOST_VERSION}.zip
|
201
|
|
- if [ ! -f $GHOST_PATH/index.js ]; then
|
202
|
|
- echo $'ghost failed to unzip'
|
203
|
|
- exit 63835
|
204
|
|
- fi
|
205
|
|
-
|
206
|
|
- sed -i "/sqlite/d" $GHOST_PATH/package.json
|
207
|
|
- npm install --production
|
208
|
|
-
|
209
|
|
- chown -R ghost: $GHOST_PATH/
|
|
177
|
+ cd /var/www/$GHOST_DOMAIN_NAME/htdocs
|
|
178
|
+ /usr/local/bin/ghost update
|
210
|
179
|
ghost_replace_services
|
211
|
|
- chown -R ghost: /var/www/${GHOST_DOMAIN_NAME}/htdocs
|
212
|
|
-
|
213
|
180
|
ghost_remove_offsite_links
|
214
|
|
- sed -i "s|ghost version.*|ghost version:${GHOST_VERSION}|g" ${COMPLETION_FILE}
|
|
181
|
+ chown -R ghost: /var/www/${GHOST_DOMAIN_NAME}/htdocs
|
215
|
182
|
systemctl restart ghost
|
216
|
183
|
}
|
217
|
184
|
|
|
@@ -221,12 +188,12 @@ function backup_local_ghost {
|
221
|
188
|
GHOST_DOMAIN_NAME=$(get_completion_param "ghost domain")
|
222
|
189
|
fi
|
223
|
190
|
|
224
|
|
- ghost_path=/var/www/${GHOST_DOMAIN_NAME}/htdocs
|
|
191
|
+ ghost_path=/var/www/${GHOST_DOMAIN_NAME}/htdocs/content
|
225
|
192
|
if [ -d $ghost_path ]; then
|
226
|
|
- function_check backup_database_to_usb
|
227
|
|
- backup_database_to_usb ghost
|
228
|
|
-
|
229
|
|
- backup_directory_to_usb $ghost_path ghost
|
|
193
|
+ suspend_site ${GHOST_DOMAIN_NAME}
|
|
194
|
+ systemctl stop ghost
|
|
195
|
+ backup_directory_to_usb $ghost_path ghostcontent
|
|
196
|
+ systemctl start ghost
|
230
|
197
|
restart_site
|
231
|
198
|
fi
|
232
|
199
|
}
|
|
@@ -237,34 +204,16 @@ function restore_local_ghost {
|
237
|
204
|
GHOST_DOMAIN_NAME=$(get_completion_param "ghost domain")
|
238
|
205
|
fi
|
239
|
206
|
if [ $GHOST_DOMAIN_NAME ]; then
|
|
207
|
+ suspend_site ${GHOST_DOMAIN_NAME}
|
240
|
208
|
systemctl stop ghost
|
241
|
209
|
|
242
|
|
- function_check ghost_create_database
|
243
|
|
- ghost_create_database
|
244
|
|
-
|
245
|
|
- function_check restore_database
|
246
|
|
- restore_database ghost ${GHOST_DOMAIN_NAME}
|
247
|
|
-
|
248
|
|
- MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
|
249
|
|
- ghost_config=/var/www/${GHOST_DOMAIN_NAME}/htdocs/config.js
|
250
|
|
- sed -i "s|password :.*|password : '${MARIADB_PASSWORD}',|g" $ghost_config
|
251
|
|
- MARIADB_PASSWORD=
|
252
|
|
-
|
253
|
|
- # install any missing packages
|
254
|
|
- if [ ! -d /var/www/${GHOST_DOMAIN_NAME}/htdocs/node_modules/intl ]; then
|
255
|
|
- cd /var/www/${GHOST_DOMAIN_NAME}/htdocs
|
256
|
|
- npm install passport-http-bearer@1.0.1
|
257
|
|
- npm install amperize@0.3.4
|
258
|
|
- npm install bcryptjs@2.4.3
|
259
|
|
- npm install knex@0.12.9
|
260
|
|
- npm install bookshelf@0.10.2
|
261
|
|
- npm install cookie-session@1.2.0
|
262
|
|
- npm install ghost-gql@0.0.6
|
263
|
|
- npm install intl@1.2.5
|
264
|
|
- npm install sanitize-html@1.14.1
|
265
|
|
- npm install showdown-ghost@0.3.6
|
266
|
|
- npm install superagent@3.5.2
|
267
|
|
- npm install mysql@2.1.1
|
|
210
|
+ temp_restore_dir=/root/tempghostcontent
|
|
211
|
+ function_check restore_directory_from_usb
|
|
212
|
+ restore_directory_from_usb $temp_restore_dir ghostcontent
|
|
213
|
+ if [ -d $temp_restore_dir ]; then
|
|
214
|
+ cp -r $temp_restore_dir/var/www/$GHOST_DOMAIN_NAME/htdocs/content/* /var/www/$GHOST_DOMAIN_NAME/htdocs/content/
|
|
215
|
+ chown -R ghost:ghost /var/www/$GHOST_DOMAIN_NAME/htdocs/content
|
|
216
|
+ rm -rf $temp_restore_dir
|
268
|
217
|
fi
|
269
|
218
|
|
270
|
219
|
systemctl start ghost
|
|
@@ -278,11 +227,10 @@ function backup_remote_ghost {
|
278
|
227
|
GHOST_DOMAIN_NAME=$(get_completion_param "ghost domain")
|
279
|
228
|
fi
|
280
|
229
|
|
281
|
|
- temp_backup_dir=/var/www/${GHOST_DOMAIN_NAME}/htdocs
|
|
230
|
+ temp_backup_dir=/var/www/${GHOST_DOMAIN_NAME}/htdocs/content
|
282
|
231
|
if [ -d $temp_backup_dir ]; then
|
283
|
232
|
suspend_site ${GHOST_DOMAIN_NAME}
|
284
|
|
- backup_database_to_friend ghost
|
285
|
|
- backup_directory_to_friend $temp_backup_dir ghost
|
|
233
|
+ backup_directory_to_friend $temp_backup_dir ghostcontent
|
286
|
234
|
restart_site
|
287
|
235
|
else
|
288
|
236
|
echo $"Ghost domain specified but not found in /var/www/${GHOST_DOMAIN_NAME}"
|
|
@@ -295,44 +243,21 @@ function restore_remote_ghost {
|
295
|
243
|
if grep -q "ghost domain" $COMPLETION_FILE; then
|
296
|
244
|
GHOST_DOMAIN_NAME=$(get_completion_param "ghost domain")
|
297
|
245
|
fi
|
|
246
|
+ suspend_site ${GHOST_DOMAIN_NAME}
|
298
|
247
|
|
299
|
248
|
systemctl stop ghost
|
300
|
249
|
|
301
|
|
- function_check get_mariadb_password
|
302
|
|
- get_mariadb_password
|
303
|
|
-
|
304
|
|
- function_check restore_database_from_friend
|
305
|
|
-
|
306
|
|
- function_check ghost_create_database
|
307
|
|
- ghost_create_database
|
308
|
|
-
|
309
|
|
- restore_database_from_friend ghost ${GHOST_DOMAIN_NAME}
|
310
|
|
-
|
311
|
|
- MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
|
312
|
|
- ghost_config=/var/www/${GHOST_DOMAIN_NAME}/htdocs/config.js
|
313
|
|
- sed -i "s|password :.*|password : '${MARIADB_PASSWORD}',|g" $ghost_config
|
314
|
|
- MARIADB_PASSWORD=
|
315
|
|
-
|
316
|
|
- # install any missing packages
|
317
|
|
- if [ ! -d /var/www/${GHOST_DOMAIN_NAME}/htdocs/node_modules/intl ]; then
|
318
|
|
- cd /var/www/${GHOST_DOMAIN_NAME}/htdocs
|
319
|
|
- npm install passport-http-bearer@1.0.1
|
320
|
|
- npm install amperize@0.3.4
|
321
|
|
- npm install bcryptjs@2.4.3
|
322
|
|
- npm install knex@0.12.9
|
323
|
|
- npm install bookshelf@0.10.2
|
324
|
|
- npm install cookie-session@1.2.0
|
325
|
|
- npm install ghost-gql@0.0.6
|
326
|
|
- npm install intl@1.2.5
|
327
|
|
- npm install sanitize-html@1.14.1
|
328
|
|
- npm install showdown-ghost@0.3.6
|
329
|
|
- npm install superagent@3.5.2
|
330
|
|
- npm install mysql@2.1.1
|
|
250
|
+ temp_restore_dir=/root/tempghostcontent
|
|
251
|
+ function_check restore_directory_from_friend
|
|
252
|
+ restore_directory_from_friend $temp_restore_dir ghostcontent
|
|
253
|
+ if [ -d $temp_restore_dir ]; then
|
|
254
|
+ cp -r $temp_restore_dir/var/www/$GHOST_DOMAIN_NAME/htdocs/content/* /var/www/$GHOST_DOMAIN_NAME/htdocs/content/
|
|
255
|
+ chown -R ghost: /var/www/$GHOST_DOMAIN_NAME/htdocs
|
|
256
|
+ rm -rf $temp_restore_dir
|
331
|
257
|
fi
|
332
|
258
|
|
333
|
259
|
systemctl start ghost
|
334
|
260
|
restart_site
|
335
|
|
- chown -R ghost: /var/www/$GHOST_DOMAIN_NAME/htdocs/
|
336
|
261
|
}
|
337
|
262
|
|
338
|
263
|
function remove_ghost {
|
|
@@ -348,9 +273,6 @@ function remove_ghost {
|
348
|
273
|
function_check remove_nodejs
|
349
|
274
|
remove_nodejs ghost
|
350
|
275
|
|
351
|
|
- drop_database ghost
|
352
|
|
- remove_backup_database_local ghost
|
353
|
|
-
|
354
|
276
|
read_config_param "GHOST_DOMAIN_NAME"
|
355
|
277
|
nginx_dissite $GHOST_DOMAIN_NAME
|
356
|
278
|
remove_certs ${GHOST_DOMAIN_NAME}
|
|
@@ -375,70 +297,6 @@ function remove_ghost {
|
375
|
297
|
remove_ddns_domain $GHOST_DOMAIN_NAME
|
376
|
298
|
}
|
377
|
299
|
|
378
|
|
-function ghost_create_config {
|
379
|
|
- ghost_config=/var/www/${GHOST_DOMAIN_NAME}/htdocs/config.js
|
380
|
|
-
|
381
|
|
- function_check get_mariadb_password
|
382
|
|
- get_mariadb_password
|
383
|
|
-
|
384
|
|
- echo "var path = require('path')," > $ghost_config
|
385
|
|
- echo ' config;' >> $ghost_config
|
386
|
|
- echo '' >> $ghost_config
|
387
|
|
- echo 'config = {' >> $ghost_config
|
388
|
|
- echo ' production: {' >> $ghost_config
|
389
|
|
- echo ' // This needs to be http and NOT https' >> $ghost_config
|
390
|
|
- echo " url: 'http://${GHOST_DOMAIN_NAME}'," >> $ghost_config
|
391
|
|
- echo ' mail: {' >> $ghost_config
|
392
|
|
- echo " transport: 'SMTP'," >> $ghost_config
|
393
|
|
- echo ' options: {' >> $ghost_config
|
394
|
|
- echo " service: 'Sendmail'," >> $ghost_config
|
395
|
|
- echo ' }' >> $ghost_config
|
396
|
|
- echo ' },' >> $ghost_config
|
397
|
|
- echo ' database: {' >> $ghost_config
|
398
|
|
- echo " client: 'mysql'," >> $ghost_config
|
399
|
|
- echo ' connection: {' >> $ghost_config
|
400
|
|
- echo " host : '127.0.0.1'," >> $ghost_config
|
401
|
|
- echo " user : 'root'," >> $ghost_config
|
402
|
|
- echo " password : '${MARIADB_PASSWORD}'," >> $ghost_config
|
403
|
|
- echo " database : 'ghost'," >> $ghost_config
|
404
|
|
- echo " charset : 'utf8'" >> $ghost_config
|
405
|
|
- echo ' }' >> $ghost_config
|
406
|
|
- echo ' },' >> $ghost_config
|
407
|
|
- echo '' >> $ghost_config
|
408
|
|
- echo ' server: {' >> $ghost_config
|
409
|
|
- echo " host: '127.0.0.1'," >> $ghost_config
|
410
|
|
- echo " port: '${GHOST_PORT}'" >> $ghost_config
|
411
|
|
- echo ' },' >> $ghost_config
|
412
|
|
- echo ' privacy: {' >> $ghost_config
|
413
|
|
- echo ' useTinfoil: true,' >> $ghost_config
|
414
|
|
- echo ' },' >> $ghost_config
|
415
|
|
- echo ' logging: false' >> $ghost_config
|
416
|
|
- echo ' }' >> $ghost_config
|
417
|
|
- echo '};' >> $ghost_config
|
418
|
|
- echo '' >> $ghost_config
|
419
|
|
- echo 'module.exports = config;' >> $ghost_config
|
420
|
|
- chmod 700 $ghost_config
|
421
|
|
-}
|
422
|
|
-
|
423
|
|
-function ghost_create_database {
|
424
|
|
- if [ -f ${IMAGE_PASSWORD_FILE} ]; then
|
425
|
|
- GIT_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
|
426
|
|
- else
|
427
|
|
- if [ ! ${GIT_ADMIN_PASSWORD} ]; then
|
428
|
|
- GIT_ADMIN_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
|
429
|
|
- fi
|
430
|
|
- fi
|
431
|
|
- if [ ! $GIT_ADMIN_PASSWORD ]; then
|
432
|
|
- return
|
433
|
|
- fi
|
434
|
|
-
|
435
|
|
- function_check get_mariadb_password
|
436
|
|
- get_mariadb_password
|
437
|
|
-
|
438
|
|
- function_check create_database
|
439
|
|
- create_database ghost "$GHOST_ADMIN_PASSWORD"
|
440
|
|
-}
|
441
|
|
-
|
442
|
300
|
function install_ghost {
|
443
|
301
|
if [ ! $ONION_ONLY ]; then
|
444
|
302
|
ONION_ONLY='no'
|
|
@@ -456,35 +314,11 @@ function install_ghost {
|
456
|
314
|
mkdir -p /var/www/$GHOST_DOMAIN_NAME/htdocs
|
457
|
315
|
fi
|
458
|
316
|
cd /var/www/$GHOST_DOMAIN_NAME/htdocs
|
459
|
|
- if [ ! -f Ghost-${GHOST_VERSION}.zip ]; then
|
460
|
|
- wget ${GHOST_DOWNLOAD_URL}
|
461
|
|
- fi
|
462
|
|
- if [ ! -f Ghost-${GHOST_VERSION}.zip ]; then
|
463
|
|
- echo $'Unable to download ghost'
|
464
|
|
- rm -rf /var/www/$GHOST_DOMAIN_NAME
|
465
|
|
- exit 63892
|
466
|
|
- fi
|
467
|
|
-
|
468
|
|
- # check the hash
|
469
|
|
- hash=$(sha256sum Ghost-${GHOST_VERSION}.zip | awk -F ' ' '{print $1}')
|
470
|
|
- if [[ "$hash" != "$GHOST_HASH" ]]; then
|
471
|
|
- echo $'ghost hash does not match'
|
472
|
|
- exit 729856
|
473
|
|
- fi
|
474
|
|
-
|
475
|
|
- unzip -o Ghost-${GHOST_VERSION}.zip
|
476
|
|
- if [ ! -f /var/www/${GHOST_DOMAIN_NAME}/htdocs/index.js ]; then
|
477
|
|
- echo $'ghost failed to unzip'
|
478
|
|
- rm -rf /var/www/$GHOST_DOMAIN_NAME
|
479
|
|
- exit 63835
|
480
|
|
- fi
|
481
|
317
|
|
482
|
318
|
function_check install_nodejs
|
483
|
319
|
install_nodejs ghost
|
484
|
320
|
|
485
|
|
- sed -i "/sqlite/d" /var/www/${GHOST_DOMAIN_NAME}/htdocs/package.json
|
486
|
|
-
|
487
|
|
- cd /var/www/$GHOST_DOMAIN_NAME/htdocs
|
|
321
|
+ # Some dependencies of ghost
|
488
|
322
|
npm install -g jison@0.4.13 --save
|
489
|
323
|
npm install moment-timezone@0.5.13
|
490
|
324
|
npm install express@4.15.3
|
|
@@ -536,44 +370,42 @@ function install_ghost {
|
536
|
370
|
npm install superagent@3.5.2
|
537
|
371
|
npm install mysql@2.1.1
|
538
|
372
|
npm install mariasql@0.2.6
|
|
373
|
+ npm install debug@2.6.8
|
|
374
|
+ npm install nconf@0.8.4
|
539
|
375
|
|
540
|
|
- npm install --production
|
541
|
|
-
|
542
|
|
- function_check install_mariadb
|
543
|
|
- install_mariadb
|
544
|
|
-
|
545
|
|
- function_check get_mariadb_password
|
546
|
|
- get_mariadb_password
|
|
376
|
+ npm install -g knex-migrator
|
|
377
|
+ knex-migrator init
|
547
|
378
|
|
548
|
|
- function_check ghost_create_database
|
549
|
|
- ghost_create_database
|
550
|
|
-
|
551
|
|
- ghost_create_config
|
|
379
|
+ # now install ghost itself
|
|
380
|
+ npm install -g ghost-cli
|
|
381
|
+ ghost install local
|
552
|
382
|
|
553
|
383
|
adduser --system --home=/var/www/${GHOST_DOMAIN_NAME}/htdocs/ --group ghost
|
554
|
|
- chown -R ghost: /var/www/${GHOST_DOMAIN_NAME}/htdocs
|
555
|
384
|
|
556
|
385
|
echo '[Unit]' > /etc/systemd/system/ghost.service
|
557
|
386
|
echo 'Description=Ghost Blog' >> /etc/systemd/system/ghost.service
|
558
|
387
|
echo 'After=syslog.target' >> /etc/systemd/system/ghost.service
|
559
|
388
|
echo 'After=network.target' >> /etc/systemd/system/ghost.service
|
560
|
|
- echo 'After=mysqld.service' >> /etc/systemd/system/ghost.service
|
561
|
389
|
echo '' >> /etc/systemd/system/ghost.service
|
562
|
390
|
echo '[Service]' >> /etc/systemd/system/ghost.service
|
563
|
391
|
echo 'Type=simple' >> /etc/systemd/system/ghost.service
|
564
|
392
|
echo 'User=ghost' >> /etc/systemd/system/ghost.service
|
565
|
393
|
echo 'Group=ghost' >> /etc/systemd/system/ghost.service
|
566
|
394
|
echo "WorkingDirectory=/var/www/${GHOST_DOMAIN_NAME}/htdocs" >> /etc/systemd/system/ghost.service
|
567
|
|
- echo "ExecStart=/usr/local/bin/node /var/www/${GHOST_DOMAIN_NAME}/htdocs/index.js" >> /etc/systemd/system/ghost.service
|
|
395
|
+ echo "ExecStart=/usr/local/bin/ghost run" >> /etc/systemd/system/ghost.service
|
|
396
|
+ echo "ExecStop=/usr/local/bin/ghost stop" >> /etc/systemd/system/ghost.service
|
|
397
|
+ echo "ExecRestart=/usr/local/bin/ghost restart" >> /etc/systemd/system/ghost.service
|
568
|
398
|
echo 'Restart=always' >> /etc/systemd/system/ghost.service
|
569
|
399
|
echo 'RestartSec=60' >> /etc/systemd/system/ghost.service
|
570
|
|
- echo "Environment=NODE_ENV=production PORT=${GHOST_PORT}" >> /etc/systemd/system/ghost.service
|
|
400
|
+ echo "Environment=NODE_ENV=development PORT=${GHOST_PORT}" >> /etc/systemd/system/ghost.service
|
571
|
401
|
echo '' >> /etc/systemd/system/ghost.service
|
572
|
402
|
echo '[Install]' >> /etc/systemd/system/ghost.service
|
573
|
403
|
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/ghost.service
|
574
|
404
|
|
575
|
405
|
ghost_remove_offsite_links
|
576
|
406
|
|
|
407
|
+ chown -R ghost: /var/www/${GHOST_DOMAIN_NAME}/htdocs
|
|
408
|
+
|
577
|
409
|
systemctl enable ghost
|
578
|
410
|
systemctl daemon-reload
|
579
|
411
|
systemctl start ghost
|
|
@@ -654,22 +486,12 @@ function install_ghost {
|
654
|
486
|
function_check create_site_certificate
|
655
|
487
|
create_site_certificate $GHOST_DOMAIN_NAME 'yes'
|
656
|
488
|
|
657
|
|
- function_check configure_php
|
658
|
|
- configure_php
|
659
|
|
-
|
660
|
|
- if [[ $ONION_ONLY != 'no' ]]; then
|
661
|
|
- sed -i "s|url: .*|url: 'http://${GHOST_ONION_HOSTNAME}',|g" /var/www/${GHOST_DOMAIN_NAME}/htdocs/config.js
|
662
|
|
- systemctl restart mariadb
|
663
|
|
- systemctl restart ghost
|
664
|
|
- fi
|
665
|
|
-
|
666
|
489
|
ghost_replace_services
|
667
|
490
|
|
668
|
491
|
function_check nginx_ensite
|
669
|
492
|
nginx_ensite $GHOST_DOMAIN_NAME
|
670
|
493
|
|
671
|
494
|
systemctl restart nginx
|
672
|
|
- systemctl restart mariadb
|
673
|
495
|
|
674
|
496
|
${PROJECT_NAME}-pass -u $MY_USERNAME -a ghost -p "$GHOST_ADMIN_PASSWORD"
|
675
|
497
|
|