From 25e7de4f24e0971228b9d7e7e22b0fb179cacada Mon Sep 17 00:00:00 2001 From: Jamil Date: Tue, 20 Dec 2022 22:20:30 -0600 Subject: [PATCH] Enrichment (#1220) * Debug TID * Use new TID from wrapped install script * Add as script param --- README.md | 7 ++----- docs/docs/deploy/docker/README.mdx | 4 +--- docs/src/components/InstallBlock/index.js | 15 +++++++++++++++ docs/src/theme/MDXComponents.js | 2 ++ rel/overlays/bin/server | 5 ++++- scripts/install.sh | 1 + 6 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 docs/src/components/InstallBlock/index.js diff --git a/README.md b/README.md index e33d70a1a..bd9179ef3 100644 --- a/README.md +++ b/README.md @@ -34,11 +34,8 @@ Follow our [deploy guide](https://docs.firezone.dev/deploy) to install your self-hosted instance of Firezone. -Or, if you're on a [supported platform](https://docs.firezone.dev/deploy/docker/supported-platforms), try our one-line install script: - -```bash -bash <(curl -fsSL https://github.com/firezone/firezone/raw/master/scripts/install.sh) -``` +Or, if you're on a [supported platform](https://docs.firezone.dev/deploy/docker/supported-platforms), +try our [auto-install script](https://docs.firezone.dev/deploy/docker/#option-1-automatic-install). Using Firezone in production at your organization? Take a look at our [Enterprise Plan](https://www.firezone.dev/pricing). diff --git a/docs/docs/deploy/docker/README.mdx b/docs/docs/deploy/docker/README.mdx index 2b243777f..1c05493b0 100644 --- a/docs/docs/deploy/docker/README.mdx +++ b/docs/docs/deploy/docker/README.mdx @@ -49,9 +49,7 @@ After prerequisites are satisfied, you're ready to install the Firezone Server. The easiest way to deploy Firezone with Docker is the automatic install script: -```bash -bash <(curl -fsSL https://github.com/firezone/firezone/raw/master/scripts/install.sh) -``` + This will ask you a few questions regarding initial configuration, then proceed to download a sample docker-compose.yml file, configure it with your responses, diff --git a/docs/src/components/InstallBlock/index.js b/docs/src/components/InstallBlock/index.js new file mode 100644 index 000000000..2ac68b076 --- /dev/null +++ b/docs/src/components/InstallBlock/index.js @@ -0,0 +1,15 @@ +import React from "react"; +import CodeBlock from '@theme/CodeBlock'; + +export default function InstallBlock() { + let distinct_id = window.posthog.get_distinct_id() + + return ( +
+ + {`bash <(curl -fsSL https://github.com/firezone/firezone/raw/master/scripts/install.sh) ${distinct_id}`} + +
+ ); +} diff --git a/docs/src/theme/MDXComponents.js b/docs/src/theme/MDXComponents.js index 7ca000c99..d71c41307 100644 --- a/docs/src/theme/MDXComponents.js +++ b/docs/src/theme/MDXComponents.js @@ -1,5 +1,6 @@ // Import the original mapper import MDXComponents from "@theme-original/MDXComponents"; +import InstallBlock from "@site/src/components/InstallBlock"; import AccentBlock from "@site/src/components/AccentBlock"; import Feedback from "@site/src/components/Feedback"; import SignUp from "@site/src/components/SignUp"; @@ -11,6 +12,7 @@ export default { ...MDXComponents, // Map the "highlight" tag to our component! // `Highlight` will receive all props that were passed to `highlight` in MDX + InstallBlock: InstallBlock, accentblock: AccentBlock, feedback: Feedback, newsletter: SignUp, diff --git a/rel/overlays/bin/server b/rel/overlays/bin/server index 6cbd73403..057f46aca 100755 --- a/rel/overlays/bin/server +++ b/rel/overlays/bin/server @@ -35,7 +35,10 @@ add_routes() setup_telemetry() { [ -f /var/firezone/.tid ] || cat /proc/sys/kernel/random/uuid > /var/firezone/.tid - export TELEMETRY_ID=$(cat /var/firezone/.tid) + telem_id=$(cat /var/firezone/.tid) + + # Try to use $TID from install script, otherwise fallback to old .tid + export TELEMETRY_ID=${TID:-$telem_id} } gen_cert() { diff --git a/scripts/install.sh b/scripts/install.sh index c69ba8682..d137499e5 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -147,6 +147,7 @@ firezoneSetup() { sed -i.bak "s/DATABASE_PASSWORD=.*/DATABASE_PASSWORD=$db_pass/" "$installDir/.env" echo "TLS_OPTS=\"$3\"" >> "$installDir/.env" echo "TELEMETRY_ENABLED=$telemEnabled" >> "$installDir/.env" + echo "TID=${1:-$telemetry_id}" >> "$installDir/.env" # XXX: This causes perms issues on macOS with postgres # echo "UID=$(id -u)" >> $installDir/.env