mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-05 01:09:30 +00:00
minimal viable product
This commit is contained in:
73
deploy.sh
Executable file
73
deploy.sh
Executable file
@@ -0,0 +1,73 @@
|
||||
#!/bin/bash
|
||||
|
||||
# deploy all needed project files to different servers:
|
||||
# test for local vm for testing
|
||||
# blackhole for local production
|
||||
# docker to publish
|
||||
|
||||
set -e
|
||||
|
||||
function sync_blackhole {
|
||||
|
||||
# docker commands need sudo
|
||||
host="blackhole.local"
|
||||
|
||||
read -sp 'Password: ' remote_pw
|
||||
export PASS=$remote_pw
|
||||
|
||||
rsync -a --progress --delete-after \
|
||||
--exclude "**/cache" \
|
||||
--exclude "**/__pycache__/" \
|
||||
--exclude "db.sqlite3" \
|
||||
. -e ssh "$host":tubearchivist
|
||||
|
||||
echo "$PASS" | ssh "$host" 'sudo -S docker build -t bbilly1/tubearchivist:latest tubearchivist 2>/dev/null'
|
||||
echo "$PASS" | ssh "$host" 'sudo -S docker-compose up -d 2>/dev/null'
|
||||
|
||||
}
|
||||
|
||||
function sync_test {
|
||||
|
||||
# docker commands don't need sudo in testing vm
|
||||
host="tubearchivist.local"
|
||||
|
||||
rsync -a --progress --delete-after \
|
||||
--exclude "**/cache" \
|
||||
--exclude "**/__pycache__/" \
|
||||
--exclude "db.sqlite3" \
|
||||
. -e ssh "$host":tubearchivist
|
||||
|
||||
rsync -r --progress --delete docker-compose.yml -e ssh "$host":docker
|
||||
|
||||
ssh "$host" 'docker build -t bbilly1/tubearchivist:latest tubearchivist'
|
||||
ssh "$host" 'docker-compose -f docker/docker-compose.yml up -d'
|
||||
|
||||
}
|
||||
|
||||
|
||||
function sync_docker {
|
||||
|
||||
if [[ $(systemctl is-active docker) != 'active' ]]; then
|
||||
echo "starting docker"
|
||||
sudo systemctl start docker
|
||||
fi
|
||||
|
||||
sudo docker build -t bbilly1/tubearchivist:latest .
|
||||
sudo docker push bbilly1/tubearchivist:latest
|
||||
|
||||
}
|
||||
|
||||
|
||||
if [[ $1 == "blackhole" ]]; then
|
||||
sync_blackhole
|
||||
elif [[ $1 == "test" ]]; then
|
||||
sync_test
|
||||
elif [[ $1 == "docker" ]]; then
|
||||
sync_docker
|
||||
else
|
||||
echo "valid options are: blackhole | test | docker"
|
||||
fi
|
||||
|
||||
|
||||
##
|
||||
exit 0
|
||||
Reference in New Issue
Block a user