Skip to content

Instantly share code, notes, and snippets.

@mark-cooper
Last active November 30, 2022 03:04
Show Gist options
  • Save mark-cooper/211f3e8ff6733ef4a36d6edd1442c591 to your computer and use it in GitHub Desktop.
Save mark-cooper/211f3e8ff6733ef4a36d6edd1442c591 to your computer and use it in GitHub Desktop.
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'
alias purge_servers='docker stop $(docker ps -a -q) && docker rm -v $(docker ps -a -q -f status=exited) && docker rmi $(docker images -f "dangling=true" -q)'
alias purge_solr_dev_server='docker stop as_dev_solr && docker rm as_dev_solr'
alias reset_solr_dev_container='purge_solr_dev_server;build_dev;run_solr_dev'
alias reset_solr_state='./build/run solr:reset'

ArchivesSpace aliases

Run ArchivesSpace with aliases

purge_servers # to start from scratch (stops and removes everything)
build_dev # build the images (ensures correct solr config for this branch)
run_servers # starts the db and solr containers
reset_solr_state # (wait for solr to start 1st) clears the local indexer state
migrate_db # run the db migrations
run_aspace # run all the aspace apps (or run_api etc.)

Repeat these steps whenever necessary to completely start over with a fresh db and solr. This set of steps should be highly consistent in providing a working dev environment.

Resetting Solr only

If the servers are running and you want to keep the current db containers:

reset_solr_dev_container # stops and removes solr, rebuilds then runs it
reset_solr_state # (wait for solr to start 1st) clears the local indexer state

ArchivesSpace can also still be running when this is done.

@brianzelip
Copy link

Run ArchivesSpace with aliases including bootstrap and dev db

purge_servers # to start from scratch (stops and removes everything)
build_dev # build the images (ensures correct solr config for this branch)
run_servers # starts the db and solr containers
reset_solr_state # (wait for solr to start 1st) clears the local indexer state
bootstrap # install application dependencies
gzip -dc ./build/mysql_db_fixtures/accessibility.sql.gz | mysql --host=127.0.0.1 --port=3306  -u root -p123456 archivesspace # optional dev db
migrate_db # run the db migrations
run_aspace # run all the aspace apps (or run_api etc.)

@mark-cooper
Copy link
Author

@brianzelip running the dev env includes the demo (accessibility) db now, so some data should already be there!

https://github.com/archivesspace/archivesspace/blob/master/docker-compose-dev.yml#L14-L15

There should be some docs for running with no database or a different database. The easiest (though kind of lame) way to do it right now is:

Stop everything.
Temporarily delete ./build/mysql_db_fixtures/accessibility.sql.gz (for no database) or to copy a file over it (for a different database).
Start everything back up again.
(Don't accidentally commit the delete / update of the accessibility db file!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment