Some fixes after review with Martin

This commit is contained in:
Patrick Skowronek
2022-05-09 12:57:24 +02:00
parent 445add6d30
commit dc8b8b3339
11 changed files with 58 additions and 51 deletions

View File

@ -1,14 +1,15 @@
#!/bin/bash -e
source lib/functions.sh
echo "This script add's a user with password to the bridghead"
log "This script add's a user with password to the bridghead"
if [ $# -eq 0 ]; then
echo "No arguments provided, please provide the project name"
log "No arguments provided, please provide the project name"
exit 1
fi
if [ ! -f /etc/systemd/system/bridgehead@$1.service.d/override.conf ]; then
echo "Please create a Service first, with setup-bridgehead-units.sh"
log "Please create a Service first, with setup-bridgehead-units.sh"
exit
fi

View File

@ -40,7 +40,7 @@ then
"
LOCAL_SERVICES+=" <tr>
<td>CCP</td>
<td><a href=\"https://${HOST}/cpp-localdatamanagement/fhir/\">Blaze</a></td>
<td><a href=\"https://${HOST}/ccp-localdatamanagement/fhir/\">Blaze</a></td>
</tr>
"
fi

View File

@ -2,8 +2,8 @@
## Check if user is a su
echo "Welcome to the starting a bridgehead. We will get your instance up and running in no time"
echo "First we will check if all prerequisites are met ..."
log "Welcome to the starting a bridgehead. We will get your instance up and running in no time"
log "First we will check if all prerequisites are met ..."
prerequisites="git docker docker-compose"
for prerequisite in $prerequisites; do
$prerequisite --version 2>&1
@ -15,54 +15,54 @@ for prerequisite in $prerequisites; do
# TODO: Check for specific version
done
echo "Checking /etc/bridgehead/"
log "Checking /etc/bridgehead/"
## Download submodule
if [ ! -d "/etc/bridgehead/" ]; then
echo "Please set up the config folder. Instruction are in the readme."
log "Please set up the config folder. Instruction are in the readme."
exit 1
else
echo "Done"
log "Done"
fi
echo "Checking /etc/bridgehead/site.conf"
log "Checking /etc/bridgehead/site.conf"
#check if site.conf is created
if [ ! -f /etc/bridgehead/site.conf ]; then
echo "Please create your specific site.conf file from the site.dev.conf"
log "Please create your specific site.conf file from the site.dev.conf"
exit 1
else
echo "Done"
log "Done"
fi
#Load site specific variables
source /etc/bridgehead/site.conf
if [ -z "$site_name" ]; then
echo "Please set site_name"
log "Please set site_name"
exit 1
fi
echo "Checking project config"
log "Checking project config"
#check if project env is present
if [ -d "/etc/bridgehead/${project}.env" ]; then
echo "Please copy the tempalte from ${project} and put it in the /etc/bridgehead-config/ folder"
log "Please copy the tempalte from ${project} and put it in the /etc/bridgehead-config/ folder"
exit 1
else
echo "Done"
log "Done"
fi
echo "Checking ssl cert"
log "Checking ssl cert"
## Create SSL Cert
if [ ! -d "/certs" ]; then
echo "SSL cert missing, now we create one. Please consider getting a signed one"
log "SSL cert missing, now we create one. Please consider getting a signed one"
mkdir certs
fi
if [ -d "/etc/bridgehead/traefik.crt" ]; then
if [ -d "certs/traefik.crt" ]; then
openssl req -x509 -newkey rsa:4096 -nodes -keyout certs/traefik.key -out certs/traefik.crt -days 365
fi
echo "All prerequisites are met!"
log "All prerequisites are met!"

View File

@ -3,12 +3,12 @@
source lib/functions.sh
if [ $# -eq 0 ]; then
echo "Please provide a Project as argument"
log "Please provide a Project as argument"
exit 1
fi
if [ $1 != "ccp" ] && [ $1 != "nngm" ] && [ $1 != "gbn" ]; then
echo "Please provide a supported project like ccp, gbn or nngm"
log "Please provide a supported project like ccp, gbn or nngm"
exit 1
fi
@ -19,7 +19,7 @@ if ! ./lib/prerequisites.sh; then
exit 1
fi
echo "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

View File

@ -5,12 +5,12 @@ source lib/functions.sh
exitIfNotRoot
if [ $# -eq 0 ]; then
echo "Please provide a Project as argument"
log "Please provide a Project as argument"
exit 1
fi
if [ $1 != "ccp" ] && [ $1 != "nngm" ] && [ $1 != "gbn" ]; then
echo "Please provide a supported project like ccp, gbn or nngm"
log "Please provide a supported project like ccp, gbn or nngm"
exit 1
fi
@ -33,9 +33,9 @@ systemctl daemon-reload
echo
if ! systemctl is-active --quiet bridgehead@"${project}"; then
echo "Enabling autostart of bridgehead@${project}.service"
log "Enabling autostart of bridgehead@${project}.service"
systemctl enable bridgehead@"${project}"
echo "Enabling nightly updates for bridgehead@${project}.service ..."
log "Enabling nightly updates for bridgehead@${project}.service ..."
systemctl enable --now bridgehead-update@"${project}".timer
fi

View File

@ -8,9 +8,9 @@ RestartSec=30
WorkingDirectory=/srv/docker/bridgehead/
ExecStart=/srv/docker/bridgehead/start-bridgehead.sh %i
RemainAfterExit=true
ExecStop=/srv/docker/bridgehead/stop-bridgehead.sh %i
ExecStartPre=exec /srv/docker/bridgehead/stop-bridgehead.sh %i
ExecStart=exec /srv/docker/bridgehead/start-bridgehead.sh %i
ExecStop=exec /srv/docker/bridgehead/stop-bridgehead.sh %i
[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target