parent
4c5eb05d26
commit
1928713b9d
|
@ -173,14 +173,14 @@ sudo git clone https://github.com/samply/bridgehead-config.git /etc/bridgehead;
|
|||
|
||||
You should now be able to run a bridgehead instance. To check if everything works, execute the following:
|
||||
``` shell
|
||||
/srv/docker/bridgehead/bridgehead start <project>
|
||||
/srv/docker/bridgehead/bridgehead start <Project>
|
||||
```
|
||||
|
||||
You should now be able to access the landing page on your system, e.g "https://<your-host>/"
|
||||
|
||||
To shutdown the bridgehead just run.
|
||||
``` shell
|
||||
/srv/docker/bridgehead/bridgehead stop <project>
|
||||
/srv/docker/bridgehead/bridgehead stop <Project>
|
||||
```
|
||||
|
||||
We recommend to run first with the start and stop script and if aviable run the systemd service, which also enables automatic updates and more.
|
||||
|
@ -189,12 +189,12 @@ We recommend to run first with the start and stop script and if aviable run the
|
|||
|
||||
For a server, we highly recommend that you install the system units for managing the bridgehead, provided by us. You can do this by executing the [bridgehead](./bridgehead) script:
|
||||
``` shell
|
||||
sudo /srv/docker/bridgehead/bridgehead install <project>
|
||||
sudo /srv/docker/bridgehead/bridgehead install <Project>
|
||||
```
|
||||
|
||||
Finally, you need to configure your sites secrets. These are places as configuration for each bridgeheads system unit. Refer to the section for your specific project:
|
||||
|
||||
For Every Project you need to set the proxy this way, if you have a proxy.
|
||||
For Every project you need to set the proxy this way, if you have a proxy.
|
||||
|
||||
``` conf
|
||||
[Service]
|
||||
|
|
14
bridgehead
14
bridgehead
|
@ -17,15 +17,15 @@ cd $BASE
|
|||
|
||||
source ./lib/functions.sh
|
||||
|
||||
action=$1
|
||||
export project=$2
|
||||
ACTION=$1
|
||||
export PROJECT=$2
|
||||
|
||||
if [[ -z $1 || -z $2 ]]; then
|
||||
printUsage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$project" in
|
||||
case "$PROJECT" in
|
||||
ccp)
|
||||
#nothing extra to do
|
||||
;;
|
||||
|
@ -43,16 +43,16 @@ esac
|
|||
|
||||
source /etc/bridgehead/site.conf
|
||||
|
||||
case "$action" in
|
||||
case "$ACTION" in
|
||||
start)
|
||||
checkRequirements
|
||||
exec docker-compose -f ./$project/docker-compose.yml --env-file /etc/bridgehead/$project.env up
|
||||
exec docker-compose -f ./$PROJECT/docker-compose.yml --env-file /etc/bridgehead/$PROJECT.env up
|
||||
;;
|
||||
stop)
|
||||
exec docker-compose -f ./$project/docker-compose.yml --env-file /etc/bridgehead/$project.env down
|
||||
exec docker-compose -f ./$PROJECT/docker-compose.yml --env-file /etc/bridgehead/$PROJECT.env down
|
||||
;;
|
||||
update)
|
||||
exec ./lib/update-bridgehead.sh $project
|
||||
exec ./lib/update-bridgehead.sh $PROJECT
|
||||
;;
|
||||
install)
|
||||
exec ./lib/setup-bridgehead-units.sh $project
|
||||
|
|
|
@ -47,8 +47,8 @@ services:
|
|||
- "traefik.http.routers.landing.tls=true"
|
||||
environment:
|
||||
HOST: ${HOST}
|
||||
project: ${project}
|
||||
site_name: ${site_name}
|
||||
PROJECT: ${PROJECT}
|
||||
SITE_NAME: ${SITE_NAME}
|
||||
|
||||
blaze:
|
||||
image: "samply/blaze:0.17"
|
||||
|
|
|
@ -52,8 +52,8 @@ services:
|
|||
- "traefik.http.routers.landing.tls=true"
|
||||
environment:
|
||||
HOST: ${HOST}
|
||||
project: ${project}
|
||||
site_name: ${site_name}
|
||||
PROJECT: ${PROJECT}
|
||||
SITE_NAME: ${SITE_NAME}
|
||||
|
||||
blaze:
|
||||
image: "samply/blaze:0.17"
|
||||
|
|
|
@ -45,14 +45,14 @@ source /etc/bridgehead/site.conf
|
|||
|
||||
# TODO: Check all required variables here in a generic loop
|
||||
|
||||
if [ -z "$site_name" ]; then
|
||||
if [ -z "$SITE_NAME" ]; then
|
||||
log ERROR "Please set site_name."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#check if project env is present
|
||||
if [ -d "/etc/bridgehead/${project}.env" ]; then
|
||||
log ERROR "Project config not found. Please copy the template from ${project} and put it under /etc/bridgehead-config/${project}.env."
|
||||
if [ -d "/etc/bridgehead/${PROJECT}.env" ]; then
|
||||
log ERROR "Project config not found. Please copy the template from ${PROJECT} and put it under /etc/bridgehead-config/${PROJECT}.env."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
@ -12,12 +12,12 @@ if [ $1 != "ccp" ] && [ $1 != "nngm" ] && [ $1 != "gbn" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
export project=$1
|
||||
export PROJECT=$1
|
||||
|
||||
#checkRequirements // not needed when uninstalling
|
||||
|
||||
log "Stopping systemd services and removing bridgehead ..."
|
||||
|
||||
systemctl disable --now bridgehead@${project}.service bridgehead-update@${project}.timer bridgehead-update@${project}.service
|
||||
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}
|
||||
|
|
|
@ -14,7 +14,7 @@ if [ $1 != "ccp" ] && [ $1 != "nngm" ] && [ $1 != "gbn" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
export project=$1
|
||||
export PROJECT=$1
|
||||
|
||||
checkRequirements
|
||||
|
||||
|
@ -29,11 +29,11 @@ systemctl daemon-reload
|
|||
|
||||
echo
|
||||
|
||||
if ! systemctl is-active --quiet bridgehead@"${project}"; then
|
||||
log "Enabling autostart of bridgehead@${project}.service"
|
||||
systemctl enable bridgehead@"${project}"
|
||||
log "Enabling nightly updates for bridgehead@${project}.service ..."
|
||||
systemctl enable --now bridgehead-update@"${project}".timer
|
||||
if ! systemctl is-active --quiet bridgehead@"${PROJECT}"; then
|
||||
log "Enabling autostart of bridgehead@${PROJECT}.service"
|
||||
systemctl enable bridgehead@"${PROJECT}"
|
||||
log "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."
|
||||
echo -e "\nDone - now start your bridgehead by running\n\tsystemctl start bridgehead@${PROJECT}.service\nor by rebooting your machine."
|
||||
|
|
|
@ -1,34 +1,35 @@
|
|||
#!/bin/bash
|
||||
service="bridgehead"
|
||||
|
||||
source lib/functions.sh
|
||||
|
||||
#checkRequirements // not required for mere update
|
||||
log "INFO" "Checking for updates of services"
|
||||
|
||||
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
|
||||
# Check git updates
|
||||
for DIR in /etc/bridgehead $(pwd); do
|
||||
old_git_hash="$(git -C $DIR rev-parse --verify HEAD)"
|
||||
git -C $DIR fetch 2>&1
|
||||
git -C $DIR pull 2>&1
|
||||
new_git_hash="$(git -C $DIR 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
|
||||
fi
|
||||
done
|
||||
|
||||
# Check docker updates
|
||||
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."
|
||||
for IMAGE in $(docker ps --filter "name=bridgehead" --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 anything is updated, restart service
|
||||
if [ $git_updated = "true" ] || [ $docker_updated = "true" ]; then
|
||||
log "INFO" "Due to previous updates now restarting $service@$1"
|
||||
systemctl restart "$service@$1.service"
|
||||
log "INFO" "Due to previous updates now restarting bridgehead"
|
||||
systemctl restart 'bridgehead@*'
|
||||
fi
|
||||
log "INFO" "checking updates finished"
|
||||
exit 0
|
|
@ -42,8 +42,8 @@ services:
|
|||
- "traefik.http.routers.landing.tls=true"
|
||||
environment:
|
||||
HOST: ${HOST}
|
||||
project: ${project}
|
||||
site_name: ${site_name}
|
||||
PROJECT: ${PROJECT}
|
||||
SITE_NAME: ${SITE_NAME}
|
||||
|
||||
nngm-connector:
|
||||
container_name: bridgehead-nngm-connector
|
||||
|
|
Loading…
Reference in New Issue