Add GraphDB Authorization flags
This commit is contained in:
parent
8dfdbec90a
commit
a76a4d3a0d
5 changed files with 21 additions and 7 deletions
|
|
@ -45,3 +45,6 @@ PASSWORD_LENGTH=64
|
||||||
|
|
||||||
# A file to be used for global authorized_keys for the ssh server.
|
# A file to be used for global authorized_keys for the ssh server.
|
||||||
GLOBAL_AUTHORIZED_KEYS_FILE=/distillery/authorized_keys
|
GLOBAL_AUTHORIZED_KEYS_FILE=/distillery/authorized_keys
|
||||||
|
|
||||||
|
# The admin password of the GraphDB interface, to be used for queries
|
||||||
|
GRAPHDB_ADMIN_PASSWORD=root
|
||||||
|
|
@ -36,12 +36,12 @@ dockerized_mysqldump --all-databases > "$BACKUP_SQL_FILE"
|
||||||
# Backup the triplestore system
|
# Backup the triplestore system
|
||||||
log_info " => Backing up Triplestore System"
|
log_info " => Backing up Triplestore System"
|
||||||
mkdir -p "$BACKUP_TRIPLESTORE_DIR"
|
mkdir -p "$BACKUP_TRIPLESTORE_DIR"
|
||||||
curl -X GET -H "Accept:application/n-quads" "http://127.0.0.1:7200/repositories/SYSTEM/statements?infer=false" > "$BACKUP_TRIPLESTORE_SYSTEM"
|
curl -X GET -H "Accept:application/n-quads" $GRAPHDB_AUTH_FLAGS "http://127.0.0.1:7200/repositories/SYSTEM/statements?infer=false" > "$BACKUP_TRIPLESTORE_SYSTEM"
|
||||||
|
|
||||||
# backup individual repos
|
# backup individual repos
|
||||||
for REPO in `grep -oP '(?<=#repositoryID> ")[^"]+' $BACKUP_TRIPLESTORE_SYSTEM`; do
|
for REPO in `grep -oP '(?<=#repositoryID> ")[^"]+' $BACKUP_TRIPLESTORE_SYSTEM`; do
|
||||||
log_info " => Backing up Triplestore Repository '$REPO'"
|
log_info " => Backing up Triplestore Repository '$REPO'"
|
||||||
curl -X GET -H "Accept:application/n-quads" "http://127.0.0.1:7200/repositories/$REPO/statements?infer=false" > "$BACKUP_TRIPLESTORE_DIR/repo_$REPO.nq"
|
curl -X GET -H "Accept:application/n-quads" $GRAPHDB_AUTH_FLAGS "http://127.0.0.1:7200/repositories/$REPO/statements?infer=false" > "$BACKUP_TRIPLESTORE_DIR/repo_$REPO.nq"
|
||||||
done
|
done
|
||||||
|
|
||||||
# backup the filesystem
|
# backup the filesystem
|
||||||
|
|
|
||||||
|
|
@ -196,6 +196,17 @@ if ! is_valid_file "$GLOBAL_AUTHORIZED_KEYS_FILE"; then
|
||||||
exit 1;
|
exit 1;
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
|
# GRAPHDB_ADMIN_PASSWORD should be the graphdb admin
|
||||||
|
if [ -z "$GRAPHDB_ADMIN_PASSWORD" ]; then
|
||||||
|
log_error "Variable 'GRAPHDB_ADMIN_PASSWORD' is not set. ";
|
||||||
|
log_info "You might want to create this file to get rid of the error message. "
|
||||||
|
log_info "Please verify that it is set correctly in '.env'";
|
||||||
|
exit 1;
|
||||||
|
fi;
|
||||||
|
|
||||||
|
# flags for graphdb authorization
|
||||||
|
GRAPHDB_AUTH_FLAGS="--user $(printf "admin:%s" "$GRAPHDB_ADMIN_PASSWORD")"
|
||||||
|
|
||||||
# paths to composer things
|
# paths to composer things
|
||||||
DEPLOY_WEB_DIR="$DEPLOY_ROOT/core/web"
|
DEPLOY_WEB_DIR="$DEPLOY_ROOT/core/web"
|
||||||
DEPLOY_SELF_DIR="$DEPLOY_ROOT/core/self"
|
DEPLOY_SELF_DIR="$DEPLOY_ROOT/core/self"
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ dockerized_mysql -e "FLUSH PRIVILEGES;"
|
||||||
# Use the template for this.
|
# Use the template for this.
|
||||||
log_info " => Generating new GraphDB repository '$GRAPHDB_REPO'"
|
log_info " => Generating new GraphDB repository '$GRAPHDB_REPO'"
|
||||||
load_template "repository/graphdb-repo.ttl" "GRAPHDB_REPO" "${GRAPHDB_REPO}" "INSTANCE_DOMAIN" "${INSTANCE_DOMAIN}" | \
|
load_template "repository/graphdb-repo.ttl" "GRAPHDB_REPO" "${GRAPHDB_REPO}" "INSTANCE_DOMAIN" "${INSTANCE_DOMAIN}" | \
|
||||||
curl -X POST \
|
curl -X POST $GRAPHDB_AUTH_FLAGS \
|
||||||
http://127.0.0.1:7200/rest/repositories \
|
http://127.0.0.1:7200/rest/repositories \
|
||||||
--header 'Content-Type: multipart/form-data' \
|
--header 'Content-Type: multipart/form-data' \
|
||||||
-F "config=@-"
|
-F "config=@-"
|
||||||
|
|
@ -45,7 +45,7 @@ GRAPHDB_PASSWORD="$(randompw)"
|
||||||
# Create the user and grant them access to the creatd database.
|
# Create the user and grant them access to the creatd database.
|
||||||
log_info " => Creating GraphDB user '$GRAPHDB_USER'"
|
log_info " => Creating GraphDB user '$GRAPHDB_USER'"
|
||||||
load_template "repository/graphdb-user.json" "GRAPHDB_USER" "${GRAPHDB_USER}" "GRAPHDB_REPO" "${GRAPHDB_REPO}" | \
|
load_template "repository/graphdb-user.json" "GRAPHDB_USER" "${GRAPHDB_USER}" "GRAPHDB_REPO" "${GRAPHDB_REPO}" | \
|
||||||
curl -X POST \
|
curl -X POST $GRAPHDB_AUTH_FLAGS \
|
||||||
"http://127.0.0.1:7200/rest/security/user/${GRAPHDB_USER}" \
|
"http://127.0.0.1:7200/rest/security/user/${GRAPHDB_USER}" \
|
||||||
--header 'Content-Type: application/json' \
|
--header 'Content-Type: application/json' \
|
||||||
--header 'Accept: text/plain' \
|
--header 'Accept: text/plain' \
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,10 @@ dockerized_mysql -e "FLUSH PRIVILEGES;"
|
||||||
|
|
||||||
# Clear the GraphDB repository.
|
# Clear the GraphDB repository.
|
||||||
log_info " => Deleting GraphDB user '$GRAPHDB_USER'"
|
log_info " => Deleting GraphDB user '$GRAPHDB_USER'"
|
||||||
curl -X DELETE http://127.0.0.1:7200/rest/security/user/$GRAPHDB_USER/
|
curl $GRAPHDB_AUTH_FLAGS -X DELETE http://127.0.0.1:7200/rest/security/user/$GRAPHDB_USER/
|
||||||
|
|
||||||
log_info " => Deleting GraphDB repository '$GRAPHDB_REPO'"
|
log_info " => Deleting GraphDB repository '$GRAPHDB_REPO'"
|
||||||
curl -X DELETE http://127.0.0.1:7200/rest/repositories/$GRAPHDB_REPO/
|
curl $GRAPHDB_AUTH_FLAGS -X DELETE http://127.0.0.1:7200/rest/repositories/$GRAPHDB_REPO/
|
||||||
|
|
||||||
# Delete the directory
|
# Delete the directory
|
||||||
log_info " => Deleting '$INSTANCE_BASE_DIR'"
|
log_info " => Deleting '$INSTANCE_BASE_DIR'"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue