Skip to content

Common (Docker) Tasks

maxwellbenjamin edited this page Sep 10, 2019 · 2 revisions

Spin up servers

  • Start Solr, Fedora, and Rails servers

    1. Type cd ./ucla2019 to change directory to the root of your Rails application
    2. Type docker-compose up
  • Shut down Solr, Fedora, and Rails servers

    1. In the terminal window where your servers are running, type ctrl-C
    2. Alternative: In your main terminal window, in your project context, type docker-compose down.
  • Start a Bash session to your application container

    1. Type cd ./ucla2019 to change directory to the root of your Rails application
    2. Type docker-compose run web bash to connect to a command prompt running in the application container
    3. Type exit when you're done to return to to your local system
  • Start a Rails console

    1. Type cd ./ucla2019 to change directory to the root of your Rails application
    2. Type docker-compose run web rails console to enter the console (or rails c for shorthand)
    3. Type exit when you're done to return to your local system

Common error fixes

  • Fix Solr if you get an error like ERROR: Core 'hydra-test' already exists!

    1. Clear the test solr instance using rm -rf tmp/solr-test/server/solr/hydra-test
    2. ALTERNATE Try solr_wrapper --config config/solr_wrapper_test.yml clean
    3. Try rails ci again and things should work; if not, ask for help!
  • Re-set Repository (without re-pulling code)

    1. Keep servers running
    2. In a rails console (docker-compose run web rails console)
      • Clean out Fedora
      require 'active_fedora/cleaner'  
      ActiveFedora::Cleaner.clean!
      
      • Clean out Solr
      Blacklight.default_index.connection.delete_by_query("*:*"); Blacklight.default_index.connection.commit
      
    3. On the command line docker-compose run web bundle exec rake db:reset
    4. On the command line,
      • Standard new repo set-up
      docker-compose run web bundle install
      docker-compose run web rails db:migrate
      docker-compose up
      docker-compose run web rails hyrax:default_collection_types:create
      docker-compose run web rails hyrax:default_admin_set:create
      

Advanced topics

  1. To use byebug:
  • After hitting the byebug in your code, run docker ps to get the id for the web container. Copy that id and then run:
      docker attach 943094304
  • Hit enter and you'll be in the byebug.