Skip to content

Commit

Permalink
update startup
Browse files Browse the repository at this point in the history
  • Loading branch information
noogen committed Sep 28, 2022
1 parent fd31152 commit 22ad66e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion files/etc/nginx/include/letsencrypt-acme-challenge.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ location ^~ /.well-known/acme-challenge/ {
# there to "webroot".
# Do NOT use alias, use root! Target directory is located here:
# /var/www/common/letsencrypt/.well-known/acme-challenge/
root /data/letsencrypt-acme-challenge;
root /app/letsencrypt-acme-challenge;
}

# Hide /acme-challenge subdirectory and return 404 on all requests.
Expand Down
File renamed without changes.
18 changes: 11 additions & 7 deletions files/root/bin/my-startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
set -e

function die {
echo >&2 "$@"
exit 1
echo >&2 "$@"
exit 1
}

#######################################
Expand All @@ -12,15 +12,19 @@ function die {
# String: value to log
#######################################
function log {
if [[ "$@" ]]; then echo "[`date +'%Y-%m-%d %T'`] $@";
else echo; fi
if [[ "$@" ]]; then echo "[`date +'%Y-%m-%d %T'`] $@";
else echo; fi
}

if [ -n "$SERVER_CONF" ] ; then
log "Getting new server.conf"

mv /app/etc/nginx/sites-enabled/server.conf /app/etc/nginx/sites-enabled/server.bak
curl -SL $SERVER_CONF --output /app/etc/nginx/sites-enabled/server.conf
# backup old config if exists
if [ -f /app/etc/nginx/sites-enabled/server.conf ]; then
mv /app/etc/nginx/sites-enabled/server.conf /app/etc/nginx/sites-enabled/server.bak
fi

log "Getting new server.conf"
curl -SL $SERVER_CONF --output /app/etc/nginx/sites-enabled/server.conf
fi

echo "*** Running cron"
Expand Down
3 changes: 2 additions & 1 deletion files/sbin/my_init
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ if [ ! -f /etc/nginx/nginx.conf ]; then
fi

mkdir -p /tmp/nginx/cache \
/tmp/nginx/body
/tmp/nginx/body \
/app/letsencrypt-acme-challenge
chown -R www-data:nginx /tmp/nginx

# if there is nginx.new, then make it current and backup existing
Expand Down

0 comments on commit 22ad66e

Please sign in to comment.