Skip to content

Instantly share code, notes, and snippets.

@mark-cooper
Created April 28, 2022 00:41
Show Gist options
  • Save mark-cooper/742a03420e87c657460c9a9c5bcf9b05 to your computer and use it in GitHub Desktop.
Save mark-cooper/742a03420e87c657460c9a9c5bcf9b05 to your computer and use it in GitHub Desktop.
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"
export APPCONFIG_PUBLIC_URL="http://localhost:3001"
export APPCONFIG_SOLR_URL="http://localhost:8983/solr/archivesspace"
# cfg secrets
export APPCONFIG_FRONTEND_COOKIE_SECRET=aspace.devserver
export APPCONFIG_PUBLIC_COOKIE_SECRET=aspace.devserver
export APPCONFIG_PUBLIC_USER_SECRET=aspace.devserver
export APPCONFIG_SEARCH_USER_SECRET=aspace.devserver
export APPCONFIG_STAFF_USER_SECRET=aspace.devserver
export JAVA_OPTS="$JAVA_OPTS -Daspace.devserver=true -Dfile.encoding=UTF-8 -Xmx2g" # -verbose:gc
jruby-9.2.20.1
#!/bin/bash
# Requires rbenv: https://github.com/rbenv/rbenv
# SETUP / RESET
# ./build/run db:nuke && ./build/run db:migrate && ./build/run solr:reset
# RUN THE DEVSERVERS
# ./asdev backend
# ./asdev frontend
# ./asdev public
# ./asdev indexer
# BACKEND PRY CONSOLE:
# ./asdev backend "pry -r ./app/main.rb"
cd "`dirname "$0"`"
rbenv install -s
APP=$1
CMD=$2
if [ -z "${APP}" ]; then
echo "App is required."
exit 1
fi
if [ -z "${CMD}" ]; then
case $APP in
backend)
CMD="ruby ./app/main.rb"
;;
frontend)
CMD="./script/rails s mizuno -p 3000 -b 0.0.0.0"
;;
public)
CMD="./bin/rails s mizuno -p 3001 -b 0.0.0.0"
;;
indexer)
CMD="ruby ./app/main.rb"
;;
*)
echo "Unknown app: ${APP}"
exit 1
;;
esac
fi
source .env.asdev
cd $APP
eval "bundle exec $CMD"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment