Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run supervisord and our rq worker in dev containers #4392

Merged

Conversation

rmol
Copy link
Contributor

@rmol rmol commented Apr 29, 2019

Status

Ready for review

Description of Changes

To ensure asynchronous processes like submission deletion and hashing happen in dev containers, run supervisord and our rq worker.

This adds a "run_supervisor" function in dev-deps that creates a supervisor config under /tmp (which just runs the rq worker), and starts supervisor.

That function is now invoked in securedrop/bin/run.

The Dockerfiles now install supervisor via pip or pip3.

Fixes #4328.

Testing

I think the easiest way to test this is to check out this branch, edit securedrop/bin/run to comment out the manage.py run at the end and add bash there. Then start the dev container with this command:

PYTHON_VERSION=2 make -C securedrop dev

Once it starts, at the bash prompt in the container verify that our rq worker is running, with ps -ef|grep rq.

If so, run ./manage.py run & to start the dev servers, then cd /var/lib/securedrop/store; ls -alR -- you should see two directories containing the test data.

Navigate to the journalist interface at http://localhost:8081, log in, and try:

  • Deleting a single submission or reply.
  • Selecting several and deleting them.
  • Deleting a source.

After each deletion, list /var/lib/securedrop/store again to verify that the file associated with the submission was in fact deleted.

Run through the same test for Python3 using PYTHON_VERSION=3 make -C securedrop dev, and if you're feeling nostalgic, BASE_OS=trusty PYTHON_VERSION=2 make -C securedrop dev. Deletion should now work in all cases.

Deployment

This is only for development environments.

Checklist

If you made non-trivial code changes:

  • I have written a test plan and validated it for this PR

To ensure asynchronous processes like submission deletion and hashing
happen in dev containers, run supervisord and our rq worker.

This adds a "run_supervisor" function in dev-deps that creates a
supervisor config under /tmp (which just runs the rq worker), and
starts supervisor.

That function is now invoked in securedrop/bin/run.

The Dockerfiles now install supervisor via pip or pip3.

Fixes freedomofpress#4328.
Copy link
Contributor

@redshiftzero redshiftzero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm (tested python 2 and python 3 on xenial), thanks @rmol!

@redshiftzero redshiftzero merged commit 5240e5f into freedomofpress:develop Apr 30, 2019
SecureDrop Team Board automation moved this from Ready for review to Done Apr 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Files associated with deleted sources not deleted in dev env
2 participants