Compare commits

..

20 Commits

Author SHA1 Message Date
54553dacb4 Merge branch 'develop' into dist/eole/2.7.1/develop 2020-07-02 17:12:51 +02:00
38de7274ba Passage en 2.7.1 2020-07-02 17:02:17 +02:00
cf632ec6e6 Merge branch 'develop' into dist/eole/2.7.0/develop 2019-06-07 15:08:26 +02:00
aec567045d extract backup with mariabackup 2019-06-07 14:49:03 +02:00
558482e860 Merge branch 'develop' into dist/eole/2.7.0/develop 2019-06-06 14:41:28 +02:00
51811c96db Merge branch 'develop' into dist/eole/2.7.0/develop 2019-05-20 10:44:58 +02:00
b9fb5ff6ad Merge branch 'develop' into dist/eole/2.7.0/develop 2019-05-16 10:29:55 +02:00
b609ee9761 Merge branch 'develop' into dist/eole/2.7.0/develop 2019-04-18 15:01:21 +02:00
3f214856a4 XMerge branch 'dist/eole/2.7.0/develop' of ssh://forge.cadoles.com:4242/Cadoles/eole-mariadb into dist/eole/2.7.0/develop 2019-04-18 14:56:37 +02:00
cbc84bd841 Merge branch 'develop' into dist/eole/2.7.0/develop 2019-04-18 14:53:36 +02:00
0c455115c8 Merge branch 'develop' into dist/eole/2.7.0/develop 2019-03-13 15:20:06 +01:00
a0684dab2f Merge branch 'dist/eole/2.7.0/develop' of ssh://forge.cadoles.com:4242/Cadoles/eole-mariadb into dist/eole/2.7.0/develop 2019-03-11 09:47:34 +01:00
997e33daf2 Merge branch 'develop' into dist/eole/2.7.0/develop 2019-03-11 09:45:26 +01:00
79785b4b60 Merge branch 'develop' into dist/eole/2.7.0/develop 2019-03-04 12:08:27 +01:00
c3040e3762 Merge branch 'develop' into dist/eole/2.7.0/develop 2019-03-04 10:29:23 +01:00
2ba4b56d51 Merge branch 'develop' into dist/eole/2.7.0/develop 2019-03-01 15:36:10 +01:00
065308a921 Merge branch 'develop' into dist/eole/2.7.0/develop 2019-02-19 17:26:31 +01:00
21b93a3462 Merge branch 'develop' into dist/eole/2.7.0/develop 2019-02-19 17:13:59 +01:00
c540b65e08 Merge branch 'develop' into dist/eole/2.7.0/develop 2019-02-19 10:03:53 +01:00
5e9eae5c13 Merge branch 'develop' into dist/eole/2.7.0/develop 2019-02-15 11:07:15 +01:00
7 changed files with 32 additions and 171 deletions

View File

@ -4,8 +4,8 @@
SOURCE=eole-mariadb SOURCE=eole-mariadb
VERSION=0.0.1 VERSION=0.0.1
EOLE_VERSION=2.6 EOLE_VERSION=2.7
EOLE_RELEASE=2.6.2 EOLE_RELEASE=2.7.1
PKGAPPS=non PKGAPPS=non
#FLASK_MODULE=<APPLICATION> #FLASK_MODULE=<APPLICATION>

View File

