-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunup.sh
More file actions
executable file
·77 lines (60 loc) · 2.17 KB
/
runup.sh
File metadata and controls
executable file
·77 lines (60 loc) · 2.17 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env bash
set -eou pipefail
# --- Load configs ---
source $(pwd)/var-config.sh .
# --- Create directories where Ghost's data lives
mkdir -pv ${LOCAL_PATH}
# --- Remove Container (in case the container is already running)
source $(pwd)/rundown.sh .
source ./fct_sync_external_themes.sh .
# --- Sync my local theme(s)
DIR_FROM=${DIR_MY_THEMES}
DIR_INTO=${DIR_CONTENT_THEMES}
source ./fct_rsync_nodelete.sh .
# --- Start Container
echo && echo "--- UNIT TEST for: <${GHOST_IMG}> - START ---" && \
docker pull ${GHOST_IMG} && echo && \
docker run -d \
--name ${CTN_NAME} \
-p 2368:2368 \
-e WEB_URL=http://localhost:2368 \
-v "${LOCAL_PATH}":"${CONTAINER_PATH}" \
"${GHOST_IMG}" && \
# uncomment if needed
#docker inspect ${CTN_NAME} && echo && echo && \
#docker logs ${CTN_NAME} && echo && echo && \
echo && echo "--- Checkpoint 01 | uname -a ---" && \
docker exec -it ${CTN_NAME} \
uname -a; sleep 0.5 && \
echo && echo "--- Checkpoint 02 | Ghost version ---" && \
docker exec -it ${CTN_NAME} \
cat /var/lib/ghost/current/package.json | grep '"version":' | sed 's: ::g' && \
echo && echo "--- Checkpoint 03 | Theme version (aka casper) ---" && \
docker exec -it ${CTN_NAME} \
cat /var/lib/ghost/current/content/themes/casper/package.json | grep '"version":' | sed 's: ::g' && \
echo && echo "--- Checkpoint 04 | node --version ---" && \
docker exec -it ${CTN_NAME} \
node --version && \
echo && \
# This will wait for Ghost to be running
export FLAG_WAIT="true"
while [[ ${FLAG_WAIT} == "true" ]]; do
# check if apps are running on K8s (or are in progress)
IN_PROGRESS=$(curl -Is --head "http://localhost:2368/ghost" | grep "HTTP/1.1 301 Moved Permanently" | wc -l)
if [[ ${IN_PROGRESS} -eq 0 ]]; then
echo "--- Ghost is starting ..." && \
sleep 2.5 ;
elif [[ ${IN_PROGRESS} -ne 0 ]]; then
echo "--- Ghost is ready! ---> " && \
echo && docker ps && \
echo && \
echo "--- Go to: http://localhost:2368 ---" && \
echo "--- Ghost's container will be removed in ${WAIT_TIMER} seconds ---" && \
FLAG_WAIT="false";
else
echo "Unexpected error (err45)" ;
fi
done && \
# Wait then shut down Ghost
sleep ${WAIT_TIMER} && \
source ${ROOT_PROJECT}/rundown.sh .