소스 검색

Fix ghost

Bob Mottram 7 년 전
부모
커밋
f396203257
1개의 변경된 파일16개의 추가작업 그리고 5개의 파일을 삭제
  1. 16
    5
      src/freedombone-app-ghost

+ 16
- 5
src/freedombone-app-ghost 파일 보기

@@ -1,4 +1,4 @@
1
-#!/bin/bash
1
+emacs#!/bin/bash
2 2
 #
3 3
 # .---.                  .              .
4 4
 # |                      |              |
@@ -175,10 +175,13 @@ function upgrade_ghost {
175 175
         return
176 176
     fi
177 177
     cd /var/www/$GHOST_DOMAIN_NAME/htdocs
178
+
178 179
     npm i -g ghost-cli
179 180
     /usr/local/bin/ghost update
181
+
180 182
     ghost_replace_services
181 183
     ghost_remove_offsite_links
184
+
182 185
     chown -R ghost: /var/www/${GHOST_DOMAIN_NAME}/htdocs
183 186
     systemctl restart ghost
184 187
 }
@@ -379,7 +382,17 @@ function install_ghost {
379 382
 
380 383
     # now install ghost itself
381 384
     npm install -g ghost-cli
382
-    ghost install local
385
+
386
+    GHOST_ONION_HOSTNAME=$(add_onion_service ghost 80 ${GHOST_ONION_PORT})
387
+
388
+    ghost install local --port ${GHOST_PORT}
389
+
390
+    # kill the started ghost process
391
+    kill_pid=$(ps aux | grep "ghost run" | awk -F ' ' '{print $2}' | head -n 1)
392
+    kill $kill_pid
393
+
394
+    # NOTE: this has to be http, not https
395
+    sed -i "s|\"url\":|\"url\": \"http://${GHOST_DOMAIN_NAME}/\",|g" /var/www/${GHOST_DOMAIN_NAME}/htdocs/config.development.json
383 396
 
384 397
     adduser --system --home=/var/www/${GHOST_DOMAIN_NAME}/htdocs/ --group ghost
385 398
 
@@ -393,7 +406,7 @@ function install_ghost {
393 406
     echo 'User=ghost' >> /etc/systemd/system/ghost.service
394 407
     echo 'Group=ghost' >> /etc/systemd/system/ghost.service
395 408
     echo "WorkingDirectory=/var/www/${GHOST_DOMAIN_NAME}/htdocs" >> /etc/systemd/system/ghost.service
396
-    echo "ExecStart=/usr/local/bin/ghost run" >> /etc/systemd/system/ghost.service
409
+    echo "ExecStart=/usr/local/bin/ghost run -D" >> /etc/systemd/system/ghost.service
397 410
     echo "ExecStop=/usr/local/bin/ghost stop" >> /etc/systemd/system/ghost.service
398 411
     echo "ExecRestart=/usr/local/bin/ghost restart" >> /etc/systemd/system/ghost.service
399 412
     echo 'Restart=always' >> /etc/systemd/system/ghost.service
@@ -411,8 +424,6 @@ function install_ghost {
411 424
     systemctl daemon-reload
412 425
     systemctl start ghost
413 426
 
414
-    GHOST_ONION_HOSTNAME=$(add_onion_service ghost 80 ${GHOST_ONION_PORT})
415
-
416 427
     if [[ ${ONION_ONLY} == "no" ]]; then
417 428
         function_check nginx_http_redirect
418 429
         nginx_http_redirect ${GHOST_DOMAIN_NAME}