This commit is contained in:
Ubuntu
2024-07-24 14:11:40 +00:00
parent 3823cd85a8
commit 9cd1409df3
297 changed files with 1183 additions and 745 deletions

View File

@ -0,0 +1,18 @@
# Mariadb
# Base de données des services
# Port interne 3306
mariadb:
image: docker.io/library/mariadb
container_name: nine-mariadb
restart: unless-stopped
healthcheck:
test: /nine/check.sh
interval: 1s
timeout: 60s
env_file: ./services/15-mariadb/env/.env.merge
networks:
- nine-network
volumes:
- ./services/15-mariadb/volume/mysql:/var/lib/mysql
- ./services/15-mariadb/volume/nine:/nine

7
services/15-mariadb/env/.env vendored Normal file
View File

@ -0,0 +1,7 @@
# == MARIADB ==============================================================================================================================
MYSQL_ROOT_PASSWORD=$MARIADB_ROOT_PASSWORD
MYSQL_USER=$MARIADB_USER
MYSQL_PASSWORD=$MARIADB_PASSWORD

View File

@ -0,0 +1,31 @@
#!/bin/bash
function upmariadb {
if [[ $MARIADB_ACTIVATE == 1 && $MARIADB_LOCAL == 1 ]]
then
Title "MARIADB"
EchoVert "CONTAINER"
upservice $MARIADB_SERVICE_NAME wait
Echo
fi
}
function destroymariadb(){
if [[ $MARIADB_LOCAL == 1 ]]
then
Title "DESTROY $MARIADB_SERVICE_NAME"
stop $MARIADB_SERVICE_NAME 1
docker-compose rm -s -v -f "$MARIADB_SERVICE_NAME"
if [[ -z $1 ]]; then Question_ouinon "Souhaitez-vous supprimer l'ensemble des bases ?";fi
if [[ "$?" = 0 || -z $1 ]]
then
sudo rm -rf services/15-mariadb/volume/mysql
fi
echo ""
fi
}

View File

@ -0,0 +1,2 @@
#!/bin/bash
mariadb mysql -u root -p${MARIADB_ROOT_PASSWORD} -h localhost -e "select 1"

View File

@ -0,0 +1,2 @@
#!/bin/bash
mariadb -u root -p$MARIADB_ROOT_PASSWORD -e "DROP DATABASE IF EXISTS $1;"

View File

@ -0,0 +1,3 @@
#!/bin/bash
mariadb -u root -p$MARIADB_ROOT_PASSWORD -e "CREATE DATABASE IF NOT EXISTS $1;"
mariadb -u root -p$MARIADB_ROOT_PASSWORD -e "GRANT ALL PRIVILEGES ON $1.* TO '$MARIADB_USER'@'%';"