/lucos_contacts_googlesync_import

Imports contact info from google

Primary LanguagePython

lucos_contacts_googlesync_import

Imports contact info from google on an hourly cron schedule

Dependencies

  • docker
  • docker-compose

Remote Dependencies

Build-time Dependencies (Installed by Dockerfile)

Running

nice -19 docker-compose up -d --no-build

Running script without cron

To test the script logic with worrying about cronjobs.

Set entrypoint: pipenv run python -u import.py in the docker-compose file (or equivalent)

Running locally

Run pipenv install to setup

pipenv run python import.py

Environment Variables

For local development, these should be stored in a .env file

  • USER_EMAIL The email address of the google account to fetch contacts from
  • GROUP The resourceName of the contact group in the about account to fetch contacts from (usually in the form contactGroups/<alphanumeric_code>)
  • CLIENT_EMAIL The Email Address for a Google IAM Service Account, which has https://www.googleapis.com/auth/contacts scope delegated to it
  • PRIVATE_KEY The Corresponding Private Key for the same Service Account
  • LUCOS_CONTACTS The base url for a running instance of lucos_contacts. Defaults to the production url
  • LUCOS_CONTACTS_API_KEY A valid api key for LUCOS_CONTACTS. Keys can be created manually through the admin UI at /admin/lucosauth/apiuser/add/. Set the system field to lucos_contacts_googlesync_import.

File structure

  • Dockerfile, Pipfile, Pipfile.lock and the .cirleci directory are used at build time
  • cron.sh ensures the cron daemon is running with the right environment set up and sharing its logs in a way that get surfaced to Docker
  • import.py Imports from Google's People API to lucos_contacts