Standard domain name
This commit is contained in:
parent
7fefb18bcb
commit
f3dc531b20
|
@ -36,20 +36,20 @@ VARIANTS="full full-vim writer"
|
|||
IN_DEFAULT_INSTALL=0
|
||||
SHOW_ON_ABOUT=1
|
||||
|
||||
TURTL_API_DOMAIN_NAME=
|
||||
TURTL_API_CODE=
|
||||
TURTL_API_ONION_PORT=8107
|
||||
TURTL_DOMAIN_NAME=
|
||||
TURTL_CODE=
|
||||
TURTL_ONION_PORT=8107
|
||||
TURTL_PORT=8181
|
||||
TURTL_API_REPO="https://github.com/turtl/api.git"
|
||||
TURTL_API_COMMIT='53e00a5583f52de8f86ef380fe11c176b5738dcf'
|
||||
TURTL_REPO="https://github.com/turtl/api.git"
|
||||
TURTL_COMMIT='53e00a5583f52de8f86ef380fe11c176b5738dcf'
|
||||
TURTL_ADMIN_PASSWORD=
|
||||
TURTL_STORAGE_LIMIT_MB=100
|
||||
TURTL_BASE_DIR=/etc/turtl
|
||||
|
||||
turtl_variables=(ONION_ONLY
|
||||
DEFAULT_DOMAIN_NAME
|
||||
TURTL_API_DOMAIN_NAME
|
||||
TURTL_API_CODE
|
||||
TURTL_DOMAIN_NAME
|
||||
TURTL_CODE
|
||||
TURTL_STORAGE_LIMIT_MB
|
||||
DDNS_PROVIDER
|
||||
MY_EMAIL_ADDRESS
|
||||
|
@ -76,11 +76,11 @@ function install_interactive_turtl {
|
|||
fi
|
||||
|
||||
if [[ $ONION_ONLY != "no" ]]; then
|
||||
TURTL_API_DOMAIN_NAME='notes.local'
|
||||
write_config_param "TURTL_API_DOMAIN_NAME" "$TURTL_API_DOMAIN_NAME"
|
||||
TURTL_DOMAIN_NAME='notes.local'
|
||||
write_config_param "TURTL_DOMAIN_NAME" "$TURTL_DOMAIN_NAME"
|
||||
else
|
||||
function_check interactive_site_details
|
||||
interactive_site_details "turtl" "TURTL_API_DOMAIN_NAME" "TURTL_API_CODE"
|
||||
interactive_site_details "turtl" "TURTL_DOMAIN_NAME" "TURTL_CODE"
|
||||
fi
|
||||
APP_INSTALLED=1
|
||||
}
|
||||
|
@ -114,22 +114,22 @@ function reconfigure_turtl {
|
|||
}
|
||||
|
||||
function upgrade_turtl {
|
||||
read_config_param "TURTL_API_DOMAIN_NAME"
|
||||
read_config_param "TURTL_DOMAIN_NAME"
|
||||
|
||||
function_check set_repo_commit
|
||||
set_repo_commit $TURTL_BASE_DIR/api "turtl api commit" "$TURTL_API_COMMIT" $TURTL_API_REPO
|
||||
nginx_dissite $TURTL_API_DOMAIN_NAME
|
||||
set_repo_commit $TURTL_BASE_DIR/api "turtl commit" "$TURTL_COMMIT" $TURTL_REPO
|
||||
nginx_dissite $TURTL_DOMAIN_NAME
|
||||
chown -R turtl:turtl $TURTL_BASE_DIR
|
||||
nginx_ensite $TURTL_API_DOMAIN_NAME
|
||||
nginx_ensite $TURTL_DOMAIN_NAME
|
||||
}
|
||||
|
||||
function backup_local_turtl {
|
||||
read_config_param "TURTL_API_DOMAIN_NAME"
|
||||
read_config_param "TURTL_DOMAIN_NAME"
|
||||
source_directory=$TURTL_BASE_DIR
|
||||
if [ -d $source_directory ]; then
|
||||
dest_directory=turtl
|
||||
function_check suspend_site
|
||||
suspend_site ${TURTL_API_DOMAIN_NAME}
|
||||
suspend_site ${TURTL_DOMAIN_NAME}
|
||||
|
||||
function_check backup_directory_to_usb
|
||||
backup_directory_to_usb $source_directory $dest_directory
|
||||
|
@ -141,7 +141,7 @@ function backup_local_turtl {
|
|||
if [ -d $source_directory ]; then
|
||||
dest_directory=rethinkdb
|
||||
function_check suspend_site
|
||||
suspend_site ${TURTL_API_DOMAIN_NAME}
|
||||
suspend_site ${TURTL_DOMAIN_NAME}
|
||||
|
||||
function_check backup_directory_to_usb
|
||||
backup_directory_to_usb $source_directory $dest_directory
|
||||
|
@ -152,8 +152,8 @@ function backup_local_turtl {
|
|||
}
|
||||
|
||||
function restore_local_turtl {
|
||||
read_config_param "TURTL_API_DOMAIN_NAME"
|
||||
if [ $TURTL_API_DOMAIN_NAME ]; then
|
||||
read_config_param "TURTL_DOMAIN_NAME"
|
||||
if [ $TURTL_DOMAIN_NAME ]; then
|
||||
temp_restore_dir=/root/tempturtl
|
||||
restore_directory_from_usb $temp_restore_dir turtl
|
||||
if [ -d $TURTL_BASE_DIR ]; then
|
||||
|
@ -198,8 +198,8 @@ function restore_local_turtl {
|
|||
}
|
||||
|
||||
function backup_remote_turtl {
|
||||
read_config_param "TURTL_API_DOMAIN_NAME"
|
||||
if [ $TURTL_API_DOMAIN_NAME ]; then
|
||||
read_config_param "TURTL_DOMAIN_NAME"
|
||||
if [ $TURTL_DOMAIN_NAME ]; then
|
||||
temp_backup_dir=$TURTL_BASE_DIR
|
||||
if [ -d $temp_backup_dir ]; then
|
||||
echo $"Backing up turtl"
|
||||
|
@ -220,8 +220,8 @@ function backup_remote_turtl {
|
|||
}
|
||||
|
||||
function restore_remote_turtl {
|
||||
read_config_param "TURTL_API_DOMAIN_NAME"
|
||||
if [ $TURTL_API_DOMAIN_NAME ]; then
|
||||
read_config_param "TURTL_DOMAIN_NAME"
|
||||
if [ $TURTL_DOMAIN_NAME ]; then
|
||||
temp_restore_dir=/root/tempturtl
|
||||
mkdir $temp_restore_dir
|
||||
function_check restore_directory_from_friend
|
||||
|
@ -276,15 +276,15 @@ function remove_turtl {
|
|||
remove_completion_param install_turtl
|
||||
sed -i '/turtl/d' $COMPLETION_FILE
|
||||
deluser turtl
|
||||
nginx_dissite $TURTL_API_DOMAIN_NAME
|
||||
if [ -f /etc/nginx/sites-available/$TURTL_API_DOMAIN_NAME ]; then
|
||||
rm /etc/nginx/sites-available/$TURTL_API_DOMAIN_NAME
|
||||
nginx_dissite $TURTL_DOMAIN_NAME
|
||||
if [ -f /etc/nginx/sites-available/$TURTL_DOMAIN_NAME ]; then
|
||||
rm /etc/nginx/sites-available/$TURTL_DOMAIN_NAME
|
||||
fi
|
||||
remove_certs $TURTL_API_DOMAIN_NAME
|
||||
remove_certs $TURTL_DOMAIN_NAME
|
||||
function_check remove_onion_service
|
||||
remove_onion_service turtlapi ${TURTL_API_ONION_PORT}
|
||||
remove_onion_service turtlapi ${TURTL_ONION_PORT}
|
||||
function_check remove_ddns_domain
|
||||
remove_ddns_domain $TURTL_API_DOMAIN_NAME
|
||||
remove_ddns_domain $TURTL_DOMAIN_NAME
|
||||
rm -rf /etc/rethinkdb
|
||||
rm -rf /var/lib/rethinkdb
|
||||
rm -rf $TURTL_BASE_DIR
|
||||
|
@ -297,11 +297,11 @@ function turtl_setup {
|
|||
BINDPORT=${BINDPORT:-8181}
|
||||
PROD_ERR_HANDLING=${PROD_ERR_HANDLING:-t}
|
||||
if [[ $ONION_ONLY == 'no' ]]; then
|
||||
FQDN=${FQDN:-$TURTL_API_DOMAIN_NAME}
|
||||
SITE_URL=${SITE_URL:-https://$TURTL_API_DOMAIN_NAME}
|
||||
FQDN=${FQDN:-$TURTL_DOMAIN_NAME}
|
||||
SITE_URL=${SITE_URL:-https://$TURTL_DOMAIN_NAME}
|
||||
else
|
||||
FQDN=${FQDN:-$TURTL_API_ONION_HOSTNAME}
|
||||
SITE_URL=${SITE_URL:-http://$TURTL_API_ONION_HOSTNAME}
|
||||
FQDN=${FQDN:-$TURTL_ONION_HOSTNAME}
|
||||
SITE_URL=${SITE_URL:-http://$TURTL_ONION_HOSTNAME}
|
||||
fi
|
||||
ADMIN_EMAIL=${ADMIN_EMAIL:-$MY_USERNAME@$DEFAULT_DOMAIN_NAME}
|
||||
EMAIL_FROM=${EMAIL_FROM:-noreply@$DEFAULT_DOMAIN_NAME}
|
||||
|
@ -311,9 +311,9 @@ function turtl_setup {
|
|||
DEFAULT_STORAGE_LIMIT=${DEFAULT_STORAGE_LIMIT:-100}
|
||||
STORAGE_INVITE_CREDIT=${STORAGE_INVITE_CREDIT:-25}
|
||||
if [[ $ONION_ONLY == 'no' ]]; then
|
||||
LOCAL_UPLOAD_URL=${LOCAL_UPLOAD_URL:-https://$TURTL_API_DOMAIN_NAME}
|
||||
LOCAL_UPLOAD_URL=${LOCAL_UPLOAD_URL:-https://$TURTL_DOMAIN_NAME}
|
||||
else
|
||||
LOCAL_UPLOAD_URL=${LOCAL_UPLOAD_URL:-http://$TURTL_API_ONION_HOSTNAME}
|
||||
LOCAL_UPLOAD_URL=${LOCAL_UPLOAD_URL:-http://$TURTL_ONION_HOSTNAME}
|
||||
fi
|
||||
LOCAL_UPLOAD_PATH=${LOCAL_UPLOAD_PATH:-"$TURTL_BASE_DIR/data"}
|
||||
AWS_S3_TOKEN=${AWS_S3_TOKEN:-(:token ''
|
||||
|
@ -501,10 +501,10 @@ __ENDCONFIG__
|
|||
|
||||
# install turtl API
|
||||
cd $TURTL_BASE_DIR/
|
||||
git clone $TURTL_API_REPO $TURTL_BASE_DIR/api
|
||||
git clone $TURTL_REPO $TURTL_BASE_DIR/api
|
||||
cd $TURTL_BASE_DIR/api
|
||||
git checkout $TURTL_API_COMMIT -b $TURTL_API_COMMIT
|
||||
set_completion_param "turtl api commit" "$TURTL_API_COMMIT"
|
||||
git checkout $TURTL_COMMIT -b $TURTL_COMMIT
|
||||
set_completion_param "turtl commit" "$TURTL_COMMIT"
|
||||
cd $TURTL_BASE_DIR/quicklisp/local-projects
|
||||
git clone git://github.com/orthecreedence/cl-hash-util
|
||||
if [[ "$check_architecture" != *"arm"* ]]; then
|
||||
|
@ -538,27 +538,27 @@ __ENDCONFIG__
|
|||
echo "(pushnew \"./\" asdf:*central-registry* :test #'equal)" >> $TURTL_BASE_DIR/api/launch.lisp
|
||||
echo '(load "start")' >> $TURTL_BASE_DIR/api/launch.lisp
|
||||
|
||||
TURTL_API_ONION_HOSTNAME=$(add_onion_service turtlapi 80 ${TURTL_API_ONION_PORT})
|
||||
TURTL_ONION_HOSTNAME=$(add_onion_service turtlapi 80 ${TURTL_ONION_PORT})
|
||||
|
||||
turtl_setup
|
||||
}
|
||||
|
||||
function install_turtl_nginx {
|
||||
turtl_nginx_site=/etc/nginx/sites-available/$TURTL_API_DOMAIN_NAME
|
||||
turtl_nginx_site=/etc/nginx/sites-available/$TURTL_DOMAIN_NAME
|
||||
if [[ $ONION_ONLY == "no" ]]; then
|
||||
function_check nginx_http_redirect
|
||||
nginx_http_redirect $TURTL_API_DOMAIN_NAME
|
||||
nginx_http_redirect $TURTL_DOMAIN_NAME
|
||||
echo 'server {' >> $turtl_nginx_site
|
||||
echo ' listen 443 ssl;' >> $turtl_nginx_site
|
||||
echo ' listen [::]:443 ssl;' >> $turtl_nginx_site
|
||||
echo " server_name ${TURTL_API_DOMAIN_NAME};" >> $turtl_nginx_site
|
||||
echo " server_name ${TURTL_DOMAIN_NAME};" >> $turtl_nginx_site
|
||||
echo '' >> $turtl_nginx_site
|
||||
echo ' # Security' >> $turtl_nginx_site
|
||||
function_check nginx_ssl
|
||||
nginx_ssl $TURTL_API_DOMAIN_NAME
|
||||
nginx_ssl $TURTL_DOMAIN_NAME
|
||||
|
||||
function_check nginx_disable_sniffing
|
||||
nginx_disable_sniffing $TURTL_API_DOMAIN_NAME
|
||||
nginx_disable_sniffing $TURTL_DOMAIN_NAME
|
||||
|
||||
echo ' add_header Strict-Transport-Security max-age=15768000;' >> $turtl_nginx_site
|
||||
echo '' >> $turtl_nginx_site
|
||||
|
@ -568,7 +568,7 @@ function install_turtl_nginx {
|
|||
echo '' >> $turtl_nginx_site
|
||||
echo ' location / {' >> $turtl_nginx_site
|
||||
function_check nginx_limits
|
||||
nginx_limits $TURTL_API_DOMAIN_NAME '15m'
|
||||
nginx_limits $TURTL_DOMAIN_NAME '15m'
|
||||
echo " proxy_pass http://localhost:${TURTL_PORT}/;" >> $turtl_nginx_site
|
||||
echo ' proxy_set_header Host $host;' >> $turtl_nginx_site
|
||||
echo ' proxy_buffering off;' >> $turtl_nginx_site
|
||||
|
@ -578,11 +578,11 @@ function install_turtl_nginx {
|
|||
echo -n '' > $turtl_nginx_site
|
||||
fi
|
||||
echo 'server {' >> $turtl_nginx_site
|
||||
echo " listen 127.0.0.1:${TURTL_API_ONION_PORT};" >> $turtl_nginx_site
|
||||
echo " server_name ${TURTL_API_ONION_HOSTNAME};" >> $turtl_nginx_site
|
||||
echo " listen 127.0.0.1:${TURTL_ONION_PORT};" >> $turtl_nginx_site
|
||||
echo " server_name ${TURTL_ONION_HOSTNAME};" >> $turtl_nginx_site
|
||||
echo '' >> $turtl_nginx_site
|
||||
function_check nginx_disable_sniffing
|
||||
nginx_disable_sniffing $TURTL_API_DOMAIN_NAME
|
||||
nginx_disable_sniffing $TURTL_DOMAIN_NAME
|
||||
echo '' >> $turtl_nginx_site
|
||||
echo ' # Logs' >> $turtl_nginx_site
|
||||
echo ' access_log /dev/null;' >> $turtl_nginx_site
|
||||
|
@ -590,7 +590,7 @@ function install_turtl_nginx {
|
|||
echo '' >> $turtl_nginx_site
|
||||
echo ' location / {' >> $turtl_nginx_site
|
||||
function_check nginx_limits
|
||||
nginx_limits $TURTL_API_DOMAIN_NAME '15m'
|
||||
nginx_limits $TURTL_DOMAIN_NAME '15m'
|
||||
echo " proxy_pass http://localhost:${TURTL_PORT}/;" >> $turtl_nginx_site
|
||||
echo ' proxy_set_header Host $host;' >> $turtl_nginx_site
|
||||
echo ' proxy_buffering off;' >> $turtl_nginx_site
|
||||
|
@ -598,15 +598,15 @@ function install_turtl_nginx {
|
|||
echo '}' >> $turtl_nginx_site
|
||||
|
||||
function_check add_ddns_domain
|
||||
add_ddns_domain $TURTL_API_DOMAIN_NAME
|
||||
add_ddns_domain $TURTL_DOMAIN_NAME
|
||||
|
||||
set_completion_param "turtl api domain" "$TURTL_API_DOMAIN_NAME"
|
||||
set_completion_param "turtl domain" "$TURTL_DOMAIN_NAME"
|
||||
|
||||
function_check create_site_certificate
|
||||
create_site_certificate $TURTL_API_DOMAIN_NAME 'yes'
|
||||
create_site_certificate $TURTL_DOMAIN_NAME 'yes'
|
||||
|
||||
function_check nginx_ensite
|
||||
nginx_ensite $TURTL_API_DOMAIN_NAME
|
||||
nginx_ensite $TURTL_DOMAIN_NAME
|
||||
|
||||
systemctl restart nginx
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue