DocumentCloud · Squarelet · MuckRock · DocumentCloud-Frontend
Analyze, Annotate, Publish. Turn documents into data.
You must first have these set up and ready to go:
- Squarelet. DocumentCloud depends on Squarelet for user authentication. As the services need to communicate directly, the development environment for DocumentCloud depends on the development environment for Squarelet - the DocumentCloud docker containers will join Squarelet's docker network. Please install Squarelet and set up its development environment first.
- DocumentCloud frontend
*Note the front end will not be functional until you complete the current install.
- Install software above and Git Large File support using these instructions.
- Ensure you have at least an additional 11 gigabytes of hard disk space allocated to Docker for these purposes.
- Ensure your Docker host application has at least 7gb of memory allocated, 10gb preferred.
- These instructions create 3 distinct docker compose sessions, with the Squarelet session hosting the shared central network.
- Check out the git repository -
git clone git@github.com:MuckRock/documentcloud.git
- Enter the directory -
cd documentcloud
- Run the dotenv initialization script -
python initialize_dotenvs.py
This will create files with the environment variables needed to run the development environment. - Set
api.dev.documentcloud.org
andminio.documentcloud.org
to point to localhost -echo "127.0.0.1 api.dev.documentcloud.org minio.documentcloud.org" | sudo tee -a /etc/hosts
- Run
export COMPOSE_FILE=local.yml;
in any of your command line sessions so that docker compose finds the configuration. - Run
docker compose up
. - Enter
api.dev.documentcloud.org/
into your browser - you should see the Django API root page. Note thatapi
is beforedev
in this service URL. - In
.envs/.local/.django
set the following environment variables:
SQUARELET_KEY
to the value of Client ID from the Squarelet ClientSQUARELET_SECRET
to the value of Client SECRET from the Squarelet Client- Additionally, get the value for
JWT_VERIFYING_KEY
by opening the Squarelet Django shell usinginv shell
and copying thesettings.SIMPLE_JWT['VERIFYING_KEY']
(remove the leadingb'
and the trailing'
, leave the\n
portions as-is)
- You must restart the Docker Compose session (via the command
docker compose down
followed bydocker compose up
) each time you change a.django
file for it to take effect. - Log in using the Squarelet superuser on the locally-running Documentcloud-frontend that you installed earlier at https://dev.documentcloud.org
SQUARELET_WHITELIST_VERIFIED_JOURNALISTS=True
environment variable makes it so only verified journalists can log into DocumentCloud.- Use the squarelet admin Organization page to mark your organization as a verified journalist to allow upload to DocumentCloud.
- Make your Squarelet superuser also a superuser on DocumentCloud Django: Run
inv shell
in the DocumentCloud folder and use these commands (no indent):tempUser = User.objects.all()[0] tempUser.is_superuser = True tempUser.save() tempUser.is_staff = True tempUser.save()
- Go to Django admin for DocumentCloud and add the required static flat page called
/tipofday/
. It can be blank. Do not prefix the URL with/pages/
. Specifying theSite
asexample.com
is alright. - Create an initial Minio bucket to simulate AWS S3 locally:
- Reference your DocumentCloud
.django
file for these variables: - Visit the
MINIO_URL
with a browser, likely at this address, and login with the minioMINIO_ACCESS_KEY
andMINIO_SECRET_KEY
- At the bottom right corner click the round plus button and then click the first circle that appears above it to "create bucket".
- Create a bucket called
documents
- Reference your DocumentCloud
- Upload a document:
- Check your memory allocation on Docker is at least 7gb. A sign that you do not have enough memory allocated is if containers are randomly failing or if your system is swapping heavily, especially when uploading documents.
- The "upload" button should not be grayed out (if it is, check your user organization Verified Journalist status above)
- If you get an error on your console about signatures, fix minio as above.
- If you get an error on your console about tipofday not found, add the static page as above.
- Develop DocumentCloud and its frontend!
- You can run the tests with
inv test
.
- If you want to run a subset of the tests, you can specify the directory containing the test you want with the
path
switch like so:inv test --path documentcloud/documents
.- You can specify a single file in
--path
if you only want to run the tests in that file.
- You can specify a single file in