-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
romer8
committed
Oct 29, 2024
1 parent
9680ac0
commit 10fa6de
Showing
2 changed files
with
60 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,4 +55,4 @@ EXPOSE 80 | |
# RUN # | ||
####### | ||
|
||
CMD ["bash", "run.sh", "--skip-perm"] | ||
CMD ["bash", "simplified_run.sh"] |
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,59 @@ | ||
#!/bin/bash | ||
|
||
tail_file() { | ||
echo "tailing file $1" | ||
ALIGN=27 | ||
LENGTH=`echo $1 | wc -c` | ||
PADDING=`expr ${ALIGN} - ${LENGTH}` | ||
PREFIX=$1`perl -e "print ' ' x $PADDING;"` | ||
file="/var/log/$1" | ||
# each tail runs in the background but prints to stdout | ||
# sed outputs each line from tail prepended with the filename+padding | ||
tail -qF $file | sed --unbuffered "s|^|${PREFIX}:|g" & | ||
} | ||
|
||
echo_status() { | ||
local args="${@}" | ||
tput setaf 4 | ||
tput bold | ||
echo -e "- $args" | ||
tput sgr0 | ||
} | ||
|
||
|
||
echo_status "Starting up..." | ||
|
||
|
||
echo_status "Enforcing start state... (This might take a bit)" | ||
salt-call --local state.apply | ||
|
||
|
||
echo_status "Changing permissions" | ||
chown -R www: /usr/lib/tethys | ||
chmod -R 777 /var/lib/tethys_persist | ||
|
||
echo_status "Starting supervisor" | ||
|
||
# Start Supervisor | ||
/usr/bin/supervisord | ||
|
||
echo_status "Done!" | ||
|
||
# Watch Logs | ||
echo_status "Watching logs. You can ignore errors from either apache (httpd) or nginx depending on which one you are using." | ||
|
||
log_files=("httpd/access_log" | ||
"httpd/error_log" | ||
"nginx/access.log" | ||
"nginx/error.log" | ||
"supervisor/supervisord.log" | ||
"tethys/tethys.log") | ||
|
||
# When this exits, exit all background tail processes | ||
trap 'kill $(jobs -p)' EXIT | ||
for log_file in "${log_files[@]}"; do | ||
tail_file "${log_file}" | ||
done | ||
|
||
# Read output from tail; wait for kill or stop command (docker waits here) | ||
wait |