Add bludit app
This commit is contained in:
parent
8d7bde9891
commit
7f89e7d87a
|
@ -0,0 +1,334 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# .---. . .
|
||||
# | | |
|
||||
# |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
|
||||
# | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
|
||||
# ' ' --' --' -' - -' ' ' -' -' -' ' - --'
|
||||
#
|
||||
# Freedom in the Cloud
|
||||
#
|
||||
# Databaseless blogging system
|
||||
#
|
||||
# License
|
||||
# =======
|
||||
#
|
||||
# Copyright (C) 2018 Bob Mottram <bob@freedombone.net>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
VARIANTS='full full-vim'
|
||||
|
||||
IN_DEFAULT_INSTALL=0
|
||||
SHOW_ON_ABOUT=1
|
||||
|
||||
BLUDIT_DOMAIN_NAME=
|
||||
BLUDIT_CODE=
|
||||
BLUDIT_ONION_PORT=9361
|
||||
BLUDIT_REPO="https://github.com/bludit/bludit"
|
||||
BLUDIT_COMMIT='0e27e31a84421b3e6bd000a77bc89c2dff3c446a'
|
||||
|
||||
bludit=(ONION_ONLY
|
||||
BLUDIT_DOMAIN_NAME
|
||||
BLUDIT_CODE
|
||||
DDNS_PROVIDER
|
||||
MY_USERNAME)
|
||||
|
||||
function logging_on_bludit {
|
||||
echo -n ''
|
||||
}
|
||||
|
||||
function logging_off_bludit {
|
||||
echo -n ''
|
||||
}
|
||||
|
||||
function remove_user_bludit {
|
||||
remove_username="$1"
|
||||
|
||||
"${PROJECT_NAME}-pass" -u "$remove_username" --rmapp bludit
|
||||
}
|
||||
|
||||
function add_user_bludit {
|
||||
new_username="$1"
|
||||
new_user_password="$2"
|
||||
|
||||
"${PROJECT_NAME}-pass" -u "$new_username" -a bludit -p "$new_user_password"
|
||||
echo '0'
|
||||
}
|
||||
|
||||
function install_interactive_bludit {
|
||||
if [ ! "$ONION_ONLY" ]; then
|
||||
ONION_ONLY='no'
|
||||
fi
|
||||
|
||||
if [[ "$ONION_ONLY" != "no" ]]; then
|
||||
BLUDIT_DOMAIN_NAME='bludit.local'
|
||||
write_config_param "BLUDIT_DOMAIN_NAME" "$BLUDIT_DOMAIN_NAME"
|
||||
else
|
||||
interactive_site_details "bludit" "BLUDIT_DOMAIN_NAME" "bludit_CODE"
|
||||
fi
|
||||
APP_INSTALLED=1
|
||||
}
|
||||
|
||||
function change_password_bludit {
|
||||
curr_username="$1"
|
||||
new_user_password="$2"
|
||||
|
||||
read_config_param 'BLUDIT_DOMAIN_NAME'
|
||||
|
||||
"${PROJECT_NAME}-pass" -u "$curr_username" -a bludit -p "$new_user_password"
|
||||
}
|
||||
|
||||
function reconfigure_bludit {
|
||||
# This is used if you need to switch identity. Dump old keys and generate new ones
|
||||
echo -n ''
|
||||
}
|
||||
|
||||
function upgrade_bludit {
|
||||
CURR_BLUDIT_COMMIT=$(get_completion_param "bludit commit")
|
||||
if [[ "$CURR_BLUDIT_COMMIT" == "$BLUDIT_COMMIT" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if grep -q "bludit domain" "$COMPLETION_FILE"; then
|
||||
BLUDIT_DOMAIN_NAME=$(get_completion_param "bludit domain")
|
||||
fi
|
||||
|
||||
# update to the next commit
|
||||
set_repo_commit "/var/www/$BLUDIT_DOMAIN_NAME/htdocs" "bludit commit" "$BLUDIT_COMMIT" $BLUDIT_REPO
|
||||
chown -R www-data:www-data "/var/www/${BLUDIT_DOMAIN_NAME}/htdocs"
|
||||
}
|
||||
|
||||
function backup_local_bludit {
|
||||
BLUDIT_DOMAIN_NAME='bludit'
|
||||
if grep -q "bludit domain" "$COMPLETION_FILE"; then
|
||||
BLUDIT_DOMAIN_NAME=$(get_completion_param "bludit domain")
|
||||
fi
|
||||
|
||||
source_directory=/var/www/${BLUDIT_DOMAIN_NAME}/htdocs
|
||||
|
||||
suspend_site "${BLUDIT_DOMAIN_NAME}"
|
||||
|
||||
dest_directory=bludit
|
||||
backup_directory_to_usb "$source_directory" $dest_directory
|
||||
|
||||
restart_site
|
||||
}
|
||||
|
||||
function restore_local_bludit {
|
||||
if ! grep -q "bludit domain" "$COMPLETION_FILE"; then
|
||||
return
|
||||
fi
|
||||
BLUDIT_DOMAIN_NAME=$(get_completion_param "bludit domain")
|
||||
if [ "$BLUDIT_DOMAIN_NAME" ]; then
|
||||
temp_restore_dir=/root/tempbludit
|
||||
bludit_dir=/var/www/${BLUDIT_DOMAIN_NAME}/htdocs
|
||||
|
||||
restore_directory_from_usb $temp_restore_dir bludit
|
||||
if [ -d $temp_restore_dir ]; then
|
||||
if [ -d "$temp_restore_dir$bludit_dir" ]; then
|
||||
cp -rp "$temp_restore_dir$bludit_dir"/* "$bludit_dir"/
|
||||
else
|
||||
if [ ! -d "$bludit_dir" ]; then
|
||||
mkdir "$bludit_dir"
|
||||
fi
|
||||
cp -rp "$temp_restore_dir"/* "$bludit_dir"/
|
||||
fi
|
||||
chown -R www-data:www-data "$bludit_dir"
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function backup_remote_bludit {
|
||||
BLUDIT_DOMAIN_NAME='bludit'
|
||||
if grep -q "bludit domain" "$COMPLETION_FILE"; then
|
||||
BLUDIT_DOMAIN_NAME=$(get_completion_param "bludit domain")
|
||||
fi
|
||||
|
||||
source_directory=/var/www/${BLUDIT_DOMAIN_NAME}/htdocs
|
||||
|
||||
suspend_site "${BLUDIT_DOMAIN_NAME}"
|
||||
|
||||
dest_directory=bludit
|
||||
backup_directory_to_friend "$source_directory" $dest_directory
|
||||
|
||||
restart_site
|
||||
}
|
||||
|
||||
function restore_remote_bludit {
|
||||
if ! grep -q "bludit domain" "$COMPLETION_FILE"; then
|
||||
return
|
||||
fi
|
||||
BLUDIT_DOMAIN_NAME=$(get_completion_param "bludit domain")
|
||||
if [ "$BLUDIT_DOMAIN_NAME" ]; then
|
||||
temp_restore_dir=/root/tempbludit
|
||||
bludit_dir=/var/www/${BLUDIT_DOMAIN_NAME}/htdocs
|
||||
|
||||
restore_directory_from_friend $temp_restore_dir bludit
|
||||
if [ -d $temp_restore_dir ]; then
|
||||
if [ -d "$temp_restore_dir$bludit_dir" ]; then
|
||||
cp -rp "$temp_restore_dir$bludit_dir"/* "$bludit_dir"/
|
||||
else
|
||||
if [ ! -d "$bludit_dir" ]; then
|
||||
mkdir "$bludit_dir"
|
||||
fi
|
||||
cp -rp $temp_restore_dir/* "$bludit_dir"/
|
||||
fi
|
||||
chown -R www-data:www-data "$bludit_dir"
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function remove_bludit {
|
||||
nginx_dissite "$BLUDIT_DOMAIN_NAME"
|
||||
remove_certs "$BLUDIT_DOMAIN_NAME"
|
||||
|
||||
if [ -d "/var/www/$BLUDIT_DOMAIN_NAME" ]; then
|
||||
rm -rf "/var/www/$BLUDIT_DOMAIN_NAME"
|
||||
fi
|
||||
if [ -f "/etc/nginx/sites-available/$BLUDIT_DOMAIN_NAME" ]; then
|
||||
rm "/etc/nginx/sites-available/$BLUDIT_DOMAIN_NAME"
|
||||
fi
|
||||
remove_onion_service bludit ${BLUDIT_ONION_PORT}
|
||||
if grep -q "bludit" /etc/crontab; then
|
||||
sed -i "/bludit/d" /etc/crontab
|
||||
fi
|
||||
remove_app bludit
|
||||
remove_completion_param install_bludit
|
||||
sed -i '/bludit/d' "$COMPLETION_FILE"
|
||||
|
||||
remove_ddns_domain "$BLUDIT_DOMAIN_NAME"
|
||||
}
|
||||
|
||||
function install_bludit {
|
||||
apt-get -yq install php-gettext php-curl php-gd php-mysql git curl
|
||||
apt-get -yq install memcached php-memcached php-intl exiftool libfcgi0ldbl
|
||||
|
||||
if [ ! -d "/var/www/$BLUDIT_DOMAIN_NAME" ]; then
|
||||
mkdir "/var/www/$BLUDIT_DOMAIN_NAME"
|
||||
fi
|
||||
if [ ! -d "/var/www/$BLUDIT_DOMAIN_NAME/htdocs" ]; then
|
||||
if [ -d /repos/bludit ]; then
|
||||
mkdir "/var/www/$BLUDIT_DOMAIN_NAME/htdocs"
|
||||
cp -r -p /repos/bludit/. "/var/www/$BLUDIT_DOMAIN_NAME/htdocs"
|
||||
cd "/var/www/$BLUDIT_DOMAIN_NAME/htdocs" || exit 324687356
|
||||
git pull
|
||||
else
|
||||
git_clone $BLUDIT_REPO "/var/www/$BLUDIT_DOMAIN_NAME/htdocs"
|
||||
fi
|
||||
|
||||
if [ ! -d "/var/www/$BLUDIT_DOMAIN_NAME/htdocs" ]; then
|
||||
echo $'Unable to clone bludit repo'
|
||||
exit 87525
|
||||
fi
|
||||
fi
|
||||
|
||||
cd "/var/www/$BLUDIT_DOMAIN_NAME/htdocs" || exit 36587356
|
||||
git checkout $BLUDIT_COMMIT -b $BLUDIT_COMMIT
|
||||
set_completion_param "bludit commit" "$BLUDIT_COMMIT"
|
||||
|
||||
chmod g+w "/var/www/$BLUDIT_DOMAIN_NAME/htdocs"
|
||||
chown -R www-data:www-data "/var/www/$BLUDIT_DOMAIN_NAME/htdocs"
|
||||
|
||||
add_ddns_domain "$BLUDIT_DOMAIN_NAME"
|
||||
|
||||
BLUDIT_ONION_HOSTNAME=$(add_onion_service bludit 80 ${BLUDIT_ONION_PORT})
|
||||
|
||||
bludit_nginx_site=/etc/nginx/sites-available/$BLUDIT_DOMAIN_NAME
|
||||
if [[ "$ONION_ONLY" == "no" ]]; then
|
||||
nginx_http_redirect "$BLUDIT_DOMAIN_NAME" "index index.php"
|
||||
{ echo 'server {';
|
||||
echo ' listen 443 ssl;';
|
||||
echo ' #listen [::]:443 ssl;';
|
||||
echo " server_name $BLUDIT_DOMAIN_NAME;";
|
||||
echo ''; } >> "$bludit_nginx_site"
|
||||
nginx_compress "$BLUDIT_DOMAIN_NAME"
|
||||
echo '' >> "$bludit_nginx_site"
|
||||
echo ' # Security' >> "$bludit_nginx_site"
|
||||
nginx_ssl "$BLUDIT_DOMAIN_NAME"
|
||||
|
||||
nginx_security_options "$BLUDIT_DOMAIN_NAME"
|
||||
|
||||
{ echo ' add_header Strict-Transport-Security max-age=15768000;';
|
||||
echo '';
|
||||
echo ' # Logs';
|
||||
echo ' access_log /dev/null;';
|
||||
echo ' error_log /dev/null;';
|
||||
echo '';
|
||||
echo ' # Root';
|
||||
echo " root /var/www/$BLUDIT_DOMAIN_NAME/htdocs;";
|
||||
echo '';
|
||||
echo ' index index.php;';
|
||||
echo ' location ~ \.php {';
|
||||
echo ' include snippets/fastcgi-php.conf;';
|
||||
echo ' fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
|
||||
echo ' fastcgi_read_timeout 30;';
|
||||
echo ' }';
|
||||
echo '';
|
||||
echo ' # Location';
|
||||
echo ' location / {'; } >> "$bludit_nginx_site"
|
||||
nginx_limits "$BLUDIT_DOMAIN_NAME" '15m'
|
||||
{ echo " try_files \$uri \$uri/ /index.html;";
|
||||
echo ' }';
|
||||
echo '}'; } >> "$bludit_nginx_site"
|
||||
else
|
||||
echo -n '' > "$bludit_nginx_site"
|
||||
fi
|
||||
{ echo 'server {';
|
||||
echo " listen 127.0.0.1:$BLUDIT_ONION_PORT default_server;";
|
||||
echo " server_name $BLUDIT_ONION_HOSTNAME;";
|
||||
echo ''; } >> "$bludit_nginx_site"
|
||||
nginx_compress "$BLUDIT_DOMAIN_NAME"
|
||||
echo '' >> "$bludit_nginx_site"
|
||||
nginx_security_options "$BLUDIT_DOMAIN_NAME"
|
||||
{ echo '';
|
||||
echo ' # Logs';
|
||||
echo ' access_log /dev/null;';
|
||||
echo ' error_log /dev/null;';
|
||||
echo '';
|
||||
echo ' # Root';
|
||||
echo " root /var/www/$BLUDIT_DOMAIN_NAME/htdocs;";
|
||||
echo '';
|
||||
echo ' index index.php;';
|
||||
echo ' location ~ \.php {';
|
||||
echo ' include snippets/fastcgi-php.conf;';
|
||||
echo ' fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
|
||||
echo ' fastcgi_read_timeout 30;';
|
||||
echo ' }';
|
||||
echo '';
|
||||
echo ' # Location';
|
||||
echo ' location / {'; } >> "$bludit_nginx_site"
|
||||
nginx_limits "$BLUDIT_DOMAIN_NAME" '15m'
|
||||
{ echo " try_files \$uri \$uri/ index.html;";
|
||||
echo ' }';
|
||||
echo '}'; } >> "$bludit_nginx_site"
|
||||
|
||||
configure_php
|
||||
|
||||
create_site_certificate "$BLUDIT_DOMAIN_NAME" 'yes'
|
||||
|
||||
nginx_ensite "$BLUDIT_DOMAIN_NAME"
|
||||
|
||||
systemctl restart php7.0-fpm
|
||||
systemctl restart nginx
|
||||
|
||||
"${PROJECT_NAME}-pass" -u "$MY_USERNAME" -a bludit -p "$BLUDIT_ADMIN_PASSWORD"
|
||||
set_completion_param "bludit domain" "$BLUDIT_DOMAIN_NAME"
|
||||
|
||||
APP_INSTALLED=1
|
||||
}
|
||||
|
||||
# NOTE: deliberately there is no "exit 0"
|
|
@ -34,7 +34,6 @@ app_name='noapp'
|
|||
app_name_lower=$(echo "${app_name}" | tr '[:upper:]' '[:lower:]')
|
||||
app_name=$app_name_lower
|
||||
app_name_upper=$(echo "${app_name}" | tr '[:lower:]' '[:upper:]')
|
||||
echo "test: $app_name_upper"
|
||||
app_repo="TODO"
|
||||
app_repo_commit='TODO'
|
||||
app_php=
|
||||
|
@ -257,24 +256,24 @@ echo ''
|
|||
echo "function remove_user_${app_name} {"
|
||||
echo " remove_username=\"\$1\""
|
||||
echo ''
|
||||
echo " \${PROJECT_NAME}-pass -u \$remove_username --rmapp ${app_name}"
|
||||
echo " \"\${PROJECT_NAME}-pass\" -u \"\$remove_username\" --rmapp ${app_name}"
|
||||
echo '}'
|
||||
echo ''
|
||||
echo "function add_user_${app_name} {"
|
||||
echo " new_username=\"\$1\""
|
||||
echo " new_user_password=\"\$2\""
|
||||
echo ''
|
||||
echo " \${PROJECT_NAME}-pass -u \$new_username -a ${app_name} -p \"\$new_user_password\""
|
||||
echo " \"\${PROJECT_NAME}-pass\" -u \"\$new_username\" -a ${app_name} -p \"\$new_user_password\""
|
||||
echo " echo '0'"
|
||||
echo '}'
|
||||
echo ''
|
||||
echo "function install_interactive_${app_name} {"
|
||||
if [ ! $app_onion_only ]; then
|
||||
echo " if [ ! \$ONION_ONLY ]; then"
|
||||
echo " if [ ! \"\$ONION_ONLY\" ]; then"
|
||||
echo " ONION_ONLY='no'"
|
||||
echo ' fi'
|
||||
echo ''
|
||||
echo " if [[ \$ONION_ONLY != \"no\" ]]; then"
|
||||
echo " if [[ \"\$ONION_ONLY\" != \"no\" ]]; then"
|
||||
echo " ${app_name_upper}_DOMAIN_NAME='${app_name}.local'"
|
||||
echo " write_config_param \"${app_name_upper}_DOMAIN_NAME\" \"\$${app_name_upper}_DOMAIN_NAME\""
|
||||
echo ' else'
|
||||
|
@ -292,7 +291,7 @@ echo " new_user_password=\"\$2\""
|
|||
echo ''
|
||||
echo " read_config_param '${app_name_upper}_DOMAIN_NAME'"
|
||||
echo ''
|
||||
echo " \${PROJECT_NAME}-pass -u \"\$curr_username\" -a ${app_name} -p \"\$new_user_password\""
|
||||
echo " \"\${PROJECT_NAME}-pass\" -u \"\$curr_username\" -a ${app_name} -p \"\$new_user_password\""
|
||||
echo '}'
|
||||
|
||||
if [[ "$database_type" == "mariadb" || "$database_type" == "mysql" || "$database_type" == "postgres"* ]]; then
|
||||
|
@ -361,23 +360,23 @@ echo " if [[ \"\$CURR_${app_name_upper}_COMMIT\" == \"\$${app_name_upper}_COM
|
|||
echo ' return'
|
||||
echo ' fi'
|
||||
echo ''
|
||||
echo " if grep -q \"${app_name} domain\" \$COMPLETION_FILE; then"
|
||||
echo " if grep -q \"${app_name} domain\" \"\$COMPLETION_FILE\"; then"
|
||||
echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name} domain\")"
|
||||
echo ' fi'
|
||||
echo ''
|
||||
echo ' # update to the next commit'
|
||||
if [ ! "$app_dir" ]; then
|
||||
echo " set_repo_commit /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs \"${app_name} commit\" \"\$${app_name_upper}_COMMIT\" \$${app_name_upper}_REPO"
|
||||
echo " chown -R www-data:www-data /var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs"
|
||||
echo " set_repo_commit \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\" \"${app_name} commit\" \"\$${app_name_upper}_COMMIT\" \$${app_name_upper}_REPO"
|
||||
echo " chown -R www-data:www-data \"/var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs\""
|
||||
else
|
||||
echo " set_repo_commit ${app_dir} \"${app_name} commit\" \"\$${app_name_upper}_COMMIT\" \$${app_name_upper}_REPO"
|
||||
echo " chown -R ${app_name}:${app_name} ${app_dir}"
|
||||
echo " set_repo_commit \"${app_dir}\" \"${app_name} commit\" \"\$${app_name_upper}_COMMIT\" \$${app_name_upper}_REPO"
|
||||
echo " chown -R ${app_name}:${app_name} \"${app_dir}\""
|
||||
fi
|
||||
echo '}'
|
||||
echo ''
|
||||
echo "function backup_local_${app_name} {"
|
||||
echo " ${app_name_upper}_DOMAIN_NAME='${app_name}'"
|
||||
echo " if grep -q \"${app_name} domain\" \$COMPLETION_FILE; then"
|
||||
echo " if grep -q \"${app_name} domain\" \"\$COMPLETION_FILE\"; then"
|
||||
echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name} domain\")"
|
||||
echo ' fi'
|
||||
echo ''
|
||||
|
@ -387,10 +386,10 @@ else
|
|||
echo " source_directory=${app_dir}"
|
||||
fi
|
||||
echo ''
|
||||
echo " suspend_site \${${app_name_upper}_DOMAIN_NAME}"
|
||||
echo " suspend_site \"\${${app_name_upper}_DOMAIN_NAME}\""
|
||||
echo ''
|
||||
echo " dest_directory=${app_name}"
|
||||
echo " backup_directory_to_usb \$source_directory \$dest_directory"
|
||||
echo " backup_directory_to_usb \"\$source_directory\" \$dest_directory"
|
||||
echo ''
|
||||
if [[ "$database_type" == "mariadb" || "$database_type" == "mysql" ]]; then
|
||||
echo " backup_database_to_usb ${app_name}"
|
||||
|
@ -405,11 +404,11 @@ echo ' restart_site'
|
|||
echo '}'
|
||||
echo ''
|
||||
echo "function restore_local_${app_name} {"
|
||||
echo " if ! grep -q \"${app_name} domain\" \$COMPLETION_FILE; then"
|
||||
echo " if ! grep -q \"${app_name} domain\" \"\$COMPLETION_FILE\"; then"
|
||||
echo ' return'
|
||||
echo ' fi'
|
||||
echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name} domain\")"
|
||||
echo " if [ \$${app_name_upper}_DOMAIN_NAME ]; then"
|
||||
echo " if [ \"\$${app_name_upper}_DOMAIN_NAME\" ]; then"
|
||||
echo " temp_restore_dir=/root/temp${app_name}"
|
||||
if [ ! "$app_dir" ]; then
|
||||
echo " ${app_name}_dir=/var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs"
|
||||
|
@ -438,15 +437,15 @@ if [[ "$database_type" == "postgres"* ]]; then
|
|||
fi
|
||||
echo " restore_directory_from_usb \$temp_restore_dir ${app_name}"
|
||||
echo " if [ -d \$temp_restore_dir ]; then"
|
||||
echo " if [ -d cp \$temp_restore_dir\$${app_name}_dir ]; then"
|
||||
echo " cp -rp \$temp_restore_dir\$${app_name}_dir/* \$${app_name}_dir/"
|
||||
echo " if [ -d \"\$temp_restore_dir\$${app_name}_dir\" ]; then"
|
||||
echo " cp -rp \"\$temp_restore_dir\$${app_name}_dir\"/* \"\$${app_name}_dir\"/"
|
||||
echo ' else'
|
||||
echo " if [ ! -d \$${app_name}_dir ]; then"
|
||||
echo " mkdir \$${app_name}_dir"
|
||||
echo " if [ ! -d \"\$${app_name}_dir\" ]; then"
|
||||
echo " mkdir \"\$${app_name}_dir\""
|
||||
echo ' fi'
|
||||
echo " cp -rp \$temp_restore_dir/* \$${app_name}_dir/"
|
||||
echo " cp -rp \"\$temp_restore_dir\"/* \"\$${app_name}_dir\"/"
|
||||
echo ' fi'
|
||||
echo " chown -R www-data:www-data \$${app_name}_dir"
|
||||
echo " chown -R www-data:www-data \"\$${app_name}_dir\""
|
||||
echo " rm -rf \$temp_restore_dir"
|
||||
echo ' fi'
|
||||
echo ''
|
||||
|
@ -455,7 +454,7 @@ echo '}'
|
|||
echo ''
|
||||
echo "function backup_remote_${app_name} {"
|
||||
echo " ${app_name_upper}_DOMAIN_NAME='${app_name}'"
|
||||
echo " if grep -q \"${app_name} domain\" \$COMPLETION_FILE; then"
|
||||
echo " if grep -q \"${app_name} domain\" \"\$COMPLETION_FILE\"; then"
|
||||
echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name} domain\")"
|
||||
echo ' fi'
|
||||
echo ''
|
||||
|
@ -465,13 +464,13 @@ else
|
|||
echo " source_directory=${app_dir}"
|
||||
fi
|
||||
echo ''
|
||||
echo " suspend_site \${${app_name_upper}_DOMAIN_NAME}"
|
||||
echo " suspend_site \"\${${app_name_upper}_DOMAIN_NAME}\""
|
||||
echo ''
|
||||
echo " dest_directory=${app_name}"
|
||||
echo " backup_directory_to_friend \$source_directory \$dest_directory"
|
||||
echo ''
|
||||
echo " backup_directory_to_friend \"\$source_directory\" \$dest_directory"
|
||||
if [[ "$database_type" == "mariadb" || "$database_type" == "mysql" ]]; then
|
||||
echo " backup_database_to_friend ${app_name}"
|
||||
echo ''
|
||||
fi
|
||||
if [[ "$database_type" == "postgres"* ]]; then
|
||||
echo ' USE_POSTGRESQL=1'
|
||||
|
@ -483,11 +482,11 @@ echo ' restart_site'
|
|||
echo '}'
|
||||
echo ''
|
||||
echo "function restore_remote_${app_name} {"
|
||||
echo " if ! grep -q \"${app_name} domain\" \$COMPLETION_FILE; then"
|
||||
echo " if ! grep -q \"${app_name} domain\" \"\$COMPLETION_FILE\"; then"
|
||||
echo ' return'
|
||||
echo ' fi'
|
||||
echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name} domain\")"
|
||||
echo " if [ \$${app_name_upper}_DOMAIN_NAME ]; then"
|
||||
echo " if [ \"\$${app_name_upper}_DOMAIN_NAME\" ]; then"
|
||||
echo " temp_restore_dir=/root/temp${app_name}"
|
||||
if [ ! "$app_dir" ]; then
|
||||
echo " ${app_name}_dir=/var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs"
|
||||
|
@ -499,7 +498,7 @@ if [[ "$database_type" == "mariadb" || "$database_type" == "mysql" ]]; then
|
|||
echo " ${app_name}_create_database"
|
||||
echo ''
|
||||
echo " restore_database_from_friend ${app_name}"
|
||||
echo " if [ -d \$temp_restore_dir ]; then"
|
||||
echo " if [ -d \"\$temp_restore_dir\" ]; then"
|
||||
echo " rm -rf \$temp_restore_dir"
|
||||
echo ' fi'
|
||||
echo ''
|
||||
|
@ -509,22 +508,22 @@ if [[ "$database_type" == "postgres"* ]]; then
|
|||
echo ''
|
||||
echo ' USE_POSTGRESQL=1'
|
||||
echo " restore_database_from_friend ${app_name}"
|
||||
echo " if [ -d \$temp_restore_dir ]; then"
|
||||
echo " if [ -d \"\$temp_restore_dir\" ]; then"
|
||||
echo " rm -rf \$temp_restore_dir"
|
||||
echo ' fi'
|
||||
echo ''
|
||||
fi
|
||||
echo " restore_directory_from_friend \$temp_restore_dir ${app_name}"
|
||||
echo " if [ -d \$temp_restore_dir ]; then"
|
||||
echo " if [ -d cp \$temp_restore_dir\$${app_name}_dir ]; then"
|
||||
echo " cp -rp \$temp_restore_dir\$${app_name}_dir/* \$${app_name}_dir/"
|
||||
echo " if [ -d \"\$temp_restore_dir\$${app_name}_dir\" ]; then"
|
||||
echo " cp -rp \"\$temp_restore_dir\$${app_name}_dir\"/* \"\$${app_name}_dir\"/"
|
||||
echo ' else'
|
||||
echo " if [ ! -d \$${app_name}_dir ]; then"
|
||||
echo " mkdir \$${app_name}_dir"
|
||||
echo " if [ ! -d \"\$${app_name}_dir\" ]; then"
|
||||
echo " mkdir \"\$${app_name}_dir\""
|
||||
echo ' fi'
|
||||
echo " cp -rp \$temp_restore_dir/* \$${app_name}_dir/"
|
||||
echo " cp -rp \$temp_restore_dir/* \"\$${app_name}_dir\"/"
|
||||
echo ' fi'
|
||||
echo " chown -R www-data:www-data \$${app_name}_dir"
|
||||
echo " chown -R www-data:www-data \"\$${app_name}_dir\""
|
||||
echo " rm -rf \$temp_restore_dir"
|
||||
echo ' fi'
|
||||
echo ''
|
||||
|
@ -536,8 +535,8 @@ if [[ "$app_node" == 'yes' ]]; then
|
|||
echo " remove_nodejs ${app_name}"
|
||||
echo ''
|
||||
fi
|
||||
echo " nginx_dissite \$${app_name_upper}_DOMAIN_NAME"
|
||||
echo " remove_certs \$${app_name_upper}_DOMAIN_NAME"
|
||||
echo " nginx_dissite \"\$${app_name_upper}_DOMAIN_NAME\""
|
||||
echo " remove_certs \"\$${app_name_upper}_DOMAIN_NAME\""
|
||||
echo ''
|
||||
if [ $app_daemon ]; then
|
||||
echo " if [ -f /etc/systemd/system/${app_name}.service ]; then"
|
||||
|
@ -548,11 +547,11 @@ if [ $app_daemon ]; then
|
|||
echo " userdel -r ${app_name}"
|
||||
fi
|
||||
echo ''
|
||||
echo " if [ -d /var/www/\$${app_name_upper}_DOMAIN_NAME ]; then"
|
||||
echo " rm -rf /var/www/\$${app_name_upper}_DOMAIN_NAME"
|
||||
echo " if [ -d \"/var/www/\$${app_name_upper}_DOMAIN_NAME\" ]; then"
|
||||
echo " rm -rf \"/var/www/\$${app_name_upper}_DOMAIN_NAME\""
|
||||
echo ' fi'
|
||||
echo " if [ -f /etc/nginx/sites-available/\$${app_name_upper}_DOMAIN_NAME ]; then"
|
||||
echo " rm /etc/nginx/sites-available/\$${app_name_upper}_DOMAIN_NAME"
|
||||
echo " if [ -f \"/etc/nginx/sites-available/\$${app_name_upper}_DOMAIN_NAME\" ]; then"
|
||||
echo " rm \"/etc/nginx/sites-available/\$${app_name_upper}_DOMAIN_NAME\""
|
||||
echo ' fi'
|
||||
if [[ "$database_type" == "mariadb" || "$database_type" == "mysql" ]]; then
|
||||
echo " drop_database ${app_name}"
|
||||
|
@ -566,13 +565,13 @@ echo " sed -i \"/${app_name}/d\" /etc/crontab"
|
|||
echo ' fi'
|
||||
echo " remove_app ${app_name}"
|
||||
echo " remove_completion_param install_${app_name}"
|
||||
echo " sed -i '/${app_name}/d' \$COMPLETION_FILE"
|
||||
echo " sed -i '/${app_name}/d' \"\$COMPLETION_FILE\""
|
||||
if [ "$app_port" ]; then
|
||||
echo ''
|
||||
echo " firewall_remove ${app_port} tcp"
|
||||
fi
|
||||
echo ''
|
||||
echo " remove_ddns_domain \$${app_name_upper}_DOMAIN_NAME"
|
||||
echo " remove_ddns_domain \"\$${app_name_upper}_DOMAIN_NAME\""
|
||||
echo '}'
|
||||
echo ''
|
||||
echo "function install_${app_name} {"
|
||||
|
@ -594,32 +593,32 @@ if [[ "$app_php" == 'yes' ]]; then
|
|||
echo ' apt-get -yq install memcached php-memcached php-intl exiftool libfcgi0ldbl'
|
||||
echo ''
|
||||
fi
|
||||
echo " if [ ! -d /var/www/\$${app_name_upper}_DOMAIN_NAME ]; then"
|
||||
echo " mkdir /var/www/\$${app_name_upper}_DOMAIN_NAME"
|
||||
echo " if [ ! -d \"/var/www/\$${app_name_upper}_DOMAIN_NAME\" ]; then"
|
||||
echo " mkdir \"/var/www/\$${app_name_upper}_DOMAIN_NAME\""
|
||||
echo ' fi'
|
||||
echo " if [ ! -d /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs ]; then"
|
||||
echo " if [ ! -d \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\" ]; then"
|
||||
echo " if [ -d /repos/${app_name} ]; then"
|
||||
echo " mkdir /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
|
||||
echo " mkdir \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\""
|
||||
if [ ! "$app_dir" ]; then
|
||||
echo " cp -r -p /repos/${app_name}/. /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
|
||||
echo " cd /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
|
||||
echo " cp -r -p /repos/${app_name}/. \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\""
|
||||
echo " cd \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\" || exit 324687356"
|
||||
else
|
||||
echo " cp -r -p /repos/${app_name}/. ${app_dir}"
|
||||
echo " cd ${app_dir}"
|
||||
echo " cp -r -p /repos/${app_name}/. \"${app_dir}\""
|
||||
echo " cd \"${app_dir}\" || exit 36487365"
|
||||
fi
|
||||
echo ' git pull'
|
||||
echo ' else'
|
||||
if [ ! "$app_dir" ]; then
|
||||
echo " git_clone \$${app_name_upper}_REPO /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
|
||||
echo " git_clone \$${app_name_upper}_REPO \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\""
|
||||
else
|
||||
echo " git_clone \$${app_name_upper}_REPO ${app_dir}"
|
||||
echo " git_clone \$${app_name_upper}_REPO \"${app_dir}\""
|
||||
fi
|
||||
echo ' fi'
|
||||
echo ''
|
||||
if [ ! "$app_dir" ]; then
|
||||
echo " if [ ! -d /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs ]; then"
|
||||
echo " if [ ! -d \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\" ]; then"
|
||||
else
|
||||
echo " if [ ! -d ${app_dir} ]; then"
|
||||
echo " if [ ! -d \"${app_dir}\" ]; then"
|
||||
fi
|
||||
echo " echo \$'Unable to clone ${app_name} repo'"
|
||||
echo ' exit 87525'
|
||||
|
@ -627,156 +626,156 @@ echo ' fi'
|
|||
echo ' fi'
|
||||
echo ''
|
||||
if [ ! "$app_dir" ]; then
|
||||
echo " cd /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
|
||||
echo " cd \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\" || exit 36587356"
|
||||
else
|
||||
echo " cd ${app_dir}"
|
||||
echo " cd \"${app_dir}\" || exit 3463754637"
|
||||
fi
|
||||
echo " git checkout \$${app_name_upper}_COMMIT -b \$${app_name_upper}_COMMIT"
|
||||
echo " set_completion_param \"${app_name} commit\" \"\$${app_name_upper}_COMMIT\""
|
||||
echo ''
|
||||
echo " chmod g+w /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
|
||||
echo " chown -R www-data:www-data /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
|
||||
echo " chmod g+w \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\""
|
||||
echo " chown -R www-data:www-data \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\""
|
||||
|
||||
if [[ "$database_type" == "mariadb" || "$database_type" == "mysql" || "$database_type" == "postgres"* ]]; then
|
||||
echo ''
|
||||
echo " ${app_name}_create_database"
|
||||
fi
|
||||
echo ''
|
||||
echo " add_ddns_domain \$${app_name_upper}_DOMAIN_NAME"
|
||||
echo " add_ddns_domain \"\$${app_name_upper}_DOMAIN_NAME\""
|
||||
echo ''
|
||||
echo " ${app_name_upper}_ONION_HOSTNAME=\$(add_onion_service ${app_name} 80 \${${app_name_upper}_ONION_PORT})"
|
||||
echo ''
|
||||
echo " ${app_name}_nginx_site=/etc/nginx/sites-available/\$${app_name_upper}_DOMAIN_NAME"
|
||||
|
||||
if [ $app_onion_only ]; then
|
||||
if [ ! $app_onion_only ]; then
|
||||
echo " if [[ \"\$ONION_ONLY\" == \"no\" ]]; then"
|
||||
if [[ "$app_php" == 'yes' ]]; then
|
||||
echo " nginx_http_redirect \$${app_name_upper}_DOMAIN_NAME \"index index.php\""
|
||||
echo " nginx_http_redirect \"\$${app_name_upper}_DOMAIN_NAME\" \"index index.php\""
|
||||
else
|
||||
echo " nginx_http_redirect \$${app_name_upper}_DOMAIN_NAME \"index index.html\""
|
||||
echo " nginx_http_redirect \"\$${app_name_upper}_DOMAIN_NAME\" \"index index.html\""
|
||||
fi
|
||||
echo " echo 'server {' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' listen 443 ssl;' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' #listen [::]:443 ssl;' >> \$${app_name}_nginx_site"
|
||||
echo " echo \" server_name \$${app_name_upper}_DOMAIN_NAME;\" >> \$${app_name}_nginx_site"
|
||||
echo " echo '' >> \$${app_name}_nginx_site"
|
||||
echo " nginx_compress \$${app_name_upper}_DOMAIN_NAME"
|
||||
echo " echo '' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' # Security' >> \$${app_name}_nginx_site"
|
||||
echo " nginx_ssl \$${app_name_upper}_DOMAIN_NAME"
|
||||
echo " { echo 'server {';"
|
||||
echo " echo ' listen 443 ssl;';"
|
||||
echo " echo ' #listen [::]:443 ssl;';"
|
||||
echo " echo \" server_name \$${app_name_upper}_DOMAIN_NAME;\";"
|
||||
echo " echo ''; } >> \"\$${app_name}_nginx_site\""
|
||||
echo " nginx_compress \"\$${app_name_upper}_DOMAIN_NAME\""
|
||||
echo " echo '' >> \"\$${app_name}_nginx_site\""
|
||||
echo " echo ' # Security' >> \"\$${app_name}_nginx_site\""
|
||||
echo " nginx_ssl \"\$${app_name_upper}_DOMAIN_NAME\""
|
||||
echo ''
|
||||
echo " nginx_security_options \$${app_name_upper}_DOMAIN_NAME"
|
||||
echo " nginx_security_options \"\$${app_name_upper}_DOMAIN_NAME\""
|
||||
echo ''
|
||||
echo " echo ' add_header Strict-Transport-Security max-age=15768000;' >> \$${app_name}_nginx_site"
|
||||
echo " echo '' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' # Logs' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' access_log /dev/null;' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' error_log /dev/null;' >> \$${app_name}_nginx_site"
|
||||
echo " echo '' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' # Root' >> \$${app_name}_nginx_site"
|
||||
echo " echo \" root /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs;\" >> \$${app_name}_nginx_site"
|
||||
echo " echo '' >> \$${app_name}_nginx_site"
|
||||
echo " { echo ' add_header Strict-Transport-Security max-age=15768000;';"
|
||||
echo " echo '';"
|
||||
echo " echo ' # Logs';"
|
||||
echo " echo ' access_log /dev/null;';"
|
||||
echo " echo ' error_log /dev/null;';"
|
||||
echo " echo '';"
|
||||
echo " echo ' # Root';"
|
||||
echo " echo \" root /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs;\";"
|
||||
echo " echo '';"
|
||||
if [[ "$app_php" == 'yes' ]]; then
|
||||
echo " echo ' index index.php;' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' location ~ \\.php {' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' include snippets/fastcgi-php.conf;' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' fastcgi_read_timeout 30;' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' }' >> \$${app_name}_nginx_site"
|
||||
echo " echo '' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' index index.php;';"
|
||||
echo " echo ' location ~ \\.php {';"
|
||||
echo " echo ' include snippets/fastcgi-php.conf;';"
|
||||
echo " echo ' fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';"
|
||||
echo " echo ' fastcgi_read_timeout 30;';"
|
||||
echo " echo ' }';"
|
||||
echo " echo '';"
|
||||
else
|
||||
echo " echo ' index index.html;' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' index index.html;';"
|
||||
fi
|
||||
echo " echo ' # Location' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' location / {' >> \$${app_name}_nginx_site"
|
||||
echo " nginx_limits \$${app_name_upper}_DOMAIN_NAME '15m'"
|
||||
echo " echo ' # Location';"
|
||||
echo " echo ' location / {'; } >> \"\$${app_name}_nginx_site\""
|
||||
echo " nginx_limits \"\$${app_name_upper}_DOMAIN_NAME\" '15m'"
|
||||
if [ ! $app_daemon ]; then
|
||||
echo " echo ' try_files \$uri \$uri/ /index.html;' >> \$${app_name}_nginx_site"
|
||||
echo " { echo \" try_files \\\$uri \\\$uri/ /index.html;\";"
|
||||
else
|
||||
echo " echo \" proxy_pass http://localhost:\$${app_name_upper}_PORT_INTERNAL;\" >> \$${app_name}_nginx_site"
|
||||
echo " { echo \" proxy_pass http://localhost:\$${app_name_upper}_PORT_INTERNAL;\";"
|
||||
fi
|
||||
echo " echo ' }' >> \$${app_name}_nginx_site"
|
||||
echo " echo '}' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' }';"
|
||||
echo " echo '}'; } >> \"\$${app_name}_nginx_site\""
|
||||
echo ' else'
|
||||
echo " echo -n '' > \$${app_name}_nginx_site"
|
||||
echo " echo -n '' > \"\$${app_name}_nginx_site\""
|
||||
echo ' fi'
|
||||
else
|
||||
echo " echo -n '' > \$${app_name}_nginx_site"
|
||||
echo " echo -n '' > \"\$${app_name}_nginx_site\""
|
||||
fi
|
||||
echo " echo 'server {' >> \$${app_name}_nginx_site"
|
||||
echo " echo \" listen 127.0.0.1:\$${app_name_upper}_ONION_PORT default_server;\" >> \$${app_name}_nginx_site"
|
||||
echo " echo \" server_name \$${app_name_upper}_ONION_HOSTNAME;\" >> \$${app_name}_nginx_site"
|
||||
echo " echo '' >> \$${app_name}_nginx_site"
|
||||
echo " nginx_compress \$${app_name_upper}_DOMAIN_NAME"
|
||||
echo " echo '' >> \$${app_name}_nginx_site"
|
||||
echo " nginx_security_options \$${app_name_upper}_DOMAIN_NAME"
|
||||
echo " echo '' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' # Logs' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' access_log /dev/null;' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' error_log /dev/null;' >> \$${app_name}_nginx_site"
|
||||
echo " echo '' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' # Root' >> \$${app_name}_nginx_site"
|
||||
echo " echo \" root /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs;\" >> \$${app_name}_nginx_site"
|
||||
echo " echo '' >> \$${app_name}_nginx_site"
|
||||
echo " { echo 'server {';"
|
||||
echo " echo \" listen 127.0.0.1:\$${app_name_upper}_ONION_PORT default_server;\";"
|
||||
echo " echo \" server_name \$${app_name_upper}_ONION_HOSTNAME;\";"
|
||||
echo " echo ''; } >> \"\$${app_name}_nginx_site\""
|
||||
echo " nginx_compress \"\$${app_name_upper}_DOMAIN_NAME\""
|
||||
echo " echo '' >> \"\$${app_name}_nginx_site\""
|
||||
echo " nginx_security_options \"\$${app_name_upper}_DOMAIN_NAME\""
|
||||
echo " { echo '';"
|
||||
echo " echo ' # Logs';"
|
||||
echo " echo ' access_log /dev/null;';"
|
||||
echo " echo ' error_log /dev/null;';"
|
||||
echo " echo '';"
|
||||
echo " echo ' # Root';"
|
||||
echo " echo \" root /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs;\";"
|
||||
echo " echo '';"
|
||||
if [[ "$app_php" == 'yes' ]]; then
|
||||
echo " echo ' index index.php;' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' location ~ \\.php {' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' include snippets/fastcgi-php.conf;' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' fastcgi_read_timeout 30;' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' }' >> \$${app_name}_nginx_site"
|
||||
echo " echo '' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' index index.php;';"
|
||||
echo " echo ' location ~ \\.php {';"
|
||||
echo " echo ' include snippets/fastcgi-php.conf;';"
|
||||
echo " echo ' fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';"
|
||||
echo " echo ' fastcgi_read_timeout 30;';"
|
||||
echo " echo ' }';"
|
||||
echo " echo '';"
|
||||
else
|
||||
echo " echo ' index index.html;' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' index index.html;';"
|
||||
fi
|
||||
echo " echo ' # Location' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' location / {' >> \$${app_name}_nginx_site"
|
||||
echo " nginx_limits \$${app_name_upper}_DOMAIN_NAME '15m'"
|
||||
echo " echo ' # Location';"
|
||||
echo " echo ' location / {'; } >> \"\$${app_name}_nginx_site\""
|
||||
echo " nginx_limits \"\$${app_name_upper}_DOMAIN_NAME\" '15m'"
|
||||
if [ ! $app_daemon ]; then
|
||||
echo " echo ' try_files \$uri \$uri/ index.html;' >> \$${app_name}_nginx_site"
|
||||
echo " { echo \" try_files \\\$uri \\\$uri/ index.html;\";"
|
||||
else
|
||||
echo " echo \" proxy_pass http://localhost:\$${app_name_upper}_PORT_INTERNAL;\" >> \$${app_name}_nginx_site"
|
||||
echo " echo \" proxy_pass http://localhost:\$${app_name_upper}_PORT_INTERNAL;\";"
|
||||
fi
|
||||
echo " echo ' }' >> \$${app_name}_nginx_site"
|
||||
echo " echo '}' >> \$${app_name}_nginx_site"
|
||||
echo " echo ' }';"
|
||||
echo " echo '}'; } >> \"\$${app_name}_nginx_site\""
|
||||
if [[ "$app_php" == 'yes' ]]; then
|
||||
echo ''
|
||||
echo ' configure_php'
|
||||
fi
|
||||
if [ $app_daemon ]; then
|
||||
echo ''
|
||||
echo " useradd -d TODO_PATH_TO_INSTALL -s /bin/false ${app_name}"
|
||||
echo " useradd -d \"TODO_PATH_TO_INSTALL\" -s /bin/false ${app_name}"
|
||||
echo ''
|
||||
echo " echo '[Unit]' > /etc/systemd/system/${app_name}.service"
|
||||
echo " echo 'Description=${app_name}' >> /etc/systemd/system/${app_name}.service"
|
||||
echo " echo 'After=syslog.target' >> /etc/systemd/system/${app_name}.service"
|
||||
echo " echo 'After=network.target' >> /etc/systemd/system/${app_name}.service"
|
||||
echo " echo '' >> /etc/systemd/system/${app_name}.service"
|
||||
echo " echo '[Service]' >> /etc/systemd/system/${app_name}.service"
|
||||
echo " echo 'Type=simple' >> /etc/systemd/system/${app_name}.service"
|
||||
echo " echo 'User=${app_name}' >> /etc/systemd/system/${app_name}.service"
|
||||
echo " echo 'Group=${app_name}' >> /etc/systemd/system/${app_name}.service"
|
||||
echo " { echo '[Unit]';"
|
||||
echo " echo 'Description=${app_name}';"
|
||||
echo " echo 'After=syslog.target';"
|
||||
echo " echo 'After=network.target';"
|
||||
echo " echo '';"
|
||||
echo " echo '[Service]';"
|
||||
echo " echo 'Type=simple';"
|
||||
echo " echo 'User=${app_name}';"
|
||||
echo " echo 'Group=${app_name}'; } > \"/etc/systemd/system/${app_name}.service\""
|
||||
if [ ! "$app_dir" ]; then
|
||||
echo " echo 'WorkingDirectory=TODO' >> /etc/systemd/system/${app_name}.service"
|
||||
echo " echo 'WorkingDirectory=TODO' >> \"/etc/systemd/system/${app_name}.service\""
|
||||
else
|
||||
echo " echo 'WorkingDirectory=${app_dir}' >> /etc/systemd/system/${app_name}.service"
|
||||
echo " echo 'WorkingDirectory=${app_dir}' >> \"/etc/systemd/system/${app_name}.service\""
|
||||
fi
|
||||
echo " echo 'ExecStart=TODO' >> /etc/systemd/system/${app_name}.service"
|
||||
echo " echo 'Restart=always' >> /etc/systemd/system/${app_name}.service"
|
||||
echo " echo 'Environment=\"USER=${app_name}\"' >> /etc/systemd/system/${app_name}.service"
|
||||
echo " echo '' >> /etc/systemd/system/${app_name}.service"
|
||||
echo " echo '[Install]' >> /etc/systemd/system/${app_name}.service"
|
||||
echo " echo 'WantedBy=multi-user.target' >> /etc/systemd/system/${app_name}.service"
|
||||
echo " { echo 'ExecStart=TODO';"
|
||||
echo " echo 'Restart=always';"
|
||||
echo " echo 'Environment=\"USER=${app_name}\"';"
|
||||
echo " echo '';"
|
||||
echo " echo '[Install]';"
|
||||
echo " echo 'WantedBy=multi-user.target'; } >> \"/etc/systemd/system/${app_name}.service\""
|
||||
echo " systemctl enable ${app_name}"
|
||||
if [ "$app_dir" ]; then
|
||||
echo " chown -R ${app_name}:${app_name} ${app_dir}"
|
||||
echo " chown -R ${app_name}:${app_name} \"${app_dir}\""
|
||||
fi
|
||||
echo " systemctl start ${app_name}"
|
||||
fi
|
||||
echo ''
|
||||
echo " create_site_certificate \$${app_name_upper}_DOMAIN_NAME 'yes'"
|
||||
echo " create_site_certificate \"\$${app_name_upper}_DOMAIN_NAME\" 'yes'"
|
||||
echo ''
|
||||
echo " nginx_ensite \$${app_name_upper}_DOMAIN_NAME"
|
||||
echo " nginx_ensite \"\$${app_name_upper}_DOMAIN_NAME\""
|
||||
echo ''
|
||||
if [[ "$database_type" == "mariadb" || "$database_type" == "mysql" ]]; then
|
||||
echo ' systemctl restart mariadb'
|
||||
|
@ -786,7 +785,7 @@ if [[ "$app_php" == 'yes' ]]; then
|
|||
fi
|
||||
echo ' systemctl restart nginx'
|
||||
echo ''
|
||||
echo " \${PROJECT_NAME}-pass -u \$MY_USERNAME -a ${app_name} -p \"\$${app_name_upper}_ADMIN_PASSWORD\""
|
||||
echo " \"\${PROJECT_NAME}-pass\" -u \"\$MY_USERNAME\" -a ${app_name} -p \"\$${app_name_upper}_ADMIN_PASSWORD\""
|
||||
echo " set_completion_param \"${app_name} domain\" \"\$${app_name_upper}_DOMAIN_NAME\""
|
||||
if [ "$app_port" ]; then
|
||||
echo ''
|
||||
|
|
Loading…
Reference in New Issue