Skip to content

Commit

Permalink
Merge branch 'master' into session_recording_to_s3_posthog_only
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed May 23, 2022
2 parents b46c460 + 351b311 commit 8d969b2
Show file tree
Hide file tree
Showing 29 changed files with 731 additions and 793 deletions.
26 changes: 14 additions & 12 deletions bin/deploy-hobby
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

# Seed a secret
export POSTHOG_SECRET=$(head -c 28 /dev/urandom | sha224sum -b | head -c 56)
export POSTHOG_APP_TAG='latest-release'
export POSTHOG_APP_TAG="${POSTHOG_APP_TAG:-latest-release}"

POSTHOG_SECRET=$(head -c 28 /dev/urandom | sha224sum -b | head -c 56)
export POSTHOG_SECRET

# Talk to the user
echo "Welcome to the single instance PostHog installer 🦔"
Expand All @@ -12,7 +14,7 @@ echo "⚠️ You really need 4gb or more of memory to run this stack ⚠️"
echo ""
while true; do
echo "Should we setup a TLS certificate for you using Let's Encrypt?"
echo "Select no if you are using this internally and PostHog will not be reachable from the internet. y/n"
echo "Select no if you are using this internally and PostHog will not be reachable from the internet. y/n"
read -p "" yn
case $yn in
[Yy]* ) export USE_SELF_SIGNED_CERT=0; break ;;
Expand All @@ -31,7 +33,7 @@ echo ""
echo "Do you have a Sentry DSN you would like for debugging should something go wrong?"
echo "If you do enter it now, otherwise just hit enter to continue"
read -r SENTRY_DSN
export SENTRY_DSN="${SENTRY_DSN:-'https://[email protected]/1'}" $SENTRY_DSN
export SENTRY_DSN="${SENTRY_DSN:-'https://[email protected]/1'}"
echo ""
echo "We will need sudo access so the next question is for you to give us superuser access"
echo "Please enter your sudo password now:"
Expand Down Expand Up @@ -99,16 +101,16 @@ import socket
import time
def loop():
print("Waiting for ClickHouse and Postgres to be ready")
try:
print("Waiting for ClickHouse and Postgres to be ready")
try:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect(('clickhouse', 9000))
print("Clickhouse is ready")
print("Clickhouse is ready")
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect(('db', 5432))
print("Postgres is ready")
print("Postgres is ready")
except ConnectionRefusedError as e:
time.sleep(5)
time.sleep(5)
loop()
loop()
Expand Down Expand Up @@ -153,7 +155,7 @@ sudo -E docker-compose -f docker-compose.yml up -d
echo "We will need to wait ~5-10 minutes for things to settle down, migrations to finish, and TLS certs to be issued"
echo ""
echo "⏳ Waiting for PostHog web to boot (this will take a few minutes)"
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8000/_health)" != "200" ]]; do sleep 5; done'
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8000/_health)" != "200" ]]; do sleep 5; done'
echo "⌛️ PostHog looks up!"
echo ""
echo "🎉🎉🎉 Done! 🎉🎉🎉"
Expand Down
6 changes: 4 additions & 2 deletions bin/upgrade-hobby
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -e

echo "Upgrading PostHog. This will cause a few minutes of downtime."
read -r -p "Do you want to upgarde PostHog? [y/N] " response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
Expand All @@ -10,7 +12,7 @@ else
fi

[[ -f ".env" ]] && export $(cat .env | xargs) || ( echo "No .env file found. Please create it with POSTHOG_SECRET and DOMAIN set." && exit 1)
export POSTHOG_APP_TAG="${POSTHOG_APP_TAG:-latest-release}" $POSTHOG_APP_TAG
export POSTHOG_APP_TAG="${POSTHOG_APP_TAG:-latest-release}"

cd posthog
git pull
Expand Down
1 change: 1 addition & 0 deletions docker-compose.hobby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ services:
command: ./bin/docker-worker-celery --with-scheduler
restart: on-failure
environment:
SKIP_SERVICE_VERSION_REQUIREMENTS: 1 # TODO: remove this after the release of 1.36.0
SENTRY_DSN: $SENTRY_DSN
SITE_URL: https://$DOMAIN
DISABLE_SECURE_SSL_REDIRECT: 'true'
Expand Down
4 changes: 2 additions & 2 deletions ee/clickhouse/sql/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
events
where team_id = %(team_id)s
{conditions}
ORDER BY toDate(timestamp) {order}, timestamp {order} {limit}
ORDER BY timestamp {order} {limit}
"""

SELECT_EVENT_BY_TEAM_AND_CONDITIONS_FILTERS_SQL = """
Expand All @@ -268,7 +268,7 @@
team_id = %(team_id)s
{conditions}
{filters}
ORDER BY toDate(timestamp) {order}, timestamp {order} {limit}
ORDER BY timestamp {order} {limit}
"""

SELECT_ONE_EVENT_SQL = """
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/models/cohortsModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const cohortsModel = kea<cohortsModelType>({
actions: () => ({
setPollTimeout: (pollTimeout: number | null) => ({ pollTimeout }),
updateCohort: (cohort: CohortType) => ({ cohort }),
deleteCohort: (cohort: CohortType) => ({ cohort }),
deleteCohort: (cohort: Partial<CohortType>) => ({ cohort }),
cohortCreated: (cohort: CohortType) => ({ cohort }),
exportCohortPersons: (id: CohortType['id']) => ({ id }),
}),
Expand Down
Loading

0 comments on commit 8d969b2

Please sign in to comment.