-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·55 lines (50 loc) · 1.77 KB
/
entrypoint.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
#!/bin/bash
# Fungsi untuk mengecek apakah folder /workspace/frappe-bench sudah ada
check_directory() {
if [ -d "/workspace/frappe-bench" ]; then
return 0 # Folder sudah ada
else
return 1 # Folder belum ada
fi
}
# Fungsi untuk menjalankan langkah-langkah saat folder belum ada
setup_frappe_bench() {
cd /workspace || exit 1
echo "Change permission folder"
sudo chown -R frappe:$GID /workspace
sudo chmod -R g+rwx /workspace
echo "Initial Directory frapp-bench"
bench init --skip-redis-config-generation frappe-bench
cd frappe-bench || exit 1
echo "Initial Database config and redis config"
bench set-config -g db_host mariadb
bench set-config -g redis_cache redis://redis-cache:6379
bench set-config -g redis_queue redis://redis-queue:6379
bench set-config -g redis_socketio redis://redis-queue:6379
echo "Initial new site with domain ${URL_SITE} with password DB ${MARIADB_PWD}"
bench new-site --mariadb-root-password $MARIADB_PWD --admin-password admin --no-mariadb-socket $URL_SITE
ehco "Initial config developer mode"
bench --site $URL_SITE set-config developer_mode 1
bench --site $URL_SITE clear-cache
echo "Starting Bench"
bench start
echo "Error Starting Bench | sleep infinity"
sleep infinity
}
# Fungsi untuk menjalankan langkah-langkah saat folder sudah ada
run_bench_start() {
cd /workspace/frappe-bench || exit 1
echo "Folder found in /workspace/frappe-bench"
echo "Starting Bench"
bench start
echo "Error Starting Bench | sleep infinity"
sleep infinity
}
# Mengecek apakah folder /workspace/frappe-bench sudah ada
if check_directory; then
/entrypoint/change-localtime.sh
run_bench_start
else
/entrypoint/change-localtime.sh
setup_frappe_bench
fi