Workaround for LXC root priv for mysql
This commit is contained in:
parent
19b62a4370
commit
0e465b0820
@ -1 +1 @@
|
||||
Subproject commit 119636f94ee6ca1c17bb9e9ffb6e924e79f8d476
|
||||
Subproject commit e05ffc194f95e9078d0bf8e9a1d2494b4a1ba3ca
|
@ -6,16 +6,16 @@ mkdir -p /srv/mifosx/mariadb_conf /srv/mifosx/mariadb_data
|
||||
chown 103306:103306 /srv/mifosx/mariadb_data
|
||||
cp mariadb_conf/my.cnf /srv/mifosx/mariadb_conf/my.cnf
|
||||
chown -R 100000:100000 /srv/mifosx/mariadb_conf
|
||||
lxc-execute mifosx-mariadb -- mysql_install_db --user=mysql --datadir=/var/lib/mysql --auth-root-authentication-method=socket --skip-test-db
|
||||
lxc-execute mifosx-mariadb -- mysql_install_db --user=mysql --datadir=/var/lib/mysql --auth-root-authentication-method=socket --auth-root-socket-user=mysql --skip-test-db
|
||||
|
||||
# Create databases
|
||||
export MIFOSX_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=')
|
||||
service lxc-mifosx-mariadb start
|
||||
envsubst <createdb.sql | lxc-attach mifosx-mariadb -- mysql
|
||||
envsubst <createdb.sql | lxc-attach mifosx-mariadb -- mysql -u mysql
|
||||
|
||||
# Populate database
|
||||
lxc-execute mifosx -- cat /tmp/mifospltaform-tenants-first-time-install.sql | lxc-attach mifosx-mariadb -- mysql mifosplatform-tenants
|
||||
envsubst <schemapwd.sql | lxc-attach mifosx-mariadb -- mysql mifosplatform-tenants
|
||||
lxc-execute mifosx -- cat /tmp/mifospltaform-tenants-first-time-install.sql | lxc-attach mifosx-mariadb -- mysql -u mysql mifosplatform-tenants
|
||||
envsubst <schemapwd.sql | lxc-attach mifosx-mariadb -- mysql -u mysql mifosplatform-tenants
|
||||
|
||||
# Configure Mifos X
|
||||
mkdir -p /srv/mifosx_conf
|
||||
@ -30,14 +30,14 @@ done
|
||||
service stop mifosx
|
||||
|
||||
# Fix missing previous_run_status column
|
||||
echo 'ALTER TABLE `scheduled_email_campaign` ADD `previous_run_status` VARCHAR(10) NULL;' | lxc-attach mifosx-mariadb -- mysql mifostenant-default
|
||||
echo 'ALTER TABLE `scheduled_email_campaign` ADD `previous_run_status` VARCHAR(10) NULL;' | lxc-attach mifosx-mariadb -- mysql -u mysql mifostenant-default
|
||||
|
||||
# Update admin account
|
||||
export MIFOSX_ADMIN_USER=admin
|
||||
export MIFOSX_ADMIN_EMAIL=admin@example.com
|
||||
export MIFOSX_ADMIN_PWD=$(head -c 12 /dev/urandom | base64 | tr -d '+/=')
|
||||
export MIFOSX_ADMIN_HASH=$(echo -n "${MIFOSX_ADMIN_PWD}{1}" | sha256sum | awk '{print $1}')
|
||||
envsubst <adminpwd.sql | lxc-attach mifosx-mariadb -- mysql mifostenant-default
|
||||
envsubst <adminpwd.sql | lxc-attach mifosx-mariadb -- mysql -u mysql mifostenant-default
|
||||
|
||||
# Install config update script
|
||||
cp update-conf.sh /srv/mifosx/update-conf.sh
|
||||
|
@ -4,4 +4,4 @@ sed -i "s|\(^\s\+proxyName=\).*|\1\"mifosx.${DOMAIN}\"|" /srv/mifosx/mifosx_conf
|
||||
sed -i "s|\(^\s\+proxyPort=\).*|\1\"${PORT}\"|" /srv/mifosx/mifosx_conf/server.xml
|
||||
|
||||
QUERY="UPDATE \`c_external_service_properties\` SET \`value\` = '${EMAIL}' WHERE \`external_service_id\` = 2 and \`name\` LIKE 'username'"
|
||||
lxc-attach mifosx-mariadb -- mysql -e "${QUERY}" mifostenant-default
|
||||
lxc-attach mifosx-mariadb -- mysql -u mysql -e "${QUERY}" mifostenant-default
|
||||
|
@ -6,12 +6,12 @@ mkdir -p /srv/ushahidi/mariadb_conf /srv/ushahidi/mariadb_data
|
||||
chown 103306:103306 /srv/ushahidi/mariadb_data
|
||||
cp mariadb_conf/my.cnf /srv/ushahidi/mariadb_conf/my.cnf
|
||||
chown -R 100000:100000 /srv/ushahidi/mariadb_conf
|
||||
lxc-execute ushahidi-mariadb -- mysql_install_db --user=mysql --datadir=/var/lib/mysql --auth-root-authentication-method=socket --skip-test-db
|
||||
lxc-execute ushahidi-mariadb -- mysql_install_db --user=mysql --datadir=/var/lib/mysql --auth-root-authentication-method=socket --auth-root-socket-user=mysql --skip-test-db
|
||||
|
||||
# Create database
|
||||
export USHAHIDI_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=')
|
||||
service lxc-ushahidi-mariadb start
|
||||
envsubst <createdb.sql | lxc-attach ushahidi-mariadb -- mysql
|
||||
envsubst <createdb.sql | lxc-attach ushahidi-mariadb -- mysql -u mysql
|
||||
|
||||
# Configure Ushahidi
|
||||
mkdir -p /srv/ushahidi/ushahidi_conf /srv/ushahidi/ushahidi_data
|
||||
@ -27,7 +27,7 @@ lxc-execute ushahidi -- /srv/ushahidi/platform/bin/phinx migrate -c /srv/ushahid
|
||||
export USHAHIDI_ADMIN_USER=admin@example.com
|
||||
export USHAHIDI_ADMIN_PWD=$(head -c 12 /dev/urandom | base64 | tr -d '+/=')
|
||||
export USHAHIDI_ADMIN_HASH=$(python3 -c "import bcrypt; print(bcrypt.hashpw('${USHAHIDI_ADMIN_PWD}'.encode(), bcrypt.gensalt()).decode().replace('2b', '2y'))")
|
||||
envsubst <adminpwd.sql | lxc-attach ushahidi-mariadb -- mysql ushahidi
|
||||
envsubst <adminpwd.sql | lxc-attach ushahidi-mariadb -- mysql -u mysql ushahidi
|
||||
|
||||
# Install config update script
|
||||
cp update-conf.sh /srv/ushahidi/update-conf.sh
|
||||
|
@ -5,11 +5,11 @@ HOST="${DOMAIN}"
|
||||
sed -i "s|\(^\s\+\"backend_url\": \).*|\1\"https://ush.${HOST}/platform\",|" /srv/ushahidi/ushahidi_conf/config.json
|
||||
API_URL="\"https:\\\/\\\/ush.${HOST}\\\/platform\\\/api\\\/v3\\\/config\\\/data-provider\""
|
||||
QUERY="UPDATE \`config\` SET \`config_value\` = '${API_URL}' WHERE \`group_name\` LIKE 'data-provider' AND \`config_key\` LIKE 'url'"
|
||||
lxc-attach ushahidi-mariadb -- mysql -e "${QUERY}" ushahidi
|
||||
lxc-attach ushahidi-mariadb -- mysql -u mysql -e "${QUERY}" ushahidi
|
||||
|
||||
JSON="{\"incoming_type\":\"IMAP\",\"incoming_server\":\"localhost\",\"incoming_port\":143,\"incoming_security\":\"None\",\"incoming_username\":\"${EMAIL}\",\"incoming_password\":\"password\",\"outgoing_type\":\"SMTP\",\"outgoing_server\":\"host\",\"outgoing_port\":25,\"outgoing_security\":\"None\",\"outgoing_username\":\"${EMAIL}\",\"outgoing_password\":\"password\",\"from\":\"${EMAIL}\",\"from_name\":\"Ushahidi\"}"
|
||||
QUERY="UPDATE \`config\` SET \`config_value\` = '${JSON}' WHERE \`group_name\` LIKE 'data-provider' AND \`config_key\` LIKE 'email'"
|
||||
lxc-attach ushahidi-mariadb -- mysql -e "${QUERY}" ushahidi
|
||||
lxc-attach ushahidi-mariadb -- mysql -u mysql -e "${QUERY}" ushahidi
|
||||
QUERY="UPDATE \`config\` SET \`config_value\` = '\"${EMAIL}\"' WHERE \`group_name\` LIKE 'site' AND \`config_key\` LIKE 'email'"
|
||||
lxc-attach ushahidi-mariadb -- mysql -e "${QUERY}" ushahidi
|
||||
lxc-attach ushahidi-mariadb -- mysql -u mysql -e "${QUERY}" ushahidi
|
||||
sed -i "s|\(^\s\+\"google_analytics_id\": \).*|\1\"${GMAPS_API_KEY}\"|" /srv/ushahidi/ushahidi_conf/config.json
|
||||
|
Loading…
Reference in New Issue
Block a user