Giter Site home page Giter Site logo

wikimedia / wikimedia-fundraising-tools Goto Github PK

View Code? Open in Web Editor NEW
4.0 10.0 2.0 1.2 MB

Github mirror of wikimedia/fundraising/tools - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)

Home Page: https://gerrit.wikimedia.org

Python 59.92% Shell 1.36% HTML 12.91% PHP 13.64% JavaScript 0.52% PLpgSQL 11.66%

wikimedia-fundraising-tools's Introduction

Documentation

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

Status

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

  • the test script (tox) which uses a mock civicrm database called 'test' created by loading the (manually updated - sigh) tests\minimal_schema.sql
  • a 'live' script which runs off your 'live' civicrm database and updates the silverpop database.

In Production

The Acoustic (Silverpop) export code runs on our staging server nightly using our replica db.

Testing

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.

Test database

Silverpop tests require a test mysql database to exist. Add it with the following:

  1. CREATE database test;
  2. CREATE USER `test`@`%`;
  3. GRANT ALL PRIVILEGES ON test.* TO `test`@`%`;

For docker users

From the civicrm container it is enough to login as root (bkr - see aliases below) and

  1. apt update
  2. apt install python3-pip
  3. apt install tox
  4. login (bkb - see aliases below), navigate to this directory (/srv/tools/silverpop_export) & run tox

If you have just applied a patch that changes the schema....

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

Smoke testing on your local

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

Running the sql directly

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'

Tox tips

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

wikimedia-fundraising-tools's People

Contributors

adamwight avatar andrewgreen avatar caseydentinger avatar damilare1 avatar eileenmcnaughton avatar ejegg avatar hashar avatar jackgleeson avatar lunartwilight avatar mattofak avatar mepps avatar wikimediawfan avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.