@ -1,5 +1,31 @@
# eole-mariadb # eole-mariadb
Paquet porté pour la 2.7.1. Les tests n'ont été réalisé que sur un Eolebase.
La version utilisé est mariadb 10.3
Ajout de ce paquet sur une 2.7.1 :
## Add the Cadoles repository on all the nodes and the Leader
GenConfig [Mode Expert] -> Dépôts Tiers
* Libellé du dépôt : Cadoles dev
* Déclaration du dépôt : deb [ arch=all ] https://vulcain.cadoles.com 2.7.1-dev main
* Méthode de récupération de la clé publique du dépôt : URL de la clé
* URL de la clé : https://vulcain.cadoles.com/cadoles.gpg
## Add the MariaDB repository on all the nodes and the Leader
GenConfig (Mode Expert) -> Dépôt tiers :
* Libellé du dépôt : MariaDB
* Déclaration du dépôt : deb [ arch=amd64 ] http://mariadb.mirrors.ovh.net/MariaDB/repo/10.3/ubuntu bionic main
* Méthode de récupération de la clé publique du dépôt : serveur de clés
* URL du serveur de clés : hkp://keyserver.ubuntu.com:80
* Empreinte de la clé : 0xF1656F24C74CD1D8
#######################################################################
Paquet porté pour la 2.7.0. Les tests n'ont été réalisé que sur un Eolebase. Paquet porté pour la 2.7.0. Les tests n'ont été réalisé que sur un Eolebase.
La version utilisé est mariadb 10.3 La version utilisé est mariadb 10.3

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<creole>
<variables>
<family name="extract_hydra" description="Optimize sur les tables d'Hydra">
<variable name="description" type="string" hidden="True"><value>Extraction des logs utils de la base Hydra</value></variable>
<variable name="day" type="schedule" description="Périodicité d'exécution"><value>daily</value></variable>
<variable name="mode" type="schedulemod" hidden="True"><value>post</value></variable>
</family>
</variables>
<constraints>
<!-- Désactive les extractions si on est pas sur la machine qui fait les backups -->
<fill name='calc_multi_condition' target='schedule.extract_hydra.day'>
<param>non</param>
<param type='eole' name='condition_1'>dbEnableBackup</param>
<param name='match'>none</param>
<param name='mismatch'>daily</param>
</fill>
</constraints>
</creole>

View File

@ -1,69 +0,0 @@
#!/bin/bash
DESC="Extraction des logs de connexion de la base Hydra"
. /usr/share/eole/schedule/config.sh
file_date=$(date '+%Y%m%d' -d@$(($(date +%s) -3600*24))) # Date pour le format des noms de fichier
today=$(date '+%Y-%m-%d') # Date de fin de requête
yesterday=$(date '+%Y-%m-%d' -d@$(($(date +%s) -3600*24))) # Date de début de requête
exit_status=0
echo "Begin date: $(date)"
mysql --defaults-file=/etc/mysql/debian.cnf hydra <<EOF
select concat ('requested_at: ', requested_at),
concat ('request_id: ', request_id),
concat ('client_id: ', client_id),
concat ('subject: ', subject)
into outfile 'access-${file_date}' character set utf8 fields terminated by '|'
from hydra_oauth2_access
where requested_at >= '${yesterday} 00:00:00' and requested_at < '${today} 00:00:00'
order by requested_at ;
EOF
(( exit_status = exit_status || $? ))
mysql --defaults-file=/etc/mysql/debian.cnf hydra <<EOF
select concat ('requested_at: ', requested_at),
concat ('challenge: ', challenge),
concat ('error: ', error),
concat ('session_access_token: ', session_access_token),
concat ('session_id_token: ', session_id_token),
concat ('handled at: ', handled_at)
into outfile 'consent-request-handled-${file_date}' character set utf8 fields terminated by '|'
from hydra_oauth2_consent_request_handled
where requested_at >= '${yesterday} 00:00:00' and requested_at < '${today} 00:00:00'
order by requested_at ;
EOF
(( exit_status = exit_status || $? ))
mysql --defaults-file=/etc/mysql/debian.cnf hydra <<EOF
select concat ('requested_at: ', requested_at),
concat ('challenge: ', challenge),
concat ('request_url: ', request_url),
concat ('client_id: ', client_id),
concat ('login_session_id: ', login_session_id)
into outfile 'authentication-request-${file_date}' character set utf8 fields terminated by '|'
from hydra_oauth2_authentication_request
where requested_at >= '${yesterday} 00:00:00' and requested_at < '${today} 00:00:00'
order by requested_at ;
EOF
(( exit_status = exit_status || $? ))
# Tags must be 32 char long max (otherwise, default fwd template truncates it)
logger -f /var/lib/mysql/hydra/access-${file_date} -t mariadb_hydra-access-${file_date}
logger -f /var/lib/mysql/hydra/consent-request-handled-${file_date} -t mariadb_hydra-consreq-h-${file_date}
logger -f /var/lib/mysql/hydra/authentication-request-${file_date} -t mariadb_hydra-authreq-${file_date}
# Remove log files older than 7 days (already saved on the NAS)
find /var/lib/mysql/hydra/ -name 'access-*' -type f -mtime +7 -exec rm -vf {} \;
find /var/lib/mysql/hydra/ -name 'consent-request-handled-*' -type f -mtime +7 -exec rm -vf {} \;
find /var/lib/mysql/hydra/ -name 'authentication-request-*' -type f -mtime +7 -exec rm -vf {} \;
find /var/log/rsyslog/local/mariadb_hydra/ -name 'access-*' -type f -mtime +7 -exec rm -vf {} \;
find /var/log/rsyslog/local/mariadb_hydra/ -name 'consreq-h-*' -type f -mtime +7 -exec rm -vf {} \;
find /var/log/rsyslog/local/mariadb_hydra/ -name 'authreq-*' -type f -mtime +7 -exec rm -vf {} \;
echo "End date: $(date)"
exit $exit_status

