mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
Add nginx:access-logs and nginx:error-logs.
Add two nginx subcommands to display nginx error/access logs for a particular app.
This commit is contained in:
@@ -159,9 +159,30 @@ EOF
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
nginx:access-logs|nginx:error-logs)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2"
|
||||
|
||||
NGINX_LOGS_TYPE=${1#nginx:}
|
||||
NGINX_LOGS_TYPE=${NGINX_LOGS_TYPE%-logs}
|
||||
NGINX_LOGS_PATH="/var/log/nginx/$APP-$NGINX_LOGS_TYPE.log"
|
||||
|
||||
if [[ $3 == "-t" ]]; then
|
||||
NGINX_LOGS_ARGS="-F"
|
||||
else
|
||||
NGINX_LOGS_ARGS="-n 20"
|
||||
fi
|
||||
|
||||
sudo tail "$NGINX_LOGS_ARGS" "$NGINX_LOGS_PATH"
|
||||
;;
|
||||
|
||||
help | nginx:help)
|
||||
cat<<EOF
|
||||
nginx:build-config <app>, (Re)builds nginx config for given app
|
||||
nginx:access-logs <app> [-t], Show the nginx access logs for an application (-t follows)
|
||||
nginx:error-logs <app> [-t], Show the nginx error logs for an application (-t follows)
|
||||
EOF
|
||||
;;
|
||||
|
||||
|
||||
@@ -4,10 +4,12 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
case "$DOKKU_DISTRO" in
|
||||
ubuntu)
|
||||
echo "%dokku ALL=(ALL) NOPASSWD:/etc/init.d/nginx reload, /usr/sbin/nginx -t" > /etc/sudoers.d/dokku-nginx
|
||||
echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/tail" >> /etc/sudoers.d/dokku-nginx
|
||||
;;
|
||||
|
||||
opensuse)
|
||||
echo "%dokku ALL=(ALL) NOPASSWD:/sbin/service nginx reload, /usr/sbin/nginx -t" > /etc/sudoers.d/dokku-nginx
|
||||
echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/tail" >> /etc/sudoers.d/dokku-nginx
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
Reference in New Issue
Block a user