-
Notifications
You must be signed in to change notification settings - Fork 1
/
runBackend.sh
executable file
·54 lines (46 loc) · 1.39 KB
/
runBackend.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# This file needs to be run with sudo
# Create an alias for this file. Is then run with "git run"
# git config --local alias.run '!sudo ./runBackend.sh'
checkInstalled() {
if ! [ -x "$(command -v $@)" ]; then
echo "Error: $@ is not installed." >&2
exit 1
else
echo "$@ is installed"
fi
}
show_help() {
echo "Usage: ./runBackend.sh [OPTIONS]"
echo "Likely needs to be run with sudo"
echo "Script for running the backend"
echo ""
echo "Options:"
echo "-h, --help Display this help message and exit"
echo "-s, --standalone Make a standalone docker run. Does not use docker-compose."
echo "-q, --quick Create an alias for this file. Is then run with \"git run\""
echo "test by sudo dotnet test Nexpo.Tests/"
echo ""
}
while getopts ":h:q:s" opt; do
case $opt in
h|help)
show_help
exit 1
;;
q|quick)
# Create an alias for this file. Is then run with "git run"
git config core.filemode false
git config --local alias.run '!sh ./runBackend.sh'
exit 1
;;
c|compose)
sudo docker-compose up -d
exit 1
;;
esac
done
checkInstalled docker
checkInstalled dotnet
sudo docker rm -f nexpo_database
sudo docker run -d --name nexpo_database -p 5432:5432 -e POSTGRES_USER=nexpo -e POSTGRES_PASSWORD=nexpo postgres:14
dotnet run --project Nexpo