Home

Awesome

Nabu Catalog

Setting up your dev environment

Use direnv to add bin to your path

PATH_add bin

Bring up the environment

# Build the base image
docker compose build

# Install the gems
nabu_run bundle

# Bring up all the containers
docker compose up

This brings up the following containers

You can then easily run all the standard commands by prefixing with nabu

nabu_run bundle install
nabu_run bundle exec rake db:create
nabu_run bundle exec rake db:schema:load
nabu_test bundle exec rake db:schema:load
nabu_run bundle exec guard # Test runner

Production

The application is designed to be deployed with containers into an AWS account using CDK

To bootstrap a new account

# Setup an AWS account and credentials as per your preferred method and set the environment to use it
AWS_PROFILE=nabu
REGION=ap-southeast-2
ACCOUNT=$(aws sts get-caller-identity | jq -r .Account)
cdk bootstrap aws://$ACCOUNT/$REGION

If ECR complains about access

ACCOUNT=$(AWS_PROFILE=nabu-stage aws sts get-caller-identity | jq -r .Account)
AWS_PROFILE=nabu-stage aws ecr get-login-password --region ap-southeast-2 | docker login --username AWS --password-stdin $ACCOUNT.dkr.ecr.ap-southeast-2.amazonaws.com

Deployment

Use CDK to deploy new code via docker as well as any infrastructure changes

bin/release stage
bin/release prod

If necessary:

bin/aws/ecs_rake deploy:migrate
bin/aws/ecs_rake searchkick:reindex

Importing a production database into your development environment

AWS_PROFILE=nabu-prod bin/aws/ecs_shell jobs -c "'mysqldump -u nabu -h \"\$NABU_DATABASE_HOSTNAME\" -p\"\$NABU_DATABASE_PASSWORD\" --single-transaction nabu | bzip2 | base64'" >| ../nabu.sql.bz2.b64
base64 -id < ../nabu.sql.bz2.b64 > ../nabu.sql.bz2
nabu_run bundle exec rake db:drop db:create
bzip2 -dc ../nabu.sql.bz2 | mysql -h 127.0.0.1 -u root nabu_devel
nabu_run bin/rails db:environment:set RAILS_ENV=development
nabu_run bin/rake db:migrate
nabu_run bin/rake searchkick:reindex:all

New Ethnologue data

We use the following source locations

Run the following rake task to import everything

bundle exec rake import:ethnologue

This will

OAI-PMH

OLAC available at:

The feeds that OLAC harvests:

Individual item:

RIF-CS available at:

use resulting server on an OAI repository explorer:

URLs to test:

The feed that ANDS harvests:

Test at ANDS:

Feed for a single collection:

Setup Secrets

aws secretsmanager list-secrets

aws secretsmanager put-secret-value --secret-id ARN --secret-string "{\"site_key\":\"***\", \"secret_key\":\"***\"}"

Upgrades

We should regularly make sure we are running the latest versions of third-party packages

# Ruby gems
nabu_run bundle outdated
nabu_run bundle update

# npm
nabu_run bin/importmap audit
nabu_run bin/importmap outdated

# Sentry
# https://docs.sentry.io/platforms/javascript/install/cdn/
vi app/views/layouts/application.html.haml