prefixes: Allow instances to be skipped
This commit allows an instance to be skipped for the purposes of the resolver by adding a file named `prefixes.skip` to the instance base directory. This can be useful for dummy or cloned instances.
This commit is contained in:
parent
1d1f61e6b4
commit
5f532d0841
3 changed files with 22 additions and 3 deletions
|
|
@ -350,6 +350,11 @@ It should not be neccessary to reload this configuration manually, as it is auto
|
||||||
It is also possible to manually add a URI prefix to an instance.
|
It is also possible to manually add a URI prefix to an instance.
|
||||||
For this purpose, add a file named `prefixes` to the base directory of the instance, with one prefix per line.
|
For this purpose, add a file named `prefixes` to the base directory of the instance, with one prefix per line.
|
||||||
|
|
||||||
|
Furthermore, you can also exclude a specific instance from URL prefix resolving.
|
||||||
|
This should be the case for cloned or backup instances.
|
||||||
|
For this purpose, add a file named `prefixes.skip` to the base directory of the instance.
|
||||||
|
This will casuse the instance to be skipped entirely.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
This project and associated files in this repository are licensed as follows:
|
This project and associated files in this repository are licensed as follows:
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,14 @@ function compute_instance_prefixfile() {
|
||||||
}
|
}
|
||||||
INSTANCE_PREFIX_FILE="$(compute_instance_prefixfile "$INSTANCE_BASE_DIR" )"
|
INSTANCE_PREFIX_FILE="$(compute_instance_prefixfile "$INSTANCE_BASE_DIR" )"
|
||||||
|
|
||||||
|
# compute the prefix file
|
||||||
|
function compute_instance_noprefixfile() {
|
||||||
|
INSTANCE_BASE_DIR="$1"
|
||||||
|
INSTANCE_PREFIX_FILE="$INSTANCE_BASE_DIR/prefixes.skip"
|
||||||
|
echo "$INSTANCE_PREFIX_FILE"
|
||||||
|
}
|
||||||
|
INSTANCE_NOPREFIX_FILE="$(compute_instance_noprefixfile "$INSTANCE_BASE_DIR" )"
|
||||||
|
|
||||||
if [ -n "$CERTBOT_EMAIL" ]; then
|
if [ -n "$CERTBOT_EMAIL" ]; then
|
||||||
LETSENCRYPT_HOST="$INSTANCE_DOMAIN"
|
LETSENCRYPT_HOST="$INSTANCE_DOMAIN"
|
||||||
LETSENCRYPT_EMAIL="$CERTBOT_EMAIL"
|
LETSENCRYPT_EMAIL="$CERTBOT_EMAIL"
|
||||||
|
|
|
||||||
|
|
@ -16,18 +16,24 @@ date | tee -a "$DEPLOY_PREFIX_CONFIG"
|
||||||
# update all the instances
|
# update all the instances
|
||||||
for slug in $(sql_bookkeep_list); do
|
for slug in $(sql_bookkeep_list); do
|
||||||
INSTANCE_DOMAIN="$(compute_instance_url "$slug")"
|
INSTANCE_DOMAIN="$(compute_instance_url "$slug")"
|
||||||
echo "$INSTANCE_DOMAIN:" | tee -a "$DEPLOY_PREFIX_CONFIG"
|
|
||||||
|
|
||||||
read -r INSTANCE_BASE_DIR MYSQL_DATABASE MYSQL_USER GRAPHDB_REPO GRAPHDB_USER GRAPHDB_PASSWORD <<< "$(sql_bookkeep_load "${slug}" "filesystem_base,sql_database,sql_user,graphdb_repository,graphdb_user,graphdb_password" | tail -n +2)"
|
read -r INSTANCE_BASE_DIR MYSQL_DATABASE MYSQL_USER GRAPHDB_REPO GRAPHDB_USER GRAPHDB_PASSWORD <<< "$(sql_bookkeep_load "${slug}" "filesystem_base,sql_database,sql_user,graphdb_repository,graphdb_user,graphdb_password" | tail -n +2)"
|
||||||
|
|
||||||
|
INSTANCE_NOPREFIX_FILE="$(compute_instance_noprefixfile "$INSTANCE_BASE_DIR" )"
|
||||||
|
INSTANCE_PREFIX_FILE="$(compute_instance_prefixfile "$INSTANCE_BASE_DIR" )"
|
||||||
|
if [ -f "$INSTANCE_NOPREFIX_FILE" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
pushd "$INSTANCE_BASE_DIR" > /dev/null
|
pushd "$INSTANCE_BASE_DIR" > /dev/null
|
||||||
|
|
||||||
INSTANCE_PREFIX_FILE="$(compute_instance_prefixfile "$INSTANCE_BASE_DIR" )"
|
echo "$INSTANCE_DOMAIN:" | tee -a "$DEPLOY_PREFIX_CONFIG"
|
||||||
|
docker-compose exec barrel /user_shell.sh -c "drush php:script /wisskiutils/list_uri_prefixes.php" | tee -a "$DEPLOY_PREFIX_CONFIG"
|
||||||
|
|
||||||
if [ -f "$INSTANCE_PREFIX_FILE" ]; then
|
if [ -f "$INSTANCE_PREFIX_FILE" ]; then
|
||||||
cat "$INSTANCE_PREFIX_FILE" | tee -a "$DEPLOY_PREFIX_CONFIG"
|
cat "$INSTANCE_PREFIX_FILE" | tee -a "$DEPLOY_PREFIX_CONFIG"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker-compose exec barrel /user_shell.sh -c "drush php:script /wisskiutils/list_uri_prefixes.php" | tee -a "$DEPLOY_PREFIX_CONFIG"
|
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue