Luigi Santivetti | b52d6d2 | 2020-05-18 00:56:27 +0100 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # holder.sh - mysql |
| 4 | # |
| 5 | # Copyright 2019 Luigi Santivetti <luigi.santivetti@gmail.com> |
| 6 | |
| 7 | # Permission is hereby granted, free of charge, to any person obtaining a |
| 8 | # copy of this software and associated documentation files (the "Software"), |
| 9 | # to deal in the Software without restriction, including without limitation |
| 10 | # the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 11 | # and/or sell copies of the Software, and to permit persons to whom the |
| 12 | # Software is furnished to do so, subject to the following conditions: |
| 13 | |
| 14 | # The above copyright notice and this permission notice (including the next |
| 15 | # paragraph) shall be included in all copies or substantial portions of the |
| 16 | # Software. |
| 17 | |
| 18 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 21 | # ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
| 22 | # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 23 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 24 | |
| 25 | # Placeholders must follow a special syntax in order to be considered valid. |
| 26 | # If they don't, then validation will fail and the process exits with error. |
| 27 | # These restrictions are described below, so that a holders.sh is considered |
| 28 | # valid as described below. |
| 29 | |
| 30 | _MYSQL_DKRC_SERVICE_="${module}" |
| 31 | _MYSQL_DKRC_VERSION_="5.7.26" |
| 32 | _MYSQL_DKRC_IMAGE_="${host_name}-img-${_MYSQL_DKRC_SERVICE_}" |
| 33 | _MYSQL_DKRC_CONTAINER_="${host_name}-con-${_MYSQL_DKRC_SERVICE_}" |
| 34 | _MYSQL_DKRC_BACKEND_IP_="172.27.0.2" |
| 35 | _MYSQL_DKRC_CONTEXT_="$mod_docker_d" |
| 36 | _MYSQL_DKRC_DOCKERFILE_="$dockerfile" |
| 37 | _MYSQL_DB_FIELD_USERNAME_="username" |
| 38 | _MYSQL_DB_FIELD_PASSWORD_="password" |
| 39 | _MYSQL_DB_FIELD_KEY_="key" |
| 40 | _MYSQL_DB_FIELD_EXPIRY_="expiry" |
| 41 | _MYSQL_DB_FIELD_VALUE_="value" |
| 42 | _MYSQL_DB_TABLE_SESSIONS_="sessions" |
| 43 | _MYSQL_DB_TABLE_USERS_="users" |
| 44 | _MYSQL_DB_NAME_="${host_name}_db" |
| 45 | _MYSQL_DB_PORT_="3306" |
| 46 | _MYSQL_INITDB_F_="$initdb_f" |
| 47 | _MYSQL_MYCONF_F_="$mycnf_f" |
| 48 | _MYSQL_MYSQL_D_="$mysql_d" |
| 49 | _MYSQL_LOG_D_="$log_d" |
| 50 | _MYSQL_BACKUP_PATH_="/var/lib/mysql" |
| 51 | if [ "${mod_mode}" = "${release}" ]; then |
| 52 | _MYSQL_GENERAL_LOG_="0" |
| 53 | _MYSQL_SLOW_QUERY_LOG_="0" |
| 54 | _MYSQL_LOG_OUTPUT_="NONE" |
| 55 | else |
| 56 | _MYSQL_GENERAL_LOG_="1" |
| 57 | _MYSQL_SLOW_QUERY_LOG_="1" |
| 58 | _MYSQL_LOG_OUTPUT_="FILE" |
| 59 | fi |
| 60 | _MYSQL_CON_LOG_D_="/var/log/mysql" |
| 61 | _MYSQL_CON_ERROR_LOG_F_="${_MYSQL_CON_LOG_D_}/$(basename "$log_error_f")" |
| 62 | _MYSQL_CON_GENERAL_LOG_F_="${_MYSQL_CON_LOG_D_}/$(basename "$log_general_f")" |
| 63 | _MYSQL_CON_SLOW_QUERY_LOG_F_="${_MYSQL_CON_LOG_D_}/$(basename "$log_query_f")" |
| 64 | if [ "$mysql_has_dummy_certs" -eq 1 ]; then |
| 65 | _MYSQL_ROOTFS_SSL_D_="$certificates_l" |
| 66 | _MYSQL_CON_SSL_D_="/etc/mysql_ssl" |
| 67 | |
| 68 | _MYSQL_SSL_SERVER_CERT_F_="${_MYSQL_CON_SSL_D_}/$(basename "$server_cert_f")" |
| 69 | _MYSQL_SSL_SERVER_KEY_F_="${_MYSQL_CON_SSL_D_}/$(basename "$server_key_f")" |
| 70 | _MYSQL_SSL_SERVER_CA_F_="${_MYSQL_CON_SSL_D_}/$(basename "$ca_f")" |
| 71 | |
| 72 | _MYSQL_SSL_CLIENT_CERT_F_="${_MYSQL_CON_SSL_D_}/$(basename "$client_cert_f")" |
| 73 | _MYSQL_SSL_CLIENT_KEY_F_="${_MYSQL_CON_SSL_D_}/$(basename "$client_key_f")" |
| 74 | _MYSQL_SSL_CLIENT_CA_F_="${_MYSQL_CON_SSL_D_}/$(basename "$ca_dup_f")" |
| 75 | fi |