-
Notifications
You must be signed in to change notification settings - Fork 0
/
init-openkoda.sh
executable file
·36 lines (29 loc) · 1.05 KB
/
init-openkoda.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
#!/bin/sh
# Generate cert
docker compose up cert_generator
# Clone Openkoda
DIR="openkoda"
if [ ! -d "$DIR" ]; then
git clone [email protected]:openkoda/openkoda.git
fi
## Initialize Database
docker compose up -d database
docker compose run openkoda java -Dloader.path=/BOOT-INF/classes -Dspring.profiles.active=openkoda,drop_and_init_database -jar /usr/src/openkoda/openkoda/build/openkoda-1.4.1.jar --server.port=8030 --spring.datasource.username=postgres --spring.datasource.password=openkoda --spring.datasource.url=jdbc:postgresql://database:5432/openkoda
docker compose cp openkoda/openkoda/etc database:/scripts
## Run extra init scripts
docker compose exec -it database sh -c '
SCRIPTS_DIR="/scripts"
for file in $SCRIPTS_DIR/*.sql; do
psql "postgresql://postgres:openkoda@localhost/openkoda" -f "${file}"
done
'
docker compose stop database
# Add entries to /etc/hosts
DOMAINS="dbui.demo.test openkoda.demo.test"
set -- $DOMAINS
while [ -n "$1" ]; do
if [ ! -n "$(grep $1 /etc/hosts)" ];then
echo "127.0.0.1 $1" | sudo tee -a /etc/hosts
fi
shift
done