No tahoelafs web

This commit is contained in:
Bob Mottram 2017-03-05 13:07:45 +00:00
parent 81256df64f
commit fe55f2976e
1 changed files with 43 additions and 37 deletions

View File

@ -32,13 +32,13 @@
VARIANTS='full full-vim cloud' VARIANTS='full full-vim cloud'
IN_DEFAULT_INSTALL=0 IN_DEFAULT_INSTALL=0
SHOW_ON_ABOUT=1 SHOW_ON_ABOUT=0
TAHOELAFS_REPO="https://github.com/tahoe-lafs/tahoe-lafs" TAHOELAFS_REPO="https://github.com/tahoe-lafs/tahoe-lafs"
TAHOELAFS_COMMIT='bb782b0331a60de438136a593bba18338d8d866b' TAHOELAFS_COMMIT='bb782b0331a60de438136a593bba18338d8d866b'
TAHOELAFS_PORT=50213 TAHOELAFS_PORT=50213
TAHOELAFS_WEB_PORT=50214 #TAHOELAFS_WEB_PORT=50214
TAHOELAFS_ONION_PORT=8096 TAHOELAFS_ONION_PORT=8096
TAHOELAFS_SHARED_DIR='Shared' 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|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|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 if ! grep -q "[storage]" $config_file; then
echo '' >> $config_file echo '' >> $config_file
@ -206,6 +205,46 @@ function configure_firewall_for_tahoelafs {
mark_completed $FUNCNAME 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 { function install_tahoelafs {
if [ $INSTALLING_MESH ]; then if [ $INSTALLING_MESH ]; then
return return
@ -288,40 +327,7 @@ function install_tahoelafs {
set_completion_param "tahoelafs commit" "$TAHOELAFS_COMMIT" set_completion_param "tahoelafs commit" "$TAHOELAFS_COMMIT"
if [ ! -d /var/www/tahoelafs ]; then #install_tahoelafs_web $TAHOELAFS_CONFIG
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
APP_INSTALLED=1 APP_INSTALLED=1
} }