Skip to content

Commit

Permalink
Nick/neos 584 add docs on analytics (#1018)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickzelei committed Jan 2, 2024
1 parent a4ccab5 commit 13d4e64
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 18 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,20 @@ Each dependency in the `neosync` repo is split into sub-Tiltfiles so that they c

Once everything is up and running, the app can be accessed locally at [http://localhost:3000](http://localhost:3000).

## Analytics

Posthog is used to capture analytics.

Today, they are only captured in a very minimal sense within Neosync app. Eventually this will be extended to the CLI.

You can see what information is captured by checking out the [posthog-provider](https://github.com/nucleuscloud/neosync/blob/main/frontend/apps/web/components/providers/posthog-provider.tsx) component that wraps each page's React components.

Analytics are used simply to get a better view into how people use Neosync.

### Disabling Analytics

If allowing Neosync to capture analytics is not desired, simply remove the `POSTHOG_KEY` from the environment, or disable analytics via the `NEOSYNC_ANALYTICS_ENABLED=false` environment variable.

## Resources

Some resources to help you along the way:
Expand Down
39 changes: 21 additions & 18 deletions docs/docs/deploy/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,24 +65,27 @@ These environment variables are loaded when running the `mgmt migrate up` comman

## Frontend App

| Variable | Description | Is Required | Default Value |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | --------------------- |
| AUTH_ENABLED | Whether or not to enable authentication in the App. Should be required for any production environment | false | false |
| NEXTAUTH_URL | This the base url that the app will be accessible from. Note: this is not the base url for the auth service, but for the app itself. Required if AUTH_ENABLED is true | false | |
| NEXTAUTH_SECRET | This is a secret value that is used to encrypt the next-auth cookie that is stored in the browser. This should change per environment. | true | |
| AUTH_CLIENT_ID | The client id that will be used to authenticate via the configured auth provider. Required if AUTH_ENABLED is true | false | |
| AUTH_CLIENT_SECRET | The client secret that will be used to authenticate via the configured auth provider. Required if AUTH_ENABLED is true | false | |
| AUTH_ISSUER | The issuer url. This is typically the baseurl for the auth instance. Required if AUTH_ENABLED is true | false | |
| AUTH_EXPECTED_ISSUER | The frontend issuer url. This is typically used if the auth service is accessed behind a proxy, or if the backend uses an internal url to access the auth service, but the client needs a different, public url. Common in networked or docker environments where the backend uses a cluster-local dns entry, while the client needs a public url | false | |
| AUTH_SCOPE | The space separated list of scopes that will be requested when issuing an access token. Required if AUTH_ENABLED is true | false | |
| AUTH_AUDIENCE | The audience that will be used when requesting the access token. Required if AUTH_ENABLED is true true | false | |
| AUTH_PROVIDER_ID | The id of your provider. This is used by next-auth to identify the provider. This can really be anything you want. Required if AUTH_ENABLED is true. | false | |
| AUTH_PROVIDER_NAME | The name of your provider. This is used on the next-auth signin page and appears in the button text that a user will select. Required if AUTH_ENABLED is true. | false | |
| NEXT_PUBLIC_APP_BASE_URL | The url of the app. This is typically the same as NEXTAUTH_URL. Used for generating invite urls, among other things. This is not baked into the HTML or the image. | false | |
| NEOSYNC_API_BASE_URL | The base url of the Neosync API. This can be overridden to connect to different Neosync API environments | false | http://localhost:8080 |
| AUTH_AUTHORIZE_URL | The full url that routes to the authorize url. This is optional and may be necessary if you're using AUTH_EXPECTED_ISSUER as the urls will be different. This will need to include the public url (same value as AUTH_EXPECTED_ISSUER). If using a fully external auth provider, this will most likely not be needed. | false | |
| AUTH_USERINFO_URL | The full url that routes to the userinfo url. This is optional and may be necessary if you're using AUTH_EXPECTED_ISSUER as the urls will be different. This will most likely need to include the internal url (same value as AUTH_ISSUER). If using a fully external auth provider, this will most likely not be needed. | false | |
| AUTH_TOKEN_URL | The full url that routes to the token url. This is optional and may be necessary if you're using AUTH_EXPECTED_ISSUER as the urls will be different. This will most likely need to include the internal url (same value as AUTH_ISSUER). If using a fully external auth provider, this will most likely not be needed. | false | |
| Variable | Description | Is Required | Default Value |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | ------------------------- |
| AUTH_ENABLED | Whether or not to enable authentication in the App. Should be required for any production environment | false | false |
| NEXTAUTH_URL | This the base url that the app will be accessible from. Note: this is not the base url for the auth service, but for the app itself. Required if AUTH_ENABLED is true | false | |
| NEXTAUTH_SECRET | This is a secret value that is used to encrypt the next-auth cookie that is stored in the browser. This should change per environment. | true | |
| AUTH_CLIENT_ID | The client id that will be used to authenticate via the configured auth provider. Required if AUTH_ENABLED is true | false | |
| AUTH_CLIENT_SECRET | The client secret that will be used to authenticate via the configured auth provider. Required if AUTH_ENABLED is true | false | |
| AUTH_ISSUER | The issuer url. This is typically the baseurl for the auth instance. Required if AUTH_ENABLED is true | false | |
| AUTH_EXPECTED_ISSUER | The frontend issuer url. This is typically used if the auth service is accessed behind a proxy, or if the backend uses an internal url to access the auth service, but the client needs a different, public url. Common in networked or docker environments where the backend uses a cluster-local dns entry, while the client needs a public url | false | |
| AUTH_SCOPE | The space separated list of scopes that will be requested when issuing an access token. Required if AUTH_ENABLED is true | false | |
| AUTH_AUDIENCE | The audience that will be used when requesting the access token. Required if AUTH_ENABLED is true true | false | |
| AUTH_PROVIDER_ID | The id of your provider. This is used by next-auth to identify the provider. This can really be anything you want. Required if AUTH_ENABLED is true. | false | |
| AUTH_PROVIDER_NAME | The name of your provider. This is used on the next-auth signin page and appears in the button text that a user will select. Required if AUTH_ENABLED is true. | false | |
| NEXT_PUBLIC_APP_BASE_URL | The url of the app. This is typically the same as NEXTAUTH_URL. Used for generating invite urls, among other things. This is not baked into the HTML or the image. | false | |
| NEOSYNC_API_BASE_URL | The base url of the Neosync API. This can be overridden to connect to different Neosync API environments | false | http://localhost:8080 |
| AUTH_AUTHORIZE_URL | The full url that routes to the authorize url. This is optional and may be necessary if you're using AUTH_EXPECTED_ISSUER as the urls will be different. This will need to include the public url (same value as AUTH_EXPECTED_ISSUER). If using a fully external auth provider, this will most likely not be needed. | false | |
| AUTH_USERINFO_URL | The full url that routes to the userinfo url. This is optional and may be necessary if you're using AUTH_EXPECTED_ISSUER as the urls will be different. This will most likely need to include the internal url (same value as AUTH_ISSUER). If using a fully external auth provider, this will most likely not be needed. | false | |
| AUTH_TOKEN_URL | The full url that routes to the token url. This is optional and may be necessary if you're using AUTH_EXPECTED_ISSUER as the urls will be different. This will most likely need to include the internal url (same value as AUTH_ISSUER). If using a fully external auth provider, this will most likely not be needed. | false | |
| NEOSYNC_ANALYTICS_ENABLED | Enables analytics within the Neosync app. Disable to turn off all analytics. | false | true |
| POSTHOG_KEY | API key used to send analytics to Posthog. Without this, analytics will be disabled, even if `NEOSYNC_ANALYTICS_ENABLED` is set to true. | false | Neosync's posthog api key |
| POSTHOG_HOST | Used to change the host of the Posthog instance that analytics are shipped to. Only needed if self-hosting Posthog or not shipping to the default Posthog platform. | false | https://app.posthog.com |

## Worker

Expand Down

0 comments on commit 13d4e64

Please sign in to comment.