feat: add ability to specify custom flags on clone/create

Refs dokku/dokku-redis#64
This commit is contained in:
Jose Diaz-Gonzalez
2017-08-26 18:10:31 -04:00
parent 464354506b
commit afcfc0253c
4 changed files with 70 additions and 6 deletions

View File

@@ -15,6 +15,8 @@ service_create() {
[[ ! -d "$PLUGIN_DATA_ROOT/$SERVICE" ]] || dokku_log_fail "$PLUGIN_SERVICE service $SERVICE already exists"
SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"; LINKS_FILE="$SERVICE_ROOT/LINKS"
service_parse_args "${@:2}"
if ! docker images | grep -e "^$PLUGIN_IMAGE " | grep -q " $PLUGIN_IMAGE_VERSION " ; then
docker pull "$PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION" || dokku_log_fail "$PLUGIN_SERVICE image $PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION pull failed"
fi
@@ -25,12 +27,21 @@ service_create() {
touch "$LINKS_FILE"
echo -e "[mysqld]\nperformance_schema = 0" > "$SERVICE_ROOT/config/disable_performance_schema.cnf"
echo -e "[mysqld]\ncharacter-set-server = utf8\ncollation-server = utf8_general_ci" > "$SERVICE_ROOT/config/charset_utf8.cnf"
rootpassword=$(openssl rand -hex 8)
password=$(openssl rand -hex 8)
echo "$rootpassword" > "$SERVICE_ROOT/ROOTPASSWORD"
echo "$password" > "$SERVICE_ROOT/PASSWORD"
ROOTPASSWORD=$(openssl rand -hex 8)
PASSWORD=$(openssl rand -hex 8)
if [[ -n "$SERVICE_PASSWORD" ]]; then
PASSWORD="$SERVICE_PASSWORD"
dokku_log_warn "Specified password may not be as secure as the auto-generated password"
fi
if [[ -n "$SERVICE_ROOT_PASSWORD" ]]; then
ROOTPASSWORD="$SERVICE_ROOT_PASSWORD"
dokku_log_warn "Specified root password may not be as secure as the auto-generated root password"
fi
echo "$ROOTPASSWORD" > "$SERVICE_ROOT/ROOTPASSWORD"
echo "$PASSWORD" > "$SERVICE_ROOT/PASSWORD"
chmod 640 "$SERVICE_ROOT/ROOTPASSWORD" "$SERVICE_ROOT/PASSWORD"
[[ -n "$SERVICE_CUSTOM_ENV" ]] && MYSQL_CUSTOM_ENV="$SERVICE_CUSTOM_ENV"
if [[ -n $MYSQL_CUSTOM_ENV ]]; then
echo "$MYSQL_CUSTOM_ENV" | tr ';' "\n" > "$SERVICE_ROOT/ENV"
else