From fe55f2976ec8d7a711938c01c701560207ef0152 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 5 Mar 2017 13:07:45 +0000 Subject: [PATCH] No tahoelafs web --- src/freedombone-app-tahoelafs | 80 +++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 37 deletions(-) diff --git a/src/freedombone-app-tahoelafs b/src/freedombone-app-tahoelafs index 212618ca..76f8d99c 100755 --- a/src/freedombone-app-tahoelafs +++ b/src/freedombone-app-tahoelafs @@ -32,13 +32,13 @@ VARIANTS='full full-vim cloud' IN_DEFAULT_INSTALL=0 -SHOW_ON_ABOUT=1 +SHOW_ON_ABOUT=0 TAHOELAFS_REPO="https://github.com/tahoe-lafs/tahoe-lafs" TAHOELAFS_COMMIT='bb782b0331a60de438136a593bba18338d8d866b' TAHOELAFS_PORT=50213 -TAHOELAFS_WEB_PORT=50214 +#TAHOELAFS_WEB_PORT=50214 TAHOELAFS_ONION_PORT=8096 TAHOELAFS_SHARED_DIR='Shared' @@ -83,7 +83,6 @@ function tahoelafs_setup_config { sed -i "s|tub.location.*|tub.location = tor:${TAHOELAFS_ONION_HOSTNAME}:${TAHOELAFS_PORT}|g" $config_file sed -i "s|nickname =.*|nickname = $HOSTNAME|g" $config_file - sed -i "s|web.port =.*|web.port = tcp:$TAHOELAFS_WEB_PORT:interface=127.0.0.1|g" $config_file if ! grep -q "[storage]" $config_file; then echo '' >> $config_file @@ -206,6 +205,46 @@ function configure_firewall_for_tahoelafs { mark_completed $FUNCNAME } +function install_tahoelafs_web { + config_file=$1 + + if [ ! -d /var/www/tahoelafs ]; then + mkdir -p /var/www/tahoelafs/htdocs + fi + tahoelafs_nginx_site=/etc/nginx/sites-available/tahoelafs + echo 'server {' > $tahoelafs_nginx_site + echo " listen 127.0.0.1:$TAHOELAFS_ONION_PORT default_server;" >> $tahoelafs_nginx_site + echo " server_name $TAHOELAFS_ONION_HOSTNAME;" >> $tahoelafs_nginx_site + echo '' >> $tahoelafs_nginx_site + function_check nginx_disable_sniffing + nginx_disable_sniffing tahoelafs + echo '' >> $tahoelafs_nginx_site + echo ' # Logs' >> $tahoelafs_nginx_site + echo ' access_log /dev/null;' >> $tahoelafs_nginx_site + echo ' error_log /dev/null;' >> $tahoelafs_nginx_site + echo '' >> $tahoelafs_nginx_site + echo ' # Root' >> $tahoelafs_nginx_site + echo " root /var/www/tahoelafs/htdocs;" >> $tahoelafs_nginx_site + echo '' >> $tahoelafs_nginx_site + echo ' location / {' >> $tahoelafs_nginx_site + function_check nginx_limits + nginx_limits tahoelafs '15m' + echo ' rewrite /(.*) /$1 break;' >> $tahoelafs_nginx_site + echo ' proxy_set_header X-Real-IP $remote_addr;' >> $tahoelafs_nginx_site + echo ' proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;' >> $tahoelafs_nginx_site + echo ' proxy_set_header Host $http_host;' >> $tahoelafs_nginx_site + echo ' proxy_set_header X-NginX-Proxy true;' >> $tahoelafs_nginx_site + echo " proxy_pass http://localhost:${TAHOELAFS_WEB_PORT};" >> $tahoelafs_nginx_site + echo ' proxy_redirect off;' >> $tahoelafs_nginx_site + echo ' }' >> $tahoelafs_nginx_site + echo '}' >> $tahoelafs_nginx_site + + function_check nginx_ensite + nginx_ensite tahoelafs + + sed -i "s|web.port =.*|web.port = tcp:$TAHOELAFS_WEB_PORT:interface=127.0.0.1|g" $config_file +} + function install_tahoelafs { if [ $INSTALLING_MESH ]; then return @@ -288,40 +327,7 @@ function install_tahoelafs { set_completion_param "tahoelafs commit" "$TAHOELAFS_COMMIT" - if [ ! -d /var/www/tahoelafs ]; then - mkdir -p /var/www/tahoelafs/htdocs - fi - - tahoelafs_nginx_site=/etc/nginx/sites-available/tahoelafs - echo 'server {' > $tahoelafs_nginx_site - echo " listen 127.0.0.1:$TAHOELAFS_ONION_PORT default_server;" >> $tahoelafs_nginx_site - echo " server_name $TAHOELAFS_ONION_HOSTNAME;" >> $tahoelafs_nginx_site - echo '' >> $tahoelafs_nginx_site - function_check nginx_disable_sniffing - nginx_disable_sniffing tahoelafs - echo '' >> $tahoelafs_nginx_site - echo ' # Logs' >> $tahoelafs_nginx_site - echo ' access_log /dev/null;' >> $tahoelafs_nginx_site - echo ' error_log /dev/null;' >> $tahoelafs_nginx_site - echo '' >> $tahoelafs_nginx_site - echo ' # Root' >> $tahoelafs_nginx_site - echo " root /var/www/tahoelafs/htdocs;" >> $tahoelafs_nginx_site - echo '' >> $tahoelafs_nginx_site - echo ' location / {' >> $tahoelafs_nginx_site - function_check nginx_limits - nginx_limits tahoelafs '15m' - echo ' rewrite /(.*) /$1 break;' >> $tahoelafs_nginx_site - echo ' proxy_set_header X-Real-IP $remote_addr;' >> $tahoelafs_nginx_site - echo ' proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;' >> $tahoelafs_nginx_site - echo ' proxy_set_header Host $http_host;' >> $tahoelafs_nginx_site - echo ' proxy_set_header X-NginX-Proxy true;' >> $tahoelafs_nginx_site - echo " proxy_pass http://localhost:${TAHOELAFS_WEB_PORT};" >> $tahoelafs_nginx_site - echo ' proxy_redirect off;' >> $tahoelafs_nginx_site - echo ' }' >> $tahoelafs_nginx_site - echo '}' >> $tahoelafs_nginx_site - - function_check nginx_ensite - nginx_ensite tahoelafs + #install_tahoelafs_web $TAHOELAFS_CONFIG APP_INSTALLED=1 }