Skip to content

Instantly share code, notes, and snippets.

@mark-cooper
mark-cooper / .bash_aliases
Last active November 30, 2022 03:04
ArchivesSpace aliases
# run app / server aliases
alias run_api='supervisord -c supervisord/api.conf'
alias run_aspace='supervisord -c supervisord/archivesspace.conf'
alias run_backend='supervisord -c supervisord/backend.conf'
alias run_servers='docker-compose -f docker-compose-dev.yml up --detach'
alias run_solr_dev='docker-compose -f docker-compose-dev.yml up solr1 --detach'
# build / container management aliases
alias bootstrap='./build/run bootstrap'
alias build_dev='docker-compose -f docker-compose-dev.yml build'
alias migrate_db='./build/run db:migrate'
@mark-cooper
mark-cooper / index.html
Created May 7, 2022 05:55
CSpace Public Browser example
<!DOCTYPE html>
<html>
<!-- cspace public browser tester -->
<!-- python3 -m http.server [8000] -->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>CollectionSpace Public Browser</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css">
@mark-cooper
mark-cooper / .env.asdev
Created April 28, 2022 00:41
Experiment with scripts for running dev servers directly using jruby.
# cfg gems etc.
export ASPACE_ENV=development
export CLASSPATH=$PWD/build/gems/jruby/2.5.0:$PWD/common:$PWD/common/lib/*
export GEM_HOME=$PWD/build/gems/jruby/2.5.0
export GEM_PATH=$PWD/build/gems:$GEM_HOME
# cfg urls
export APPCONFIG_BACKEND_URL="http://localhost:4567"
export APPCONFIG_DB_URL="jdbc:mysql://127.0.0.1:3306/archivesspace?useUnicode=true&characterEncoding=UTF-8&user=as&password=as123&useSSL=false&allowPublicKeyRetrieval=true"
export APPCONFIG_FRONTEND_URL="http://localhost:3000"
@mark-cooper
mark-cooper / ascli
Last active March 7, 2022 23:11
Load ArchivesSpace backend in a pry session
#!/bin/bash
# SETUP: requires asdf || rbenv
# asdf install ruby jruby-9.2.20.1 && asdf local ruby jruby-9.2.20.1 && gem install bundler pry
# rbenv install jruby-9.2.20.1 && rbenv local jruby-9.2.20.1 && gem install bundler pry
# chmod u+x ./ascli
# ./build/run bootstrap && ./build/run db:migrate
# ./ascli (default asdf) # ./ascli rbenv
export ASCLI_RUNNER=${1:-asdf} # or rbenv
export RUBYLIB=$PWD/common/

Upgrading Rack for ArchivesSpace

  • Install local JRuby (match aspace version, currently: 9.2.12.0) and switch to it.
  • Install Maven.
  • Download jruby-rack.
git checkout 1.1-stable
# install bundler version to match 1.1-stable Gemfile.lock
gem install bundler --version=1.14.6
@mark-cooper
mark-cooper / exports.py
Last active July 18, 2018 23:02
ArchivesSpace: basic script to download exported files to `exports` folder in current directory.
#!/usr/bin/env python3
'''
Basic script to download exported files to `exports` folder in current
directory. It will only download if a file does not exist or the remote
file is updated and "newer" than an existing local file. A remote file
with deleted status will be removed if it exists in the local directory.
SETUP:
python3 required [adjust python3 and pip3 refs per system setup]
@mark-cooper
mark-cooper / check_archon_classifications.rb
Created March 22, 2017 18:34
Check Archon returns all classifications
require 'httparty'
require 'json'
require 'set'
def ok_status?(code)
code.to_s =~ /^2/
end
BASE_URL ="http://localhost/"
$batch_start = 1
DELIMITER //
CREATE FUNCTION generateLocationTitle(_id INT)
RETURNS TEXT
READS SQL DATA
BEGIN
DECLARE _title VARCHAR(255) DEFAULT '';
SELECT
REPLACE(
CONCAT(
@mark-cooper
mark-cooper / TOP_CONTAINER_MIGRATION.md
Last active June 3, 2016 05:56
Top container migration -- what happens?

Top container migration

Reminder: regarding top containers you may have an issue if you don't use barcodes and do reuse numbering sequences within the same resource or accession. Otherwise, review the upgrade documentation and relax =)

What happens during the top container migration? Example (fairly) typical tree with parallel sequencing (reused box numbering sequences):

Record 1
-
@mark-cooper
mark-cooper / Vagrantfile
Created September 9, 2015 05:44
Local no-thrills, no-assumptions vagrant box for dev
# -*- mode: ruby -*-
# vi: set ft=ruby :
$cpu = ENV.fetch('DEV_CPU', 4)
$ram = ENV.fetch('DEV_RAM', 4096)
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.box_check_update = true
config.vm.hostname = "dev"