Explorar el Código

Remove turtl app

Bob Mottram hace 8 años
padre
commit
7abc762bfc
Se han modificado 1 ficheros con 65 adiciones y 191 borrados
  1. 65
    191
      src/freedombone-app-turtl

+ 65
- 191
src/freedombone-app-turtl Ver fichero

@@ -36,23 +36,20 @@ VARIANTS="full full-vim writer"
36 36
 IN_DEFAULT_INSTALL=0
37 37
 SHOW_ON_ABOUT=1
38 38
 
39
-TURTL_DOMAIN_NAME=
40
-TURTL_CODE=
41
-TURTL_ONION_PORT=8107
42
-TURTL_API_ONION_PORT=8108
39
+TURTL_API_DOMAIN_NAME=
40
+TURTL_API_CODE=
41
+TURTL_API_ONION_PORT=8107
43 42
 TURTL_PORT=8181
44 43
 TURTL_API_REPO="https://github.com/turtl/api.git"
45 44
 TURTL_API_COMMIT='53e00a5583f52de8f86ef380fe11c176b5738dcf'
46
-TURTL_REPO="https://github.com/turtl/js.git"
47
-TURTL_COMMIT='61923ffb47d95d172f80d14c76aa032a4d5f5d6d'
48 45
 TURTL_ADMIN_PASSWORD=
49 46
 TURTL_STORAGE_LIMIT_MB=100
50 47
 TURTL_BASE_DIR=/etc/turtl
51 48
 
