diff --git a/lib/apache b/lib/apache index f29c7ea2cb..02827d1f1b 100644 --- a/lib/apache +++ b/lib/apache @@ -27,6 +27,11 @@ set +o xtrace APACHE_USER=${APACHE_USER:-$STACK_USER} APACHE_GROUP=${APACHE_GROUP:-$(id -gn $APACHE_USER)} +APACHE_LOCAL_HOST=$SERVICE_LOCAL_HOST +if [[ "$SERVICE_IP_VERSION" == 6 ]]; then + APACHE_LOCAL_HOST=[$APACHE_LOCAL_HOST] +fi + # Set up apache name and configuration directory # Note that APACHE_CONF_DIR is really more accurately apache's vhost @@ -323,7 +328,7 @@ function write_local_uwsgi_http_config { rm -rf $file iniset "$file" uwsgi wsgi-file "$wsgi" port=$(get_random_port) - iniset "$file" uwsgi http-socket "127.0.0.1:$port" + iniset "$file" uwsgi http-socket "$APACHE_LOCAL_HOST:$port" iniset "$file" uwsgi processes $API_WORKERS # This is running standalone iniset "$file" uwsgi master true @@ -359,7 +364,7 @@ function write_local_uwsgi_http_config { apache_conf=$(apache_site_config_for $name) echo "KeepAlive Off" | sudo tee $apache_conf echo "SetEnv proxy-sendchunked 1" | sudo tee -a $apache_conf - echo "ProxyPass \"${url}\" \"http://127.0.0.1:$port\" retry=0 " | sudo tee -a $apache_conf + echo "ProxyPass \"${url}\" \"http://$APACHE_LOCAL_HOST:$port\" retry=0 " | sudo tee -a $apache_conf enable_apache_site $name restart_apache_server } diff --git a/lib/databases/mysql b/lib/databases/mysql index 30e4b7c496..0f45273d4b 100644 --- a/lib/databases/mysql +++ b/lib/databases/mysql @@ -86,10 +86,16 @@ function configure_database_mysql { exit_distro_not_supported "mysql configuration" fi - # Start mysql-server + # Change bind-address from localhost (127.0.0.1) to any (::) + iniset -sudo $my_conf mysqld bind-address "$(ipv6_unquote $SERVICE_LISTEN_ADDRESS)" + + # (Re)Start mysql-server if is_fedora || is_suse; then # service is not started by default start_service $MYSQL_SERVICE_NAME + elif is_ubuntu; then + # required since bind-address could have changed above + restart_service $MYSQL_SERVICE_NAME fi # Set the root password - only works the first time. For Ubuntu, we already @@ -102,7 +108,7 @@ function configure_database_mysql { if is_ubuntu && [ "$MYSQL_SERVICE_NAME" == "mariadb" ]; then local cmd_args="-uroot -p$DATABASE_PASSWORD " else - local cmd_args="-uroot -p$DATABASE_PASSWORD -h127.0.0.1 " + local cmd_args="-uroot -p$DATABASE_PASSWORD -h$SERVICE_LOCAL_HOST " fi # In mariadb e.g. on Ubuntu socket plugin is used for authentication @@ -119,9 +125,7 @@ function configure_database_mysql { # Now update ``my.cnf`` for some local needs and restart the mysql service - # Change bind-address from localhost (127.0.0.1) to any (::) and - # set default db type to InnoDB - iniset -sudo $my_conf mysqld bind-address "$(ipv6_unquote $SERVICE_LISTEN_ADDRESS)" + # Set default db type to InnoDB iniset -sudo $my_conf mysqld sql_mode TRADITIONAL iniset -sudo $my_conf mysqld default-storage-engine InnoDB iniset -sudo $my_conf mysqld max_connections 1024