Skip to content

titanous/muckrock

 
 

Repository files navigation

MuckRock

Codeship Status for MuckRock/muckrock codecov.io

Install

  1. Check out the git repository

  2. git clone git@github.com:MuckRock/muckrock.git

  3. Set up your virtual machine

  4. Install Vagrant and VirtualBox

  5. Run vagrant up (this will take a while)

  6. Run vagrant ssh to ssh into the virtual machine

  7. Set the secrets

  8. cd muckrock

  9. touch .settings.sh

  10. The .settings.sh file should never be checked in to the repository.

  11. We will send you the (definitely) sensitive information in a (probably) secure manner.

  12. Inside your VM, run source ~/.bashrc.

  13. Populate the database and sync the files from AWS inside the virtual machine (Run all commands inside the VM)

  14. Restart the database to pick up correct permissions, sudo service postgresql

  15. Login to heroku toolbelt, heroku login

  16. Pull the database, fab populate-db

  17. Pull files from S3, fab sync-aws

  18. Build the search index

  19. Install watson with fab manage:installwatson

  20. Build the search index with fab manage:buildwatson

  21. After this, the index should stay updated. If a new model is registered with watson, then build the index (step 2). This command should be run on any staging or production servers when pushing code that updates the registration.

You should have a fully populated MuckRock site running locally now. The code checked out from GitHub is synced between the virtual machine and your host machine, so you may edit the code using your favorite text editor locally while running the code from within the virtual machine.

Develop

Run

  1. Run npm run watch & to start a background Webpack instance
  2. Run fab mail & to start a background email server
  3. Run fab celery & to start a background task queue
  4. Run fab runserver to start a server instance
  5. Navigate your web browser (from the host machine) to localhost:8000

Add dependencies

To add a dependency, list it in one of the two .in files inside the pip folder. The dev-requirements.in file is used for local libraries, like testing suites. The requirements.in file is used for production libraries—stuff that should run on Heroku.

When entering a dependency, make sure to append a comment explaining its purpose. This is hugely helpful when it comes to navigating dependency hell.

After entering your dependency in the .in file, run fab pip-compile to canonize your change.

Test and lint

  • Test your code in one of two ways:
    • Run fab test to run all the tests.
    • Run fab test:muckrock.<app> to test a particular application.
    • Run fab test:muckrock,1 to reuse the database between tests, which saves a ton of time.
  • Lint your Python by running fab pylint.
  • Lint your Javascript by running npm run lint.

Deploy

The master branch represents our product code. master should only ever be updated by merges from the dev branch, which tracks it. New features should be branched from dev, then merged back into dev once they are tested and linted. Any feature branch pushed to GitHub will be evaluated by Codeship. If the staging branch is pushed, the staging server will be updated. If the master branch is pushed, the production server will be updated.

Releases

No releases published

Packages

No packages published

Languages

  • Python 44.3%
  • Ruby 26.6%
  • HTML 14.1%
  • Puppet 6.7%
  • CSS 5.0%
  • JavaScript 2.5%
  • Other 0.8%