Skip to content
Switch branches/tags
Go to file

Latest commit



Failed to load latest commit information.
Latest commit message
Commit time


Codeship Status for MuckRock/muckrock

MuckRock is a non-profit collaborative news site that gives you the tools to keep our government transparent and accountable.


Software required

  1. docker
  2. docker-compose
  3. python
  4. invoke

Installation Steps

MuckRock depends on Squarelet for user authentication. As the services need to communivate directly, the development environment for MuckRock depends on the development environment for Squarelet - the MuckRock docker containers will join Squarelet's docker network. Please install Squarelet and set up its development environment first.

  1. Check out the git repository - git clone
  2. Enter the directory - cd muckrock
  3. Run the dotenv initialization script - python This will create files with the environment variables needed to run the development environment.
  4. Set up the javascript run inv npm "install" and inv npm "run build"
  5. Start the docker images - inv up This will build and start all of the docker images using docker-compose. The invoke tasks specify the local.yml configuration file for docker-compose. If you would like to run docker-compose commands directly, set the environment variable export COMPSE_FILE=local.yml.
  6. Set to point to localhost - sudo echo "" >> /etc/hosts
  7. Enter into your browser - you should see the MuckRock home page.

Docker info

The development environment is managed via docker and docker compose. Please read up on them if you are unfmiliar with them. The docker compose file is local.yml. If you would like to run docker-compose commands directly, please run export COMPOSE_FILE=local.yml so you don't need to specify it in every command.

The containers which are run include the following:

  • Django This is the Django application

  • PostgreSQL PostgreSQL is the relational database used to store the data for the Django application

  • Redis Redis is an in-memory datastore, used as a message broker for Celery as well as a cache backend for Django.

  • Celery Worker Celery is a distrubuted task queue for Python, used to run background tasks from Django. The worker is responsible for running the tasks.

  • Celery Beat The celery beat image is responsible for queueing up periodic celery tasks.

All systems can be brought up using inv up. You can rebuild all images using inv build. There are various other invoke commands for common tasks interacting with docker, which you can view in the file.

Squarelet Integration

If you have not yet created an RSA key on squarelet, please run: creatersakey from the squarelet command line.

Create the client on Squarelet by going to the Admin site - OpenID Connect Provider - Clients and adding a client.

  • Name - set this to MuckRock Dev
  • Owner - you may leave this blank or set it to your user account.
  • Client Type - Confidential
  • Response types - code (Authorization Code Flow)
  • Redirect URIs - (you may optionally add on a second line if you will be developing FOIAMachine)
  • JWT Algorithm - RS256
  • Require Consent? - Unchecked
  • Reuse Consent? - Checked
  • Client ID - This will be filled in automatically upon saving, and will be copied into the .envs/.local/.django file.
  • Client SECRET - This will be filled in automatically upon saving, and will be copied into the .envs/.local/.django file.
  • Scopes - read_user write_user read_organization write_charge read_auth_token
  • Post Logout Redirect URIs - (you may optionally add on a second line if you will be developing FOIAMachine)
  • Add a client profile and set the Webhook URL -

Click save and continue editing. In .envs/.local/.django set the following environment variables:

  • SQUARELET_KEY to the value of Client ID
  • SQUARELET_SECRET to the value of Client SECRET

You should now be able to log in to MuckRock using your Squarelet account.

Networking Setup

The MuckRock development environment will join Squarelet's environments docker network, so that the services can coexist. Please see the README file from Squarelet for more information.

Environment Variables

The application is configured with environment variables in order to make it easy to customize behavior in different environments (dev, testing, staging, production, etc). Some of this environment variables may be sensitive information, such as passwords or API tokens to various services. For this reason, they are not to be checked in to version control. In order to assist with the setup of a new development environment, a script called is provided which will create the files in the expected places, with the variables included. Those which require external accounts will generally be left blank, and you may sign up for an account to use for development and add your own credentials in. You may also add extra configuration here as necessary for your setup.

Invoke info

Invoke is a task execution library. It is used to allow easy access to common commands used during development. You may look through the file to see the commands being run. I will go through some of the more important ones here.


inv prod will merge your dev branch into master, and push to GitHub, which will trigger CodeShip to release it to Heroku, as long as all code checks pass. The production site is currently hosted at inv staging will push the staging branch to GitHub, which will trigger CodeShip to release it to Heroku, as long as all code checks pass. The staging site is currently hosted at


inv test will run the test suite. To reuse the database, pass it the -r=1 option. inv coverage will run the test suite and generate a coverage report at htmlcov/index.html.

The test suite will be run on CodeShip prior to releasing new code. Please ensure your code passes all tests before trying to release it. Also please add new tests if you develop new code.

Code Quality

inv pylint will run pylint. It is possible to silence checks, but should only be done in instances where pylint is misinterpreting the code. inv format will format the code using the yapf code formatter.

Both linting and formatting are checked on CodeShip. Please ensure your code is linted and formatted correctly before attempting to release changes.


inv up will start all containers in the background. inv runserver will run the Django server in the foreground. Be careful to not have multiple Django servers running at once. Running the server in the foreground is mainly useful for situations where you would like to use an interactive debugger within your application code. inv shell will run an interactive python shell within the Django environment. inv sh will run a bash shell within the Django docker comtainer. inv dbshell will run a postgresql shell. inv manage will allow you to easily run Django commands. inv npm will allow you to run NPM commands. inv npm "run build" should be run to rebuild assets if any javascript or CSS is changed. If you will be editing a lot of javascript or CSS, you can run inv npm "run watch". inv heroku will open a python shell on Heroku.

Pip Tools

Python dependencies are managed via pip-tools. This allows us to keep all of the python dependencies (including underling dependencies) pinned, to allow for consistent execution across development and production environments.

The corresponding files are kept in the pip folder. There are requirements and dev-requirements files. requirements will be installed in all environments, while dev-requirements will only be installed for local development environments. It can be used for code only needed during develpoment, such as testing. For each environment there is an .in file and a .txt file. The .in file is the input file - you list your direct dependencies here. You may specify version constraints here, but do not have to.

Running inv pip-compile will compile the .in files to the corresponding .txt files. This will pin all of the dependencies, and their dependencies, to the latest versions that meet any constraints that have been put on them. You should run this command if you need to add any new dependencies to an .in files. Please keep the .in files sorted. After running inv pip-compile, you will need to run inv build to rebuild the docker images with the new dependencies included.


FOIAMachine is our free FOIA filing tool, that allows you to track your requests while requiring you to manually handle all of the message sending and receiving. It is run off of the same code base as MuckRock. To access it, set to point to localhost - sudo echo "" >> /etc/hosts. Then pointing your browser to will take you to FOIAMachine - the correst page is shown depending on the domain host.

Update search index

MuckRock uses watson for search. The index should stay updated. If a new model is registered with watson, then build the index (fab manage:buildwatson). This command should be run on any staging or production servers when pushing code that updates the registration.


MuckRock's source code - Please report bugs, issues and feature requests to





No releases published


No packages published