forked from mjordan/islandora_workbench
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into simple-field-json
- Loading branch information
Showing
113 changed files
with
3,114 additions
and
1,234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Keep GitHub Actions up to date with GitHub's Dependabot... | ||
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot | ||
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem | ||
version: 2 | ||
updates: | ||
- package-ecosystem: github-actions | ||
directory: / | ||
groups: | ||
github-actions: | ||
patterns: | ||
- "*" # Group all Actions updates into a single larger pull request | ||
schedule: | ||
interval: weekly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env python3 | ||
|
||
"""Islandora Workbench shutdown script to send a the log file to someone | ||
if it contains any ERROR entries. | ||
""" | ||
|
||
import smtplib | ||
import re | ||
import sys | ||
from ruamel.yaml import YAML | ||
|
||
workbench_config_file_path = sys.argv[1] | ||
|
||
yaml = YAML() | ||
config_yaml = open(workbench_config_file_path, "r") | ||
config = yaml.load(config_yaml) | ||
if "log_file_path" in config: | ||
workbench_log_file_path = config["log_file_path"] | ||
else: | ||
log_file_path = "workbench.log" | ||
|
||
fromaddr = "someaddr@example.com" | ||
toaddrs = "anotheraddr@example.com" | ||
# toaddrs = "anotheraddr@example.com,yetanotheraddr@example.com" | ||
|
||
msg = ( | ||
"Subject: Islandora Workbench log file - there were errors!\r\nFrom: %s\r\nTo: %s\r\n\r\n" | ||
% (fromaddr, toaddrs) | ||
) | ||
|
||
# If the log contains any ERROR entries, mail it. | ||
log_file = open(workbench_log_file_path, "r") | ||
log_file_text = log_file.read() | ||
log_file.close() | ||
matches = re.findall("ERROR", log_file_text) | ||
|
||
if len(matches) > 0: | ||
msg = msg + log_file_text | ||
server = smtplib.SMTP("localhost") | ||
server.sendmail(fromaddr, toaddrs, msg.encode("utf-8")) | ||
server.quit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/usr/bin/env python3 | ||
|
||
"""Iterates over all nodes that are parents and warms the cache of the | ||
View that generates the node's IIIF Manifest at /node/xxx/book-manifest. | ||
""" | ||
|
||
import sys | ||
import os | ||
import logging | ||
import sqlite3 | ||
import logging | ||
import tempfile | ||
from ruamel.yaml import YAML | ||
import requests | ||
from requests.exceptions import ConnectTimeout, ReadTimeout, ConnectionError | ||
|
||
logging.basicConfig( | ||
filename="iiif_generation.log", | ||
level=logging.INFO, | ||
format="%(asctime)s - %(levelname)s - %(message)s", | ||
datefmt="%d-%b-%y %H:%M:%S", | ||
) | ||
|
||
current_config_file_path = sys.argv[1] | ||
|
||
yaml = YAML() | ||
config_yaml = open(current_config_file_path, "r") | ||
config = yaml.load(config_yaml) | ||
if "csv_id_to_node_id_map_path" in config: | ||
csv_id_to_node_id_map_path = config["csv_id_to_node_id_map_path"] | ||
else: | ||
csv_id_to_node_id_map_path = os.path.join( | ||
tempfile.gettempdir(), "csv_id_to_node_id_map.db" | ||
) | ||
|
||
if os.path.exists(csv_id_to_node_id_map_path) is False: | ||
logging.error( | ||
f"Can't find CSV ID to node ID map database at {csv_id_to_node_id_map_path}" | ||
) | ||
sys.exit(1) | ||
|
||
query = ( | ||
"select config_file,csv_id,node_id from csv_id_to_node_id_map where node_id in" | ||
+ f" (select parent_node_id from csv_id_to_node_id_map where parent_node_id != '') and config_file = '{current_config_file_path}'" | ||
) | ||
|
||
try: | ||
params = () | ||
con = sqlite3.connect(csv_id_to_node_id_map_path) | ||
con.row_factory = sqlite3.Row | ||
cur = con.cursor() | ||
res = cur.execute(query, params).fetchall() | ||
con.close() | ||
except sqlite3.OperationalError as e: | ||
logging.error(f"Error executing database query: {e}") | ||
sys.exit(1) | ||
|
||
for row in res: | ||
try: | ||
# row[1] is CSV ID, row[2] is node ID | ||
url = f"{config['host']}/node/{row[2]}/book-manifest" | ||
r = requests.get(url, timeout=60) | ||
if r.status_code == 200: | ||
logging.info(f"Generated IIIF Manifest {url} (CSV ID {row[1]}).") | ||
else: | ||
logging.error( | ||
f"Problem hitting IIIF Manfiest for {url} (CSV ID {row[1]}): HTTP response code was {r.status_code}." | ||
) | ||
except Exception as e: | ||
logging.error(f"Problem accessing {url}: {e}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ task: create | |
host: https://islandora.traefik.me | ||
username: admin | ||
password: password | ||
secure_ssl_only: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.