Template support for mongodb
This commit is contained in:
parent
e34bca9eac
commit
6d7cd198bb
|
@ -55,22 +55,22 @@ function show_help {
|
||||||
echo $'Creates a new app script which can then be filled in'
|
echo $'Creates a new app script which can then be filled in'
|
||||||
echo ''
|
echo ''
|
||||||
echo ''
|
echo ''
|
||||||
echo $' -h --help Show help'
|
echo $' -h --help Show help'
|
||||||
echo $' -a --app [name] Name of the application'
|
echo $' -a --app [name] Name of the application'
|
||||||
echo $' -n --name [name] Your name'
|
echo $' -n --name [name] Your name'
|
||||||
echo $' -e --email [address] Your email address'
|
echo $' -e --email [address] Your email address'
|
||||||
echo $' -r --repo [url] Git repo url for the app'
|
echo $' -r --repo [url] Git repo url for the app'
|
||||||
echo $' -c --commit [hash] Git commit'
|
echo $' -c --commit [hash] Git commit'
|
||||||
echo $' --port [number] Port number for the app'
|
echo $' --port [number] Port number for the app'
|
||||||
echo $' --portinternal [number] Internal port between a daemon and the web server'
|
echo $' --portinternal [number] Internal port between a daemon and the web server'
|
||||||
echo $' --node [yes|no] Is this a nodejs app?'
|
echo $' --node [yes|no] Is this a nodejs app?'
|
||||||
echo $' --nodeapp [package] Specify a nodejs package to install'
|
echo $' --nodeapp [package] Specify a nodejs package to install'
|
||||||
echo $' -o --onion [yes|no] Is this app only available on an onion address?'
|
echo $' -o --onion [yes|no] Is this app only available on an onion address?'
|
||||||
echo $' -p --php [yes|no] Is this a PHP app?'
|
echo $' -p --php [yes|no] Is this a PHP app?'
|
||||||
echo $' -s --daemon [yes|no] Add a daemon'
|
echo $' -s --daemon [yes|no] Add a daemon'
|
||||||
echo $' -d --database [mariadb|postgresql] Type of database'
|
echo $' -d --database [mariadb|postgresql|mongodb] Type of database'
|
||||||
echo $' -w --web [yes|no] Whether there is a web user interface (default is yes)'
|
echo $' -w --web [yes|no] Whether there is a web user interface (default is yes)'
|
||||||
echo $' --dir [directory] Where to install to'
|
echo $' --dir [directory] Where to install to'
|
||||||
echo ''
|
echo ''
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
@ -322,7 +322,7 @@ 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 '}'
|
echo '}'
|
||||||
|
|
||||||
if [[ "$database_type" == "mariadb" || "$database_type" == "mysql" || "$database_type" == "postgres"* ]]; then
|
if [[ "$database_type" == "mariadb" || "$database_type" == "mysql" || "$database_type" == "postgres"* || "$database_type" == "mongo"* ]]; then
|
||||||
echo ''
|
echo ''
|
||||||
echo "function ${app_name}_create_database {"
|
echo "function ${app_name}_create_database {"
|
||||||
echo " if [ -f \$IMAGE_PASSWORD_FILE ]; then"
|
echo " if [ -f \$IMAGE_PASSWORD_FILE ]; then"
|
||||||
|
@ -336,9 +336,13 @@ if [[ "$database_type" == "mariadb" || "$database_type" == "mysql" || "$database
|
||||||
echo ' return'
|
echo ' return'
|
||||||
echo ' fi'
|
echo ' fi'
|
||||||
echo ''
|
echo ''
|
||||||
if [[ "$database_type" != "postgres"* ]]; then
|
if [[ "$database_type" = "mysql" || "$database_type" = "mariadb" ]]; then
|
||||||
echo " create_database ${app_name} \"\$${app_name_upper}_ADMIN_PASSWORD\" \$MY_USERNAME"
|
echo " create_database ${app_name} \"\$${app_name_upper}_ADMIN_PASSWORD\" \$MY_USERNAME"
|
||||||
else
|
fi
|
||||||
|
if [[ "$database_type" = "mongo"* ]]; then
|
||||||
|
echo " create_database_mongodb ${app_name} \"\$${app_name_upper}_ADMIN_PASSWORD\" \$MY_USERNAME"
|
||||||
|
fi
|
||||||
|
if [[ "$database_type" == "postgres"* ]]; then
|
||||||
echo ' systemctl restart postgresql'
|
echo ' systemctl restart postgresql'
|
||||||
echo " run_system_query_postgresql \"CREATE USER peertube WITH PASSWORD '\$${app_name_upper}_ADMIN_PASSWORD';\""
|
echo " run_system_query_postgresql \"CREATE USER peertube WITH PASSWORD '\$${app_name_upper}_ADMIN_PASSWORD';\""
|
||||||
echo " run_system_query_postgresql \"CREATE DATABASE ${app_name} OWNER ${app_name};\""
|
echo " run_system_query_postgresql \"CREATE DATABASE ${app_name} OWNER ${app_name};\""
|
||||||
|
@ -430,6 +434,11 @@ if [[ "$database_type" == "postgres"* ]]; then
|
||||||
echo " backup_database_to_usb ${app_name}"
|
echo " backup_database_to_usb ${app_name}"
|
||||||
echo ''
|
echo ''
|
||||||
fi
|
fi
|
||||||
|
if [[ "$database_type" == "mongo"* ]]; then
|
||||||
|
echo ' USE_MONGODB=1'
|
||||||
|
echo " backup_database_to_usb ${app_name}"
|
||||||
|
echo ''
|
||||||
|
fi
|
||||||
if [ $app_webui ]; then
|
if [ $app_webui ]; then
|
||||||
echo ' restart_site'
|
echo ' restart_site'
|
||||||
fi
|
fi
|
||||||
|
@ -481,6 +490,16 @@ if [[ "$database_type" == "postgres"* ]]; then
|
||||||
echo ' fi'
|
echo ' fi'
|
||||||
echo ''
|
echo ''
|
||||||
fi
|
fi
|
||||||
|
if [[ "$database_type" == "mongo"* ]]; then
|
||||||
|
echo " ${app_name}_create_database"
|
||||||
|
echo ''
|
||||||
|
echo ' USE_MONGODB=1'
|
||||||
|
echo " restore_database ${app_name}"
|
||||||
|
echo " if [ -d \$temp_restore_dir ]; then"
|
||||||
|
echo " rm -rf \$temp_restore_dir"
|
||||||
|
echo ' fi'
|
||||||
|
echo ''
|
||||||
|
fi
|
||||||
echo " restore_directory_from_usb \$temp_restore_dir ${app_name}"
|
echo " restore_directory_from_usb \$temp_restore_dir ${app_name}"
|
||||||
echo " if [ -d \$temp_restore_dir ]; then"
|
echo " if [ -d \$temp_restore_dir ]; then"
|
||||||
echo " if [ -d \"\$temp_restore_dir\$${app_name}_dir\" ]; then"
|
echo " if [ -d \"\$temp_restore_dir\$${app_name}_dir\" ]; then"
|
||||||
|
@ -539,6 +558,11 @@ if [[ "$database_type" == "postgres"* ]]; then
|
||||||
echo " backup_database_to_friend ${app_name}"
|
echo " backup_database_to_friend ${app_name}"
|
||||||
echo ''
|
echo ''
|
||||||
fi
|
fi
|
||||||
|
if [[ "$database_type" == "mongo"* ]]; then
|
||||||
|
echo ' USE_MONGODB=1'
|
||||||
|
echo " backup_database_to_friend ${app_name}"
|
||||||
|
echo ''
|
||||||
|
fi
|
||||||
if [ $app_daemon ]; then
|
if [ $app_daemon ]; then
|
||||||
echo ''
|
echo ''
|
||||||
echo " systemctl start ${app_name}"
|
echo " systemctl start ${app_name}"
|
||||||
|
@ -592,6 +616,16 @@ if [[ "$database_type" == "postgres"* ]]; then
|
||||||
echo ' fi'
|
echo ' fi'
|
||||||
echo ''
|
echo ''
|
||||||
fi
|
fi
|
||||||
|
if [[ "$database_type" == "mongo"* ]]; then
|
||||||
|
echo " ${app_name}_create_database"
|
||||||
|
echo ''
|
||||||
|
echo ' USE_MONGODB=1'
|
||||||
|
echo " restore_database_from_friend ${app_name}"
|
||||||
|
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 " restore_directory_from_friend \$temp_restore_dir ${app_name}"
|
||||||
echo " if [ -d \$temp_restore_dir ]; then"
|
echo " if [ -d \$temp_restore_dir ]; then"
|
||||||
echo " if [ -d \"\$temp_restore_dir\$${app_name}_dir\" ]; then"
|
echo " if [ -d \"\$temp_restore_dir\$${app_name}_dir\" ]; then"
|
||||||
|
@ -655,6 +689,9 @@ fi
|
||||||
if [[ "$database_type" == "postgres"* ]]; then
|
if [[ "$database_type" == "postgres"* ]]; then
|
||||||
echo " drop_database_postgresql ${app_name}"
|
echo " drop_database_postgresql ${app_name}"
|
||||||
fi
|
fi
|
||||||
|
if [[ "$database_type" == "mongo"* ]]; then
|
||||||
|
echo " drop_database_mongodb ${app_name}"
|
||||||
|
fi
|
||||||
echo " remove_onion_service ${app_name} \"\${${app_name_upper}_ONION_PORT}\""
|
echo " remove_onion_service ${app_name} \"\${${app_name_upper}_ONION_PORT}\""
|
||||||
echo " if grep -q \"${app_name}\" /etc/crontab; then"
|
echo " if grep -q \"${app_name}\" /etc/crontab; then"
|
||||||
echo " sed -i \"/${app_name}/d\" /etc/crontab"
|
echo " sed -i \"/${app_name}/d\" /etc/crontab"
|
||||||
|
@ -683,6 +720,10 @@ if [[ "$database_type" == "postgres"* ]]; then
|
||||||
echo ' install_postgresql'
|
echo ' install_postgresql'
|
||||||
echo ''
|
echo ''
|
||||||
fi
|
fi
|
||||||
|
if [[ "$database_type" == "mongo"* ]]; then
|
||||||
|
echo ' install_mongodb'
|
||||||
|
echo ''
|
||||||
|
fi
|
||||||
if [[ "$app_node" == 'yes' ]]; then
|
if [[ "$app_node" == 'yes' ]]; then
|
||||||
echo " install_nodejs ${app_name}"
|
echo " install_nodejs ${app_name}"
|
||||||
fi
|
fi
|
||||||
|
@ -748,7 +789,7 @@ if [ $app_webui ]; then
|
||||||
echo " chown -R www-data:www-data \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\""
|
echo " chown -R www-data:www-data \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$database_type" == "mariadb" || "$database_type" == "mysql" || "$database_type" == "postgres"* ]]; then
|
if [[ "$database_type" == "mariadb" || "$database_type" == "mysql" || "$database_type" == "postgres"* || "$database_type" == "mongo"* ]]; then
|
||||||
echo ''
|
echo ''
|
||||||
echo " ${app_name}_create_database"
|
echo " ${app_name}_create_database"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue