Skip to content

Commit

Permalink
add website feature
Browse files Browse the repository at this point in the history
  • Loading branch information
aleskxyz authored May 8, 2024
1 parent 2d775af commit 138884d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions reality-ezpz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,8 @@ echo "
expose:
- 80
restart: always
volumes:
- ./website:/usr/share/nginx/html
networks:
- reality
haproxy:
Expand Down Expand Up @@ -789,6 +791,7 @@ echo "
- ./$(dirname "${path[server_pem]#${config_path}/}"):/certificate
- ./${path[certbot_deployhook]#${config_path}/}:/deployhook.sh
- ./${path[certbot_startup]#${config_path}/}:/startup.sh
- ./website:/website
networks:
- reality
entrypoint: /bin/sh
Expand Down Expand Up @@ -907,13 +910,17 @@ awk -F= '{print \$2}' | tr -d : | tr '[:upper:]' '[:lower:]')
fi
fi
while true; do
response=\$(curl -skL --max-time 3 http://${config[server]})
if echo "\$response" | grep 'Welcome to nginx!' >/dev/null; then
ls -d /website/* | grep -E '^/website/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\$'|xargs rm -f
uuid=\$(uuidgen)
echo "\$uuid" > "/website/\$uuid"
response=\$(curl -skL --max-time 3 http://${config[server]}/\$uuid)
if echo "\$response" | grep \$uuid >/dev/null; then
break
fi
echo "Domain ${config[server]} is not pointing to the server"
sleep 5
done
ls -d /website/* | grep -E '^/website/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\$'|xargs rm -f
while true; do
certbot certonly -n \\
--standalone \\
Expand Down Expand Up @@ -952,7 +959,7 @@ EOF
function generate_certbot_dockerfile {
cat >"${path[certbot_dockerfile]}" << EOF
FROM ${image[certbot]}
RUN apk add --no-cache docker-cli-compose curl
RUN apk add --no-cache docker-cli-compose curl uuidgen
EOF
}

Expand Down

0 comments on commit 138884d

Please sign in to comment.