(simatec) Beta 0.6.0

This commit is contained in:
simatec 2022-12-18 13:15:56 +01:00
parent d641f8801d
commit 30733904de
5 changed files with 223 additions and 25 deletions

View file

@ -80,6 +80,25 @@ If Let's Encrypt is disabled, the Piler is at http://your-piler-domain or at htt
> After installation, any changes can be made in piler.conf at any time and the install script can then be run again.
**********************************************************************************************************
### Update Guide:
You can execute the following commands to update the containers.
Here the current yml files are downloaded from Github and the containers are updated if necessary.
```
cd /opt/piler-docker
bash update.sh
```
* After a successful update, unused container images can be removed from the system with the following command:
```
docker system prune
```
**********************************************************************************************************
### Using the Piler on the command line
@ -116,6 +135,10 @@ To leave the container on the console you have to execute 2x `exit`.
**********************************************************************************************************
## Changelog
### 0.6.0 (18.12.2022)
* (simatec) Update Installer
* (simatec) update.sh added
* (simatec) downgrade mariadb to v10.5
### 0.5.3 (17.12.2022)
* (simatec) Installer Fix

View file

@ -2,7 +2,7 @@ version: "3"
services:
mysql:
image: mariadb:10.9.4
image: mariadb:10.5
container_name: mysql_piler
restart: unless-stopped
cap_drop:

View file

@ -23,7 +23,7 @@ services:
environment:
- DEFAULT_EMAIL=${LETSENCRYPT_EMAIL}
mysql:
image: mariadb:10.9.4
image: mariadb:10.5
container_name: mysql-piler
restart: unless-stopped
cap_drop:

View file

@ -22,19 +22,52 @@ fi
HLINE="=================================================================="
BLA_metro=( 0.2 ' ' '= ' '== ' '=== ' ' ===' ' ==' ' =' )
BLA::play_loading_animation_loop() {
while true ; do
for frame in "${BLA_active_loading_animation[@]}" ; do
printf "\r%s" "${frame}"
sleep "${BLA_loading_animation_frame_interval}"
done
done
}
BLA::start_loading_animation() {
BLA_active_loading_animation=( "${@}" )
BLA_loading_animation_frame_interval="${BLA_active_loading_animation[0]}"
unset "BLA_active_loading_animation[0]"
tput civis # Hide the terminal cursor
BLA::play_loading_animation_loop &
BLA_loading_animation_pid="${!}"
}
BLA::stop_loading_animation() {
kill "${BLA_loading_animation_pid}" &> /dev/null
printf "\n"
tput cnorm # Restore the terminal cursor
}
#######################################################################################
installPth = "/opt/piler-docker"
configPth = "/opt/piler-docker/config"
etcPth = "/var/lib/docker/volumes/piler-docker_piler_etc/_data"
# Load config
. ./piler.conf
if [ ! -f /opt/piler-docker/.env ]; then
if [ ! -f $installPth/.env ]; then
ln -s ./piler.conf .env
fi
if [ -f /opt/piler-docker/docker-compose.yml ]; then
rm /opt/piler-docker/docker-compose.yml
if [ -f $installPth/docker-compose.yml ]; then
rm $installPth/docker-compose.yml
fi
if [ "$USE_LETSENCRYPT" = "yes" ]; then
cp /opt/piler-docker/config/piler-ssl.yml /opt/piler-docker/docker-compose.yml
cp $configPth/piler-ssl.yml $installPth/docker-compose.yml
else
cp /opt/piler-docker/config/piler-default.yml /opt/piler-docker/docker-compose.yml
cp $configPth/piler-default.yml $installPth/docker-compose.yml
fi
while true; do
@ -45,8 +78,9 @@ while true; do
* ) echo -e "${red} Please confirm with y or n.";;
esac
done
# old docker stop
cd /opt/piler-docker
cd $installPth
docker-compose down
# docker start
@ -56,7 +90,7 @@ echo "${greenBold} start docker-compose for Piler"
echo "${greenBold}${HLINE}${normal}"
echo
cd /opt/piler-docker
cd $installPth
if [ "$USE_LETSENCRYPT" = "yes" ]; then
if ! docker network ls | grep -o "nginx-proxy"; then
@ -72,8 +106,11 @@ fi
docker-compose up -d
echo "${blue}********* Piler started.... Please wait........"
echo "${blue}********* Piler started... Please wait... *********"
BLA::start_loading_animation "${BLA_metro[@]}"
sleep 20
BLA::stop_loading_animation
echo
echo "${blue}${HLINE}"
@ -81,11 +118,11 @@ echo "${blue} backup the File config-site.php"
echo "${blue}${HLINE}${normal}"
echo
if [ ! -f /var/lib/docker/volumes/piler-docker_piler_etc/_data/config-site.php.bak ]; then
cp /var/lib/docker/volumes/piler-docker_piler_etc/_data/config-site.php /var/lib/docker/volumes/piler-docker_piler_etc/_data/config-site.php.bak
if [ ! -f $etcPth/config-site.php.bak ]; then
cp $etcPth/config-site.php $etcPth/config-site.php.bak
else
rm /var/lib/docker/volumes/piler-docker_piler_etc/_data/config-site.php
cp /var/lib/docker/volumes/piler-docker_piler_etc/_data/config-site.php.bak /var/lib/docker/volumes/piler-docker_piler_etc/_data/config-site.php
rm $etcPth/config-site.php
cp $etcPth/config-site.php.bak $etcPth/config-site.php
fi
echo
@ -94,7 +131,7 @@ echo "${blue} set User settings ..."
echo "${blue}${HLINE}${normal}"
echo
cat >> /var/lib/docker/volumes/piler-docker_piler_etc/_data/config-site.php <<EOF
cat >> $etcPth/config-site.php <<EOF
// Smarthost
\$config['SMARTHOST'] = '$SMARTHOST';
@ -163,7 +200,7 @@ echo "set Mailcow Api-Key config"
echo "${blue}${HLINE}${normal}"
echo
cat >> /var/lib/docker/volumes/piler-docker_piler_etc/_data/config-site.php <<EOF
cat >> $etcPth/config-site.php <<EOF
// Mailcow API
\$config['MAILCOW_API_KEY'] = '$MAILCOW_APIKEY';
@ -173,22 +210,22 @@ cat >> /var/lib/docker/volumes/piler-docker_piler_etc/_data/config-site.php <<EO
include('auth-mailcow.php');
EOF
curl -o /var/lib/docker/volumes/piler-docker_piler_etc/_data/auth-mailcow.php https://raw.githubusercontent.com/patschi/mailpiler-mailcow-integration/master/auth-mailcow.php
curl -o $etcPth/auth-mailcow.php https://raw.githubusercontent.com/patschi/mailpiler-mailcow-integration/master/auth-mailcow.php
fi
# add config settings
if [ ! -f /var/lib/docker/volumes/piler-docker_piler_etc/_data/piler.conf.bak ]; then
cp /var/lib/docker/volumes/piler-docker_piler_etc/_data/piler.conf /var/lib/docker/volumes/piler-docker_piler_etc/_data/piler.conf.bak
if [ ! -f $etcPth/piler.conf.bak ]; then
cp $etcPth/piler.conf $etcPth/piler.conf.bak
else
rm /var/lib/docker/volumes/piler-docker_piler_etc/_data/piler.conf
cp /var/lib/docker/volumes/piler-docker_piler_etc/_data/piler.conf.bak /var/lib/docker/volumes/piler-docker_piler_etc/_data/piler.conf
rm $etcPth/piler.conf
cp $etcPth/piler.conf.bak $etcPth/piler.conf
fi
sed -i "s/default_retention_days=.*/default_retention_days=$DEFAULT_RETENTION_DAYS/" /var/lib/docker/volumes/piler-docker_piler_etc/_data/piler.conf
sed -i "s/update_counters_to_memcached=.*/update_counters_to_memcached=1/" /var/lib/docker/volumes/piler-docker_piler_etc/_data/piler.conf
sed -i "s/default_retention_days=.*/default_retention_days=$DEFAULT_RETENTION_DAYS/" $etcPth/piler.conf
sed -i "s/update_counters_to_memcached=.*/update_counters_to_memcached=1/" $etcPth/piler.conf
cat >> /var/lib/docker/volumes/piler-docker_piler_etc/_data/piler.conf <<EOF
cat >> $etcPth/piler.conf <<EOF
queuedir=/var/piler/store
EOF
@ -199,7 +236,7 @@ echo "${blue} restart piler ..."
echo "${blue}${HLINE}${normal}"
echo
cd /opt/piler-docker
cd $installPth
docker-compose restart piler
echo

