Fixed naming

Update the git config repo
This commit is contained in:
Patrick Skowronek 2022-05-11 10:30:18 +02:00
parent 4c5eb05d26
commit 1928713b9d
9 changed files with 52 additions and 51 deletions

View File

@ -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: You should now be able to run a bridgehead instance. To check if everything works, execute the following:
``` shell ``` 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>/" You should now be able to access the landing page on your system, e.g "https://<your-host>/"
To shutdown the bridgehead just run. To shutdown the bridgehead just run.
``` shell ``` 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. 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: 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 ``` 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: 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 ``` conf
[Service] [Service]

View File

@ -17,15 +17,15 @@ cd $BASE
source ./lib/functions.sh source ./lib/functions.sh
action=$1 ACTION=$1
export project=$2 export PROJECT=$2
if [[ -z $1 || -z $2 ]]; then if [[ -z $1 || -z $2 ]]; then
printUsage printUsage
exit 1 exit 1
fi fi
case "$project" in case "$PROJECT" in
ccp) ccp)
#nothing extra to do #nothing extra to do
;; ;;
@ -43,16 +43,16 @@ esac
source /etc/bridgehead/site.conf source /etc/bridgehead/site.conf
case "$action" in case "$ACTION" in
start) start)
checkRequirements 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) 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) update)
exec ./lib/update-bridgehead.sh $project exec ./lib/update-bridgehead.sh $PROJECT
;; ;;
install) install)
exec ./lib/setup-bridgehead-units.sh $project exec ./lib/setup-bridgehead-units.sh $project

View File

@ -47,8 +47,8 @@ services:
- "traefik.http.routers.landing.tls=true" - "traefik.http.routers.landing.tls=true"
environment: environment:
HOST: ${HOST} HOST: ${HOST}
project: ${project} PROJECT: ${PROJECT}
site_name: ${site_name} SITE_NAME: ${SITE_NAME}
blaze: blaze:
image: "samply/blaze:0.17" image: "samply/blaze:0.17"

View File

@ -52,8 +52,8 @@ services:
- "traefik.http.routers.landing.tls=true" - "traefik.http.routers.landing.tls=true"
environment: environment:
HOST: ${HOST} HOST: ${HOST}
project: ${project} PROJECT: ${PROJECT}
site_name: ${site_name} SITE_NAME: ${SITE_NAME}
blaze: blaze:
image: "samply/blaze:0.17" image: "samply/blaze:0.17"

View File

@ -45,14 +45,14 @@ source /etc/bridgehead/site.conf
# TODO: Check all required variables here in a generic loop # 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." log ERROR "Please set site_name."
exit 1 exit 1
fi fi
#check if project env is present #check if project env is present
if [ -d "/etc/bridgehead/${project}.env" ]; then 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." log ERROR "Project config not found. Please copy the template from ${PROJECT} and put it under /etc/bridgehead-config/${PROJECT}.env."
exit 1 exit 1
fi fi

View File

@ -12,12 +12,12 @@ if [ $1 != "ccp" ] && [ $1 != "nngm" ] && [ $1 != "gbn" ]; then
exit 1 exit 1
fi fi
export project=$1 export PROJECT=$1
#checkRequirements // not needed when uninstalling #checkRequirements // not needed when uninstalling
log "Stopping systemd services and removing bridgehead ..." 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} rm -v /etc/systemd/system/{bridgehead\@.service,bridgehead-update\@.timer,bridgehead-update\@.service}

View File

@ -14,7 +14,7 @@ if [ $1 != "ccp" ] && [ $1 != "nngm" ] && [ $1 != "gbn" ]; then
exit 1 exit 1
fi fi
export project=$1 export PROJECT=$1
checkRequirements checkRequirements
@ -29,11 +29,11 @@ systemctl daemon-reload
echo echo
if ! systemctl is-active --quiet bridgehead@"${project}"; then if ! systemctl is-active --quiet bridgehead@"${PROJECT}"; then
log "Enabling autostart of bridgehead@${project}.service" log "Enabling autostart of bridgehead@${PROJECT}.service"
systemctl enable bridgehead@"${project}" systemctl enable bridgehead@"${PROJECT}"
log "Enabling nightly updates for bridgehead@${project}.service ..." log "Enabling nightly updates for bridgehead@${PROJECT}.service ..."
systemctl enable --now bridgehead-update@"${project}".timer systemctl enable --now bridgehead-update@"${PROJECT}".timer
fi 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."

View File

@ -1,34 +1,35 @@
#!/bin/bash #!/bin/bash
service="bridgehead"
source lib/functions.sh 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 git updates
# check prerequisites 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
done
# check if updates are available # Check docker updates
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" docker_updated="false"
for image in $(docker ps --filter "name=$service" --format {{.Image}}); do for IMAGE in $(docker ps --filter "name=bridgehead" --format {{.Image}}); do
log "INFO" "Checking for Updates of Image: $image" log "INFO" "Checking for Updates of Image: $IMAGE"
if docker pull $image | grep "Downloaded newer image"; then if docker pull $IMAGE | grep "Downloaded newer image"; then
log "INFO" "$image updated." log "INFO" "$IMAGE updated."
docker_updated="true" docker_updated="true"
fi fi
done done
# If anything is updated, restart service
if [ $git_updated = "true" ] || [ $docker_updated = "true" ]; then if [ $git_updated = "true" ] || [ $docker_updated = "true" ]; then
log "INFO" "Due to previous updates now restarting $service@$1" log "INFO" "Due to previous updates now restarting bridgehead"
systemctl restart "$service@$1.service" systemctl restart 'bridgehead@*'
fi fi
log "INFO" "checking updates finished" log "INFO" "checking updates finished"
exit 0 exit 0

View File

@ -42,8 +42,8 @@ services:
- "traefik.http.routers.landing.tls=true" - "traefik.http.routers.landing.tls=true"
environment: environment:
HOST: ${HOST} HOST: ${HOST}
project: ${project} PROJECT: ${PROJECT}
site_name: ${site_name} SITE_NAME: ${SITE_NAME}
nngm-connector: nngm-connector:
container_name: bridgehead-nngm-connector container_name: bridgehead-nngm-connector