-
Ruby version 2.7.4
-
Rails version 5.1.7
-
Blacklight 7.4.1
- Clone the git repo:
git clone [email protected]:emory-libraries/blacklight-catalog.git cd ./blacklight-catalog- Install the required gems:
gem install bundler:2.1.4bundle install
- Since we're now using MySQL for the database, run
rails db:create. If you run into errors here, it may be one of two things:- Your local
ENVvariables may not be set correctly. If so, reach out to an already up and running developer for help. - You may have MySQL already configured on your system and set to your own username and passwords. In this case, assign that information into the necessary
ENVvariables and try the create command above once more.
- Your local
- If you are still experiencing problems setting up the database, reach out to a software engineer for a screenshare meeting.
- Migrate the database:
rails db:migrate - Launch development instance of solr in the same folder but a separate terminal window/tab:
bundle exec solr_wrapper - First time running this application locally? Give yourself some test objects by following the directions here
- Start the application:
rails server - You should now be able to go to
http://localhost:3000/catalogand see the application - In order to be able to sign into the application locally, the environment variable DATABASE_AUTH=true must be set in your development environment. You must create a user via the rails console:
bundle exec rails c
u = User.new
u.uid = "user"
u.display_name = "User Name"
u.email = "[email protected]"
u.password = "password"
u.password_confirmation = "password"
u.save
- A separate instance of Solr must be up and running before tests can be run. To do so, run the following command inside your cloned folder:
solr_wrapper --config config/solr_wrapper_test.yml - In a new tab/window within the same folder, run
bundle exec rspec. All tests should be passing
- Save the output of the following to a Ruby file in
spec/support/solr_documents
bundle exec rails c
solr = Blacklight.default_index.connection
response = solr.get 'select', params: { q: 'id:YOUR_ID' }
document = response["response"]["docs"].first
document.deep_symbolize_keys!
- Remove
:scoreand:_version_lines (will not re-save to solr if these are included) - Assign to a global variable and add
.freezeto the end of the hash
- Connect to
vpn.emory.edu - Pull the latest version of
main - Stub AWS' environment variables for
Emory Account 70within the same terminal window. These can be found in the page loaded after logging into Emory's AWS. Directions below: a. After logging in, the page should be theAWS access portal. A table of multiple accounts should be presesnt (typically three). Expand theEmory Account 70option. b. Clicking onAccess keyswill open a modal with multiple credential options. Option 1 (Set AWS environment variables) is necessary for successful deployment. c. Copy the variables in Option 1, paste them into the terminal window that the deployment script will be processed, and press enter. - To deploy, run
BRANCH={BRANCH_NAME_OR_TAG} bundle exec cap {ENVIRONMENT} deploy. To deploy main to the arch environment, for instance, you runBRANCH=main bundle exec cap arch deploy.
If errors occur when running the deployment script, there could be a couple of factors causing them:
- Ensure you are authorized to access the server you are deploying to. You can verify your access by trying to ssh into the server e.g.
ssh deploy@SERVER_IP_ADDRESS. - The server IP lookup processing may not be working. In this case, stub the backup environment variables for the desired server in the local
.env.developmentfile. The list of backup environment variables are below:
ARCH_SERVER_IP=
TEST_SERVER_IP=
PROD_SERVER_IP=
- Install Docker using these instructions
- Clone the git repository
cdinto theblacklight-catalogrepository- Copy
docker-compose-sample.ymlintodocker-compose.ymland set credentials - Set env variables from
dotenv-samplein a new file.env.development. Reach out to a colleague for guidance setting this file since some credentials require additional approvals. Ensure credentials in.env.developmentmatch credentials indocker-compose.yml. - Run
docker compose up - Access the application through
http://localhost:3000
- Error
RSolr::Error::Http - 404 Not Foundoccurs while running tests.- Solution: The test Solr instance isn't running. You'll know that that Solr is up once you see this complete line:
Starting Solr 7.7.1 on port 8985 ... http://127.0.0.1:8985/solr/
- Solution: The test Solr instance isn't running. You'll know that that Solr is up once you see this complete line:
- Install and run Apache Jmeter in GUI mode.
- Open
jmeter/blacklight_catalog.jmxfrom the file menu. - Hit the green forward arrow to start the tests running.
- View the immediate results in "View Results Tree" (green with a checkmark for successes, red with an x for failures).
- If the test suite is ran more than once, results will build in "Aggregate Graph".
In development mode, this app uses gems rack-mini-profiler and stackprof for profiling and generating flamegraphs. To generate a flamegraph, add ?pp=flamegraph to any page you visit locally, e.g. http://localhost:3000/?pp=flamegraph will generate a flamegraph for the home page.