update nginx

This commit is contained in:
qiaofeng1227 2023-09-23 11:29:08 +08:00
parent 6ef55aeb83
commit 5eb133e5b5
3 changed files with 23 additions and 6 deletions

View file

@ -10,7 +10,6 @@ COPY ./config/initproxy.conf /data/nginx/proxy_host/
#RUN touch /etc/s6-overlay/s6-rc.d/user/contents.d/init_user
#RUN chmod -R 755 /etc/s6-overlay/s6-rc.d/init_user
COPY ./s6/init_user/init_user.sh /app/init_user.sh
RUN chmod +x /app/init_user.sh
CMD ["/bin/sh", "-c", "/app/init_user.sh && tail -f /dev/null"]

View file

@ -22,10 +22,28 @@ while [ -z "$token" ]; do
done
echo "Change username(email)" >> /tmp/userlog
curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d '{"email": "'$username'", "nickname": "admin", "is_disabled": false, "roles": ["admin"]}' http://localhost:81/api/users/1
while true; do
response=$(curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d '{"email": "'$username'", "nickname": "admin", "is_disabled": false, "roles": ["admin"]}' http://localhost:81/api/users/1)
if [ $? -eq 0 ]; then
echo "HTTP call successful"
break
else
echo "HTTP call Change username failed, retrying..." >> /tmp/userlog
sleep 5
fi
done
echo "Update password" >> /tmp/userlog
curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d '{"type":"password","current":"changeme","secret":"'$password'"}' http://localhost:81/api/users/1/auth
while true; do
response=$(curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d '{"type":"password","current":"changeme","secret":"'$password'"}' http://localhost:81/api/users/1/auth)
if [ $? -eq 0 ]; then
echo "HTTP call successful"
break
else
echo "HTTP call Update password failed, retrying..." >> /tmp/userlog
sleep 5
fi
done
echo "Save to credential"
json="{\"username\":\"$username\",\"password\":\"$password\"}"

View file

@ -4,7 +4,7 @@ set -e
trap "sleep 1; continue" ERR
try_times=30
try_times=100
counter=1
portainer_username="admin"
@ -38,7 +38,8 @@ copy_credential() {
while true; do
set +e
sleep 3
printf "Try to get credentials for %d times\n" "$counter"
copy_credential "websoft9-git" "/var/websoft9/credential" "websoft9-apphub" "/websoft9/credentials/credential_git"
@ -56,7 +57,6 @@ while true; do
fi
fi
sleep 3
set -e
counter=$((counter + 1))