Github mirror of wikimedia/fundraising/tools - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)
The main documentation for our Acoustic exports can be found at https://wikitech.wikimedia.org/wiki/Fundraising/Data_and_Integrated_Processes/Acoustic_Integration#Exporting_data_to_Acoustic
We don't have a fully sorted config to make this 'just work' on our docker installs with no set up. The current place for work on that is https://phabricator.wikimedia.org/T341017 This README provides enough to run the code in 2 ways
silverpop
The Acoustic (Silverpop) export code runs on our staging server nightly using our replica db.
To run the test script you need to run the command tox
in this folder on your civicrm
container. The steps below describe config/ cli options to get it to run.
Silverpop tests require a test mysql database to exist. Add it with the following:
CREATE database test;
CREATE USER `test`@`%`;
GRANT ALL PRIVILEGES ON test.* TO `test`@`%`;
From the civicrm container it is enough to login as root (bkr - see aliases below) and
tox
run drop_incremental_schema.sql
The tables will be recreated if they don't exist - but not updated if they do. If you wish to recreate them manually call rebuild_schema.sql
To run the 'live' script from inside the docker civicrm container you likely need to create the database first ie
in mysql
CREATE DATABASE silverpop;
You may also need to install the requirements first (in theory running tox
might do this for you) - ie
pip3 install -r /srv/tools/requirements.txt
env PYTHONPATH=/srv/tools LOGNAME=docker /srv/tools/silverpop_export/update.py
After running this you can check the silverpop database is correctly populated.
You can also generate the csv files
env PYTHONPATH=/srv/tools LOGNAME=docker /srv/tools/silverpop_export/update.py
It is also possible to run tox and the update script from your local host. Last time I updated this file I was only getting the local host to run the live script. As of this update it won't run but the above variant of running on the civicrm container is...
My previously working notes were to call
env PYTHONPATH=~/dev/fundraising-dev/src/tools LOGGING=docker silverpop_export/export.py
The generated files will be in the \tmp directory on your docker container
Generally you can do a lot of testing by just copying queries from update_table.sql into your query console & running them there...
###Aliases
Note the following aliases are referenced: alias bkb='docker-compose --file ~/dev/fundraising-dev/docker-compose.yml exec civicrm bash' alias bkr='docker-compose --file ~/dev/fundraising-dev/docker-compose.yml exec -u root civicrm bash'
List the default envs:
tox -l
You can pass arguments to the underlying command with a double dash:
tox -e flake8 -- --statistics
tox -e flake8 -- ./audit