Преглед на файлове

Change how ghost is installed and limit to 1Gb+ RAM

Bob Mottram преди 7 години
родител
ревизия
ce85662f90
променени са 1 файла, в които са добавени 17 реда и са изтрити 63 реда
  1. 17
    63
      src/freedombone-app-ghost

+ 17
- 63
src/freedombone-app-ghost Целия файл

@@ -14,7 +14,7 @@
14 14
 # License
15 15
 # =======
16 16
 #
17
-# Copyright (C) 2016-2017 Bob Mottram <bob@freedombone.net>
17
+# Copyright (C) 2016-2018 Bob Mottram <bob@freedombone.net>
18 18
 #
19 19
 # This program is free software: you can redistribute it and/or modify
20 20
 # it under the terms of the GNU Affero General Public License as published by
@@ -347,6 +347,8 @@ function remove_ghost {
347 347
 }
348 348
 
349 349
 function install_ghost {
350
+    check_ram_availability 900
351
+
350 352
     if [ ! $ONION_ONLY ]; then
351 353
         ONION_ONLY='no'
352 354
     fi
@@ -367,78 +369,26 @@ function install_ghost {
367 369
     function_check install_nodejs
368 370
     install_nodejs ghost
369 371
 
370
-    # Some dependencies of ghost
371
-    npm install -g jison@0.4.13 --save
372
-    npm install moment-timezone@0.5.13
373
-    npm install express@4.15.3
374
-    npm install lodash@4.17.4
375
-    npm install uuid@3.0.1
376
-    npm install bluebird@3.5.0
377
-    npm install chalk@1.1.3
378
-    npm install intl-messageformat@1.3.0
379
-    npm install validator@7.0.0
380
-    npm install express-hbs@1.0.4
381
-    npm install glob@7.1.2
382
-    npm install unidecode@0.1.8
383
-    npm install csv-parser@1.11.0
384
-    npm install archiver@1.3.0
385
-    npm install fs-extra@3.0.1
386
-    npm install extract-zip-fork@1.5.1
387
-    npm install moment@2.18.1
388
-    npm install nodemailer@4.0.1
389
-    npm install html-to-text@3.3.0
390
-    npm install gscan@1.1.0
391
-    npm install body-parser@1.17.2
392
-    npm install compression@1.6.2
393
-    npm install morgan@1.8.2
394
-    npm install semver@5.3.0
395
-    npm install path-match@1.2.4
396
-    npm install downsize@0.0.8
397
-    npm install rss@1.2.2
398
-    npm install cheerio@1.0.0-rc.1
399
-    npm install passport@0.3.2
400
-    npm install xml@1.0.1
401
-    npm install multer@1.3.0
402
-    npm install oauth2orize@1.8.0
403
-    npm install connect-slashes@1.3.1
404
-    npm install cors@2.8.3
405
-    npm install netjet@1.1.3
406
-    npm install jsonpath@0.2.11
407
-    npm install image-size@0.5.4
408
-    npm install passport-oauth2-client-password@0.1.2
409
-    npm install passport-http-bearer@1.0.1
410
-    npm install amperize@0.3.4
411
-    npm install bcryptjs@2.4.3
412
-    npm install knex@0.12.9
413
-    npm install bookshelf@0.10.2
414
-    npm install cookie-session@1.2.0
415
-    npm install ghost-gql@0.0.6
416
-    npm install intl@1.2.5
417
-    npm install sanitize-html@1.14.1
418
-    npm install showdown-ghost@0.3.6
419
-    npm install superagent@3.5.2
420
-    npm install mysql@2.1.1
421
-    npm install mariasql@0.2.6
422
-    npm install debug@2.6.8
423
-    npm install nconf@0.8.4
424
-
425
-    npm install -g knex-migrator
426
-    knex-migrator init
427
-
428 372
     # now install ghost itself
429
-    npm install -g ghost-cli
373
+    npm install -g ghost-cli@1.4.1
430 374
 
431 375
     GHOST_ONION_HOSTNAME=$(add_onion_service ghost 80 ${GHOST_ONION_PORT})
432 376
 
433
-    ghost install local --port ${GHOST_PORT}
377
+    rm -rf /var/www/$GHOST_DOMAIN_NAME/htdocs/*
378
+    npm install -g yarn
379
+    yarn install --no-emoji --no-progress
380
+    yarn cache clean
381
+    printf 'y' | ghost install ${GHOST_VERSION} --user ghost --db=sqlite3 --port ${GHOST_PORT} --verbose
382
+    adduser --system --home=/var/www/${GHOST_DOMAIN_NAME}/htdocs/ --group ghost
383
+
384
+    npm install -g knex-migrator
385
+    knex-migrator init
434 386
 
435 387
     ghost_bust
436 388
 
437 389
     # NOTE: this has to be http, not https
438 390
     sed -i "s|\"url\":|\"url\": \"http://${GHOST_DOMAIN_NAME}/\",|g" /var/www/${GHOST_DOMAIN_NAME}/htdocs/config.development.json
439 391
 
440
-    adduser --system --home=/var/www/${GHOST_DOMAIN_NAME}/htdocs/ --group ghost
441
-
442 392
     echo '[Unit]' > /etc/systemd/system/ghost.service
443 393
     echo 'Description=Ghost Blog' >> /etc/systemd/system/ghost.service
444 394
     echo 'After=syslog.target' >> /etc/systemd/system/ghost.service
@@ -463,6 +413,9 @@ function install_ghost {
463 413
 
464 414
     chown -R ghost: /var/www/${GHOST_DOMAIN_NAME}/htdocs
465 415
 
416
+    n ${NODEJS_VERSION}
417
+    npm upgrade -g npm@${NPM_VERSION} --save
418
+
466 419
     systemctl enable ghost
467 420
     systemctl daemon-reload
468 421
     systemctl start ghost
@@ -562,6 +515,7 @@ function install_ghost {
562 515
     else
563 516
         sed -i "s|ghost version.*|ghost version:${GHOST_VERSION}|g" ${COMPLETION_FILE}
564 517
     fi
518
+
565 519
     APP_INSTALLED=1
566 520
 }
567 521