blob: 0f459ab01c6d28279d39d3d6016ff5f3c094883f [file] [log] [blame]
Luigi Santivettib52d6d22020-05-18 00:56:27 +01001#!/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"
51if [ "${mod_mode}" = "${release}" ]; then
52 _MYSQL_GENERAL_LOG_="0"
53 _MYSQL_SLOW_QUERY_LOG_="0"
54 _MYSQL_LOG_OUTPUT_="NONE"
55else
56 _MYSQL_GENERAL_LOG_="1"
57 _MYSQL_SLOW_QUERY_LOG_="1"
58 _MYSQL_LOG_OUTPUT_="FILE"
59fi
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")"
64if [ "$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")"
75fi