Management commands
Within the Docker container of the Arkindex backend, the arkindex executable provides a multitude of subcommands to help manage an Arkindex instance, develop on Arkindex, or troubleshoot issues.
This page only documents some of the available subcommands. To retrieve a list of all available subcommands, run arkindex --help. To get help about a single subcommand, use arkindex <subcommand> --help.
cleanup
This command removes unused items in the database and the S3 buckets to free up space.
arkindex cleanup
This command will remove:
-
All Ponos artifacts that are not tied to a Process;
-
Artifacts and log files from the tasks of expired processes, both in the database and on S3 buckets;
-
Old database exports, both in the database and on S3 buckets;
-
All database exports on S3 that are not tied to a reference in database anymore;
-
All uploaded files on S3 that are not tied to a reference in database anymore;
-
All images in the database that are over 2 weeks old and are not tied to any element;
-
All images on the S3 bucket of the local IIIF server that are not in the database;
-
Ponos logs that are not tied to a task in the database;
-
Worker instances that have been archived for longer than the configured worker cleanup delay and that are not being used in any worker result;
-
Model instances that have been archived for longer than the configured model cleanup delay and that are not being used in any worker result;
-
Model versions from the bucket that are not tied to a reference in the database;
-
Links between users and asynchronous jobs that no longer exist in the cache;
-
Unused worker types that are not tied to any workers in the database.
|
Automation
We recommend running this command through cron, using a Docker command:
|
cleanup_unused_corpus
| This command is only available in Enterprise Edition. |
Detects inactive projects within a specified category, then either warns of their imminent deletion or deletes them.
arkindex cleanup_unused_corpus
[--dry-run]
[--inactive-day-warning <days>]
[--inactive-day-deletion <days>]
<category_slug>
This command may perform one of three actions on a project:
-
Mark a project as expiring if it appears to have been inactive over the specified warning delay, emailing all users that are administrators of the project about this expiration;
-
Unset the expiration warning if the project became active again;
-
Delete the project, if it was already marked as expiring and is still inactive after the specified deletion delay, emailing all project administrators of the deletion.
The default warning delay is 30 days, and the default deletion delay is 90 days.
The --dry-run option will cause this command to only print what it would do, without updating or deleting any project and without sending emails.
Whether or not a project is active is determined by:
-
the last update date of the project itself;
-
the last update date of any element within the project;
-
the last update date of any process within the project.
When combining this command with the default_corpus_category setting, it becomes possible to allow users to create any project, then have them automatically deleted when they become inactive, unless an instance administrator intervenes to change the project’s category to a different one.
This command is intended to be run periodically, for example as a cron job.
load_export
Imports a database export into a new project.
arkindex load_export
<database_path>
--email <email>
[--corpus-name <name>]
database_path-
Path to the SQLite database to import.
--email-
Email address of an existing Arkindex user on this instance to which administrator rights for the new project will be granted.
--corpus-name-
A custom name for the newly created project.
When this is not set, the project will be named after the database file name.
If the database file name cannot be used, the project will be instead named
Corpus importfollowed by the date and time of the import.
| An export from an Arkindex instance cannot be re-imported into the same instance unless the original project has first been deleted. |
reindex
Runs search indexation for one project, or for all indexable projects. The search feature flag must be enabled.
arkindex reindex
[--drop]
[--setup]
(--all | --corpus-id <id>)
Either --all or --corpus-id must be set. Both cannot be set at once. The other arguments are optional.
--drop-
Delete any existing index for this project before indexing. This is required when a breaking change in the indexation process is part of your release upgrade notes.
--setup-
Do not add or update any data in the index. This will only create a new index, or update the fields in an existing index.
--all-
Execute the specified actions on all indexable projects.
--corpus-id <id>-
Execute the specified actions on only one indexable project.
sendtestemail
Sends a test e-mail to one or more addresses using the current email configuration.
This command is provided by Django, the web framework behind Arkindex. To learn more about this command, see the Django documentation.
arkindex sendtestemail <email> [<email> ...]
Only one email will be sent, with all of the specified addresses in the To header.
When the email configuration is entirely absent, the email to be sent will be printed to the console instead of being sent to any SMTP server. When emails are configured, there will be no output if the command succeeds, and a Python error message otherwise.
The --admins and --managers options of this command have no effect, as they rely on Django features that are not used by Arkindex.