- Table of contents
- Administrating beCPG under Docker
Administrating beCPG under Docker¶
Installation¶
Installation consist of docker images that are build and distribute by beCPG on hosted docker registry.
Docker compose is used to start download and update those images.
On the host machine under /opt/becpg-srv-instances you will find beCPG installation folder:
Important files are :
/opt/becpg-srv-instances/inst1/.env /opt/becpg-srv-instances/inst1/README.md /opt/becpg-srv-instances/inst1/docker-compose.override.yml /opt/becpg-srv-instances/inst1/docker-compose.yml /opt/becpg-srv-instances/inst1/purge-logs.sh /opt/becpg-srv-instances/inst1/ssl/000-default.conf /opt/becpg-srv-instances/inst1/taillogs.sh /opt/becpg-srv-instances/inst1/reindex.sh /opt/becpg-srv-instances/inst1/stats.sh
Configuring beCPG¶
Major part of the configuration are included into the container and need rebuilding the container to be deployed.
However you can override the default configuration by editing the docker-compose.override.yml file.
Service name can be change under .env file and should match DNS and SSL certificate:
SERVICE_NAME=inst1.becpg.fr
You can change the memory allocated to services under:
vi /opt/becpg-srv-instances/inst1/docker-compose.override.yml CATALINA_OPTS * -Xmx6G to -Xmx8G for example
Configuring SSL¶
SSL certificates are store under /opt/becpg-srv-instances/inst1/ssl/, to update the certificate just upload your new certificate with the same name in this folder and restart the service.
In some installation SSL certificate path are different and can be changed in /opt/becpg-srv-instances/inst1/ssl/000-default.conf
Extending beCPG¶
First create a new config folder
cd /opt/becpg-srv-instances/inst1 mkdir config
Then edit docker-compose.override.yml
vi /opt/becpg-srv-instances/inst1/docker-compose.override.yml
And add volumes declaration under becpg: section
volumes: - ./config/becpg-config-custom.xml:/usr/local/tomcat/shared/classes/alfresco/web-extension/becpg-config-custom.xml:ro
Create your becpg-config-custom.xml file
touch config/becpg-config-custom.xml
And paste this text into it.
<alfresco-config>
<config evaluator="string-compare" condition="wizard" replace="true">
<!-- Your code -->
</config>
</alfresco-config>
All the configurations files can be overrided like this. Service has to be restart to be take in count.
Administrating application¶
Start and stop beCPG service:
cd /opt/becpg-srv-instances/inst1 docker-compose stop docker-compose up -d
or
cd /opt/becpg-srv-instances/inst1 docker-compose restart
You can also restart docker
service docker restart
Look at the logs:
cd /opt/becpg-srv-instances/inst1 ./taillogs.sh
or
cd /opt/becpg-srv-instances/inst1 docker-compose logs -f -t --tail="100"
Or you can display a container logs using (here becpg-mail):
docker-compose logs becpg-mail
Full log documentation
https://docs.docker.com/compose/reference/logs
Additional logs are available for each container in /var/lib/docker/volumes/*_logs/*
Deploying new release of beCPG¶
cd /opt/becpg-srv-instances/inst1 docker-compose pull docker-compose up -d
Monitoring application¶
If you wish to monitor application, important metrics are :
- Disk size (df -h)
- Available memory on server (no swapping) (top)
- Java Heap Size and OutOfMemory Errors (docker-compose logs)
Under beCPG admin you also have access to Java memory usage, and connected users
https://{instance}/share/page/console/admin-console/becpg-admin
You can also use Support Tools
https://{instance}/alfresco/s/ootbee/admin/admin-performance
On the server you can use docker to have each container memory usage
cd /opt/becpg-srv-instances/inst1 ./stats.sh
You can also use top
Show space left on device¶
df -h
du -ms /var/lib/docker/volumes
Access to beCPG logs¶
Since Alfresco 5.1 version (beCPG 2.2.1), you can have an access to the Log through the alfresco service.
Use this link to get access to it :
[SERVER ADRESS]/alfresco/s/ootbee/admin/log4j-loggers
Then click on Tail Repository Log (below image)
Reindex in case of index crash¶
cd /opt/becpg-srv-instances/inst1 ./reindex.sh
*Warning it can take a lot of times to reindex > 24H *
Backup¶
The backup in beCPG is a fully automated on-the-spot procedure (which means with a turning on system).
The backup includes:
- The backup of the search index ;
- The backup of the data from databases ;
- The backup of contents and setting data.
The backup order is important, by default it’s guaranteed by the beCPG scripts and carried out in this order :
- 00:00 Statistics update (Cube OLAP)
- 03:00 Creation of the search index backups
- 03:30 Creation of the databases backups
- 04:00 Backups of contents and setting
The backups and contents are available on the beCPG server in : /var/lib/docker/volumes
The backup of the folder can be done thanks to the tool « rsync » or another tool from 4:00 (point 4).
We will refering as $BACKUP_DIR the folder where are store the backup of /var/lib/docker/volumes
Recovery¶
The recovery of the system is done while the system is off.
Stop the service¶
On the beCPG server :
docker stop inst1_becpg_1 docker stop inst1_solr_1
Copy files¶
On the beCPG server :
mv /var/lib/docker/volumes/inst1_becpg_data to /var/lib/docker/volumes/inst1_becpg_data_old cp $BACKUP_DIR/inst1_becpg_data to /var/lib/docker/volumes/
Using rsync:
rsync -P --exclude 'solr4Backup' --exclude 'lucene-indexes' --exclude 'backup-lucene-indexes' --exclude 'keystore' -r -a --delete -v $BACKUP_DIR/inst1_becpg_data/_data/ /var/lib/docker/volumes/inst1_becpg_data/_data/
MySQL databases recovery¶
Mysql backup are located under:
$BACKUP_DIR/inst1_becpg_backups/_data/:- becpg-db
- olap-db
Select the backup you want to restore and unzip the backup
gunzip db_18_01_17.gz gunzip becpg_olap_18_01_17.gz
Import old database to mysql:
For main Database:
echo "DROP DATABASE db;" | docker exec -i inst1_becpg-db_1 mysql -u root -pbecpg echo "CREATE DATABASE db DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;" | docker exec -i inst1_becpg-db_1 mysql -u root -pbecpg docker exec -i inst1_becpg-db_1 mysql -u root -pbecpg db < $BACKUP
$BACKUP refering to db_18_01_17
For olap Database:
echo "DROP DATABASE becpg_olap;" | docker exec -i inst1_olap-db_1 mysql -u root -pbecpg echo "CREATE DATABASE becpg_olap DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;" | docker exec -i inst1_olap-db_1 mysql -u root -pbecpg mysqldump --host=$DB_IP -u becpg -pbecpg becpg_olap < $BACKUP
$BACKUP refering to becpg_olap_18_01_17
Restart the service¶
cd /opt/becpg-srv-instances/inst1 docker-compose -f docker-compose.yml -f docker-compose.prod.yml restart
-- Notes :
- It’s important to keep a backup of the set up virtual machine ;
- This documentation doesn’t cover the recovery or the installation on the virtual machine.