Compare commits

...

2 commits

Author SHA1 Message Date
93284171d9 Improved documentation. 2024-08-19 00:54:25 +02:00
3740992dd1 Improved build script. 2024-08-19 00:54:07 +02:00
2 changed files with 78 additions and 101 deletions

View file

@ -90,16 +90,60 @@ Usage:
statoolinfos list errlog <logfilesorconfigfile> display http error log lines statoolinfos list errlog <logfilesorconfigfile> display http error log lines
``` ```
### htmlize removed ### Simple configuration file
Example of `libre-service.eu.conf`:
```
# [Configuration] conf + organization + services + machines + metrics
conf.class=federation
conf.protocol=StatoolInfos-0.6.0
conf.crawl.input=https://www.libre-service.eu/.well-known/statoolinfos/libre-service.eu.properties
conf.crawl.cache=/srv/statoolinfos/cache/
```
The field `input` gives the federation properties URL file. Reminder, the StatoolInfos Protocol requires that the federation properties file is exposed on the Web.
The field `cache` gives local directory used as data cache.
## Crawl
Example of cron configuration:
```
55 * * * * root /srv/statoolinfos/bin/statoolinfos crawl /srv/statoolinfos/conf/libre-service.eu.conf >> /srv/statoolinfos/statoolinfos-cron.log
```
## Uptime
This command is very useful to collect the uptime of services. It's just to share which services are down and since how many time. It is not a monitoring feature because an one hour check is enough for this. Actually, only website are checked.
Example of cron configuration:
```
4 * * * * root /srv/statoolinfos/bin/statoolinfos uptime /srv/statoolinfos/conf/libre-service.eu.conf >> /srv/statoolinfos/statoolinfos-cron.log
```
One check per hour is a good idea. In the uptime page, the mouse over a yellow status icon show the list of the check results.
## Htmlize removed
The htmlize command is removed since 2024-07. The htmlize command is removed since 2024-07.
As a reminder, the htmlize command generated absolutely all the pages needed for a static site. As a reminder, the htmlize command generated absolutely all the pages needed for a static website.
As the number of pages generated became too large (> 10000 with 100 organizations), the decision was made to separate the html valuation into a separate project, StatoolInfosWeb. As the number of pages generated became too large (> 10000 with 100 organizations), the decision was made to separate the html valuation into a separate project, StatoolInfosWeb.
A dynamic web site allows to generate page only when it is necessary. A dynamic web site allows to generate page only when it is necessary.
## Generate metrics files
## Probe (Generate metrics files)
### Basics ### Basics
@ -291,6 +335,7 @@ conf.prob.httperrorlog.datetimepattern=
Warning: to have month metric values, you have to set **retention log to 7 weeks or 50 days** in Nginx or Apache logrotate configuration. Warning: to have month metric values, you have to set **retention log to 7 weeks or 50 days** in Nginx or Apache logrotate configuration.
For Nginx, éditer le fichier `/etc/logrotate.d/nginx` : For Nginx, éditer le fichier `/etc/logrotate.d/nginx` :
``` ```
/var/log/nginx/*.log { /var/log/nginx/*.log {
weekly weekly
@ -299,9 +344,23 @@ For Nginx, éditer le fichier `/etc/logrotate.d/nginx` :
``` ```
For Apache, éditer le fichier `/etc/logrotate.d/apache2` : For Apache, éditer le fichier `/etc/logrotate.d/apache2` :
``` ```
/var/log/apache2/*.log { /var/log/apache2/*.log {
weekly weekly
missingok missingok
rotate 7 rotate 7
``` ```
### Cron all task
A situation you will encounter is the need to do several tasks from the same machine. In this case, avoid multiple cron in the same time. Put all in Bash script and call it with only one cron.
Example:
```
4 0,12,23 * * * root /srv/statoolinfos/bin/refresh >> /srv/statoolinfos/statoolinfos-cron.log
4 1-11,13-22 * * * root /srv/statoolinfos/bin/statoolinfos uptime /srv/statoolinfos/conf/libre-service.eu.conf >> /srv/statoolinfos/statoolinfos-cron.log
```

114
build.sh
View file

@ -5,7 +5,7 @@
# #
function help function help
{ {
echo "StatoolInfos build script." echo "Kiss4web build script."
echo "Usage: build.sh [ -h | -help | --help | -snapshot | -local | -full ]" echo "Usage: build.sh [ -h | -help | --help | -snapshot | -local | -full ]"
echo " -h, -help, --help display this help." echo " -h, -help, --help display this help."
echo " -snapshot, --snapshot build a snapshot." echo " -snapshot, --snapshot build a snapshot."
@ -15,93 +15,9 @@ function help
} }
# #
# Build snapshot. # Check env.
# #
function build_snapshot function check_env
{
okCount=0
# Ant check.
antCheck=`which ant`
if [[ "$antCheck" =~ ^/.* ]]; then
echo "Ant requirement................ OK"
let "okCount+=1"
else
echo "Ant requirement................ MISSING"
fi
# Javac check.
javacCheck=`which javac`
if [[ "$javacCheck" =~ ^/.* ]]; then
echo "Javac requirement.............. OK"
let "okCount+=1"
else
echo "Javac requirement.............. MISSING"
fi
# Java version check.
javaVersionCheck=`javac -version 2>&1`
if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then
echo "Java 11 version requirement..... OK"
let "okCount+=1"
else
echo "Java 11 version requirement..... MISSING"
fi
if [ "$okCount" == 3 ]; then
echo "Requirement OK"
ant -f build-snapshot.xml
else
echo "Requirement MISSING, build abort"
fi
}
#
# Build local.
#
function build_local
{
okCount=0
# Ant check.
antCheck=`which ant`
if [[ "$antCheck" =~ ^/.* ]]; then
echo "Ant requirement................ OK"
let "okCount+=1"
else
echo "Ant requirement................ MISSING"
fi
# Javac check.
javacCheck=`which javac`
if [[ "$javacCheck" =~ ^/.* ]]; then
echo "Javac requirement.............. OK"
let "okCount+=1"
else
echo "Javac requirement.............. MISSING"
fi
# Java version check.
javaVersionCheck=`javac -version 2>&1`
if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then
echo "Java 11 version requirement..... OK"
let "okCount+=1"
else
echo "Java 11 version requirement..... MISSING"
fi
if [ "$okCount" == 3 ]; then
echo "Requirement OK"
ant -f build-local.xml
else
echo "Requirement MISSING, build abort"
fi
}
#
# Build tagandpush.
#
function build_tagandpush
{ {
okCount=0 okCount=0
@ -143,26 +59,28 @@ function build_tagandpush
if [ "$okCount" == 4 ]; then if [ "$okCount" == 4 ]; then
echo "Requirement OK" echo "Requirement OK"
ant -f build-tagandpush.xml
else else
echo "Requirement MISSING, build abort" echo "Requirement MISSING, build abort"
exit -1
fi fi
} }
# #
# Main. # Main.
# #
if [ "$#" -eq 0 ] || [ "$1" == "-h" ] || [ "$1" == "-help" ] || [ "$1" == "--help" ]; then if [ "$#" -eq 0 ] || [ "$1" == "-h" ] || [ "$1" == "-help" ] || [ "$1" == "--help" ]; then
help help
elif [ "$1" == "-snapshot" ] || [ "$1" == "--snapshot" ] ; then
build_snapshot
elif [ "$1" == "-local" ] || [ "$1" == "--local" ] ; then
build_local
elif [ "$1" == "-tagandpush" ] || [ "$1" == "--tagandpush" ] ; then
build_tagandpush
else else
echo "Invalid parameters." check_env
help if [ "$1" == "-snapshot" ] || [ "$1" == "--snapshot" ] ; then
ant -f build-snapshot.xml
elif [ "$1" == "-local" ] || [ "$1" == "--local" ] ; then
ant -f build-local.xml
elif [ "$1" == "-tagandpush" ] || [ "$1" == "--tagandpush" ] ; then
ant -f build-tagandpush.xml
else
echo "Invalid parameters."
help
fi
fi fi