Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
166 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#! /bin/bash | ||
# make this file executable with chmod u+x (filename).sh | ||
set -u # exit if an uninitialised variable is used (https://www.davidpashley.com/articles/writing-robust-shell-scripts/) | ||
set -e # exit if any statement returns a non-true return value (https://www.davidpashley.com/articles/writing-robust-shell-scripts/) | ||
|
||
# only allow to run this command if Docker is running | ||
[[ $(docker stats --no-stream 2>/dev/null ) == "" ]] && printf "\e[31mERROR: Please start Docker before running DSP-API.\e[0m\n" && return | ||
|
||
# check dependencies | ||
echo "check for outdated dependencies..." | ||
[[ "$(brew outdated)" != "" ]] && printf "\e[31mWARNING: Some of your Homebrew formulas/casks are outdated. Please execute \"brew upgrade\"\e[0m\n" | ||
[[ "$(java --version)" =~ .*[Tt]emurin-17.* ]] || printf "\e[31mWARNING: Your JDK seems to be outdated. Please install JDK 17 Temurin.\e[0m\n" | ||
if echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 -w 10 > /dev/null 2>&1; then | ||
# pip should only be called if there is an internet connection | ||
[[ "$(pip list --outdated)" =~ .*dsp-tools.* ]] && printf "\e[31mWARNING: Your version of dsp-tools is outdated. Please update it with \"pip install --upgrade dsp-tools\"\e[0m\n" | ||
[[ "$(pip list --outdated)" != "" ]] && printf "\e[31mWARNING: Some of your pip packages are outdated. List them with \"pip list --outdated\" and consider updating them with \"pip install --upgrade (package)\"\e[0m\n" | ||
fi | ||
|
||
logfile="../dsp-api-stackup.log" | ||
|
||
cd ~ | ||
mkdir -p .dsp-tools | ||
cd .dsp-tools | ||
if [[ ! -d dsp-api ]]; then | ||
echo "git clone https://github.com/dasch-swiss/dsp-api.git" 2>&1 | tee -a "$logfile" | ||
git clone https://github.com/dasch-swiss/dsp-api.git >>"$logfile" 2>&1 | ||
fi | ||
cd dsp-api | ||
rm -f "$logfile" | ||
echo "make stack-down-delete-volumes..." 2>&1 | tee -a "$logfile" | ||
make stack-down-delete-volumes >>"$logfile" 2>&1 | ||
if echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 -w 10 > /dev/null 2>&1; then | ||
# only pull if there is an internet connection | ||
echo "git pull ..." 2>&1 | tee -a "$logfile" | ||
git pull >>"$logfile" 2>&1 | ||
fi | ||
echo "make init-db-test..." 2>&1 | tee -a "$logfile" | ||
make init-db-test >>"$logfile" 2>&1 | ||
echo "make stack-up..." 2>&1 | tee -a "$logfile" | ||
make stack-up >>"$logfile" 2>&1 | ||
echo "DSP-API is up and running." # due to "set -e", this will only be printed if everything went well |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#! /bin/bash | ||
# make this file executable with chmod u+x (filename).sh | ||
set -u # exit if an uninitialised variable is used (https://www.davidpashley.com/articles/writing-robust-shell-scripts/) | ||
set -e # exit if any statement returns a non-true return value (https://www.davidpashley.com/articles/writing-robust-shell-scripts/) | ||
|
||
[[ "$(npm -g outdated)" =~ .*@angular/cli.* ]] || printf "\e[31mWARNING: Your Angular seems to be outdated. Please update it with \"npm update -g @angular/cli\"\e[0m\n" | ||
|
||
logfile="../dsp-app-startup.log" | ||
|
||
cd ~ | ||
mkdir -p .dsp-tools | ||
cd .dsp-tools | ||
if [[ ! -d dsp-app ]]; then | ||
echo "git clone https://github.com/dasch-swiss/dsp-app.git" 2>&1 | tee -a "$logfile" | ||
git clone https://github.com/dasch-swiss/dsp-app.git >>"$logfile" 2>&1 | ||
fi | ||
cd dsp-app | ||
rm -f "$logfile" | ||
|
||
if echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 -w 10 > /dev/null 2>&1; then | ||
# only pull if there is an internet connection | ||
echo "git pull ..." 2>&1 | tee -a "$logfile" | ||
git checkout HEAD package-lock.json >>"$logfile" 2>&1 | ||
git pull >>"$logfile" 2>&1 | ||
fi | ||
echo "npm i --legacy-peer-deps ..." 2>&1 | tee -a "$logfile" | ||
npm i --legacy-peer-deps >>"$logfile" 2>&1 | ||
echo "ng s ..." 2>&1 | tee -a "$logfile" | ||
npm run ng s 2>&1 | tee -a "$logfile" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#! /bin/bash | ||
# make this file executable with chmod u+x (filename).sh | ||
set -u # exit if an uninitialised variable is used (https://www.davidpashley.com/articles/writing-robust-shell-scripts/) | ||
set -e # exit if any statement returns a non-true return value (https://www.davidpashley.com/articles/writing-robust-shell-scripts/) | ||
|
||
[[ $(docker stats --no-stream 2>/dev/null ) == "" ]] && printf "\e[31mERROR: Docker is not running, so there is no DSP-API to shut down.\e[0m\n" && return | ||
|
||
logfile="../dsp-api-stackdown.log" | ||
|
||
cd ~ | ||
[[ ! -d .dsp-tools/dsp-api ]] && return | ||
cd .dsp-tools/dsp-api | ||
rm -f "$logfile" | ||
echo "make stack-down-delete-volumes ..." 2>&1 | tee -a "$logfile" | ||
make stack-down-delete-volumes >>"$logfile" 2>&1 | ||
echo "make clean-sipi-tmp ..." 2>&1 | tee -a "$logfile" | ||
make clean-sipi-tmp >>"$logfile" 2>&1 | ||
echo "make clean-sipi-projects ..." 2>&1 | tee -a "$logfile" | ||
make clean-sipi-projects >>"$logfile" 2>&1 |