Revert to old Project API key (#1379)

Also update ping event timer to 1 day, with a 1 minute delay on boot.

Waiting on PostHog to confirm old API key is set.
This commit is contained in:
Jamil
2023-01-26 12:49:11 -08:00
committed by GitHub
parent 4e2a62af71
commit e4854902cd
18 changed files with 29 additions and 21 deletions

View File

@@ -9,6 +9,10 @@ defmodule FzHttp.ConnectivityCheckService do
alias FzHttp.ConnectivityChecks
# Wait a minute before sending the first ping to avoid event spamming when
# a container is stuck in a reboot loop.
@initial_delay 60 * 1_000
def start_link(_) do
http_client().start()
GenServer.start_link(__MODULE__, %{})
@@ -17,7 +21,7 @@ defmodule FzHttp.ConnectivityCheckService do
@impl GenServer
def init(state) do
if enabled?() do
:timer.send_interval(interval(), :perform)
:timer.send_after(@initial_delay, :perform)
end
{:ok, state}
@@ -26,6 +30,7 @@ defmodule FzHttp.ConnectivityCheckService do
# XXX: Consider passing state here to implement exponential backoff in case of errors.
@impl GenServer
def handle_info(:perform, _state) do
:timer.send_interval(interval(), :perform)
{:noreply, post_request()}
end

View File

@@ -6,7 +6,8 @@ defmodule FzHttp.TelemetryPingService do
use GenServer
alias FzHttp.Telemetry
@interval 3_600
@initial_delay 60 * 1_000
@interval 43_200
def start_link(_) do
GenServer.start_link(__MODULE__, %{})
@@ -14,14 +15,16 @@ defmodule FzHttp.TelemetryPingService do
@impl GenServer
def init(state) do
# Send ping every hour
:timer.send_interval(@interval * 1000, :perform)
# Send ping after 1 minute
:timer.send_after(@initial_delay, :perform)
{:ok, state}
end
@impl GenServer
def handle_info(:perform, state) do
Telemetry.ping()
# Continue pinging twice a day
:timer.send_interval(@interval * 1_000, :perform)
{:noreply, state}
end
end

View File

@@ -8,7 +8,7 @@ defmodule FzHttpWeb.UserSocket do
https://docs.firezone.dev/deploy/reverse-proxies?utm_source=code \
"""
# 4 hour channel tokens
# 1 day channel tokens
@token_verify_opts [max_age: 86_400]
require Logger

View File

@@ -6,7 +6,7 @@ config :phoenix, :json_library, Jason
# Public API key for telemetry
config :posthog,
api_url: "https://t.firez.one",
api_key: "phc_xnIRwzHSaI6c81ukilv09w2TRWUJIRo4VCxshvl7znY"
api_key: "phc_ubuPhiqqjMdedpmbWpG2Ak3axqv5eMVhFDNBaXl9UZK"
# Guardian configuration
config :fz_http, FzHttpWeb.Auth.HTML.Authentication,
@@ -39,7 +39,7 @@ config :fz_http,
supervision_tree_mode: :full,
http_client: HTTPoison,
connectivity_checks_enabled: true,
connectivity_checks_interval: 3_600,
connectivity_checks_interval: 43_200,
connectivity_checks_url: "https://ping-dev.firez.one/",
cookie_secure: true,
cookie_signing_salt: "Z9eq8iof",

View File

@@ -131,7 +131,7 @@ if config_env() == :prod do
System.get_env("CI") != "true"
connectivity_checks_interval =
System.get_env("CONNECTIVITY_CHECKS_INTERVAL", "3600")
System.get_env("CONNECTIVITY_CHECKS_INTERVAL", "43200")
|> String.to_integer()
|> FzInteger.clamp(60, 86_400)

View File

@@ -41,7 +41,7 @@ config :fz_http,
mock_events_module_errors: false,
telemetry_module: FzCommon.MockTelemetry,
supervision_tree_mode: :test,
connectivity_checks_interval: 86_400,
connectivity_checks_interval: 43_200,
sql_sandbox: true,
http_client: FzHttp.Mocks.HttpClient

View File

@@ -1,2 +1,2 @@
!function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src=s.api_host+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.posthog||[]);
posthog.init('phc_xnIRwzHSaI6c81ukilv09w2TRWUJIRo4VCxshvl7znY',{api_host:'https://t.firez.one'})
posthog.init('phc_ubuPhiqqjMdedpmbWpG2Ak3axqv5eMVhFDNBaXl9UZK',{api_host:'https://t.firez.one'})

View File

@@ -20,7 +20,7 @@ def capture
uri = URI('https://t.firez.one/capture/')
data = {
api_key: 'phc_xnIRwzHSaI6c81ukilv09w2TRWUJIRo4VCxshvl7znY',
api_key: 'phc_ubuPhiqqjMdedpmbWpG2Ak3axqv5eMVhFDNBaXl9UZK',
event: 'firezone-ctl create-or-reset-admin',
properties: {
distinct_id: telemetry_id

View File

@@ -16,7 +16,7 @@ def capture
uri = URI('https://t.firez.one/capture/')
data = {
api_key: 'phc_xnIRwzHSaI6c81ukilv09w2TRWUJIRo4VCxshvl7znY',
api_key: 'phc_ubuPhiqqjMdedpmbWpG2Ak3axqv5eMVhFDNBaXl9UZK',
event: 'firezone-ctl force-cert-renewal',
properties: {
distinct_id: telemetry_id

View File

@@ -16,7 +16,7 @@ def capture
uri = URI('https://t.firez.one/capture/')
data = {
api_key: 'phc_xnIRwzHSaI6c81ukilv09w2TRWUJIRo4VCxshvl7znY',
api_key: 'phc_ubuPhiqqjMdedpmbWpG2Ak3axqv5eMVhFDNBaXl9UZK',
event: 'firezone-ctl reconfigure',
properties: {
distinct_id: telemetry_id

View File

@@ -16,7 +16,7 @@ def capture
uri = URI('https://t.firez.one/capture/')
data = {
api_key: 'phc_xnIRwzHSaI6c81ukilv09w2TRWUJIRo4VCxshvl7znY',
api_key: 'phc_ubuPhiqqjMdedpmbWpG2Ak3axqv5eMVhFDNBaXl9UZK',
event: 'firezone-ctl stop-cert-renewal',
properties: {
distinct_id: telemetry_id

View File

@@ -10,7 +10,7 @@ capture () {
-m 5 \
-H 'Content-Type: application/json' \
-d "{
\"api_key\": \"phc_xnIRwzHSaI6c81ukilv09w2TRWUJIRo4VCxshvl7znY\",
\"api_key\": \"phc_ubuPhiqqjMdedpmbWpG2Ak3axqv5eMVhFDNBaXl9UZK\",
\"event\": \"fz_http_crash\",
\"properties\": {
\"distinct_id\": \"$telemetry_id\"

View File

@@ -11,7 +11,7 @@ capture () {
-m 5 \
-H 'Content-Type: application/json' \
-d "{
\"api_key\": \"phc_xnIRwzHSaI6c81ukilv09w2TRWUJIRo4VCxshvl7znY\",
\"api_key\": \"phc_ubuPhiqqjMdedpmbWpG2Ak3axqv5eMVhFDNBaXl9UZK\",
\"event\": \"postinst\",
\"properties\": {
\"distinct_id\": \"$telemetry_id\"

View File

@@ -14,7 +14,7 @@ capture () {
-m 5 \
-H 'Content-Type: application/json' \
-d "{
\"api_key\": \"phc_xnIRwzHSaI6c81ukilv09w2TRWUJIRo4VCxshvl7znY\",
\"api_key\": \"phc_ubuPhiqqjMdedpmbWpG2Ak3axqv5eMVhFDNBaXl9UZK\",
\"event\": \"postrm\",
\"properties\": {
\"distinct_id\": \"$telemetry_id\"

View File

@@ -53,7 +53,7 @@ capture () {
-m 5 \
-H 'Content-Type: application/json' \
-d "{
\"api_key\": \"phc_xnIRwzHSaI6c81ukilv09w2TRWUJIRo4VCxshvl7znY\",
\"api_key\": \"phc_ubuPhiqqjMdedpmbWpG2Ak3axqv5eMVhFDNBaXl9UZK\",
\"event\": \"preinst\",
\"properties\": {
\"distinct_id\": \"$telemetry_id\"

View File

@@ -15,7 +15,7 @@ capture () {
-m 5 \
-H 'Content-Type: application/json' \
-d "{
\"api_key\": \"phc_xnIRwzHSaI6c81ukilv09w2TRWUJIRo4VCxshvl7znY\",
\"api_key\": \"phc_ubuPhiqqjMdedpmbWpG2Ak3axqv5eMVhFDNBaXl9UZK\",
\"event\": \"prerm\",
\"properties\": {
\"distinct_id\": \"$telemetry_id\"

View File

@@ -42,7 +42,7 @@ capture () {
-m 5 \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"phc_xnIRwzHSaI6c81ukilv09w2TRWUJIRo4VCxshvl7znY\",
\"api_key\": \"phc_ubuPhiqqjMdedpmbWpG2Ak3axqv5eMVhFDNBaXl9UZK\",
\"event\": \"$1\",
\"properties\": {
\"distinct_id\": \"$tid\",

View File

@@ -23,7 +23,7 @@ capture () {
-m 5 \
-H 'Content-Type: application/json' \
-d "{
\"api_key\": \"phc_xnIRwzHSaI6c81ukilv09w2TRWUJIRo4VCxshvl7znY\",
\"api_key\": \"phc_ubuPhiqqjMdedpmbWpG2Ak3axqv5eMVhFDNBaXl9UZK\",
\"event\": \"$1\",
\"properties\": {
\"distinct_id\": \"$telemetry_id\",