mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-04-24 17:28:29 +02:00
Updated Gitlab hook script (markdown)
@@ -9,22 +9,23 @@ The script pushes the challenge to the pages git defined in $REPO, waits for it
|
|||||||
#
|
#
|
||||||
# dehydrated hook script to deploy a key to Gitlab.
|
# dehydrated hook script to deploy a key to Gitlab.
|
||||||
#
|
#
|
||||||
|
# https://github.com/lukas2511/dehydrated/wiki/Gitlab-hook-script
|
||||||
|
#
|
||||||
# Add the following options to your config file:
|
# Add the following options to your config file:
|
||||||
# TOKEN= API token, generate in Gitlab profile settings (select API access)
|
# TOKEN= # API token, generate in Gitlab profile settings (select API access)
|
||||||
# PROJECT= ID or URL-encoded path of the project (replace / with %2F)
|
# PROJECT= # ID or URL-encoded path of the project (replace / with %2F)
|
||||||
# REPO= path to local git repo of your pages project
|
# REPO= # path to local git repo of your pages project
|
||||||
|
|
||||||
. "$BASEDIR/$CONFIG"
|
. "$BASEDIR/$CONFIG"
|
||||||
|
|
||||||
deploy_challenge() {
|
deploy_challenge() {
|
||||||
DOMAIN="$1"
|
DOMAIN="$1"
|
||||||
TOKEN_FILENAME="$2"
|
TOKEN_FILENAME="$2"
|
||||||
cd "$REPO"
|
mkdir -p "$REPO/public/.well-known/acme-challenge"
|
||||||
mkdir -p public/.well-known/acme-challenge
|
cp "$WELLKNOWN/$TOKEN_FILENAME" "$REPO/public/.well-known/acme-challenge/"
|
||||||
cp "$WELLKNOWN/$TOKEN_FILENAME" public/.well-known/acme-challenge/
|
git -C "$REPO" add public/.well-known/acme-challenge/"$TOKEN_FILENAME"
|
||||||
git add public/.well-known/acme-challenge/"$TOKEN_FILENAME"
|
git -C "$REPO" commit -m "Let's Encrypt challenge"
|
||||||
git commit -m "Let's Encrypt challenge"
|
git -C "$REPO" push
|
||||||
git push
|
|
||||||
sleep 20
|
sleep 20
|
||||||
while ! curl --output /dev/null --silent --head --fail "http://$DOMAIN/.well-known/acme-challenge/$TOKEN_FILENAME"; do
|
while ! curl --output /dev/null --silent --head --fail "http://$DOMAIN/.well-known/acme-challenge/$TOKEN_FILENAME"; do
|
||||||
echo sleeping
|
echo sleeping
|
||||||
@@ -34,11 +35,11 @@ deploy_challenge() {
|
|||||||
|
|
||||||
clean_challenge() {
|
clean_challenge() {
|
||||||
TOKEN_FILENAME="$2"
|
TOKEN_FILENAME="$2"
|
||||||
cd "$REPO"
|
git -C "$REPO" reset --hard HEAD~
|
||||||
git reset --hard HEAD~
|
git -C "$REPO" push --force-with-lease
|
||||||
git push --force-with-lease
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# https://docs.gitlab.com/ee/api/pages_domains.html
|
||||||
deploy_cert() {
|
deploy_cert() {
|
||||||
DOMAIN="$1"
|
DOMAIN="$1"
|
||||||
KEYFILE="$2"
|
KEYFILE="$2"
|
||||||
|
|||||||
Reference in New Issue
Block a user