/ docker-startup.sh
docker-startup.sh
 1  #!/bin/bash
 2  
 3  DATA_TMP_DIR="${APPCONFIG_DATA_DIR:-"/archivesspace/data"}/tmp"
 4  
 5  # DEPLOY_PKG (optional): [./config/config.rb, ./config/robots.txt, ./plugins, ./stylesheets]
 6  if [[ -v ASPACE_DEPLOY_PKG_URL ]]; then
 7    wget -O /archivesspace/deploy_pkg.zip $ASPACE_DEPLOY_PKG_URL
 8    if [[ "$?" != 0 ]]; then
 9      echo "Error downloading deploy package from: $ASPACE_DEPLOY_PKG_URL"
10      exit 1
11    else
12      unzip -o /archivesspace/deploy_pkg.zip -d /archivesspace/tmp
13      cp /archivesspace/tmp/config/config.rb /archivesspace/config/config.rb || true
14      cp /archivesspace/tmp/config/robots.txt /archivesspace/config/robots.txt || true
15      cp -r /archivesspace/tmp/plugins/* /archivesspace/plugins/ || true
16      cp -r /archivesspace/tmp/stylesheets/* /archivesspace/stylesheets/ || true
17      rm -rf /archivesspace/tmp
18    fi
19  fi
20  
21  # INITIALIZE PLUGINS (optional): ASPACE_INITIALIZE_PLUGINS=plugin1,plugin2,plugin3
22  if [[ -v ASPACE_INITIALIZE_PLUGINS ]]; then
23    for plugin in ${ASPACE_INITIALIZE_PLUGINS//,/ }
24    do
25      echo "Initializing plugin: $plugin"
26      /archivesspace/scripts/initialize-plugin.sh $plugin
27    done
28  fi
29  
30  # clear out tmp pre-startup as it can build up if persisted
31  rm -rf $DATA_TMP_DIR/*
32  
33  if [ "$ASPACE_DB_MIGRATE" = true ]; then
34    /archivesspace/scripts/setup-database.sh
35    if [[ "$?" != 0 ]]; then
36      echo "Error running the database setup script."
37      exit 1
38    fi
39  fi
40  
41  exec /archivesspace/archivesspace.sh