0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-25 11:17:50 +01:00
🦔 PostHog provides open-source product analytics, session recording, feature flagging and A/B testing that you can self-host.
Go to file
2021-02-22 13:01:14 +01:00
.devcontainer [plugin-server] prettier 2020-12-05 14:39:21 +01:00
.github [plugin-server] Show outgoing version in main repo autoPR 2021-02-22 13:01:14 +01:00
benchmarks [plugin-server] fix some type errors (https://github.com/PostHog/plugin-server/pull/167) 2021-02-18 15:46:30 +01:00
bin [plugin-server] Fix bin script (https://github.com/PostHog/plugin-server/pull/148) 2021-02-12 13:21:51 +01:00
src [plugin-server] Send all Redis commands via DB (https://github.com/PostHog/plugin-server/pull/194) 2021-02-22 11:55:42 +01:00
tests [plugin-server] Send all Redis commands via DB (https://github.com/PostHog/plugin-server/pull/194) 2021-02-22 11:55:42 +01:00
.babelrc
.dockerignore [plugin-server] Dockerize (https://github.com/PostHog/plugin-server/pull/113) 2021-01-22 13:22:56 +01:00
.editorconfig [plugin-server] Improve repo experience (https://github.com/PostHog/plugin-server/pull/89) 2021-01-07 11:46:40 +01:00
.eslintrc.js [plugin-server] Sort imports (https://github.com/PostHog/plugin-server/pull/133) 2021-02-08 15:55:24 +01:00
.gitattributes [plugin-server] Improve repo experience (https://github.com/PostHog/plugin-server/pull/89) 2021-01-07 11:46:40 +01:00
.gitignore [plugin-server] Port Python process_event_ee over to plugin server (https://github.com/PostHog/plugin-server/pull/34) 2021-02-04 14:59:46 +01:00
.prettierignore [plugin-server] Add CI and set up Jest (https://github.com/PostHog/plugin-server/pull/23) 2020-11-26 09:10:46 +01:00
.prettierrc [plugin-server] Add CI and set up Jest (https://github.com/PostHog/plugin-server/pull/23) 2020-11-26 09:10:46 +01:00
Dockerfile [plugin-server] Update Dockerfile 2021-02-17 04:01:09 +01:00
jest.config.js [plugin-server] Port Python process_event_ee over to plugin server (https://github.com/PostHog/plugin-server/pull/34) 2021-02-04 14:59:46 +01:00
jest.setup.fetch-mock.js [plugin-server] fix deprecations in tests 2020-12-07 16:07:44 +01:00
package.json [plugin-server] Bump version to 0.9.20 2021-02-22 11:38:33 +00:00
README.md [plugin-server] TSC output structure fix (https://github.com/PostHog/plugin-server/pull/142) 2021-02-11 13:00:47 +01:00
tsconfig.json [plugin-server] TSC output structure fix (https://github.com/PostHog/plugin-server/pull/142) 2021-02-11 13:00:47 +01:00
yarn.lock [plugin-server] Babel Loop Timeouts (https://github.com/PostHog/plugin-server/pull/155) 2021-02-18 08:52:25 +01:00

PostHog Plugin Server

npm package MIT License

This service takes care of processing events with plugins and more.

Get started

Let's get you developing the plugin server in no time:

  1. Install dependencies and prepare for takeoff by running command yarn.

  2. Start a development instance of PostHog. After all, this is the PostHog Plugin Server, and it works in conjuction with the main server. To avoid interference, disable the plugin server there.

  3. Make sure that the plugin server is configured correctly (see Configuration). Two settings that you MUST get right are DATABASE_URL and REDIS_URL - they need to be identical between the plugin server and the main server.

  4. If developing the enterprise Kafka + ClickHouse pipeline, set KAFKA_ENABLED to true and provide KAFKA_HOSTS.

    Otherwise if developing the basic Redis + Postgres pipeline, skip ahead.

  5. Start the plugin server in autoreload mode with yarn start, or in compiled mode with yarn build && yarn start:dist, and develop away!

  6. Run tests with yarn test. Run benchmarks with yarn benchmark.

Configuration

There's a multitude of settings you can use to control the plugin server. Use them as environment variables.

Name Description Default value
DATABASE_URL Postgres database URL 'postgres://localhost:5432/posthog'
REDIS_URL Redis store URL 'redis://localhost'
BASE_DIR base path for resolving local plugins '.'
WORKER_CONCURRENCY number of concurrent worker threads 0 all cores
TASKS_PER_WORKER number of parallel tasks per worker thread 10
SCHEDULE_LOCK_TTL How many seconds to hold the lock for the schedule 60
CELERY_DEFAULT_QUEUE Celery outgoing queue 'celery'
PLUGINS_CELERY_QUEUE Celery incoming queue 'posthog-plugins'
PLUGINS_RELOAD_PUBSUB_CHANNEL Redis channel for reload events 'reload-plugins'
PLUGIN_SERVER_INGESTION Whether the plugin server should put events right into the database false
CLICKHOUSE_HOST ClickHouse host 'localhost'
CLICKHOUSE_DATABASE ClickHouse database 'default'
CLICKHOUSE_USER ClickHouse username 'default'
CLICKHOUSE_PASSWORD ClickHouse password null
CLICKHOUSE_CA ClickHouse CA certs null
CLICKHOUSE_SECURE Secure ClickHouse connection false
KAFKA_ENABLED use Kafka instead of Celery to ingest events false
KAFKA_HOSTS comma-delimited Kafka hosts null
KAFKA_CONSUMPTION_TOPIC Kafka consumption topic override null (automatic)
KAFKA_CLIENT_CERT_B64 Kafka certificate in Base64 null
KAFKA_CLIENT_CERT_KEY_B64 Kafka certificate key in Base64 null
KAFKA_TRUSTED_CERT_B64 Kafka trusted CA in Base64 null
DISABLE_WEB whether to disable web server true
WEB_PORT port for web server to listen on 3008
WEB_HOSTNAME hostname for web server to listen on '0.0.0.0'
LOG_LEVEL minimum log level LogLevel.Info
SENTRY_DSN Sentry ingestion URL null
STATSD_HOST StatsD host - integration disabled if this is not provided null
STATSD_PORT StatsD port 8125
STATSD_PREFIX StatsD prefix 'plugin-server.'

Releasing a new version

It's magic! Just bump up version in package.json on the main branch and the new version will be published automatically, on GitHub and on npm. Courtesy of GitHub Actions.

Questions?

Join our Slack community.