Maintenance (#681)

* Maintenance
This commit is contained in:
tteckster 2022-10-29 21:04:45 -04:00 committed by GitHub
parent e7ec3d0275
commit 8e331fcbff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
155 changed files with 12962 additions and 11552 deletions

View file

@ -1,16 +1,16 @@
#!/usr/bin/env bash
RELEASE=$(curl -s https://api.github.com/repos/NginxProxyManager/nginx-proxy-manager/releases/latest \
| grep "tag_name" \
| awk '{print substr($2, 3, length($2)-4) }') \
RELEASE=$(curl -s https://api.github.com/repos/NginxProxyManager/nginx-proxy-manager/releases/latest |
grep "tag_name" |
awk '{print substr($2, 3, length($2)-4) }')
RD=`echo "\033[01;31m"`
BL=`echo "\033[36m"`
RD=$(echo "\033[01;31m")
BL=$(echo "\033[36m")
CM='\xE2\x9C\x94\033'
GN=`echo "\033[1;92m"`
CL=`echo "\033[m"`
GN=$(echo "\033[1;92m")
CL=$(echo "\033[m")
function update_info {
echo -e "${RD}
echo -e "${RD}
_ _ _____ __ __
| \ | | | __ \ | \/ |
| \| | | |__) | | \ / |
@ -24,19 +24,19 @@ ${CL}"
update_info
while true; do
read -p "This will update Nginx Proxy Manager to v${RELEASE}. Proceed(y/n)?" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
read -p "This will update Nginx Proxy Manager to v${RELEASE}. Proceed(y/n)?" yn
case $yn in
[Yy]*) break ;;
[Nn]*) exit ;;
*) echo "Please answer yes or no." ;;
esac
done
clear
update_info
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
shopt -s expand_aliases
alias die='EXIT=$? LINE=$LINENO error_exit'
trap die ERR
@ -57,23 +57,23 @@ function msg() {
T="$(date +%M)"
if [ -f /lib/systemd/system/npm.service ]; then
echo -en "${GN} Prep For Update... "
sleep 2
echo -e "${CM}${CL} \r"
echo -en "${GN} Stopping Services... "
echo -en "${GN} Prep For Update... "
sleep 2
echo -e "${CM}${CL} \r"
echo -en "${GN} Stopping Services... "
systemctl stop openresty
systemctl stop npm
echo -e "${CM}${CL} \r"
echo -en "${GN} Cleaning Old Files... "
rm -rf /app \
/var/www/html \
/etc/nginx \
/var/log/nginx \
/var/lib/nginx \
/var/cache/nginx &>/dev/null
echo -e "${CM}${CL} \r"
else
echo -en "${GN} Cleaning Old Files... "
rm -rf /app \
/var/www/html \
/etc/nginx \
/var/log/nginx \
/var/lib/nginx \
/var/cache/nginx &>/dev/null
echo -e "${CM}${CL} \r"
else
echo -en "${RD} No NPM to Update! ${CL}"
exit
fi
@ -103,24 +103,24 @@ cp docker/rootfs/etc/logrotate.d/nginx-proxy-manager /etc/logrotate.d/nginx-prox
ln -sf /etc/nginx/nginx.conf /etc/nginx/conf/nginx.conf
rm -f /etc/nginx/conf.d/dev.conf
mkdir -p /tmp/nginx/body \
/run/nginx \
/data/nginx \
/data/custom_ssl \
/data/logs \
/data/access \
/data/nginx/default_host \
/data/nginx/default_www \
/data/nginx/proxy_host \
/data/nginx/redirection_host \
/data/nginx/stream \
/data/nginx/dead_host \
/data/nginx/temp \
/var/lib/nginx/cache/public \
/var/lib/nginx/cache/private \
/var/cache/nginx/proxy_temp
/run/nginx \
/data/nginx \
/data/custom_ssl \
/data/logs \
/data/access \
/data/nginx/default_host \
/data/nginx/default_www \
/data/nginx/proxy_host \
/data/nginx/redirection_host \
/data/nginx/stream \
/data/nginx/dead_host \
/data/nginx/temp \
/var/lib/nginx/cache/public \
/var/lib/nginx/cache/private \
/var/cache/nginx/proxy_temp
chmod -R 777 /var/cache/nginx
chown root /tmp/nginx
echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf);" > /etc/nginx/conf.d/include/resolvers.conf
echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf);" >/etc/nginx/conf.d/include/resolvers.conf
echo -e "${CM}${CL} \r"
if [ ! -f /data/nginx/dummycert.pem ] || [ ! -f /data/nginx/dummykey.pem ]; then
@ -144,7 +144,7 @@ echo -e "${CM}${CL} \r"
echo -en "${GN} Initializing Backend... "
rm -rf /app/config/default.json &>/dev/null
if [ ! -f /app/config/production.json ]; then
cat << 'EOF' > /app/config/production.json
cat <<'EOF' >/app/config/production.json
{
"database": {
"engine": "knex-native",
@ -168,7 +168,7 @@ systemctl enable npm &>/dev/null
systemctl start openresty
systemctl start npm
echo -e "${CM}${CL} \r"
TS="$(($(date +%M)-T))"
TS="$(($(date +%M) - T))"
IP=$(hostname -I | cut -f1 -d ' ')
echo -e "${GN}Successfully Updated Nginx Proxy Manager to ${RD}${RELEASE}${CL} and it took ${RD}${TS} minutes.${CL}