Skip to content

Commit

Permalink
Merge pull request #72 from pulibrary/console-script
Browse files Browse the repository at this point in the history
Add console script.
  • Loading branch information
hackartisan authored Sep 5, 2024
2 parents 61a455f + f3d733c commit cdeaebf
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ Run Docker Image: `docker run -t -p 4000:4000 -e DATABASE_URL='ecto://postgres:@
1. Connect to VPN
1. `BRANCH=<branch> ./bin/deploy staging`

## Connecting to Staging Shell or IEX Console

1. Connect to VPN
1. `./bin/console staging [bash/repl]`

## Figgy Fixtures

We copy fixtures from Figgy's production database into a Docker container so that we can easily use it for testing indexing. To rebuild that container:
Expand Down
28 changes: 28 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
ENV=$1
TYPE="${2:-bash}"
REPOSITORY="${REPO:-dpul-collections}"
CONSOLE_COMMAND=${CONSOLE_C:-./bin/dpul_collections remote}
JOB_NAME="${JOBNAME:-dpulc}"
JOB_TASK="${JOBTASK:-webserver}"

# Make sure we're on VPN
if ! nslookup nomad-host-prod1.lib.princeton.edu 2>&1 > /dev/null
then
echo "Unable to connect to nomad-host-prod1. Ensure you're on VPN."
exit 1
fi

if [[ -z "${ENV}" ]];
then
echo "Missing Environment. Command: './bin/console staging [bash/repl]'."
exit
fi

COMMAND="/bin/bash"
# Connect to the environment given.
if [ "$TYPE" = "repl" ]
then
COMMAND=$CONSOLE_COMMAND
fi
ssh -t deploy@nomad-host-prod1.lib.princeton.edu "nomad alloc exec -task ${JOB_TASK} -job ${JOB_NAME}-${ENV} ${COMMAND}"

0 comments on commit cdeaebf

Please sign in to comment.