Initial import
This commit is contained in:
commit
7c1a0bbcf2
2 changed files with 54 additions and 0 deletions
0
README.md
Normal file
0
README.md
Normal file
54
dokku-sync.sh
Normal file
54
dokku-sync.sh
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# vim: set ts=2 sw=2 et:
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -u
|
||||||
|
|
||||||
|
LOCAL="danaos.infra.glenux.net"
|
||||||
|
REMOTE="dinlas.infra.glenux.net"
|
||||||
|
SSH_REMOTE="root@$REMOTE"
|
||||||
|
SSH_KEY="$HOME/.ssh/dinlas-to-danaos_rsync2022_ed25519"
|
||||||
|
|
||||||
|
sshrun() {
|
||||||
|
ssh -i "$SSH_KEY" root@dinlas.infra.glenux.net "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
# mkdir -p /srv/backup
|
||||||
|
# APPS=$ (sshrun "dokku ls" |awk '/^[^--]/ { print $1; }')
|
||||||
|
|
||||||
|
# Stop all remote services
|
||||||
|
sshrun "dokku ps:stop --all"
|
||||||
|
|
||||||
|
sshrun "dokku mariadb:list |tail -n+2 |xargs -iSERVICE -- dokku mariadb:stop SERVICE"
|
||||||
|
sshrun "dokku postgres:list |tail -n+2 |xargs -iSERVICE -- dokku postgres:stop SERVICE"
|
||||||
|
sshrun "dokku redis:list |tail -n+2 |xargs -iSERVICE -- dokku redis:stop SERVICE"
|
||||||
|
sshrun "dokku mongo:list |tail -n+2 |xargs -iSERVICE -- dokku mongo:stop SERVICE"
|
||||||
|
|
||||||
|
sshrun "systemctl stop docker"
|
||||||
|
sshrun "systemctl stop docker.socket"
|
||||||
|
|
||||||
|
|
||||||
|
# Stop all local services
|
||||||
|
dokku ps:stop --all
|
||||||
|
systemctl stop docker
|
||||||
|
systemctl stop docker.socket
|
||||||
|
|
||||||
|
# Copy all data
|
||||||
|
mkdir -p /home/dokku/
|
||||||
|
mkdir -p /home/data/
|
||||||
|
mkdir -p /var/lib/dokku/
|
||||||
|
|
||||||
|
rsync -avz --delete "$SSH_REMOTE:/home/dokku/" /home/dokku/
|
||||||
|
rsync -avz --delete "$SSH_REMOTE:/var/lib/dokku/" /var/lib/dokku/
|
||||||
|
rsync -avz --delete "$SSH_REMOTE:/home/data/" /home/data/
|
||||||
|
rsync -avz --delete "$SSH_REMOTE:/home/git/" /home/git/
|
||||||
|
|
||||||
|
# Start all local services
|
||||||
|
dokku apps:list
|
||||||
|
|
||||||
|
# Patch URLs from imported domains
|
||||||
|
find /home/dokku/ -name VHOST -or -name URLS \
|
||||||
|
| xargs -iFILE -- \
|
||||||
|
sed -i "s/$REMOTE/$LOCAL/g" FILE
|
||||||
|
|
||||||
|
echo "SUCCESS"
|
Loading…
Reference in a new issue