Skip to content

vinz3g/islandora_workbench_demo_content

 
 

Repository files navigation

Islandora_Workbench Demo Content

This content is intended to be used with islandora_workbench to demonstrate the functionality of the tool. This can be used to test the tool, or to create a sandbox environment for testing and development.

Steps to use this content

Overview of the steps to use this content:

  1. Clone islandora_workbench repo
  2. Clone this repo inside of that directory
  3. Edit config file
  4. Build the docker container
  5. Check the config (optional)
  6. Run the docker container to create the content

Detailed steps

  1. Clone https://github.com/mjordan/islandora_workbench
  2. Change directory into the islandora_workbench directory (cd islandora_workbench)
  3. Clone this repo inside of that directory (git clone https://github.com/DonRichards/islandora_workbench_demo_content)
  4. Open example_content.yml and change the line with "nopassword" to the password in Drupal or to contents of isle-dc/secrets/live/DRUPAL_DEFAULT_ACCOUNT_PASSWORD.
  5. Open example_content.yml and change the line with input directory to include the absolute path for demo_content_files/ where it's mounted inside of the container. input_dir: /workbench/islandora_workbench_demo_content/demo_content_files. See notes below for more information.
  6. Then run the docker build command from the parent directory islandora_workbench: docker build -t workbench-docker .
  7. (Optional) Check the config docker run -it --rm --network="host" -v $(pwd):/workbench --name my-running-workbench workbench-docker bash -lc "cd /workbench ; python setup.py install ; ./workbench --config /workbench/islandora_workbench_demo_content/example_content.yml --check"
  8. To create content start the container process docker run -it --rm --network="host" -v $(pwd):/workbench --name my-running-workbench workbench-docker bash -lc "cd /workbench ; python setup.py install ; ./workbench --config /workbench/islandora_workbench_demo_content/example_content.yml"

Notes:

In the config file, the input_dir is set to /workbench/islandora_workbench_demo_content/demo_content_files because that is the absolute path to the directory when the container is running. If you are running the workbench on your local machine, you will need to change the input_dir to the absolute path to the directory on your local machine.

... ROLLBACK IS CURRENTLY NOT WORKING WITH THIS DEMO CONTENT ...

To rollback the demo content

Check the config docker run -it --rm --network="host" -v $(pwd):/workbench --name my-running-workbench workbench-docker bash -lc "cd /workbench ; python setup.py install ; ./workbench --config /workbench/rollback.yml"

Workaround

If you want to rollback the content, you will need to manually delete the content from Drupal. The content should be removed in the following order: Files -> Media -> Nodes

# !!!!! WARNING !!!!!
# This will remove ALL media and files from the site

# Remove all files
docker-compose -f ../docker-compose.yml exec -T drupal bash -lc "drush entity:delete file"

# Remove all media
docker-compose -f ../docker-compose.yml exec -T drupal bash -lc "drush entity:delete media"

# Remove all nodes
docker-compose -f ../docker-compose.yml exec -T drupal bash -lc "drush entity:delete node $(tail -n +2 islandora_workbench_demo_content/demo_content_files/rollback.csv | sed 'H;1h;$!d;x;y/\n/,/')"

A more cautious solution would be to remove the content in the reverse order that it was created by using the rollback.csv generated by workbench. This would be a little more complicated to implement, but would be safer. But in no way is the trully "safe" so don't use this on a production site. Here's a script that will do that but should be used with caution and not on a production site. Github Gist: rollback_workaround.sh

TL;DR

git clone https://github.com/mjordan/islandora_workbench
cd islandora_workbench
git clone https://github.com/DonRichards/islandora_workbench_demo_content
sed -i.bak "s/^nopassword.*/password\: $(cat ../secrets/live/DRUPAL_DEFAULT_ACCOUNT_PASSWORD) /g" islandora_workbench_demo_content/example_content.yml
sed -i.bak "s|^input_dir.*|input_dir\: /workbench/islandora_workbench_demo_content/demo_content_files|g" islandora_workbench_demo_content/example_content.yml
docker build -t workbench-docker .
docker run -it --rm --network="host" -v $(pwd):/workbench --name my-running-workbench workbench-docker bash -lc "cd /workbench ; python setup.py install ; ./workbench --config /workbench/islandora_workbench_demo_content/example_content.yml"

TO DO

  • Add setup.py install to Dockerfile
  • Make Alternative rollback option
  • Fix rollback functionality

About

Demo content to work with islandora_workbench

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published