[Helper] Fixes for volume detection of backup/restore script

[Helper] Redis timeout set to 0 in NC
[Helper] Small fixes to check_translations script
master
André 2018-04-26 22:57:20 +02:00
parent 435fee2bc9
commit 3e08416c6d
3 changed files with 15 additions and 13 deletions

View File

@ -47,6 +47,7 @@ COMPOSE_FILE=${SCRIPT_DIR}/../docker-compose.yml
echo "Using ${BACKUP_LOCATION} as backup/restore location." echo "Using ${BACKUP_LOCATION} as backup/restore location."
echo echo
source ${SCRIPT_DIR}/../mailcow.conf source ${SCRIPT_DIR}/../mailcow.conf
CMPS_PRJ=$(echo $COMPOSE_PROJECT_NAME | tr -cd "[A-Za-z-_]")
function backup() { function backup() {
DATE=$(date +"%Y-%m-%d-%H-%M-%S") DATE=$(date +"%Y-%m-%d-%H-%M-%S")
@ -57,33 +58,33 @@ function backup() {
vmail|all) vmail|all)
docker run --rm \ docker run --rm \
-v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup \ -v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup \
-v $(docker volume ls -qf name=vmail-vol-1):/vmail \ -v $(docker volume ls -qf name=${CMPS_PRJ}_vmail-vol-1):/vmail \
debian:stretch-slim /bin/tar -cvpzf /backup/backup_vmail.tar.gz /vmail debian:stretch-slim /bin/tar -cvpzf /backup/backup_vmail.tar.gz /vmail
;;& ;;&
redis|all) redis|all)
docker exec $(docker ps -qf name=redis-mailcow) redis-cli save docker exec $(docker ps -qf name=redis-mailcow) redis-cli save
docker run --rm \ docker run --rm \
-v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup \ -v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup \
-v $(docker volume ls -qf name=redis-vol-1):/redis \ -v $(docker volume ls -qf name=${CMPS_PRJ}_redis-vol-1):/redis \
debian:stretch-slim /bin/tar -cvpzf /backup/backup_redis.tar.gz /redis debian:stretch-slim /bin/tar -cvpzf /backup/backup_redis.tar.gz /redis
;;& ;;&
rspamd|all) rspamd|all)
docker run --rm \ docker run --rm \
-v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup \ -v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup \
-v $(docker volume ls -qf name=rspamd-vol-1):/rspamd \ -v $(docker volume ls -qf name=${CMPS_PRJ}_rspamd-vol-1):/rspamd \
debian:stretch-slim /bin/tar -cvpzf /backup/backup_rspamd.tar.gz /rspamd debian:stretch-slim /bin/tar -cvpzf /backup/backup_rspamd.tar.gz /rspamd
;;& ;;&
postfix|all) postfix|all)
docker run --rm \ docker run --rm \
-v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup \ -v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup \
-v $(docker volume ls -qf name=postfix-vol-1):/postfix \ -v $(docker volume ls -qf name=${CMPS_PRJ}_postfix-vol-1):/postfix \
debian:stretch-slim /bin/tar -cvpzf /backup/backup_postfix.tar.gz /postfix debian:stretch-slim /bin/tar -cvpzf /backup/backup_postfix.tar.gz /postfix
;;& ;;&
mysql|all) mysql|all)
SQLIMAGE=$(grep -iEo '(mysql|mariadb)\:.+' ${COMPOSE_FILE}) SQLIMAGE=$(grep -iEo '(mysql|mariadb)\:.+' ${COMPOSE_FILE})
docker run --rm \ docker run --rm \
--network $(docker network ls -qf name=mailcow) \ --network $(docker network ls -qf name=${CMPS_PRJ}_mailcow-network) \
-v $(docker volume ls -qf name=mysql-vol-1):/var/lib/mysql/ \ -v $(docker volume ls -qf name=${CMPS_PRJ}_mysql-vol-1):/var/lib/mysql/ \
--entrypoint= \ --entrypoint= \
-v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup \ -v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup \
${SQLIMAGE} /bin/sh -c "mysqldump -hmysql -uroot -p${DBROOT} --all-databases | gzip > /backup/backup_mysql.gz" ${SQLIMAGE} /bin/sh -c "mysqldump -hmysql -uroot -p${DBROOT} --all-databases | gzip > /backup/backup_mysql.gz"
@ -103,7 +104,7 @@ function restore() {
docker stop $(docker ps -qf name=dovecot-mailcow) docker stop $(docker ps -qf name=dovecot-mailcow)
docker run -it --rm \ docker run -it --rm \
-v ${RESTORE_LOCATION}:/backup \ -v ${RESTORE_LOCATION}:/backup \
-v $(docker volume ls -qf name=vmail):/vmail \ -v $(docker volume ls -qf name=${CMPS_PRJ}_vmail-vol-1):/vmail \
debian:stretch-slim /bin/tar -xvzf /backup/backup_vmail.tar.gz debian:stretch-slim /bin/tar -xvzf /backup/backup_vmail.tar.gz
docker start $(docker ps -aqf name=dovecot-mailcow) docker start $(docker ps -aqf name=dovecot-mailcow)
echo echo
@ -122,7 +123,7 @@ function restore() {
docker stop $(docker ps -qf name=redis-mailcow) docker stop $(docker ps -qf name=redis-mailcow)
docker run -it --rm \ docker run -it --rm \
-v ${RESTORE_LOCATION}:/backup \ -v ${RESTORE_LOCATION}:/backup \
-v $(docker volume ls -qf name=redis):/redis \ -v $(docker volume ls -qf name=${CMPS_PRJ}_redis-vol-1):/redis \
debian:stretch-slim /bin/tar -xvzf /backup/backup_redis.tar.gz debian:stretch-slim /bin/tar -xvzf /backup/backup_redis.tar.gz
docker start $(docker ps -aqf name=redis-mailcow) docker start $(docker ps -aqf name=redis-mailcow)
;; ;;
@ -130,7 +131,7 @@ function restore() {
docker stop $(docker ps -qf name=rspamd-mailcow) docker stop $(docker ps -qf name=rspamd-mailcow)
docker run -it --rm \ docker run -it --rm \
-v ${RESTORE_LOCATION}:/backup \ -v ${RESTORE_LOCATION}:/backup \
-v $(docker volume ls -qf name=rspamd):/rspamd \ -v $(docker volume ls -qf name=${CMPS_PRJ}_rspamd-vol-1):/rspamd \
debian:stretch-slim /bin/tar -xvzf /backup/backup_rspamd.tar.gz debian:stretch-slim /bin/tar -xvzf /backup/backup_rspamd.tar.gz
docker start $(docker ps -aqf name=rspamd-mailcow) docker start $(docker ps -aqf name=rspamd-mailcow)
;; ;;
@ -138,7 +139,7 @@ function restore() {
docker stop $(docker ps -qf name=postfix-mailcow) docker stop $(docker ps -qf name=postfix-mailcow)
docker run -it --rm \ docker run -it --rm \
-v ${RESTORE_LOCATION}:/backup \ -v ${RESTORE_LOCATION}:/backup \
-v $(docker volume ls -qf name=postfix):/postfix \ -v $(docker volume ls -qf name=${CMPS_PRJ}_postfix-vol-1):/postfix \
debian:stretch-slim /bin/tar -xvzf /backup/backup_postfix.tar.gz debian:stretch-slim /bin/tar -xvzf /backup/backup_postfix.tar.gz
docker start $(docker ps -aqf name=postfix-mailcow) docker start $(docker ps -aqf name=postfix-mailcow)
;; ;;
@ -147,7 +148,7 @@ function restore() {
docker stop $(docker ps -qf name=mysql-mailcow) docker stop $(docker ps -qf name=mysql-mailcow)
docker run \ docker run \
-it --rm \ -it --rm \
-v $(docker volume ls -qf name=mysql):/var/lib/mysql/ \ -v $(docker volume ls -qf name=${CMPS_PRJ}_mysql-vol-1):/var/lib/mysql/ \
--entrypoint= \ --entrypoint= \
-u mysql \ -u mysql \
-v ${RESTORE_LOCATION}:/backup \ -v ${RESTORE_LOCATION}:/backup \

View File

@ -22,7 +22,7 @@ not_used = []
not_used_in_php.each do |string| not_used_in_php.each do |string|
section = string.scan(/([a-z]+)/)[0][0] section = string.scan(/([a-z]+)/)[0][0]
key = string.scan(/([a-z]+)/)[1][0] key = string.scan(/([a-z]+)/)[1][0]
%x[git grep lang.#{key} -- #{DIR}/data/web/js/#{section}.js] %x[git grep lang.#{key} -- #{DIR}/data/web/js/#{section}.js #{DIR}/data/web/js/debug.js]
if $?.exitstatus > 0 if $?.exitstatus > 0
not_used << string not_used << string
end end

View File

@ -86,6 +86,7 @@ elif [[ ${NC_INSTALL} == "y" ]]; then
docker exec -it -u www-data $(docker ps -f name=php-fpm-mailcow -q) bash -c "/web/nextcloud/occ config:system:set redis host --value=redis --type=string; \ docker exec -it -u www-data $(docker ps -f name=php-fpm-mailcow -q) bash -c "/web/nextcloud/occ config:system:set redis host --value=redis --type=string; \
/web/nextcloud/occ config:system:set redis port --value=6379 --type=integer; \ /web/nextcloud/occ config:system:set redis port --value=6379 --type=integer; \
/web/nextcloud/occ config:system:set redis timeout --value=0.0 --type=integer; \
/web/nextcloud/occ config:system:set memcache.locking --value='\OC\Memcache\Redis' --type=string; \ /web/nextcloud/occ config:system:set memcache.locking --value='\OC\Memcache\Redis' --type=string; \
/web/nextcloud/occ config:system:set memcache.local --value='\OC\Memcache\Redis' --type=string; \ /web/nextcloud/occ config:system:set memcache.local --value='\OC\Memcache\Redis' --type=string; \
/web/nextcloud/occ config:system:set trusted_domains 1 --value=${MAILCOW_HOSTNAME}; \ /web/nextcloud/occ config:system:set trusted_domains 1 --value=${MAILCOW_HOSTNAME}; \