provision: Autocreate WissKI Salz Adapter
This commit updates the 'provision_container.sh' script to automatically create a WissKI Salz Adapter.
This commit is contained in:
parent
5415bc632c
commit
07755aacf5
3 changed files with 65 additions and 10 deletions
|
|
@ -91,6 +91,7 @@ VOLUME /var/www/data
|
||||||
|
|
||||||
# Add and configure the entrypoint
|
# Add and configure the entrypoint
|
||||||
ADD scripts/entrypoint.sh /entrypoint.sh
|
ADD scripts/entrypoint.sh /entrypoint.sh
|
||||||
|
ADD scripts/create_adapter.php /create_adapter.php
|
||||||
ENTRYPOINT [ "/entrypoint.sh" ]
|
ENTRYPOINT [ "/entrypoint.sh" ]
|
||||||
CMD ["apache2-foreground"]
|
CMD ["apache2-foreground"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This script will automatically create a WissKI Salz Adapter for use within the distillery.
|
||||||
|
* It will not update any existing adapter and is rather primitive.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$argc = $_SERVER['argc']-3;
|
||||||
|
$argv = array_slice($_SERVER['argv'], 3);
|
||||||
|
|
||||||
|
// read parameters from the command line
|
||||||
|
if ($argc != 3) {
|
||||||
|
die("Usage: drush php:script create_adapter.php INSTANCE_DOMAIN GRAPHDB_REPO HEADER");
|
||||||
|
}
|
||||||
|
$INSTANCE_DOMAIN = $argv[0];
|
||||||
|
$GRAPHDB_REPO = $argv[1];
|
||||||
|
$HEADER = $argv[2];
|
||||||
|
|
||||||
|
//
|
||||||
|
// PROPERTIES FOR THE ADAPTER
|
||||||
|
//
|
||||||
|
|
||||||
|
$id = 'default'; // id
|
||||||
|
$type = 'sparql11_with_pb'; // plugin
|
||||||
|
$machine_name = 'default'; // machine-name
|
||||||
|
$label = 'Default WissKI Distillery Adapter';
|
||||||
|
$description = 'Adapter for ' . $INSTANCE_DOMAIN; // description
|
||||||
|
$writable = TRUE; // writable
|
||||||
|
$is_preferred_local_store = TRUE; // is_preferred_local_store
|
||||||
|
$header = $HEADER; // header
|
||||||
|
$read_url = 'http://triplestore:7200/repositories/' . $GRAPHDB_REPO; // read_url
|
||||||
|
$write_url = 'http://triplestore:7200/repositories/' . $GRAPHDB_REPO . '/statements'; // write_url
|
||||||
|
$is_federatable = TRUE; // is_federatable
|
||||||
|
$default_graph_uri = 'https://' . $INSTANCE_DOMAIN . '/';
|
||||||
|
$same_as_properties = ['http://www.w3.org/2002/07/owl#sameAs']; // same_as_properties
|
||||||
|
$ontology_graphs = []; // ontology_graphs
|
||||||
|
|
||||||
|
//
|
||||||
|
// Do the creation!
|
||||||
|
//
|
||||||
|
|
||||||
|
$storage = \Drupal::entityTypeManager()->getStorage('wisski_salz_adapter');
|
||||||
|
$adapter = $storage->create([
|
||||||
|
"id" => $id,
|
||||||
|
"label" => $label,
|
||||||
|
"description" => $description,
|
||||||
|
]);
|
||||||
|
$adapter->setEngineConfig([
|
||||||
|
"id" => $type,
|
||||||
|
"machine-name" => $machine_name,
|
||||||
|
"header" => $header,
|
||||||
|
"writeable" => $writable,
|
||||||
|
"is_preferred_local_store" => $is_preferred_local_store,
|
||||||
|
"read_url" => $read_url,
|
||||||
|
"write_url" => $write_url,
|
||||||
|
"is_federatable" => $is_federatable,
|
||||||
|
"default_graph" => $default_graph_uri,
|
||||||
|
"same_as_properties" => $same_as_properties,
|
||||||
|
"ontology_graphs" => $ontology_graphs,
|
||||||
|
]);
|
||||||
|
$adapter->save();
|
||||||
|
|
@ -129,21 +129,14 @@ log_info " => Enable Wisski modules"
|
||||||
drush pm-enable --yes wisski_core wisski_linkblock wisski_pathbuilder wisski_adapter_sparql11_pb wisski_salz
|
drush pm-enable --yes wisski_core wisski_linkblock wisski_pathbuilder wisski_adapter_sparql11_pb wisski_salz
|
||||||
drupal_sites_permission_workaround
|
drupal_sites_permission_workaround
|
||||||
|
|
||||||
|
log_info " => Setting up WissKI Salz Adapter"
|
||||||
|
drush php:script /create_adapter.php "$INSTANCE_DOMAIN" "$GRAPHDB_REPO" "$GRAPHDB_HEADER"
|
||||||
|
|
||||||
log_info " => Provisioning is now complete. "
|
log_info " => Provisioning is now complete. "
|
||||||
log_ok "Your installation details are as follows:"
|
log_ok "Your installation details are as follows:"
|
||||||
function printdetails() {
|
function printdetails() {
|
||||||
echo "URL: http://$INSTANCE_DOMAIN"
|
echo "URL: http://$INSTANCE_DOMAIN"
|
||||||
echo "Username: $DRUPAL_USER"
|
echo "Username: $DRUPAL_USER"
|
||||||
echo "Password: $DRUPAL_PASS"
|
echo "Password: $DRUPAL_PASS"
|
||||||
log_info " => Your GraphDB details (for WissKI Salz) are: "
|
|
||||||
echo "Read URL: http://triplestore:7200/repositories/$GRAPHDB_REPO"
|
|
||||||
echo "Write URL: http://triplestore:7200/repositories/$GRAPHDB_REPO/statements"
|
|
||||||
echo "Username: $GRAPHDB_USER"
|
|
||||||
echo "Password: $GRAPHDB_PASSWORD"
|
|
||||||
echo "Authorization Header: $GRAPHDB_HEADER"
|
|
||||||
echo "Writable: yes"
|
|
||||||
echo "Default Graph URI: http://$INSTANCE_DOMAIN/#"
|
|
||||||
echo "Ontology Paths: (empty)"
|
|
||||||
echo "SameAs property: http://www.w3.org/2002/07/owl#sameAs"
|
|
||||||
}
|
}
|
||||||
printdetails
|
printdetails
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue