See the README for the Rails app for more information about the application.
We are working to support development in a Vagrant environment as well as a development environment using local Ruby and docker services. Choose your poison.
In deployed environments, Find is configured to point at a Solr index that is built and maintained by the catalog-indexing app.
Caveat: The vagrant development environment has only been tested in the local environments our developers currently have. This currently includes Linux, Intel-based Macs and M1 Macs.
In order to use the integrated development environment you will need to install Vagrant [do not use the Vagrant version that may be available for your distro repository - explicitly follow instructions at the Vagrant homepage] and the appropriate virtualization software. If you are running Linux or Mac x86 then install VirtualBox, if you are using a Mac with ARM processors then install Parallels.
You may need to update the VirtualBox configuration for the creation of a host-only network. This can be done by creating a file /etc/vbox/networks.conf
containing:
* 10.0.0.0/8
- The Find Rails app
- Solr
- Postgres
- Chrome (for running system tests)
From the vagrant directory run:
if running with Virtualbox:
vagrant up --provision
if running with Parallels:
vagrant up --provider=parallels --provision
This will run the vagrant/Vagrantfile which will bring up an Ubuntu VM and run the Ansible script which will provision a single node Docker Swarm behind nginx with a self-signed certificate to mimic a load balancer. Your hosts file will be modified; the domain catalog-find-dev.library.upenn.edu
will be added and mapped to the Ubuntu VM. Once the Ansible script has completed and the Docker Swarm is deployed you can access the application by navigating to https://catalog-find-dev.library.upenn.edu/.
To stop the development environment, from the vagrant
directory run:
vagrant halt
To destroy the development environment, from the vagrant
directory run:
vagrant destroy -f
You may ssh into the Vagrant VM by running:
vagrant ssh
Once your vagrant environment is set up you can ssh into the vagrant box to interact with the application:
- Enter the Vagrant VM by running
vagrant ssh
in the/vagrant
directory - Start a shell in the
find
container:
docker exec -it catalog-find_catalog_find.1.{whatever} sh
To index some same records into the Solr instance:
- Start a shell in the find app, see interacting-with-the-rails-application
- Run rake tasks:
bundle exec rake tools:index_sample_file
Important Note: The available Vagrant environment relies on a Bundler configuration that houses the installed gems in the
vendor/bundle
directory. If you want to use local services, and a local Ruby interpreter (viarbenv
,asdf
or somesuch), you'll need to instruct bundler to ignore this configuration when running commands withbundle
(includingbundle exec
).To ignore the vagrant-specific Bundler config in a terminal session, run
export BUNDLE_IGNORE_CONFIG=true
. Alternatively, you can prepend the environment variable with each command; e.g.BUNDLE_IGNORE_CONFIG=true bundle exec rails c
.
Guidance for working in this environment - with the above provision - can be found in the Rails App README file.
- Using Wireguard VPN...
- Get a deployed Solr collection URL complete with included basic auth credentials. Somethings like:
http://staging-admin:[email protected]/solr1/catalog-staging
. - Add a local settings file at
rails_app/config/settings.local.yml
that defines asolr_url
setting with the deployed Solr URL. - In the Vagrant environment, restart the Rails server by running
touch tmp/restart.txt
command in the runningcatalog-find_catalog_find
container. - DO NOT run any SolrTools methods that are going to modify the deployed Solr collection!