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

Automatically run Rosie and update Jarbas #449

Merged
merged 21 commits into from
Feb 8, 2019

Conversation

cuducos
Copy link
Collaborator

@cuducos cuducos commented Jan 17, 2019

This work in progress PR kicks-offs the implementation for #447. More details of the implementation in the issue page.

Feel free to jump in this PR ; )


Gonna update this roadmap from time to time:

This initial commit for this issue #447 suggests the usage of Ansible to
create and delete a DigitalOcean droplet to ru these tasks. In between these
steps we can run Roise and update Jarbas (but that's for next commits).

Co-authored-by: Eduardo Cuducos <cuducos@ok.org.br>
Co-authored-by: Filipe Cifali Stangler <cifali.filipe@gmail.com>
@cuducos cuducos force-pushed the cuducos-run-rosie-and-update-jarbas branch from 4ecdbe9 to 05f0cc3 Compare January 17, 2019 17:05
@cuducos
Copy link
Collaborator Author

cuducos commented Jan 29, 2019

Working on this issue I realized I oversimplified the Run the two update commands — the way I described before woulde nd up in data loss (namely reimbursement receipt texts, tweets and search vector). This step actually has to:

  1. Backup Twitter data to re-link reimbursements later
  2. Delete all data from Reimbursement model
  3. Load all data from all reimbursements-YYYY.csv files
  4. Load the suspicions.xz file
  5. Reload receipt texts (download the CSV and import it)
  6. Rebuild the search vector
  7. Restores Twitter data

I'm working on a Django command to handle that using existing update commands ; )

@cuducos cuducos force-pushed the cuducos-run-rosie-and-update-jarbas branch from e42016d to 217457e Compare February 1, 2019 12:16
@cuducos cuducos changed the title [WIP] Automatically run Rosie and update Jarbas Automatically run Rosie and update Jarbas Feb 1, 2019
Beyond minor edits (fix tests, PEP8, simplify docs) this commit adds a
new Django custom command to Jarbas and call it in the Ansible playbook.
This command:
* Backup Twitter data to re-link reimbursements later
* Delete all data from Reimbursement model
* Load all data from all reimbursements-YYYY.csv files
* Load the suspicions.xz file
* Reload receipt texts (download the CSV and import it)
* Rebuild the search vector
* Restores Twitter data
@cuducos cuducos force-pushed the cuducos-run-rosie-and-update-jarbas branch from 217457e to ebd05c8 Compare February 1, 2019 12:31
Copy link

@chicocvenancio chicocvenancio left a comment

Choose a reason for hiding this comment

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

I'm having a hard time understanding when the update command created here will be used.

@cuducos
Copy link
Collaborator Author

cuducos commented Feb 1, 2019

I'm having a hard time understanding when the update command created here will be used.

@chicocvenancio, well spotted. We must call it in the update.yml – gonna add a commit soon. My bad.


UPDATE Fixed in 1b1c515

Copy link

@chicocvenancio chicocvenancio left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@willianpaixao willianpaixao left a comment

Choose a reason for hiding this comment

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

Here are my initial thoughts on the PR.

contrib/update/update.yml Outdated Show resolved Hide resolved
contrib/update/update.yml Outdated Show resolved Hide resolved
contrib/update/Dockerfile Outdated Show resolved Hide resolved
contrib/update/requirements.txt Outdated Show resolved Hide resolved
As added to the README.md in this commit:

1. The `dopy` Python package Ansible depends on is
   [only available in Python 2](Wiredcraft/dopy#61)
2. We could use a fork, but we
   [would need to trust the fork owner](#449 (comment))
3. Maintaining a fork is out of our scope at the moment

However, Ansible is already
[migrating for an alternative package](ansible/ansible#33984)
and soon (before the end of life of Python 2) we will be able to update.

Thanks, @willianpaixao for the heads up on item #2.
After feedback from the community (thanks @willianpaixao and
@filipecifali) Ansible runs locally now (and not inside Docker anymore).

This change also addresses the issue of creating a one-time only SSH
key: now the process uses the host machine's SSH private key, and only
requires the user to inform (as an environment variable) the name the
public part of this key holds in DigitalOcean.

It also uses Pipenv to be more explicit and restrict about the Python 2
requirement: by using it to run the commands it ensures the Python
version specified in the Pipfile.
@cuducos cuducos merged commit 55b0772 into master Feb 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants