From abd41a34ea3e50ae17bac5eb7d5b7a4ad6f513c4 Mon Sep 17 00:00:00 2001 From: AndrMoura Date: Wed, 4 Sep 2024 02:18:27 +0100 Subject: [PATCH] add PostHog (#1145) * add PostHog * fix temporal-ui service port, add 1.0 tag to helper image, and minimum requirements * add 1.0 tag to helper image * remove helper image --- public/v4/apps/posthog.yml | 338 ++++++++++++++++++++++++++++++++++++ public/v4/logos/posthog.png | Bin 0 -> 1763 bytes 2 files changed, 338 insertions(+) create mode 100644 public/v4/apps/posthog.yml create mode 100644 public/v4/logos/posthog.png diff --git a/public/v4/apps/posthog.yml b/public/v4/apps/posthog.yml new file mode 100644 index 000000000..d3b93689d --- /dev/null +++ b/public/v4/apps/posthog.yml @@ -0,0 +1,338 @@ +captainVersion: 4 +services: + $$cap_appname-db: + image: postgres:12-alpine + environment: + POSTGRES_USER: $$cap_postgres_user + POSTGRES_DB: $$cap_postgres_db + POSTGRES_PASSWORD: $$cap_postgres_password + volumes: + - $$cap_appname-postgres-data:/var/lib/postgresql/data + caproverExtra: + notExposeAsWebApp: 'true' + + $$cap_appname-redis: + caproverExtra: + notExposeAsWebApp: 'true' + restart: on-failure + image: redis:6.2.7-alpine + command: sh -c "redis-server --maxmemory-policy allkeys-lru --maxmemory 200mb" + + $$cap_appname-redis7: + image: redis:7.2-alpine + restart: on-failure + caproverExtra: + notExposeAsWebApp: 'true' + command: sh -c "redis-server --maxmemory-policy allkeys-lru --maxmemory 200mb" + + $$cap_appname-zookeeper: + image: zookeeper:3.7.0 + restart: on-failure + caproverExtra: + notExposeAsWebApp: 'true' + volumes: + - $$cap_appname-zookeeper-datalog:/datalog + - $$cap_appname-zookeeper-data:/data + - $$cap_appname-zookeeper-logs:/logs + + $$cap_appname-clickhouse: + restart: on-failure + caproverExtra: + notExposeAsWebApp: 'true' + dockerfileLines: + - FROM alpine AS build + - RUN apk add --no-cache curl tar + - WORKDIR / + - RUN mkdir -p "docker" + - RUN curl -L https://github.com/PostHog/posthog/tarball/c25b571388a9ad05d529a14daee8f49819280496 | tar -xz --wildcards --strip-components=2 -C "./" '*/posthog/idl/*' + - RUN curl -L https://github.com/PostHog/posthog/tarball/c25b571388a9ad05d529a14daee8f49819280496 | tar -xz --wildcards --strip-components=2 -C "docker" '*/docker/*' + - RUN sed -i "s|zookeeper|srv-captain--$$cap_appname-zookeeper|" /docker/clickhouse/config.xml + - FROM clickhouse/clickhouse-server:23.11.2.11-alpine + - COPY --from=build /docker/clickhouse/config.xml /etc/clickhouse-server/config.xml + - COPY --from=build /docker/clickhouse/users.xml /etc/clickhouse-server/users.xml + - COPY --from=build /docker/clickhouse/docker-entrypoint-initdb.d /docker-entrypoint-initdb.d + - COPY --from=build /idl /idl + volumes: + - clickhouse-data:/var/lib/clickhouse + + $$cap_appname-kafka: + image: ghcr.io/posthog/kafka-container:v2.8.2 + restart: on-failure + caproverExtra: + notExposeAsWebApp: 'true' + environment: + KAFKA_BROKER_ID: 1001 + KAFKA_CFG_RESERVED_BROKER_MAX_ID: 1001 + KAFKA_CFG_LISTENERS: PLAINTEXT://:9092 + KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://srv-captain--$$cap_appname-kafka:9092 + KAFKA_CFG_ZOOKEEPER_CONNECT: srv-captain--$$cap_appname-zookeeper:2181 + ALLOW_PLAINTEXT_LISTENER: 'true' + depends_on: + - $$cap_appname-zookeeper + volumes: + - $$cap_appname-kafka-data:/bitnami/kafka + + $$cap_appname-worker: + image: posthog/posthog:$$cap_posthog_version + command: ./bin/docker-worker-celery --with-scheduler + caproverExtra: + notExposeAsWebApp: 'true' + restart: on-failure + environment: + SITE_URL: http://$$cap_appname-web.$$cap_root_domain + SECRET_KEY: $$cap_secret_key + DATABASE_URL: postgres://$$cap_postgres_user:$$cap_postgres_password@srv-captain--$$cap_appname-db:$$cap_postgres_port/$$cap_postgres_db + REDIS_URL: redis://srv-captain--$$cap_appname-redis:6379/ + CLICKHOUSE_HOST: srv-captain--$$cap_appname-clickhouse + KAFKA_HOSTS: srv-captain--$$cap_appname-kafka:9092 + IS_BEHIND_PROXY: $$cap_behind_proxy + TRUST_ALL_PROXIES: $$cap_trust_all_proxies + CLICKHOUSE_SECURE: $$cap_clickhouse_secure + DISABLE_SECURE_SSL_REDIRECT: $$cap_disable_ssl_redirect + OBJECT_STORAGE_ACCESS_KEY_ID: $$cap_object_storage_root_user + OBJECT_STORAGE_SECRET_ACCESS_KEY: $$cap_object_storage_root_password + OBJECT_STORAGE_ENDPOINT: http://srv-captain--$$cap_appname-objectstorage:19000 + OBJECT_STORAGE_ENABLED: $$cap_enable_object_storage + + $$cap_appname-objectstorage: + image: minio/minio:RELEASE.2022-06-25T15-50-16Z + restart: on-failure + volumes: + - $$cap_appname-objectstorage:/data + ports: + - '19000:19000' + - '19001:19001' + environment: + MINIO_ROOT_USER: $$cap_object_storage_root_user + MINIO_ROOT_PASSWORD: $$cap_object_storage_root_password + command: sh -c 'mkdir -p /data/posthog && minio server --address ":19000" --console-address ":19001" /data' + + $$cap_appname-plugin: + image: posthog/posthog:$$cap_posthog_version + depends_on: + - $$cap_appname-db + - $$cap_appname-redis + - $$cap_appname-clickhouse + - $$cap_appname-kafka + - $$cap_appname-objectstorage + caproverExtra: + notExposeAsWebApp: 'true' + environment: + SECRET_KEY: $$cap_secret_key + SITE_URL: http://$$cap_appname-web.$$cap_root_domain + DATABASE_URL: postgres://$$cap_postgres_user:$$cap_postgres_password@srv-captain--$$cap_appname-db:$$cap_postgres_port/$$cap_postgres_db + REDIS_URL: redis://srv-captain--$$cap_appname-redis:6379/ + CLICKHOUSE_HOST: srv-captain--$$cap_appname-clickhouse + KAFKA_HOSTS: srv-captain--$$cap_appname-kafka:9092 + DISABLE_SECURE_SSL_REDIRECT: $$cap_disable_ssl_redirect + OBJECT_STORAGE_ACCESS_KEY_ID: $$cap_object_storage_root_user + OBJECT_STORAGE_SECRET_ACCESS_KEY: $$cap_object_storage_root_password + OBJECT_STORAGE_ENDPOINT: http://srv-captain--$$cap_appname-objectstorage:19000 + OBJECT_STORAGE_ENABLED: $$cap_enable_object_storage + CLICKHOUSE_SECURE: $$cap_clickhouse_secure + CDP_REDIS_HOST: srv-captain--$$cap_appname-redis7 + CDP_REDIS_PORT: 6379 + command: ./bin/plugin-server + + $$cap_appname-web: + image: posthog/posthog:$$cap_posthog_version + caproverExtra: + containerHttpPort: '8000' + restart: on-failure + depends_on: + - $$cap_appname-db + - $$cap_appname-redis + - $$cap_appname-clickhouse + - $$cap_appname-kafka + environment: + SITE_URL: http://$$cap_appname-web.$$cap_root_domain + SECRET_KEY: $$cap_secret_key + DATABASE_URL: postgres://$$cap_postgres_user:$$cap_postgres_password@srv-captain--$$cap_appname-db:$$cap_postgres_port/$$cap_postgres_db + REDIS_URL: redis://srv-captain--$$cap_appname-redis:6379/ + CLICKHOUSE_HOST: srv-captain--$$cap_appname-clickhouse + KAFKA_HOSTS: srv-captain--$$cap_appname-kafka:9092 + IS_BEHIND_PROXY: $$cap_behind_proxy + TRUST_ALL_PROXIES: $$cap_trust_all_proxies + CLICKHOUSE_SECURE: $$cap_clickhouse_secure + DISABLE_SECURE_SSL_REDIRECT: $$cap_disable_ssl_redirect + OBJECT_STORAGE_ACCESS_KEY_ID: $$cap_object_storage_root_user + OBJECT_STORAGE_SECRET_ACCESS_KEY: $$cap_object_storage_root_password + OBJECT_STORAGE_ENDPOINT: http://srv-captain--$$cap_appname-objectstorage:19000 + OBJECT_STORAGE_ENABLED: $$cap_enable_object_storage + command: sh -c "./bin/migrate && ./bin/docker-server" + + # Temporal containers + $$cap_appname-elasticsearch: + caproverExtra: + notExposeAsWebApp: 'true' + environment: + cluster.routing.allocation.disk.threshold_enabled: true + cluster.routing.allocation.disk.watermark.low: 512mb + cluster.routing.allocation.disk.watermark.high: 256mb + cluster.routing.allocation.disk.watermark.flood_stage: 128mb + discovery.type: single-node + ES_JAVA_OPTS: -Xms256m -Xmx256m + xpack.security.enabled: false + image: elasticsearch:7.16.2 + expose: + - 9200 + volumes: + - $$cap_appname-elasticsearch:/var/lib/elasticsearch/data + + $$cap_appname-temporal: + restart: on-failure + caproverExtra: + notExposeAsWebApp: 'true' + environment: + DB: postgresql + DB_PORT: $$cap_postgres_port + POSTGRES_USER: $$cap_postgres_user + POSTGRES_PWD: $$cap_postgres_password + POSTGRES_SEEDS: srv-captain--$$cap_appname-db + ENABLE_ES: $$cap_enable_elastic_search + ES_SEEDS: srv-captain--$$cap_appname-elasticsearch + ES_VERSION: v7 + image: temporalio/auto-setup:1.20.0 + ports: + - 7233:7233 + depends_on: + $$cap_appname-db: + condition: service_healthy + $$cap_appname-elasticsearch: + condition: service_started + + $$cap_appname-temporal-admin-tools: + environment: + TEMPORAL_CLI_ADDRESS: srv-captain--$$cap_appname-temporal:7233 + image: temporalio/admin-tools:1.20.0 + caproverExtra: + notExposeAsWebApp: 'true' + depends_on: + - $$cap_appname-temporal + + $$cap_appname-temporal-ui: + caproverExtra: + containerHttpPort: '8080' + environment: + TEMPORAL_ADDRESS: srv-captain--$$cap_appname-temporal:7233 + TEMPORAL_CORS_ORIGINS: http://localhost:3000 + image: temporalio/ui:2.10.3 + ports: + - 8081:8080 + depends_on: + - $$cap_appname-temporal + - $$cap_appname-db + + $$cap_appname-temporal-django-worker: + image: posthog/posthog:$$cap_posthog_version + command: ./bin/temporal-django-worker + restart: on-failure + caproverExtra: + notExposeAsWebApp: 'true' + environment: + SITE_URL: http://$$cap_appname-web.$$cap_root_domain + SECRET_KEY: $$cap_secret_key + DATABASE_URL: postgres://$$cap_postgres_user:$$cap_postgres_password@srv-captain--$$cap_appname-db:$$cap_postgres_port/$$cap_postgres_db + REDIS_URL: redis://srv-captain--$$cap_appname-redis:6379/ + CLICKHOUSE_HOST: srv-captain--$$cap_appname-clickhouse + KAFKA_HOSTS: srv-captain--$$cap_appname-kafka:9092 + IS_BEHIND_PROXY: $$cap_behind_proxy + TRUST_ALL_PROXIES: $$cap_trust_all_proxies + CLICKHOUSE_SECURE: $$cap_clickhouse_secure + DISABLE_SECURE_SSL_REDIRECT: $$cap_disable_ssl_redirect + TEMPORAL_HOST: srv-captain--$$cap_appname-temporal + depends_on: + - $$cap_appname-db + - $$cap_appname-redis + - $$cap_appname-clickhouse + - $$cap_appname-kafka + - $$cap_appname-objectstorage + - $$cap_appname-temporal + +caproverOneClickApp: + variables: + - id: $$cap_postgres_db + label: Postgres DB name + defaultValue: posthog + + - id: $$cap_postgres_user + label: Postgres User + defaultValue: posthog + + - id: $$cap_postgres_password + defaultValue: $$cap_gen_random_hex(12) + label: Postgres Password + + - id: $$cap_postgres_port + defaultValue: 5432 + label: Postgres Port + validRegex: /^\d+$/ + + - id: $$cap_posthog_version + label: PostHog's version + defaultValue: 577f7abaec6cdf6e162bc51096c4f774e21f29ee + + - id: $$cap_secret_key + label: PostHog-LLM Secret Key + defaultValue: $$cap_gen_random_hex(23) + validRegex: /^([^\s^\/])+$/ + + - id: $$cap_behind_proxy + label: Is PostHog running behind a proxy + defaultValue: 'true' + validRegex: /^(true|false)$/ + description: 'Set to true if PostHog is running behind proxy (Caddy, nginx)' + + - id: $$cap_trust_all_proxies + label: Trust all proxies + defaultValue: 'false' + validRegex: /^(true|false)$/ + description: 'Determines if all proxies can be trusted.' + + - id: $$cap_disable_ssl_redirect + label: Disable Secure SSL Redirect + defaultValue: 'true' + validRegex: /^(true|false)$/ + description: Disables automatic redirect from port 80 (HTTP) to port 443 (HTTPS). + + - id: $$cap_clickhouse_secure + label: Clickhouse secure + defaultValue: 'false' + validRegex: /^(true|false)$/ + description: Whether to secure ClickHouse connection + + - id: $$cap_enable_object_storage + label: Enable Object storage + validRegex: /^(true|false)$/ + defaultValue: 'true' + + - id: $$cap_object_storage_root_user + label: Object Storage Root User + description: The access key for the root user for MinIO + defaultValue: object_storage_root_user + + - id: $$cap_object_storage_root_password + label: Object Storage Password Key + description: The secret key for the root user + defaultValue: $$cap_gen_random_hex(23) + validRegex: /^([^\s^\/])+$/ + + - id: $$cap_enable_elastic_search + description: Enable elastic search with Temporal + label: Enable Elastic Search + defaultValue: 'false' + validRegex: /^(true|false)$/ + + instructions: + start: >- + Enter your PostHog Configuration parameters and click on next. The process will take a just a few minutes to finish. + + **Note**: This One Click App deploys a **total of 16 different apps** and it requires at least 8GB of RAM with a a Quad-Core CPU. + end: > + Posthog is deployed and available as $$cap_appname-web. Migrations from Clickhouse and Postgres have now started. + + IMPORTANT: It will take up to 5-8 minutes for PostHog to be ready. Before that, you might see a 502 error page. Check the logs under the Deployment tab. + displayName: PostHog + isOfficial: false + description: 🦔 PostHog provides open-source product analytics, session recording, feature flagging and A/B testing that you can self-host. + documentation: https://posthog.com/docs diff --git a/public/v4/logos/posthog.png b/public/v4/logos/posthog.png new file mode 100644 index 0000000000000000000000000000000000000000..27530644663a4970d0731d7fb6ce58b14c720ba2 GIT binary patch literal 1763 zcmZ8ic{Cf?8jlj|SW}e~!eD5twklCesWhP>2}%vEw2>k$wN*r09ZD2o(06KUBetOR z7!u@JQcH?5wM^2E(~x=|tw~J6jM|GaN#8&3ynD{Q-}d|N{l4$~&bib8tdFKTL>&MC zXreA6E&%`vt}@+SRZ(_w+jB-`LW$^w@d5x?#Txq&K$)$Oe8~q6Xq_@zmKkb^7sHYP zfMXW&t$@1p-Jde2UjRB7>63_-sase8)b~)P{NMW0Z}q>PgJ(uM=)>K|ekx3E7F-xECT^Zj&GIgUItfFDR7 ziK?!ay!k7x*`(OjnzMOeW4)KS`myejbWgWKvR6S*HsA~z7gyl?naKujdbq*X>$W%<=or1!Jv9DxO2fqafTg_FJ&yK}1WqBrf5U_5$%SV(Q! zELx?P!n>HV%vNi+d&OwyrRAocxZdqXaPL$315q=&;;J??Y(YHXJxCfJMt1DwcnlYf zmmipt=9Of(ZC@_K9hsXmig=GM+&3j{nn$Oa3l7N0nFih*`=<~V}o1nj} z`RaYeag*WZmw*2dDCC`fN{xNc5Hj7#o|r`x@<*gb+*Kd`=|cK3AUpuX;j8e~p1O#V zEUNjFB6uMmDUTD6wIIIrDuJ2wL4nI)*La7dLSDVW5}OKPXw0}|%_T2OCp;pHsH_*5 zwDDmYvr7zifYyBMsj&B2)#{X^1Txg0CVlU63wfs%=^!joh1Yaz<8xkmu5AQ{0AX}D z_7M3I|LwK0>6La34M!NjJ62|@@_v1{aiR+kBKYvQw}5G}YcZ;?@A$||HzgP0ohM5B zSV0~-S7Vlv)$^5+5XkDaU##9~#g4199v)@Pu*FyAh3m;XKls<6wjq9ojIUfU7fg!D z%<-HqbKe|3yo(r3p~9~KoL zTB}0!F`sxN&+QeTR3h2#-l7>9$qYL7K5HgKmt#_5y7AXw24Q!z#mZ@K_IOT7QfU{j z!8st7K+=$NjzBg6%!QC0U3blNbM*D^D`rMex=&KDW@mKhMYw^ffuqHWaX3^+V}!$Vk?2l-2m`O9 z=C+XF&Wsbk2p+T|Wy1nNJ-vo>QDoXW$6@`)v6`UB;hBA-URZq1=E7m7(P<&g@H(Xx zV=Y)qfItxhPZs{F=TO|n26x|8*nH{}FVOCS5e2>ru0QuM{)=+X;{=y4#KFxP7b*KX>y$U-deM)d(!E>}^L;GH=x!ODq&JUXT9%Sr8!^m22+5d!@tbn)N=k)N zcpc@vcg9Owzm^Wd{c?CJnijf6T{t7Lk$x8I4J}apWuGfsv@-5DEYt0|L1 zJpt)ps7rX&H;ZSTt~%cY9d%3G1!}*pFq>7PNE+st(et&x29d~*5Yh1;W#npmh9LC6V16#}x8O6)H?yHg)Ly^L{UXuTd9MxBgXq`$pKh|L0* z*`=K~jWdh-Z9`n49hfs2pY%$lt*!)?STH*MtzX9xBLRkO+ literal 0 HcmV?d00001