138
update.sh Normal file
View file

@ -0,0 +1,138 @@
#!/bin/bash
# Colors
if [ -z ${BASH_SOURCE} ]; then
blue=`echo "\e[1m\e[34m"`
green=`echo "\e[1m\e[32m"`
greenBold=`echo "\e[1m\e[1;32m"`
redBold=`echo "\e[1m\e[1;31m"`
red=`echo "\e[1m\e[31m"`
purple=`echo "\e[1m\e[35m"`
bold=`echo "\e[1m"`
normal=`echo "\e[0m"`
else
blue=`echo -e "\e[1m\e[34m"`
green=`echo -e "\e[1m\e[32m"`
greenBold=`echo -e "\e[1m\e[1;32m"`
redBold=`echo -e "\e[1m\e[1;31m"`
puple=`echo -e "\e[1m\e[35m"`
bold=`echo -e "\e[1m"`
normal=`echo -en "\e[0m"`
fi
HLINE="=================================================================="
BLA_metro=( 0.2 ' ' '= ' '== ' '=== ' ' ===' ' ==' ' =' )
BLA::play_loading_animation_loop() {
while true ; do
for frame in "${BLA_active_loading_animation[@]}" ; do
printf "\r%s" "${frame}"
sleep "${BLA_loading_animation_frame_interval}"
done
done
}
BLA::start_loading_animation() {
BLA_active_loading_animation=( "${@}" )
BLA_loading_animation_frame_interval="${BLA_active_loading_animation[0]}"
unset "BLA_active_loading_animation[0]"
tput civis # Hide the terminal cursor
BLA::play_loading_animation_loop &
BLA_loading_animation_pid="${!}"
}
BLA::stop_loading_animation() {
kill "${BLA_loading_animation_pid}" &> /dev/null
printf "\n"
tput cnorm # Restore the terminal cursor
}
#######################################################################################
installPth = "/opt/piler-docker"
configPth = "/opt/piler-docker/config"
# config load
. ./piler.conf
if [ ! -f $installPth/.env ]; then
ln -s ./piler.conf .env
fi
if [ -f $installPth/docker-compose.yml ]; then
rm $installPth/docker-compose.yml
fi
# Download yml update
echo
echo "${greenBold}${HLINE}"
echo "${greenBold} Download Update files for Piler"
echo "${greenBold}${HLINE}${normal}"
echo
cd $configPth
# Update yml
curl -OL https://raw.githubusercontent.com/simatec/piler-docker/main/config/piler-default.yml
curl -OL https://raw.githubusercontent.com/simatec/piler-docker/main/config/piler-ssl.yml
# old docker stop
cd $installPth
docker-compose down
if [ "$USE_LETSENCRYPT" = "yes" ]; then
cp $configPth/piler-ssl.yml $installPth/docker-compose.yml
else
cp $configPth/piler-default.yml $installPth/docker-compose.yml
fi
# start Update Container
echo
echo "${greenBold}${HLINE}"
echo "${greenBold} Update Container for Piler"
echo "${greenBold}${HLINE}${normal}"
echo
if [ "$USE_LETSENCRYPT" = "yes" ]; then
if ! docker network ls | grep -o "nginx-proxy"; then
docker network create nginx-proxy
echo
echo "${blue}${HLINE}"
echo "${blue} docker network created"
echo "${blue}${HLINE}${normal}"
echo
fi
fi
docker-compose up --force-recreate --build -d
echo "${blue}********* Piler started... Please wait... *********"
BLA::start_loading_animation "${BLA_metro[@]}"
sleep 10
BLA::stop_loading_animation
echo
echo "${greenBold}${HLINE}"
echo "${greenBold} Piler Update completed successfully"
echo "${greenBold}${HLINE}${normal}"
echo
echo
echo "${greenBold}${HLINE}"
if [ "$USE_LETSENCRYPT" = "yes" ]; then
echo "${greenBold}you can start in your Browser with https://${PILER_DOMAIN}!"
else
echo "${greenBold}you can start in your Browser with:"
echo "${greenBold}http://${PILER_DOMAIN} or http://local-ip"
fi
echo "${greenBold}${HLINE}${normal}"
echo
echo "${blue}${HLINE}"
echo "${blue}You can remove the old unused containers on your system!"
echo "${blue}Execute the following command: docker system prune"
echo "${blue}${HLINE}${normal}"
echo