Sven Ullmann
2 years ago
16 changed files with 261 additions and 103 deletions
-
20bin/commands/create-project
-
4bin/commands/install-project-manager
-
16bin/commands/list-projects
-
8bin/commands/remove-project
-
1bin/includes/includes
-
2bin/project-manager
-
24etc/.config_template
-
4etc/.project_manager_config_template
-
115plugins/db/commands/create-config
-
64plugins/db/etc/.config_template
-
17plugins/db/etc/.my.cnf_template
-
20plugins/db/includes/includes
-
11plugins/git/commands/clone
-
10plugins/git/etc/.config_template
-
32plugins/shopware/etc/.config_template
-
16plugins/ssh/etc/.config_template
@ -1,5 +1,5 @@ |
|||
#!/bin/bash |
|||
|
|||
workspaces_dir="" |
|||
project_manager_dir="" |
|||
workspaces_dir='' |
|||
project_manager_dir='' |
|||
|
@ -0,0 +1,115 @@ |
|||
#!/bin/bash |
|||
|
|||
function usage { |
|||
echo |
|||
echoMainTitle "Create configuration files" |
|||
echo |
|||
echoSubTitle "Usage:" |
|||
echo |
|||
echo "project-manager db:create-config [project-shortname]" |
|||
echo |
|||
echo "--help Prints this message" |
|||
echo |
|||
} |
|||
|
|||
help="$(getParameter "--help" false "$*")" |
|||
if [ "$help" == true ] || [ "$1" == "" ] |
|||
then |
|||
usage |
|||
exit |
|||
fi |
|||
|
|||
source "$project_manager_dir/bin/includes/project_header" |
|||
dbValidate |
|||
|
|||
echo |
|||
echoMainTitle "Creating db configuration" |
|||
echo |
|||
echoSubTitle "Please verify data" |
|||
echo |
|||
echo "Stage Socket: $db_stage_socket" |
|||
echo "Stage Host: $db_stage_host" |
|||
echo "Stage Port: $db_stage_port" |
|||
echo "Stage Database: $db_stage_database" |
|||
echo "Stage Admin User: $db_stage_admin_user" |
|||
echo |
|||
echo "Live Socket: $db_live_socket" |
|||
echo "Live Host: $db_live_host" |
|||
echo "Live Port: $db_live_port" |
|||
echo "Live Database: $db_live_database" |
|||
echo "Live Admin User: $db_live_admin_user" |
|||
echo |
|||
echo "Local Stage Socket: $db_local_stage_socket" |
|||
echo "Local Stage Host: $db_local_stage_host" |
|||
echo "Local Stage Port: $db_local_stage_port" |
|||
echo "Local Stage Database: $db_local_stage_database" |
|||
echo "Local Stage Admin User: $db_local_stage_admin_user" |
|||
echo |
|||
echo "Local Live Socket: $db_local_live_socket" |
|||
echo "Local Live Host: $db_local_live_host" |
|||
echo "Local Live Port: $db_local_live_port" |
|||
echo "Local Live Database: $db_local_live_database" |
|||
echo "Local Live Admin User: $db_local_live_admin_user" |
|||
echo |
|||
confirm |
|||
|
|||
|
|||
template_file="$project_manager_dir/plugins/db/etc/.my.cnf_template" |
|||
path="$project_manager_dir/data/$customer/$project" |
|||
|
|||
quoted_socket="$(sedEscape "$db_stage_socket")" |
|||
quoted_password="$(sedEscape "$db_stage_password")" |
|||
quoted_admin_password="$(sedEscape "$db_stage_admin_password")" |
|||
cat "$template_file" | \ |
|||
sed "s/socket=/socket=$quoted_socket/" | \ |
|||
sed "s/host=/host=$db_stage_host/" | \ |
|||
sed "s/port=/port=$db_stage_port/" | \ |
|||
sed "s/database=/database=$db_stage_database/" | \ |
|||
sed "s/\[client\]/\[client\]\nuser=$db_stage_user\npassword=$quoted_password/" | \ |
|||
sed "s/\[clientadmin\]/\[clientadmin\]\nuser=$db_stage_admin_user\npassword=$quoted_admin_password/" \ |
|||
> "$path/etc/stage.my.cnf" |
|||
|
|||
quoted_socket="$(sedEscape "$db_live_socket")" |
|||
quoted_password="$(sedEscape "$db_live_password")" |
|||
quoted_admin_password="$(sedEscape "$db_live_admin_password")" |
|||
cat "$template_file" | \ |
|||
sed "s/socket=/socket=$quoted_socket/" | \ |
|||
sed "s/host=/host=$db_live_host/" | \ |
|||
sed "s/port=/port=$db_live_port/" | \ |
|||
sed "s/database=/database=$db_live_database/" | \ |
|||
sed "s/\[client\]/\[client\]\nuser=$db_live_user\npassword=$quoted_password/" | \ |
|||
sed "s/\[clientadmin\]/\[clientadmin\]\nuser=$db_live_admin_user\npassword=$quoted_admin_password/" \ |
|||
> "$path/etc/live.my.cnf" |
|||
|
|||
quoted_socket="$(sedEscape "$db_local_stage_socket")" |
|||
quoted_password="$(sedEscape "$db_local_stage_password")" |
|||
quoted_admin_password="$(sedEscape "$db_local_stage_admin_password")" |
|||
cat "$template_file" | \ |
|||
sed "s/socket=/socket=$quoted_socket/" | \ |
|||
sed "s/host=/host=$db_local_stage_host/" | \ |
|||
sed "s/port=/port=$db_local_stage_port/" | \ |
|||
sed "s/database=/database=$db_local_stage_database/" | \ |
|||
sed "s/\[client\]/\[client\]\nuser=$db_local_stage_user\npassword=$quoted_password/" | \ |
|||
sed "s/\[clientadmin\]/\[clientadmin\]\nuser=$db_local_stage_admin_user\npassword=$quoted_admin_password/" \ |
|||
> "$path/etc/local_stage.my.cnf" |
|||
|
|||
quoted_socket="$(sedEscape "$db_local_live_socket")" |
|||
quoted_password="$(sedEscape "$db_local_live_password")" |
|||
quoted_admin_password="$(sedEscape "$db_local_live_admin_password")" |
|||
cat "$template_file" | \ |
|||
sed "s/socket=/socket=$quoted_socket/" | \ |
|||
sed "s/host=/host=$db_local_live_host/" | \ |
|||
sed "s/port=/port=$db_local_live_port/" | \ |
|||
sed "s/database=/database=$db_local_live_database/" | \ |
|||
sed "s/\[client\]/\[client\]\nuser=$db_local_live_user\npassword=$quoted_password/" | \ |
|||
sed "s/\[clientadmin\]/\[clientadmin\]\nuser=$db_local_live_admin_user\npassword=$quoted_admin_password/" \ |
|||
> "$path/etc/local_live.my.cnf" |
|||
|
|||
echo |
|||
echoSubTitle "Running postscripts ..." |
|||
postScript "$path/bin/postscripts/plugins/db/commands/create-config" |
|||
postScript "$workspaces_dir/$customer/$project/bin/postscripts/plugins/db/commands/create-config" |
|||
|
|||
echo |
|||
echoSuccess "Database configuration files created" |
|||
echo |
@ -0,0 +1,17 @@ |
|||
[mysqldump] |
|||
max_allowed_packet=500M |
|||
socket= |
|||
host= |
|||
port= |
|||
database= |
|||
|
|||
[mysql] |
|||
max_allowed_packet=500M |
|||
socket= |
|||
host= |
|||
port= |
|||
database= |
|||
|
|||
[client] |
|||
|
|||
[clientadmin] |
@ -0,0 +1,20 @@ |
|||
#!/bin/bash |
|||
|
|||
db_included=true |
|||
|
|||
function dbValidate { |
|||
if ([ "$db_local_stage_user" == "" ] && [ "$db_local_live_user" == "" ]) |
|||
then |
|||
echo >&2 |
|||
echoError "Please configure $project_manager_dir/data/$customer/$project/etc/plugins/db/config" >&2 |
|||
echo >&2 |
|||
exit |
|||
fi |
|||
} |
|||
|
|||
function dbGetConfig { |
|||
local env=$(getArgument "$1" "Usage getEnvVar [live|stage|local_live|local_stage] var" "live stage local_live local_stage") |
|||
local suffix=$(getArgument "$2" "Usage getEnvVar [live|stage|local_live|local_stage] var" true) |
|||
|
|||
echo "$(eval "echo \"\$db_${env}_$suffix\"")" |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue