support mariadb
This commit is contained in:
@@ -11,5 +11,13 @@ flavor=dev
|
||||
|
||||
database_name=nextcloud_$flavor
|
||||
username=nextcloud_$flavor
|
||||
|
||||
# postgres
|
||||
db_port=5432
|
||||
db_hostname=127.0.0.1
|
||||
dbtype_nextcloude=pgsql
|
||||
|
||||
# mariadb/mysql
|
||||
db_port=3306
|
||||
db_hostname=127.0.0.1
|
||||
dbtype_nextcloud=mysql
|
||||
|
||||
@@ -15,10 +15,16 @@ log_info "See https://docs.nextcloud.com/server/latest/admin_manual/configuratio
|
||||
|
||||
source ./config_db_query.sh
|
||||
|
||||
# convert localhost of host into container virtual brdige hostname mapping
|
||||
# convert localhost of host into container virtual bridge hostname mapping
|
||||
#db_hostname=host.docker.internal
|
||||
#db_hostname=host.containers.internal
|
||||
# host loopback mapped address
|
||||
db_hostname=10.1.1.13
|
||||
# dbtype_nextcloud inherited from config_db_query
|
||||
|
||||
$defer ./run_occ.sh db:convert-type --password="$password" --port="$db_port" --all-apps pgsql "$username" "$db_hostname" "$database_name"
|
||||
$defer ./run_occ.sh db:convert-type --password="$password" --port="$db_port" --all-apps "$dbtype_nextcloud" "$username" "$db_hostname" "$database_name"
|
||||
|
||||
if [[ $dbtype_nextcloud == mysql ]]
|
||||
then
|
||||
$defer ./run_occ.sh config:system:set mysql.utf8mb4 --type boolean --value="true"
|
||||
fi
|
||||
|
||||
@@ -20,4 +20,14 @@ GRANT ALL PRIVILEGES ON SCHEMA public TO $username;
|
||||
EOF
|
||||
} | pipeto sudo -u postgres psql -f -
|
||||
|
||||
|
||||
{
|
||||
cat <<EOF
|
||||
CREATE USER '$username'@'localhost' IDENTIFIED BY '$password';
|
||||
CREATE DATABASE IF NOT EXISTS ${database_name} CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
GRANT ALL PRIVILEGES on ${database_name}.* to '$username'@'localhost';
|
||||
EOF
|
||||
} | pipeto sudo mariadb -uroot -p
|
||||
|
||||
|
||||
log_info "created database ${database_name} with user $username"
|
||||
|
||||
Reference in New Issue
Block a user