Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation update for v0.0.5 #5

Merged
merged 3 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 10 additions & 24 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -51,38 +51,24 @@ CONSISTENCY=delegated
# locally you can continue to rely on "islandora", CI/DC will override this
# variable though.
#
# This should match image.isle.repository value in the Helm chart.
# PHP 8.1
ISLE_REPOSITORY=islandora
# PHP 8.1 local registry (i.e., isle-buildkit images built locally)
# Local registry (i.e., isle-buildkit images built locally)
# ISLE_REPOSITORY=islandora.dev

# The version of the isle-buildkit images to use.
#
# This should match image.isle.tag value in the Helm chart.
# PHP 8.1 remote registry
ISLE_TAG=3.2.4
# PHP 8.1 local registry (i.e., isle-buildkit images built locally)
# ISLE_TAG=latest

# The repository for images produced by this repository.
#
# The base path calincs/cwrc/leaf/leaf-base-i8 is included as it is shared
# across all images.
#
# This requires logging in:
#
# `docker login gitlab.com`
#
# This should match image.repsoitory value in the Helm chart.
REPOSITORY=registry.gitlab.com/calincs/cwrc/leaf/leaf-base-i8

# This should match image.tag value in the Helm chart.
TAG=local
# remote registry
ISLE_TAG=3.4.0
# local registry (i.e., isle-buildkit images built locally)
# ISLE_TAG=local

#####################################################################
# Config: General
# Config: General
#####################################################################
#DOMAIN=v2.cwrc.ca
DOMAIN=islandora.dev
SITE=https://${DOMAIN}

# The repository for images produced by this repository.
BAGGER_TAG=local
BAGGER_REPOSITORY=ghcr.io/cwrc
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN --mount=type=cache,id=bagger-apk-${TARGETARCH},sharing=locked,target=/var/ca
&& \
echo '' > /root/.ash_history

# PHP 8.1
#
ARG BAGGER_COMMIT="14661df7867af47bb86187f0f94a067e5aa91fd2"
ARG BAGGER_FILE=${BAGGER_COMMIT}.tar.gz
ARG BAGGER_URL="https://github.com/cwrc/islandora_bagger/archive/${BAGGER_FILE}"
Expand Down
55 changes: 34 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Bagger

Docker image for [Islandora Bagger](https://github.com/mjordan/islandora_bagger).
Container image for [Islandora Bagger](https://github.com/mjordan/islandora_bagger).

The application repository contains the documentation [Islandora Bagger](https://github.com/mjordan/islandora_bagger), this is likely a good place to start for learning how to use the application and how to use.

Produces archival information packages, [Bags](https://en.wikipedia.org/wiki/BagIt), for objects using Islandora's REST interface. For more information see [Islandora Bagger]

Expand Down Expand Up @@ -59,31 +61,23 @@ This container makes several opinionated assumptions about how one installs and
* Turn on the ability to register preservation bag creation with Drupal/Islandora (https://github.com/mjordan/islandora_bagger_integration/pull/31) via `BAGGER_DEFAULT_PER_BAG_REGISTER_BAGS_WITH_ISLANDORA`
* Make no assumptions about setup infrastructure: assume a proxy or edge router (see warnings about setup in [Islandora Bagger])

## Test

ToDo: revise

* permissions wrong (if `APP_ENV` is set to prod)
* automate the build of a list of resources to preserve and pass to islandora_bagger (rough idea: gather Drupal resources by their modified date and compare against the modified dates (or hash?) in the islandora_bagger_integration bag log and if differ then add to a list to preserve )
* post-bag plugin to upload archival packages to OLRC
* automate OCI image generation and upload to an image repository

ToDo: Test further
## Setup Drupal

* Test: Drupal Context that sends requests to the Bagger REST API to queue a preservation request
* test if per bag config can override location in the per config/services.yml. Also set in the crontab to override any overrides in the per bag
* convert yaml_path to an env (where the per bag configuration is stored on web requests for preservation - https://github.com/mjordan/islandora_bagger/blob/1b4973023d0ace40633c79340077980b3be7c947/src/Controller/IslandoraBaggerController.php#L26)
* `delete_settings_file`: problems arise if the resource is added to the queue multiple times before being preserved. The resource is added to the preservation queue multiple times but the settings file is only stored on the filesystem once thus the first preservation will delete the settings file and subsequent queued items may cause a missing settings file error.
See [Islandora Bagger] for the Drupal setup requirements. `getjwtonlogin` and `islandora_bagger_integration` are required. A quick way to add:

## Setup Drupal
Add to composer.json "repositories" key in your Drupal project

See [Islandora Bagger] for the Drupal setup requirements. `getjwtonlogin` and `islandora_bagger_integration` are required. A quick way to add (note: should use composer, this is a temporary kluge):
``` yaml
{
"type": "git",
"url": "https://github.com/cwrc/islandora_bagger_integration.git",
"no-api": true
},
```

``` bash
composer require 'drupal/getjwtonlogin:^2.0'
cd web/modules/contrib/
git clone https://github.com/mjordan/islandora_bagger_integration.git
cd /var/www/drupal
cd ${DRUPAL_HOME}
composer require -d /var/www/drupal 'drupal/getjwtonlogin:^2.0' 'mjordan/islandora_bagger_integration'
drush en -y getjwtonlogin
drush en -y islandora_bagger_integration
composer install
Expand Down Expand Up @@ -170,6 +164,25 @@ BAGGER_DEFAULT_PER_BAG_REGISTER_BAGS_WITH_ISLANDORA=true
* add `build/certs/rootCA.pem` to the containers `/etc/ssl/certs/ca-certificates.crt` file otherwise an SSL exception will occur
* note: this is not automatic at the moment

* Add additional Bagger properties to the `.env`, as needed.

## Test and future work

ToDo: revise

* permissions wrong (if `APP_ENV` is set to prod)
* automate the build of a list of resources to preserve and pass to islandora_bagger (rough idea: gather Drupal resources by their modified date and compare against the modified dates (or hash?) in the islandora_bagger_integration bag log and if differ then add to a list to preserve )
* post-bag plugin to upload archival packages to OLRC
* automate OCI image generation and upload to an image repository

ToDo: Test further

* Test: Drupal Context that sends requests to the Bagger REST API to queue a preservation request
* test if per bag config can override location in the per config/services.yml. Also set in the crontab to override any overrides in the per bag
* convert yaml_path to an env (where the per bag configuration is stored on web requests for preservation - https://github.com/mjordan/islandora_bagger/blob/1b4973023d0ace40633c79340077980b3be7c947/src/Controller/IslandoraBaggerController.php#L26)
* `delete_settings_file`: problems arise if the resource is added to the queue multiple times before being preserved. The resource is added to the preservation queue multiple times but the settings file is only stored on the filesystem once thus the first preservation will delete the settings file and subsequent queued items may cause a missing settings file error.


## References

[Islandora Bagger]: https://github.com/mjordan/islandora_bagger
6 changes: 3 additions & 3 deletions docker-compose.bagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
# COMPOSE_PATH_SEPARATOR=:
# COMPOSE_FILE=docker-compose.yml:docker-compose.bagger.yml
# # Environment for the Islandora Bagger container
# BAGGER_REPOSITORY=cwrc
# BAGGER_TAG=latest
# BAGGER_REPOSITORY=ghcr.io/cwrc
# BAGGER_TAG=local
# BAGGER_DEFAULT_PER_BAG_REGISTER_BAGS_WITH_ISLANDORA=true
#
# * copy this file into the repo
Expand Down Expand Up @@ -51,7 +51,7 @@ services:
<<: *dev
restart: "no"
environment:
BAGGER_DRUPAL_URL: ${SITE:-"https://islandora.dev"}
BAGGER_DRUPAL_URL: ${SITE:-"https://islandora.dev"}
BAGGER_CROND_ENABLE_SERVICE: ${BAGGER_CROND_ENABLE_SERVICE:-"true"}
BAGGER_CROND_SCHEDULE: ${BAGGER_CROND_SCHEDULE:-1 2 * * *}
BAGGER_CROND_LOG_LEVEL: ${BAGGER_CROND_LOG_LEVEL:-"8"}
Expand Down
12 changes: 4 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
##

secrets:
UID:
file: ./custom/secrets/UID
GID:
file: ./custom/secrets/UID
BAGGER_DRUPAL_DEFAULT_ACCOUNT_PASSWORD:
file: ./custom/secrets/DRUPAL_DEFAULT_ACCOUNT_PASSWORD

Expand Down Expand Up @@ -53,13 +49,13 @@ services:
BAGGER_DEFAULT_PER_BAG_LOG_BAG_CREATION: ${BAGGER_DEFAULT_PER_BAG_LOG_BAG_CREATION:-"true"}
BAGGER_DEFAULT_PER_BAG_LOG_BAG_LOCATION: ${BAGGER_DEFAULT_PER_BAG_LOG_BAG_LOCATION:-"false"}
BAGGER_DEFAULT_PER_BAG_REGISTER_BAGS_WITH_ISLANDORA: ${BAGGER_DEFAULT_PER_BAG_REGISTER_BAGS_WITH_ISLANDORA:-"false"}
image: ${REPOSITORY}/cwrc/isle-bagger:${TAG}
ports:
image: ${BAGGER_REPOSITORY}/isle-bagger:${BAGGER_TAG}
ports:
- 9856:8000
# secrets:
secrets:
# - source: UID
# - source: GID
# - source: BAGGER_DRUPAL_DEFAULT_ACCOUNT_PASSWORD
- source: BAGGER_DRUPAL_DEFAULT_ACCOUNT_PASSWORD
volumes:
- bagger-data:/var/www/bagger/var
- bagger-aip:${BAGGER_OUTPUT_DIR:-/data/aip}