diff --git a/bin/commands/create-project b/bin/commands/create-project index 7492ec2..791313a 100644 --- a/bin/commands/create-project +++ b/bin/commands/create-project @@ -116,15 +116,7 @@ plugin_path="$project_manager_dir/plugins" plugins=$(ls -t "$plugin_path") for plugin in ${plugins[*]} do - etc_file="$plugin_path/$plugin/etc/.config_template" - if [ -f "$etc_file" ] && [ ! -f "$path/etc/plugins/$plugin/config" ] - then - if [ ! -d "$path/etc/plugins/$plugin" ] - then - mkdir "$path/etc/plugins/$plugin" - fi - cp "$etc_file" "$path/etc/plugins/$plugin/config" - fi + "$project_manager_dir/bin/commands/install-plugin" "$shortname" "$plugin" done if [ ! -d "$workspaces_dir/$customer/$project" ]; then mkdir -p "$workspaces_dir/$customer/$project"; fi diff --git a/bin/commands/install-plugin b/bin/commands/install-plugin new file mode 100644 index 0000000..85d7678 --- /dev/null +++ b/bin/commands/install-plugin @@ -0,0 +1,71 @@ +#!/bin/bash + +### DO NOT EDIT THIS FILE + +source "$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." &> /dev/null && pwd)/etc/config" +source "$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." &> /dev/null && pwd)/etc/projects" + +function usage { + echo + echoMainTitle "Installs a plugin" + echo + echoSubTitle "Usage:" + echo + echo "install-plugin [shortname] [plugin]" + echo + echo "--help Prints this message" + echo " " +} + +help="$(getParameter "--help" false "$*")" +if [ "$help" == true ] || [ "$1" == "" ] +then + usage + exit +fi + +shortname=$(getArgument "$1" "$(usage)" true) +plugin=$(getArgument "$2" "$(usage)" true) +customer=$(getCustomerFromShortname "$shortname") +project=$(getProjectFromShortname "$shortname") +project_dir="$project_manager_dir/data/$customer/$project" +plugin_dir="$project_manager_dir/plugins/$plugin" + +if [ ! -d "$project_dir" ] +then + echo + echoError "Could not find project dir" + echo + exit +fi + +if [ ! -d "$plugin_dir" ] +then + echo + echoError "Could not find plugin dir" + echo + exit +fi + +echo +echoMainTitle "Install plugin" + +if [ ! -d "$project_dir/etc/plugins/$plugin" ] +then + mkdir "$project_dir/etc/plugins/$plugin" +fi + +etc_files=$(list "$plugin/etc") +for etc_file in "${etc_files[@]}" +do + cp "$etc_file" "$project_dir/etc/plugins/$plugin/config" +done + +echo +echoSubTitle "Running postscripts ..." +postScript "$project_manager_dir/bin/postscripts/commands/install-plugin" +postScript "$project_dir/bin/postscripts/commands/install-plugin" + +echo +echoSuccess "Plugin has been installed, please configure: $project_dir/etc/plugins/$plugin" +echo \ No newline at end of file diff --git a/plugins/db/etc/.config_template b/plugins/db/etc/config similarity index 100% rename from plugins/db/etc/.config_template rename to plugins/db/etc/config diff --git a/plugins/db/etc/.my.cnf_template b/plugins/db/etc/live.my.cnf similarity index 76% rename from plugins/db/etc/.my.cnf_template rename to plugins/db/etc/live.my.cnf index a55291c..add3038 100644 --- a/plugins/db/etc/.my.cnf_template +++ b/plugins/db/etc/live.my.cnf @@ -14,5 +14,9 @@ host= port= [client] +user= +password= -[clientadmin] \ No newline at end of file +[clientadmin] +user= +password= \ No newline at end of file diff --git a/plugins/db/etc/stage.my.cnf b/plugins/db/etc/stage.my.cnf new file mode 100644 index 0000000..add3038 --- /dev/null +++ b/plugins/db/etc/stage.my.cnf @@ -0,0 +1,22 @@ + +### DO NOT EDIT THIS FILE + +[mysqldump] +max_allowed_packet=500M +socket= +host= +port= + +[mysql] +max_allowed_packet=500M +socket= +host= +port= + +[client] +user= +password= + +[clientadmin] +user= +password= \ No newline at end of file diff --git a/plugins/db/includes/includes b/plugins/db/includes/includes index bc2e7fd..8a48101 100644 --- a/plugins/db/includes/includes +++ b/plugins/db/includes/includes @@ -45,7 +45,7 @@ function dbDump { local ssh_domain="$(sshGetConfig "$env" "domain")" sshAddKey "$env" - scp "$app_dir/etc/$env.my.cnf" "$ssh_user"@"$ssh_domain":"~/$env.my.cnf" + scp "$app_dir/etc/plugins/db/$env.my.cnf" "$ssh_user"@"$ssh_domain":"~/$env.my.cnf" ssh "$ssh_user"@"$ssh_domain" "mysqldump --defaults-extra-file=~/$env.my.cnf --no-tablespaces ${parameters[*]} $database $tables | \ LANG=C LC_CTYPE=C LC_ALL=C sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' | \ sed -e 's/,NO_AUTO_CREATE_USER//' | gzip -9 > ~/${env}_$name.sql.gz" @@ -54,7 +54,7 @@ function dbDump { gunzip "$app_dir/var/tmp/$currentDate-${env}_$name.sql.gz" else - mysqldump --defaults-extra-file="$app_dir/etc/${env}.my.cnf" --no-tablespaces ${parameters[*]} $database $tables | \ + mysqldump --defaults-extra-file="$app_dir/plugins/db/etc/${env}.my.cnf" --no-tablespaces ${parameters[*]} $database $tables | \ LANG=C LC_CTYPE=C LC_ALL=C sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' | sed -e 's/,NO_AUTO_CREATE_USER//' \ > "$app_dir/var/tmp/${currentDate}-${env}_$name.sql" fi diff --git a/plugins/git/etc/.config_template b/plugins/git/etc/config similarity index 100% rename from plugins/git/etc/.config_template rename to plugins/git/etc/config diff --git a/plugins/plesk/etc/.config_template b/plugins/plesk/etc/config similarity index 100% rename from plugins/plesk/etc/.config_template rename to plugins/plesk/etc/config diff --git a/plugins/shopware5/etc/config b/plugins/shopware5/etc/config new file mode 100644 index 0000000..38fb994 --- /dev/null +++ b/plugins/shopware5/etc/config @@ -0,0 +1,70 @@ +#!/bin/bash + +### GENERAL + +shopware5_httpdocs_subpath='' + +shopware5_local_user='' +shopware5_local_email='' +shopware5_local_firstname='' +shopware5_local_lastname='' + +shopware5_install_name='' +shopware5_install_email='' +shopware5_install_locale='' +shopware5_install_currency='' +shopware5_install_storefront_name='' +shopware5_install_storefront_url='' + +### URL MAPPING + +shopware5_live_urls=() +shopware5_stage_urls=() +shopware5_local_urls=() + +### GDPR SHOPWARE 6 TABLES + +shopware5_gdpr_tables=( + s_user + s_user_addresses + s_user_addresses_attributes + s_user_attributes + s_user_billingaddress + s_user_billingaddress_attributes + s_user_shippingaddress + s_user_shippingaddress_attributes + s_customer_search_index + s_customer_streams + s_customer_streams_attributes + s_customer_streams_mapping + s_mail_log + s_mail_log_contact + s_mail_log_document + s_mail_log_recipient + s_order_attributes + s_order_basket + s_order_basket_attributes + s_order_billingaddress + s_order_billingaddress_attributes + s_order_comparisons + s_order_details + s_order_details_attributes + s_order_documents + s_order_documents_attributes + s_order_esd + s_order_history + s_order_notes + s_order_shippingaddress + s_order_shippingaddress_attributes +) + +### Media Files + +shopware5_shared_files=( + '/files' + '/media' +) + +### MAILER + +shopware5_local_mailer_url='' \ No newline at end of file diff --git a/plugins/shopware5/includes/includes b/plugins/shopware5/includes/includes new file mode 100644 index 0000000..570b34c --- /dev/null +++ b/plugins/shopware5/includes/includes @@ -0,0 +1,19 @@ +#!/bin/bash + +### DO NOT EDIT THIS FILE + +function shopware5BuildIgnoredTablesArguments { + local env=$(getArgument "$1" "Usage: buildIgnoredTables [live|stage|local] [ignoredTablesArray]" "live stage local") + local ignoredTables=$(getArgument "$2" "Usage: buildIgnoredTables [live|stage|local] [ignoredTablesArray]" true) + + local database_name=$(eval "echo \"\$${env}_database_name\"") + + ignoredTables=($ignoredTables) + local ignoredTablesArguments="" + for table in "${ignoredTables[@]}" + do + ignoredTablesArguments="$ignoredTablesArguments --ignore-table=\"${database_name}.${table}\"" + done + + echo "$ignoredTablesArguments" +} \ No newline at end of file diff --git a/plugins/shopware6/etc/.config_template b/plugins/shopware6/etc/config similarity index 100% rename from plugins/shopware6/etc/.config_template rename to plugins/shopware6/etc/config diff --git a/plugins/ssh/etc/.config_template b/plugins/ssh/etc/config similarity index 100% rename from plugins/ssh/etc/.config_template rename to plugins/ssh/etc/config