52 49
 turtl_variables=(ONION_ONLY
53 50
                  DEFAULT_DOMAIN_NAME
54
-                 TURTL_DOMAIN_NAME
55
-                 TURTL_CODE
51
+                 TURTL_API_DOMAIN_NAME
52
+                 TURTL_API_CODE
56 53
                  TURTL_STORAGE_LIMIT_MB
57 54
                  DDNS_PROVIDER
58 55
                  MY_EMAIL_ADDRESS
@@ -79,13 +76,11 @@ function install_interactive_turtl {
79 76
     fi
80 77
 
81 78
     if [[ $ONION_ONLY != "no" ]]; then
82
-        TURTL_DOMAIN_NAME='notes.local'
83
-        write_config_param "TURTL_DOMAIN_NAME" "$TURTL_DOMAIN_NAME"
79
+        TURTL_API_DOMAIN_NAME='notes.local'
80
+        write_config_param "TURTL_API_DOMAIN_NAME" "$TURTL_API_DOMAIN_NAME"
84 81
     else
85 82
         function_check interactive_site_details
86
-        interactive_site_details "turtl" "TURTL_DOMAIN_NAME" "TURTL_CODE"
87
-        write_config_param "API_TURTL_DOMAIN_NAME" "api.${TURTL_DOMAIN_NAME}"
88
-        write_config_param "API_TURTL_CODE" "${TURTL_CODE}"
83
+        interactive_site_details "turtl" "TURTL_API_DOMAIN_NAME" "TURTL_API_CODE"
89 84
     fi
90 85
     APP_INSTALLED=1
91 86
 }
@@ -113,39 +108,28 @@ function configure_interactive_turtl {
113 108
 
114 109
 
115 110
 function reconfigure_turtl {
116
-    if [ -d /var/www/${TURTL_DOMAIN_NAME}/htdocs/data ]; then
117
-        rm -rf /var/www/${TURTL_DOMAIN_NAME}/htdocs/data/*
111
+    if [ -d $TURTL_BASE_DIR/data ]; then
112
+        rm -rf $TURTL_BASE_DIR/data/*
118 113
     fi
119 114
 }
120 115
 
121 116
 function upgrade_turtl {
122
-    read_config_param "TURTL_DOMAIN_NAME"
117
+    read_config_param "TURTL_API_DOMAIN_NAME"
123 118
 
124 119
     function_check set_repo_commit
125
-    set_repo_commit /var/www/$TURTL_DOMAIN_NAME/htdocs "turtl commit" "$TURTL_COMMIT" $TURTL_REPO
126 120
     set_repo_commit $TURTL_BASE_DIR/api "turtl api commit" "$TURTL_API_COMMIT" $TURTL_API_REPO
127
-    nginx_dissite $TURTL_DOMAIN_NAME
128
-    cd /var/www/$TURTL_DOMAIN_NAME/htdocs
129
-    rm -rf node_modules npm-shrinkwrap.json
130
-    npm install uglify@0.1.5 --no-optional
131
-    npm install minimatch@3.0.2 --no-optional
132
-    npm install --no-optional
133
-    sed -i 's|{config,controllers,handlers,locales,library,models,turtl}|.|g' Makefile
134
-    sed -i 's|tests/{data,tests}|tests|g' Makefile
135
-    make clean
136
-    make
121
+    nginx_dissite $TURTL_API_DOMAIN_NAME
137 122
     chown -R turtl:turtl $TURTL_BASE_DIR
138
-    chown -R turtl:turtl /var/www/$TURTL_DOMAIN_NAME/htdocs
139
-    nginx_ensite $TURTL_DOMAIN_NAME
123
+    nginx_ensite $TURTL_API_DOMAIN_NAME
140 124
 }
141 125
 
142 126
 function backup_local_turtl {
143
-    read_config_param "TURTL_DOMAIN_NAME"
144
-    source_directory=/var/www/${TURTL_DOMAIN_NAME}/htdocs
127
+    read_config_param "TURTL_API_DOMAIN_NAME"
128
+    source_directory=$TURTL_BASE_DIR
145 129
     if [ -d $source_directory ]; then
146 130
         dest_directory=turtl
147 131
         function_check suspend_site
148
-        suspend_site ${TURTL_DOMAIN_NAME}
132
+        suspend_site ${TURTL_API_DOMAIN_NAME}
149 133
 
150 134
         function_check backup_directory_to_usb
151 135
         backup_directory_to_usb $source_directory $dest_directory
@@ -157,7 +141,7 @@ function backup_local_turtl {
157 141
     if [ -d $source_directory ]; then
158 142
         dest_directory=rethinkdb
159 143
         function_check suspend_site
160
-        suspend_site ${TURTL_DOMAIN_NAME}
144
+        suspend_site ${TURTL_API_DOMAIN_NAME}
161 145
 
162 146
         function_check backup_directory_to_usb
163 147
         backup_directory_to_usb $source_directory $dest_directory
@@ -168,28 +152,28 @@ function backup_local_turtl {
168 152
 }
169 153
 
170 154
 function restore_local_turtl {
171
-    read_config_param "TURTL_DOMAIN_NAME"
172
-    if [ $TURTL_DOMAIN_NAME ]; then
155
+    read_config_param "TURTL_API_DOMAIN_NAME"
156
+    if [ $TURTL_API_DOMAIN_NAME ]; then
173 157
         temp_restore_dir=/root/tempturtl
174 158
         restore_directory_from_usb $temp_restore_dir turtl
175
-        if [ -d /var/www/${TURTL_DOMAIN_NAME}/htdocs ]; then
176
-            if [ -d /var/www/${TURTL_DOMAIN_NAME}/previous ]; then
177
-                rm -rf /var/www/${TURTL_DOMAIN_NAME}/previous
159
+        if [ -d $TURTL_BASE_DIR ]; then
160
+            if [ -d /etc/turtl_previous ]; then
161
+                rm -rf /etc/turtl_previous
178 162
             fi
179
-            mv /var/www/${TURTL_DOMAIN_NAME}/htdocs /var/www/${TURTL_DOMAIN_NAME}/previous
163
+            mv $TURTL_BASE_DIR /etc/turtl_previous
180 164
         fi
181
-        temp_source_dir=$(find ${temp_restore_dir} -name htdocs)
182
-        cp -r ${temp_source_dir} /var/www/${TURTL_DOMAIN_NAME}/
165
+        temp_source_dir=$(find ${temp_restore_dir} -name turtl)
166
+        cp -r ${temp_source_dir} /etc/
183 167
         if [ ! "$?" = "0" ]; then
184
-            if [ -d /var/www/${TURTL_DOMAIN_NAME}/previous ]; then
185
-                mv /var/www/${TURTL_DOMAIN_NAME}/previous /var/www/${TURTL_DOMAIN_NAME}/htdocs
168
+            if [ -d /etc/turtl_previous ]; then
169
+                mv /etc/turtl_previous $TURTL_BASE_DIR
186 170
             fi
187 171
             set_user_permissions
188 172
             backup_unmount_drive
189 173
             exit 36723
190 174
         fi
191 175
         rm -rf ${temp_restore_dir}
192
-        chown -R turtl:turtl /var/www/${TURTL_DOMAIN_NAME}/htdocs
176
+        chown -R turtl:turtl $TURTL_BASE_DIR
193 177
 
194 178
         temp_restore_dir=/root/temprethinkdb
195 179
         restore_directory_from_usb $temp_restore_dir rethinkdb
@@ -214,9 +198,9 @@ function restore_local_turtl {
214 198
 }
215 199
 
216 200
 function backup_remote_turtl {
217
-    read_config_param "TURTL_DOMAIN_NAME"
218
-    if [ $TURTL_DOMAIN_NAME ]; then
219
-        temp_backup_dir=/var/www/${TURTL_DOMAIN_NAME}/htdocs
201
+    read_config_param "TURTL_API_DOMAIN_NAME"
202
+    if [ $TURTL_API_DOMAIN_NAME ]; then
203
+        temp_backup_dir=$TURTL_BASE_DIR
220 204
         if [ -d $temp_backup_dir ]; then
221 205
             echo $"Backing up turtl"
222 206
             backup_directory_to_friend $temp_backup_dir turtl
@@ -236,29 +220,28 @@ function backup_remote_turtl {
236 220
 }
237 221
 
238 222
 function restore_remote_turtl {
239
-    read_config_param "TURTL_DOMAIN_NAME"
240
-    if [ $TURTL_DOMAIN_NAME ]; then
223
+    read_config_param "TURTL_API_DOMAIN_NAME"
224
+    if [ $TURTL_API_DOMAIN_NAME ]; then
241 225
         temp_restore_dir=/root/tempturtl
242 226
         mkdir $temp_restore_dir
243 227
         function_check restore_directory_from_friend
244 228
         restore_directory_from_friend $temp_restore_dir turtl
245
-        if [ -d /var/www/${TURTL_DOMAIN_NAME}/htdocs ]; then
246
-            if [ -d /var/www/${TURTL_DOMAIN_NAME}/previous ]; then
247
-                rm -rf /var/www/${TURTL_DOMAIN_NAME}/previous
229
+        if [ -d $TURTL_BASE_DIR ]; then
230
+            if [ -d /etc/turtl_previous ]; then
231
+                rm -rf /etc/turtl_previous
248 232
             fi
249
-            mv /var/www/${TURTL_DOMAIN_NAME}/htdocs /var/www/${TURTL_DOMAIN_NAME}/previous
233
+            mv $TURTL_BASE_DIR /etc/turtl_previous
250 234
         fi
251
-        temp_source_dir=$(find ${temp_restore_dir} -name htdocs)
252
-        cp -r ${temp_source_dir} /var/www/${TURTL_DOMAIN_NAME}/
235
+        temp_source_dir=$(find ${temp_restore_dir} -name turtl)
236
+        cp -r ${temp_source_dir} /etc/
253 237
         if [ ! "$?" = "0" ]; then
254
-            if [ -d /var/www/${TURTL_DOMAIN_NAME}/previous ]; then
255
-                mv /var/www/${TURTL_DOMAIN_NAME}/previous /var/www/${TURTL_DOMAIN_NAME}/htdocs
238
+            if [ -d /etc/turtl_previous ]; then
239
+                mv /etc/turtl_previous $TURTL_BASE_DIR
256 240
             fi
257 241
             exit 37823
258 242
         fi
259 243
         rm -rf ${temp_restore_dir}
260 244
 
261
-
262 245
         temp_restore_dir=/root/temprethinkdb
263 246
         mkdir $temp_restore_dir
264 247
         function_check restore_directory_from_friend
@@ -293,20 +276,15 @@ function remove_turtl {
293 276
     remove_completion_param install_turtl
294 277
     sed -i '/turtl/d' $COMPLETION_FILE
295 278
     deluser turtl
296
-    nginx_dissite $TURTL_DOMAIN_NAME
297
-    if [ -f /etc/nginx/sites-available/$TURTL_DOMAIN_NAME ]; then
298
-        rm /etc/nginx/sites-available/$TURTL_DOMAIN_NAME
299
-    fi
300
-    remove_certs $TURTL_DOMAIN_NAME
301
-    if [ -d /var/www/$TURTL_DOMAIN_NAME ]; then
302
-        rm -rf /var/www/$TURTL_DOMAIN_NAME
279
+    nginx_dissite $TURTL_API_DOMAIN_NAME
280
+    if [ -f /etc/nginx/sites-available/$TURTL_API_DOMAIN_NAME ]; then
281
+        rm /etc/nginx/sites-available/$TURTL_API_DOMAIN_NAME
303 282
     fi
283
+    remove_certs $TURTL_API_DOMAIN_NAME
304 284
     function_check remove_onion_service
305
-    remove_onion_service turtl ${TURTL_ONION_PORT}
306 285
     remove_onion_service turtlapi ${TURTL_API_ONION_PORT}
307 286
     function_check remove_ddns_domain
308
-    remove_ddns_domain $TURTL_DOMAIN_NAME
309
-    remove_nodejs turtl
287
+    remove_ddns_domain $TURTL_API_DOMAIN_NAME
310 288
     rm -rf /etc/rethinkdb
311 289
     rm -rf /var/lib/rethinkdb
312 290
     rm -rf $TURTL_BASE_DIR
@@ -318,8 +296,8 @@ function turtl_setup {
318 296
     BINDADDR=${BINDADDR:-0.0.0.0}
319 297
     BINDPORT=${BINDPORT:-8181}
320 298
     PROD_ERR_HANDLING=${PROD_ERR_HANDLING:-t}
321
-    FQDN=${FQDN:-turtl.local}
322
-    SITE_URL=${SITE_URL:-http://turtl.local}
299
+    FQDN=${FQDN:-$TURTL_API_DOMAIN_NAME}
300
+    SITE_URL=${SITE_URL:-https://$TURTL_API_DOMAIN_NAME}
323 301
     ADMIN_EMAIL=${ADMIN_EMAIL:-$MY_USERNAME@$DEFAULT_DOMAIN_NAME}
324 302
     EMAIL_FROM=${EMAIL_FROM:-noreply@$DEFAULT_DOMAIN_NAME}
325 303
     SMTP_USER=${SMTP_USER:-}
@@ -327,8 +305,8 @@ function turtl_setup {
327 305
     DISPLAY_ERRORS=${DISPLAY_ERRORS:-t}
328 306
     DEFAULT_STORAGE_LIMIT=${DEFAULT_STORAGE_LIMIT:-100}
329 307
     STORAGE_INVITE_CREDIT=${STORAGE_INVITE_CREDIT:-25}
330
-    LOCAL_UPLOAD_URL=${LOCAL_UPLOAD_URL:-http://turtl.local}
331
-    LOCAL_UPLOAD_PATH=${LOCAL_UPLOAD_PATH:-"$TURTL_BASE_DIR/api/uploads"}
308
+    LOCAL_UPLOAD_URL=${LOCAL_UPLOAD_URL:-https://$TURTL_API_DOMAIN_NAME}
309
+    LOCAL_UPLOAD_PATH=${LOCAL_UPLOAD_PATH:-"$TURTL_BASE_DIR/data"}
332 310
     AWS_S3_TOKEN=${AWS_S3_TOKEN:-(:token ''
333 311
                                   :secret ''
334 312
                                   :bucket ''
@@ -407,6 +385,7 @@ function install_turtl_api {
407 385
         mkdir -p $TURTL_BASE_DIR
408 386
     fi
409 387
     cd $TURTL_BASE_DIR
388
+    mkdir cd $TURTL_BASE_DIR/data
410 389
     check_architecture=$(uname -a)
411 390
 
412 391
     # Install ccl
@@ -553,58 +532,24 @@ __ENDCONFIG__
553 532
     turtl_setup
554 533
 }
555 534
 
556
-function install_turtl_app {
557
-    function_check install_nodejs
558
-    install_nodejs turtl
559
-
560
-    if [ -d /var/www/$TURTL_DOMAIN_NAME ]; then
561
-        rm -rf /var/www/$TURTL_DOMAIN_NAME
562
-    fi
563
-    mkdir -p /var/www/$TURTL_DOMAIN_NAME
564
-
565
-    if [ -f $IMAGE_PASSWORD_FILE ]; then
566
-        TURTL_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
567
-    else
568
-        if [ ! $TURTL_ADMIN_PASSWORD ]; then
569
-            TURTL_ADMIN_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
570
-        fi
571
-    fi
572
-
573
-    cd /var/www/$TURTL_DOMAIN_NAME
574
-    git_clone $TURTL_REPO /var/www/$TURTL_DOMAIN_NAME/htdocs
575
-    git checkout $TURTL_COMMIT -b $TURTL_COMMIT
576
-    set_completion_param "turtl commit" "$TURTL_COMMIT"
577
-
578
-    if [ ! -f /var/www/$TURTL_DOMAIN_NAME/htdocs/config/config.js.default ]; then
579
-        echo $'turtl app config file not found'
580
-        exit 737223
581
-    fi
582
-    cp /var/www/$TURTL_DOMAIN_NAME/htdocs/config/config.js.default /var/www/$TURTL_DOMAIN_NAME/htdocs/config/config.js
583
-
584
-    # change settings
585
-    sed -i "s|api_url.*|api_url: 'https://api.${TURTL_DOMAIN_NAME}'|g" /var/www/$TURTL_DOMAIN_NAME/htdocs/config/config.js
586
-    sed -i "s|site_url.*|site_url: 'https://${TURTL_DOMAIN_NAME}'|g" /var/www/$TURTL_DOMAIN_NAME/htdocs/config/config.js
587
-
588
-    chown -R turtl:turtl /var/www/$TURTL_DOMAIN_NAME/htdocs
589
-
590
-    TURTL_ONION_HOSTNAME=$(add_onion_service turtl 80 ${TURTL_ONION_PORT})
535
+function install_turtl_nginx {
591 536
     TURTL_API_ONION_HOSTNAME=$(add_onion_service turtlapi 80 ${TURTL_API_ONION_PORT})
592 537
 
593
-    turtl_nginx_site=/etc/nginx/sites-available/$TURTL_DOMAIN_NAME
538
+    turtl_nginx_site=/etc/nginx/sites-available/$TURTL_API_DOMAIN_NAME
594 539
     if [[ $ONION_ONLY == "no" ]]; then
595 540
         function_check nginx_http_redirect
596
-        nginx_http_redirect $TURTL_DOMAIN_NAME
541
+        nginx_http_redirect $TURTL_API_DOMAIN_NAME
597 542
         echo 'server {' >> $turtl_nginx_site
598 543
         echo '  listen 443 ssl;' >> $turtl_nginx_site
599 544
         echo '  listen [::]:443 ssl;' >> $turtl_nginx_site
600
-        echo "  server_name api.${TURTL_DOMAIN_NAME};" >> $turtl_nginx_site
545
+        echo "  server_name ${TURTL_API_DOMAIN_NAME};" >> $turtl_nginx_site
601 546
         echo '' >> $turtl_nginx_site
602 547
         echo '  # Security' >> $turtl_nginx_site
603 548
         function_check nginx_ssl
604
-        nginx_ssl $TURTL_DOMAIN_NAME
549
+        nginx_ssl $TURTL_API_DOMAIN_NAME
605 550
 
606 551
         function_check nginx_disable_sniffing
607
-        nginx_disable_sniffing $TURTL_DOMAIN_NAME
552
+        nginx_disable_sniffing $TURTL_API_DOMAIN_NAME
608 553
 
609 554
         echo '  add_header Strict-Transport-Security max-age=15768000;' >> $turtl_nginx_site
610 555
         echo '' >> $turtl_nginx_site
@@ -614,44 +559,13 @@ function install_turtl_app {
614 559
         echo '' >> $turtl_nginx_site
615 560
         echo '  location / {' >> $turtl_nginx_site
616 561
         function_check nginx_limits
617
-        nginx_limits $TURTL_DOMAIN_NAME '15m'
562
+        nginx_limits $TURTL_API_DOMAIN_NAME '15m'
618 563
         echo "    proxy_pass        http://localhost:${TURTL_PORT}/;" >> $turtl_nginx_site
619 564
         echo '    proxy_set_header  Host $host;' >> $turtl_nginx_site
620 565
         echo '    proxy_buffering   off;' >> $turtl_nginx_site
621 566
         echo '  }' >> $turtl_nginx_site
622
-        echo '' >> $turtl_nginx_site
623
-        echo '}' >> $turtl_nginx_site
624
-        echo '' >> $turtl_nginx_site
625
-        echo 'server {' >> $turtl_nginx_site
626
-        echo '  listen 443 ssl;' >> $turtl_nginx_site
627
-        echo '  listen [::]:443 ssl;' >> $turtl_nginx_site
628
-        echo "  server_name ${TURTL_DOMAIN_NAME};" >> $turtl_nginx_site
629
-        echo '' >> $turtl_nginx_site
630
-        echo '  index index.html;' >> $turtl_nginx_site
631
-        echo "  root /var/www/$TURTL_DOMAIN_NAME/htdocs;" >> $turtl_nginx_site
632
-        echo '' >> $turtl_nginx_site
633
-        echo '  # Security' >> $turtl_nginx_site
634
-        function_check nginx_ssl
635
-        nginx_ssl $TURTL_DOMAIN_NAME
636
-
637
-        function_check nginx_disable_sniffing
638
-        nginx_disable_sniffing $TURTL_DOMAIN_NAME
639
-
640
-        echo '  add_header Strict-Transport-Security max-age=15768000;' >> $turtl_nginx_site
641
-        echo '' >> $turtl_nginx_site
642
-        echo '  # Logs' >> $turtl_nginx_site
643
-        echo '  access_log /dev/null;' >> $turtl_nginx_site
644
-        echo '  error_log /dev/null;' >> $turtl_nginx_site
645
-        echo '' >> $turtl_nginx_site
646
-        echo '  location / {' >> $turtl_nginx_site
647
-        function_check nginx_limits
648
-        nginx_limits $TURTL_DOMAIN_NAME '15m'
649
-        echo '  }' >> $turtl_nginx_site
650
-        echo '' >> $turtl_nginx_site
651 567
         echo '}' >> $turtl_nginx_site
652 568
     else
653
-        sed -i "s|api_url.*|api_url: 'http://${TURTL_API_ONION_HOSTNAME}'|g" /var/www/$TURTL_DOMAIN_NAME/htdocs/config/config.js
654
-        sed -i "s|site_url.*|site_url: 'http://${TURTL_ONION_HOSTNAME}'|g" /var/www/$TURTL_DOMAIN_NAME/htdocs/config/config.js
655 569
         echo -n '' > $turtl_nginx_site
656 570
     fi
657 571
     echo 'server {' >> $turtl_nginx_site
@@ -659,7 +573,7 @@ function install_turtl_app {
659 573
     echo "  server_name ${TURTL_API_ONION_HOSTNAME};" >> $turtl_nginx_site
660 574
     echo '' >> $turtl_nginx_site
661 575
     function_check nginx_disable_sniffing
662
-    nginx_disable_sniffing $TURTL_DOMAIN_NAME
576
+    nginx_disable_sniffing $TURTL_API_DOMAIN_NAME
663 577
     echo '' >> $turtl_nginx_site
664 578
     echo '  # Logs' >> $turtl_nginx_site
665 579
     echo '  access_log /dev/null;' >> $turtl_nginx_site
@@ -667,70 +581,30 @@ function install_turtl_app {
667 581
     echo '' >> $turtl_nginx_site
668 582
     echo '  location / {' >> $turtl_nginx_site
669 583
     function_check nginx_limits
670
-    nginx_limits $TURTL_DOMAIN_NAME '15m'
584
+    nginx_limits $TURTL_API_DOMAIN_NAME '15m'
671 585
     echo "    proxy_pass        http://localhost:${TURTL_PORT}/;" >> $turtl_nginx_site
672 586
     echo '    proxy_set_header  Host $host;' >> $turtl_nginx_site
673 587
     echo '    proxy_buffering   off;' >> $turtl_nginx_site
674 588
     echo '  }' >> $turtl_nginx_site
675
-    echo '' >> $turtl_nginx_site
676
-    echo '}' >> $turtl_nginx_site
677
-    echo '' >> $turtl_nginx_site
678
-    echo 'server {' >> $turtl_nginx_site
679
-    echo "  listen 127.0.0.1:$TURTL_ONION_PORT default_server;" >> $turtl_nginx_site
680
-    echo "  server_name $TURTL_ONION_HOSTNAME;" >> $turtl_nginx_site
681
-    echo '' >> $turtl_nginx_site
682
-    echo '  index index.html;' >> $turtl_nginx_site
683
-    echo "  root /var/www/$TURTL_DOMAIN_NAME/htdocs;" >> $turtl_nginx_site
684
-    echo '' >> $turtl_nginx_site
685
-    function_check nginx_disable_sniffing
686
-    nginx_disable_sniffing $TURTL_DOMAIN_NAME
687
-    echo '' >> $turtl_nginx_site
688
-    echo '  # Logs' >> $turtl_nginx_site
689
-    echo '  access_log /dev/null;' >> $turtl_nginx_site
690
-    echo '  error_log /dev/null;' >> $turtl_nginx_site
691
-    echo '' >> $turtl_nginx_site
692
-    echo '  location / {' >> $turtl_nginx_site
693
-    function_check nginx_limits
694
-    nginx_limits $TURTL_DOMAIN_NAME '15m'
695
-    echo '  }' >> $turtl_nginx_site
696
-    echo '' >> $turtl_nginx_site
697 589
     echo '}' >> $turtl_nginx_site
698 590
 
699
-    ${PROJECT_NAME}-pass -u $MY_USERNAME -a turtl -p "$TURTL_ADMIN_PASSWORD"
700
-
701 591
     function_check add_ddns_domain
702
-    add_ddns_domain $TURTL_DOMAIN_NAME
703
-
704
-    set_completion_param "turtl domain" "$TURTL_DOMAIN_NAME"
705
-
706
-    cd /var/www/$TURTL_DOMAIN_NAME/htdocs
707
-    sed -i 's|GPLv3|GPL-3.0|g' package.json
708
-    sed -i "/license/a \"repository\": \"$TURTL_REPO\"," package.json
709
-    rm -rf node_modules npm-shrinkwrap.json
710
-    npm install uglify@0.1.5 --no-optional
711
-    npm install minimatch@3.0.2 --no-optional
712
-    npm install --no-optional
713
-
714
-    sed -i 's|{config,controllers,handlers,locales,library,models,turtl}|.|g' Makefile
715
-    sed -i 's|tests/{data,tests}|tests|g' Makefile
716
-
717
-    make clean
718
-    make
592
+    add_ddns_domain $TURTL_API_DOMAIN_NAME
719 593
 
720
-    chown -R turtl:turtl /var/www/$TURTL_DOMAIN_NAME/htdocs
594
+    set_completion_param "turtl api domain" "$TURTL_API_DOMAIN_NAME"
721 595
 
722 596
     function_check create_site_certificate
723
-    create_site_certificate $TURTL_DOMAIN_NAME 'yes'
597
+    create_site_certificate $TURTL_API_DOMAIN_NAME 'yes'
724 598
 
725 599
     function_check nginx_ensite
726
-    nginx_ensite $TURTL_DOMAIN_NAME
600
+    nginx_ensite $TURTL_API_DOMAIN_NAME
727 601
 
728 602
     systemctl restart nginx
729 603
 }
730 604
 
731 605
 function install_turtl {
732 606
     install_turtl_api
733
-    install_turtl_app
607
+    install_turtl_nginx
734 608
 
735 609
     APP_INSTALLED=1
736 610
 }