Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Jormungandr] monitor jormungandr #4112

Merged
merged 4 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker/debian11/Dockerfile-jormungandr
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ RUN a2ensite 000-default.conf \

HEALTHCHECK CMD curl -f http://localhost/v1 || exit 1

EXPOSE 80
EXPOSE 80 9091 5050

ENTRYPOINT [ "/usr/src/app/run.sh" ]
53 changes: 52 additions & 1 deletion docker/run_jormungandr.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,65 @@
#!/usr/bin/env bash

file=/usr/src/app/jormungandr.wsgi
jormungandr_cache2="name=jormungandr,items=2048"
monitor_cache2="name=monitor,items=100"


function show_help() {
cat << EOF
Usage: ${0##*/} -a jormungandr-processes -m monitor-processes -r max-requests
-a app-processes number
-m [0|1] activate monitor-process
-r max-requests before reload for jormungandr worker
EOF
}

while getopts "a:m:r:h" opt; do
case $opt in
a) app_processes=$OPTARG
;;
m) monitor_processes=$OPTARG
;;
r) app_max_requests=$OPTARG
;;
h|\?)
show_help
exit 1
;;
esac
done


if [[ -z $app_max_requests ]]
then
max_requests=""
else
max_requests=" --max-requests ${app_max_requests} "
fi

if [[ -z $monitor_processes ]]
then
monitor_processes=0
fi


# run apache2
service apache2 start
if [ $? == 1 ]
then
echo "Error: failed to start apache2";
exit 1
fi

# run UWSGI
uwsgi --http 0.0.0.0:9090 --file /usr/src/app/jormungandr.wsgi
if [ $monitor_processes -eq 1 ]
then
echo "!!!!!!!!!!!!!!!!!!!!! Start Jormungandr with monitoring service !!!!!!!!!!!!!!!!!!!!!"
uwsgi --cache2 $jormungandr_cache2 $max_requests --http :9090 --stats :5050 --file $file --processes $app_processes & uwsgi --cache2 $monitor_cache2 --http :9091 --file $file --processes 1 --listen 5
else
echo "!!!!!!!!!!!!!!!!!!!!! Start Jormungandr without monitoring service !!!!!!!!!!!!!!!!!!!!!"
uwsgi --cache2 $jormungandr_cache2 $max_requests --http :9090 --stats :5050 --file $file --processes $app_processes
fi

if [ $? == 1 ]
then
Expand Down