forked from jan/cacert-devsetup
f9b0eb5195
This commit renames the application container to webdb and drops the test suffix in favour of using www.cacert.localhost directly. The server certificate for www.cacert.localhost got an additional subjectAlternativeName secure.cacert.localhost and is used for both hostnames now. Environment variables containing _APP have been renamed to _WEBDB to keep consistency.
136 lines
11 KiB
Bash
Executable file
136 lines
11 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
set -eux
|
|
|
|
mysql -h localhost -u root "-p$MYSQL_ROOT_PASSWORD" <<-EOF
|
|
CREATE database cacert CHARSET latin1 COLLATE latin1_swedish_ci;
|
|
CREATE database $MYSQL_CATS_DATABASE CHARSET latin1 COLLATE latin1_swedish_ci;
|
|
CREATE database mgr CHARSET utf8 COLLATE utf8_unicode_ci;
|
|
EOF
|
|
|
|
for script in /db_migrations/*.sh; do
|
|
sh "$script" -h localhost -u root "-p$MYSQL_ROOT_PASSWORD" cacert
|
|
done
|
|
|
|
mysql -h localhost -u root "-p$MYSQL_ROOT_PASSWORD" mgr </mgr_dbadm/ca_mgr.mysql
|
|
|
|
mysql -h localhost -u root "-p$MYSQL_ROOT_PASSWORD" "${MYSQL_CATS_DATABASE}" </cats_db/create_db.sql
|
|
mysql -h localhost -u root "-p$MYSQL_ROOT_PASSWORD" "${MYSQL_CATS_DATABASE}" </cats_db/update1.sql
|
|
mysql -h localhost -u root "-p$MYSQL_ROOT_PASSWORD" "${MYSQL_CATS_DATABASE}" </cats_db/update2.sql
|
|
mysql -h localhost -u root "-p$MYSQL_ROOT_PASSWORD" "${MYSQL_CATS_DATABASE}" </cats_db/sample_test.sql
|
|
|
|
mysql -h localhost -u root "-p$MYSQL_ROOT_PASSWORD" cacert <<-'EOF'
|
|
INSERT INTO languages (locale, en_co, en_lang, country, lang)
|
|
VALUES ('sq_AL', 'Albania', 'Albanian', 'Shqipëria', 'shqipe'),
|
|
('ar_DZ', 'Algeria', 'Arabic', 'ﺮﺌﺎﺰﺠﻠﺍ', 'ﺔﻴﺐﺮﻌﻠﺍ'),
|
|
('ar_AA', 'Arabic Speaking', 'Arabic', 'ﺔﻴﺐﺮﻌﻠﺍ', 'ﺔﻴﺐﺮﻌﻠﺍ'),
|
|
('es_AR', 'Argentina', 'Spanish', 'Argentina', 'Español'),
|
|
('en_AU', 'Australia', 'English', 'Australia', 'English'),
|
|
('de_AT', 'Austria', 'German', 'Österreich', 'Deutsch'),
|
|
('ar_BH', 'Bahrain', 'Arabic', 'ﻦﻴﺮﺤﺐﻠﺍ', 'ﺔﻴﺐﺮﻌﻠﺍ'),
|
|
('be_BY', 'Belarus', 'Belarusian', 'Беларусь', 'беларуски'),
|
|
('nl_BE', 'Belgium', 'Dutch', 'België', 'Nederlands'),
|
|
('fr_BE', 'Belgium', 'French', 'Belgique', 'français'),
|
|
('es_BO', 'Bolivia', 'Spanish', 'Bolivia', 'Español'),
|
|
('sh_BA', 'Bosnia Herzogovina', 'Serbo-Croatian', 'Bosnia Herzogovina', 'Serbo-Croatian'),
|
|
('pt_BR', 'Brazil', 'Portuguese', 'Brasil', 'Português'),
|
|
('bg_BG', 'Bulgaria', 'Bulgarian', 'България', 'български'),
|
|
('en_CA', 'Canada', 'English', 'Canada', 'English'),
|
|
('fr_CA', 'Canada', 'French', 'Canada', 'français'),
|
|
('es_CL', 'Chile', 'Spanish', 'Chile', 'Español'),
|
|
('es_CO', 'Colombia', 'Spanish', 'Colombia', 'Español'),
|
|
('es_CR', 'Costa Rica', 'Spanish', 'Costa Rica', 'Español'),
|
|
('hr_HR', 'Croatia', 'Croatian', 'Hrvatska', 'hrvatski'),
|
|
('cs_CZ', 'Czech Republic', 'Czech', 'Česká republika', 'čeština'),
|
|
('da_DK', 'Denmark', 'Danish', 'Danmark', 'dansk'),
|
|
('es_DO', 'Dominican Republic', 'Spanish', 'República Dominicana', 'Español'),
|
|
('es_EC', 'Ecuador', 'Spanish', 'Ecuador', 'Español'),
|
|
('ar_EG', 'Egypt', 'Arabic', 'ﺮﺼﻣ', 'ﺔﻴﺐﺮﻌﻠﺍ'),
|
|
('es_SV', 'El Salvador', 'Spanish', 'El Salvador', 'Español'),
|
|
('et_EE', 'Estonia', 'Estonian', 'Eesti', 'eesti'),
|
|
('mk_MK', 'FYR Macedonia', 'Macedonian', 'FYR Macedonia', 'Macedonian'),
|
|
('fi_FI', 'Finland', 'Finnish', 'Suomi', 'suomi'),
|
|
('sv_FI', 'Finland', 'Swedish', 'Finland', 'svenska'),
|
|
('fr_FR', 'France', 'French', 'France', 'français'),
|
|
('de_DE', 'Germany', 'German', 'Deutschland', 'Deutsch'),
|
|
('el_GR', 'Greece', 'Greek', 'Ελλάδα', 'ελληνικά'),
|
|
('es_GT', 'Guatemala', 'Spanish', 'Guatemala', 'Español'),
|
|
('es_HN', 'Honduras', 'Spanish', 'Honduras', 'Español'),
|
|
('zh_HK', 'Hong Kong', 'Chinese', '香港', '中文'),
|
|
('hu_HU', 'Hungary', 'Hungarian', 'Magyarország', 'magyar'),
|
|
('is_IS', 'Iceland', 'Icelandic', 'Ísland', 'íslenska'),
|
|
('in_ID', 'Indonesia', 'Indonesian', 'Indonesia', 'Bahasa Indonesia'),
|
|
('fa_IR', 'Iran', 'Farsi', 'Iran', 'ﻰﺴﺮﺎﻓ'),
|
|
('en_IE', 'Ireland', 'English', 'Ireland', 'English'),
|
|
('he_IL', 'Israel', 'Hebrew', 'לארשי', 'תירבע'),
|
|
('iw_IL', 'Israel', 'Hebrew', 'לארשי', 'תירבע'),
|
|
('it_IT', 'Italy', 'Italian', 'Italia', 'italiano'),
|
|
('ja_JP', 'Japan', 'Japanese', '日本', '日本語'),
|
|
('ar_JO', 'Jordan', 'Arabic', 'ﻦﺪﺮﺄﻠﺍ', 'ﺔﻴﺐﺮﻌﻠﺍ'),
|
|
('ko_KR', 'Korea', 'Korean', '대한민국', '한국어'),
|
|
('ar_KW', 'Kuwait', 'Arabic', 'ﺖﻴﻮﻜﻠﺍ', 'ﺔﻴﺐﺮﻌﻠﺍ'),
|
|
('es_LA', 'Latin America', 'Spanish', 'América latina', 'Español'),
|
|
('lv_LV', 'Latvia', 'Latvian', 'Latvija', 'latviešu'),
|
|
('ar_LB', 'Lebanon', 'Arabic', 'ﻦﺎﻨﺐﻟ', 'ﺔﻴﺐﺮﻌﻠﺍ'),
|
|
('de_LI', 'Liechtenstein', 'German', 'Liechtenstein', 'Deutsch'),
|
|
('lt_LT', 'Lithuania', 'Lithuanian', 'Lietuva', 'lietuvių'),
|
|
('fr_LU', 'Luxembourg', 'French', 'Luxembourg', 'français'),
|
|
('de_LU', 'Luxembourg', 'German', 'Luxemburg', 'Deutsch'),
|
|
('es_MX', 'Mexico', 'Spanish', 'México', 'Español'),
|
|
('ar_MA', 'Morocco', 'Arabic', 'ﺔﻴﺐﺮﻐﻤﻠﺍ ﺔﻜﻠﻤﻤﻠﺍ', 'ﺔﻴﺐﺮﻌﻠﺍ'),
|
|
('nl_NL', 'Netherlands', 'Dutch', 'Nederland', 'Nederlands'),
|
|
('en_NZ', 'New Zealand', 'English', 'New Zealand', 'English'),
|
|
('es_NI', 'Nicaragua', 'Spanish', 'Nicarágua', 'Español'),
|
|
('no_NO', 'Norway', 'Norwegian', 'Norge', 'bokmål'),
|
|
('ar_OM', 'Oman', 'Arabic', 'ﻦﺎﻤﻋ', 'ﺔﻴﺐﺮﻌﻠﺍ'),
|
|
('es_PA', 'Panama', 'Spanish', 'Panamá', 'Español'),
|
|
('es_PY', 'Paraguay', 'Spanish', 'Paraguay', 'Español'),
|
|
('zh_CN', 'People''s Republic of China', 'Chinese', '中华人民共和国', '中文'),
|
|
('es_PE', 'Peru', 'Spanish', 'Perú', 'Español'),
|
|
('pl_PL', 'Poland', 'Polish', 'Polska', 'polski'),
|
|
('pt_PT', 'Portugal', 'Portuguese', 'Portugal', 'português'),
|
|
('ar_QA', 'Qatar', 'Arabic', 'ﺮﻄﻗ', 'ﺔﻴﺐﺮﻌﻠﺍ'),
|
|
('ro_RO', 'Romania', 'Romanian', 'România', 'română'),
|
|
('ru_RU', 'Russia', 'Russian', 'Россия', 'русский'),
|
|
('ar_SA', 'Saudi Arabia', 'Arabic', 'ﺔﻴﺪﻮﻌﺴﻠﺍ ﺔﻴﺐﺮﻌﻠﺍ ﺔﻜﻠﻤﻤﻠﺍ', 'ﺔﻴﺐﺮﻌﻠﺍ'),
|
|
('hr_SP', 'Serbia', 'Romanian', 'Srbija', 'română'),
|
|
('sr_SP', 'Serbia', 'Serbian (Cyrillic)', 'Југославија', 'српски'),
|
|
('zh_SG', 'Singapore', 'Chinese', '新加坡', '中文'),
|
|
('sk_SK', 'Slovakia', 'Slovak', 'Slovenská republika', 'slovenčina'),
|
|
('sl_SI', 'Slovenia', 'Slovene', 'Slovenija', 'slovenski'),
|
|
('en_ZA', 'South Africa', 'English', 'South Africa', 'English'),
|
|
('eu_ES', 'Spain', 'Basque', 'Espainia', 'Euskara'),
|
|
('ca_ES', 'Spain', 'Catalan', 'Espanya', 'català'),
|
|
('es_ES', 'Spain', 'Spanish', 'España', 'Español'),
|
|
('sv_SE', 'Sweden', 'Swedish', 'Sverige', 'svenska'),
|
|
('fr_CH', 'Switzerland', 'French', 'Suisse', 'français'),
|
|
('de_CH', 'Switzerland', 'German', 'Schweiz', 'Deutsch'),
|
|
('it_CH', 'Switzerland', 'Italian', 'Svizzera', 'italiano'),
|
|
('ar_SY', 'Syria', 'Arabic', 'ﺎﻴﺮﻮﺳ', 'ﺔﻴﺐﺮﻌﻠﺍ'),
|
|
('zh_TW', 'Taiwan', 'Chinese', '中華民國', '中文'),
|
|
('th_TH', 'Thailand', 'Thai', 'ไทย', 'ไทย'),
|
|
('ar_TN', 'Tunisia', 'Arabic', 'ﺲﻨﻮﺗ', 'ﺔﻴﺐﺮﻌﻠﺍ'),
|
|
('tr_TR', 'Turkey', 'Turkish', 'Türkiye', 'Türkçe'),
|
|
('ar_UA', 'U.A.E.', 'Arabic', 'ﺔﺪﺤﺘﻤﻠﺍ ﺔﻴﺐﺮﻌﻠﺍ ﺖﺎﺮﺎﻤﺈﻠﺍ', 'ﺔﻴﺐﺮﻌﻠﺍ'),
|
|
('uk_UA', 'Ukraine', 'Ukrainian', 'Україна', 'україньска'),
|
|
('en_GB', 'United Kingdom', 'English', 'United Kingdom', 'English'),
|
|
('en_US', 'United States', 'English', 'United States', 'English'),
|
|
('es_US', 'United States', 'Spanish', 'Estados Unidos', 'Español'),
|
|
('es_UY', 'Uruguay', 'Spanish', 'Uruguay', 'Español'),
|
|
('es_VE', 'Venezuela', 'Spanish', 'Venezuela', 'Español'),
|
|
('vi_VN', 'Vietnam', 'Vietnamese', 'Việt Nam', 'Tiểng Việt'),
|
|
('ar_YE', 'Yemen', 'Arabic', 'ﻦﻤﻴﻠﺍ', 'ﺔﻴﺐﺮﻌﻠﺍ');
|
|
EOF
|
|
|
|
mysql -h localhost -u root "-p$MYSQL_ROOT_PASSWORD" <<-EOF
|
|
CREATE USER $MYSQL_WEBDB_USER@'%' IDENTIFIED BY '$MYSQL_WEBDB_PASSWORD';
|
|
GRANT CREATE TEMPORARY TABLES ON cacert.* TO $MYSQL_WEBDB_USER@'%';
|
|
GRANT SELECT, INSERT, UPDATE, DELETE ON cacert.* TO $MYSQL_WEBDB_USER@'%';
|
|
|
|
CREATE USER $MYSQL_MGR_USER@'%' IDENTIFIED BY '$MYSQL_MGR_PASSWORD';
|
|
GRANT SELECT, INSERT, UPDATE, DELETE ON mgr.* TO $MYSQL_MGR_USER@'%';
|
|
GRANT SELECT, INSERT, UPDATE, DELETE ON cacert.* TO $MYSQL_MGR_USER@'%';
|
|
|
|
CREATE USER $MYSQL_CATS_USER@'%' IDENTIFIED BY '$MYSQL_CATS_PASSWORD';
|
|
GRANT SELECT, INSERT, UPDATE, DELETE ON $MYSQL_CATS_DATABASE.* TO $MYSQL_CATS_USER@'%';
|
|
EOF
|