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.
Overview of the steps to use this content:
- Clone islandora_workbench repo
- Clone this repo inside of that directory
- Edit config file
- Build the docker container
- Check the config (optional)
- Run the docker container to create the content
- Clone https://github.com/mjordan/islandora_workbench
- Change directory into the islandora_workbench directory (
cd islandora_workbench
) - Clone this repo inside of that directory (
git clone https://github.com/DonRichards/islandora_workbench_demo_content
) - 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.
- 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. - Then run the docker build command from the parent directory islandora_workbench:
docker build -t workbench-docker .
- (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"
- 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"
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.
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"
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
git clone https://github.com/mjordan/islandora_workbench
cd islandora_workbench
git clone https://github.com/DonRichards/islandora_workbench_demo_content
SITE="http://localhost:8000"
# Reset the password in the config files
find islandora_workbench/islandora_workbench_demo_content/ -type f -name '*.yml' -exec sed -i.bak 's/^nopassword.*/password\: $(shell cat secrets/live/DRUPAL_DEFAULT_ACCOUNT_PASSWORD) /g' {} +
# Set the domain in the config files
find islandora_workbench/islandora_workbench_demo_content/ -type f -name '*.yml' -exec sed -i.bak '/^host:/s/.*/host: "$(subst /,\/,$(subst .,\.,${SITE}))\/"/' {} +
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"
- Add setup.py install to Dockerfile
- Make Alternative rollback option
- Fix rollback functionality