View File

@ -9,11 +9,9 @@ DESC="Exportation des bases MariaDB"
MYSQLSAVDIR=$SAVDIR/sql MYSQLSAVDIR=$SAVDIR/sql
OPTION="--lock-tables" OPTION="--lock-tables"
if [[ -d ${MYSQLSAVDIR} ]] rm -f $MYSQLSAVDIR/*.sql || true
then mkdir -p $MYSQLSAVDIR
rm -rf ${MYSQLSAVDIR}
mkdir -p ${MYSQLSAVDIR}
fi
mariabackup --defaults-file=/etc/mysql/debian.cnf --backup --target-dir=$MYSQLSAVDIR mariabackup --defaults-file=/etc/mysql/debian.cnf --backup --target-dir=$MYSQLSAVDIR
exit $?
exit 0

View File

@ -1,25 +0,0 @@
#!/bin/bash
(
mysql --defaults-file=/etc/mysql/debian.cnf hydra <<EOF
SELECT
TABLE_NAME AS \`Table\`,
ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS \`Size\`
FROM
information_schema.TABLES
WHERE
TABLE_SCHEMA = "hydra"
ORDER BY
(DATA_LENGTH + INDEX_LENGTH)
DESC;
EOF
) | while read table size; do
if [ "${table}" != Table ]; then
real_size=$(ls -lh /var/lib/mysql/hydra/${table}.ibd | cut -d' ' -f 5)
else
real_size="Taille réelle"
fi
echo -e ${table}\\t${size}M\\t${real_size}
done
echo $a

View File

@ -1,49 +0,0 @@
#!/bin/bash
# Optimize sur les tables d'Hydra
echo "Begin date: $(date)"
part=$1
if [ -z "$part" ]; then
echo 'Bad empty part. Please give a number between 1 and 7'
exit 1
fi
case $part in
1)
tables='hydra_oauth2_access'
;;
2)
tables='hydra_oauth2_oidc'
;;
3)
tables='hydra_oauth2_code'
;;
4)
tables='hydra_oauth2_authentication_request'
;;
5)
tables='hydra_oauth2_consent_request'
;;
6)
tables='hydra_oauth2_logout_request, hydra_oauth2_consent_request_handled'
;;
7)
tables='hydra_oauth2_authentication_session, hydra_oauth2_authentication_request_handled, hydra_oauth2_pkce'
;;
*)
echo "Unexpected error. Part: $part"
exit 1
esac
mysql --defaults-file=/etc/mysql/debian.cnf hydra <<EOF
OPTIMIZE TABLE $tables;
EOF
exit_val=$?
echo "End date: $(date)"
exit $exit_val