Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The ingest server runs as an executable jar. Using the init script allows for starting and stopping of the server as root: `service ingest-server start`

Administration

Local Bag Ingestion

When we need to ingest a Bag by hand because, the following steps need to be taken:

  1. Create a BagIt bag if one does not already exist
  2. Create a CSV containing the filenames and fixity values for each file in the Bag

  3. Create a Bag using the Create Bag API method from Ingest Restful-Server API
  4. Upload the Bag's file listing using the File Ingest API method
  5. Register a Staging entity for the Bag using the Create Staging API method, marking that the Bag is staged and ready to be replicated
    1. Note that it will take time for the Bag to be replicated as the Ingest Server will first create AceTokens for each file


Code Block
languagebash
titleExample Bag Ingest
collapsetrue
#!/bin/sh
#
# This is pseudocode which provides an example for how ingesting a bag might look
# when scripted. It will likely be revised before the production release of 3.0.0
# to actually work.
#################################################################################

BAGS="test-bag-0"
MANIFEST="manifest-sha256.txt"
TAGMANIFEST="tagmanifest-sha256.txt"

BAG_JSON="{}"
STAGING_JSON="{}"
INGEST_USER="ingest"
INGEST_PASSWORD="secret"
INGEST_BAG_CREATE="http://localhost:8080/api/bags"
INGEST_FILE_CREATE="http://localhost:8080/api/bags/{id}/files"
INGEST_STAGING_CREATE="http://localhost:8080/api/bags{id}/staging/BAG"

generate_csv() {
    for bag in $BAGS; do
        current_manifest="$bag/$MANIFEST"
        current_tagmanifest="$bag/$TAGMANIFEST"

        awk -v bag="$bag" 'BEGIN { printf "FILENAME,SIZE,FIXITY_VALUE,FIXITY_ALGORITHM\n" } 
                  { printf "\"" $2 "\","
                    system("find " bag "/" $2 " -printf '%s'")
                    printf ","
                    printf $1 ",SHA-256\n" }' $current_tagmanifest $current_manifest > "$bag".csv
        tagsum=$(sha256sum $current_tagmanifest | cut -c -64)
        tagsize=$(find $current_tagmanifest -printf '%s') 
        echo "\"$TAGMANIFEST\",$tagsize,$tagsum,SHA-256" >> "$bag".csv
        gzip -c "$bag".csv > "$bag".csv.gz

        echo -n "$bag csv: "
        find "${bag}.csv" -printf '%s\n'
    done
}

# generate a csv file
generate_csv();

# register the bag, files, and staging
curl --user ${INGEST_USER}:${INGEST_PASSWORD} --header "Content-Type: application/json" --data '${BAG_JSON}' ${INGEST_BAG_CREATE}
# the bag id needs to be retrieved and injected into the next 2 calls
curl --user ${INGEST_USER}:${INGEST_PASSWORD} -F "file=@${bag}.csv;type=text/csv" ${INGEST_FILE_CREATE}
curl --user ${INGEST_USER}:${INGEST_PASSWORD} --header "Content-Type: application/json" --data '${STAGING_JSON}' ${INGEST_STAGING_CREATE}

Resetting Passwords

As of version 1.4.0, passwords for users are now encoded using bcrypt. In the event a user forgets their password, we will need to reset it for them. As we do not have email notifications or anything of the like setup, for the moment everything will need to be done manually. We will first need to run the password through an encoder, which can be found online. If you aren't sure how many rounds to use, check the database as the information is kept as part of the encoding, i.e. $2a$08 uses 8 rounds; $2a$10 uses 10 rounds.

Then we connect to the database and issue a simple update:

...