Jump to content

Fundraising tech/CiviProxy Docker

From mediawiki.org

CiviProxy On Docker

[edit]

Overview

[edit]

As part of the email preferences work relating to this ticket, we added Civiproxy to the fundraising tech docker stack. We haven't managed to script up all the steps needed to make CiviProxy run as of writing. Currently there are two fairly straightforward manual setup steps required to get CiviProxy working with CiviCRM on the docker stack.

Setup

[edit]

Get/Set CIVICRM_SITE_KEY in docker-compose.yml

[edit]

From the fundraising_dev project root open up src/civi-sites/wmff.sh and find the value of CIVI_SITE_KEY e.g. 'sG17RSjGxjgFVzgy'. Use this value to set the CiviProxy environment variable below:

 civiproxy:
   environment:
     - CIVICRM_SITE_KEY=SET_VALUE_HERE

Update `civicrm`.`contact` api_key field for admin user to 'docker-api-key'

[edit]

Before running the SQL query below. You need to have logged into Drupal as the admin user so that CiviCRM creates the associated civicrm contact for admin otherwise it won't work. See screengrab of why is this necessary here.

UPDATE civicrm.civicrm_contact
INNER JOIN
   civicrm.civicrm_uf_match drupal_user_field ON (drupal_user_field.contact_id = civicrm_contact.id)
SET
   civicrm_contact.api_key = 'docker-api-key'
WHERE
   drupal_user_field.uf_name = 'admin@example.com'

Other

[edit]

Docker stack CiviProxy Test URL

[edit]

https://localhost:9005/rest.php?entity=civiproxy&action=getpreferences&key=SITE_KEY&version=3&json=1&api_key=API_KEY&hash=256fa6f5a00bce4598bc9144f203132f&contact_id=204

Gerrit patches

[edit]
  • dev-images: (only needed if building locally): https://gerrit.wikimedia.org/r/c/releng/dev-images/+/664919
  • Fundraising-dev: https://gerrit.wikimedia.org/r/c/wikimedia/fundraising/dev/+/673094
  • CiviCRM: https://gerrit.wikimedia.org/r/c/wikimedia/fundraising/crm/+/649729