mirror of https://github.com/samply/bridgehead.git
refactor: Remove unused Bridgehead Scripts
This commit is contained in:
parent
f4f33b95fc
commit
996e8dbd1b
|
@ -1,32 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
### Note: Currently not complete, needs some features before useable for production
|
|
||||||
|
|
||||||
source lib/functions.sh
|
|
||||||
|
|
||||||
exitIfNotRoot
|
|
||||||
|
|
||||||
if ! ./lib/prerequisites.sh; then
|
|
||||||
log "Prerequisites failed, exiting"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
source site.conf
|
|
||||||
|
|
||||||
./lib/generate.sh
|
|
||||||
|
|
||||||
echo -e "\nInstalling systemd units ..."
|
|
||||||
cp -v \
|
|
||||||
lib/systemd/bridgehead\@.service \
|
|
||||||
lib/systemd/bridgehead-update\@.service \
|
|
||||||
lib/systemd/bridgehead-update\@.timer \
|
|
||||||
/etc/systemd/system/
|
|
||||||
|
|
||||||
systemctl daemon-reload
|
|
||||||
|
|
||||||
if ! systemctl is-active --quiet bridgehead@"${project}"; then
|
|
||||||
echo "Enabling autostart of bridgehead@${project}.service"
|
|
||||||
systemctl enable bridgehead@"${project}"
|
|
||||||
echo "Enabling nightly updates for bridgehead@${project}.service ..."
|
|
||||||
systemctl enable --now bridgehead-update@"${project}".timer
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e "\nDone - now start your bridgehead by running\n\tsystemctl start bridgehead@${project}.service\nor by rebooting your machine."
|
|
|
@ -1,18 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
### Note: Currently not complete, needs some features before useable for production
|
|
||||||
|
|
||||||
source lib/functions.sh
|
|
||||||
|
|
||||||
if ! lib/prerequisites.sh; then
|
|
||||||
log "Prerequisites failed, exiting"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
source site.conf
|
|
||||||
|
|
||||||
./lib/generate.sh
|
|
||||||
|
|
||||||
log "Starting bridgehead"
|
|
||||||
|
|
||||||
docker-compose -f <(docker run --rm --volume ${pwd}/${project}/:/tmp/workdir/ samply/templer /tmp/workdir/docker-compose.yml TEST="TEST_0 TEST_1") config
|
|
||||||
|
|
||||||
log "The bridgehead should be in online in a few seconds"
|
|
|
@ -1,8 +0,0 @@
|
||||||
#!/bin/bash -e
|
|
||||||
|
|
||||||
source lib/functions.sh
|
|
||||||
source site.conf
|
|
||||||
|
|
||||||
log "Stopping bridgehead"
|
|
||||||
|
|
||||||
docker-compose -f ${project}/docker-compose.yml --env-file site-config/${project}.env down
|
|
|
@ -1,10 +0,0 @@
|
||||||
#!/bin/bash -e
|
|
||||||
|
|
||||||
source site.conf
|
|
||||||
source lib/functions.sh
|
|
||||||
|
|
||||||
echo "Stopping systemd services and removing bridgehead ..."
|
|
||||||
|
|
||||||
systemctl disable --now bridgehead@${project}.service bridgehead-update@${project}.timer bridgehead-update@${project}.service
|
|
||||||
|
|
||||||
rm -v /etc/systemd/system/{bridgehead\@.service,bridgehead-update\@.timer,bridgehead-update\@.service}
|
|
|
@ -1,38 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
service="bridgehead"
|
|
||||||
|
|
||||||
source lib/functions.sh
|
|
||||||
|
|
||||||
if ! lib/prerequisites.sh; then
|
|
||||||
log "Prerequisites failed, exiting"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
log "INFO" "Checking for updates of $service"
|
|
||||||
# check prerequisites
|
|
||||||
|
|
||||||
# check if updates are available
|
|
||||||
old_git_hash="$(git rev-parse --verify HEAD)"
|
|
||||||
git fetch 2>&1
|
|
||||||
git pull 2>&1
|
|
||||||
new_git_hash="$(git rev-parse --verify HEAD)"
|
|
||||||
git_updated="false"
|
|
||||||
if [ "$old_git_hash" != "$new_git_hash" ]; then
|
|
||||||
log "INFO" "Pulled new changes from origin"
|
|
||||||
git_updated="true"
|
|
||||||
fi
|
|
||||||
docker_updated="false"
|
|
||||||
for image in $(docker ps --filter "name=$service" --format {{.Image}}); do
|
|
||||||
log "INFO" "Checking for Updates of Image: $image"
|
|
||||||
if docker pull $image | grep "Downloaded newer image"; then
|
|
||||||
log "INFO" "$image updated."
|
|
||||||
docker_updated="true"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ $git_updated = "true" ] || [ $docker_updated = "true" ]; then
|
|
||||||
log "INFO" "Due to previous updates now restarting $service@$1"
|
|
||||||
systemctl restart "$service@$1.service"
|
|
||||||
./lib/generate.sh
|
|
||||||
fi
|
|
||||||
log "INFO" "checking updates finished"
|
|
||||||
exit 0
|
|
Loading…
Reference in New Issue