Skip to content

Commit

Permalink
app telemetry on deployment level (opt-in), german translations, demo…
Browse files Browse the repository at this point in the history
…-mode
  • Loading branch information
genox committed Mar 22, 2023
1 parent 42aded2 commit 02f9a7b
Show file tree
Hide file tree
Showing 27 changed files with 748 additions and 434 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,13 @@ Specific to `backend` container:

Specific to `frontend` container:

| Variable name | Description | Default value |
|------------------|---------------------------------------------------------------------------------------|---------------|
| ENVIRONMENT | `production` - any other value runs NextJS in dev mode. Not suggested in deployments. | production |
| NEXT_AUTH_SECRET | Hash for next-auth session salting, e.g. the output of `openssl rand -base64 32` | random string |
| Variable name | Description | Default value |
|------------------------------|---------------------------------------------------------------------------------------------|---------------|
| ENVIRONMENT | `production` - any other value runs NextJS in dev mode. Not suggested in deployments. | production |
| NEXT_AUTH_SECRET | Hash for next-auth session salting, e.g. the output of `openssl rand -base64 32` | random string |
| LASIUS_DEMO_MODE | Enables or disables demo mode | `false` |
| LASIUS_TELEMETRY_MATOMO_HOST | Hostname/FQDN of a matomo instance to collect anonymous usage data, e.g. `stats.domain.com` | undefined |
| LASIUS_TELEMETRY_MATOMO_ID | Matomo site ID, e.g. `42` | undefined |

We suggest you use a `.env` file and save it in the same directory as the `docker-compose.yml` for build dependent configuration and edit all other variables in the `docker-compose.yml` file directly if they are not dependent on CI/CD variables.

Expand Down
19 changes: 19 additions & 0 deletions frontend/.env.template
Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@
# This is an example of what your env.local should contain.
# env.local is not tracked by git, so you can put your own values here.

# Either set this to "production" or "development"; development will enable hot reloading and other features.
ENVIRONMENT=development

LASIUS_API_URL=http://localhost:3000/backend
LASIUS_API_WEBSOCKET_URL=ws://localhost:3000/backend
LASIUS_API_URL_INTERNAL=http://localhost:3000/backend

# This flag enables showing login credentials for the demo database on our demo instance (demo.lasius.ch)
LASIUS_DEMO_MODE=false

# If these two variables are set, anonymous usage data will be sent to the given Matomo instance.
# This does not include any references to sessions or data entered by any user.
#
# The events tracked are:
# - page views
# - user actions (e.g. clicking on a button)
#
# The following information is sent:
# - platform version
# - browser version
# - screen size
#
LASIUS_TELEMETRY_MATOMO_HOST=
LASIUS_TELEMETRY_MATOMO_ID=

NEXTAUTH_SECRET=hir9L/uRsagmDqcDtwQzKPltZYO0RedvK/DbV4+Aq54=
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_URL_INTERNAL=http://localhost:3000
Expand Down
12 changes: 11 additions & 1 deletion frontend/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ const withPWA = require('next-pwa')({

const { ENVIRONMENT } = process.env;

const { LASIUS_API_WEBSOCKET_URL, LASIUS_API_URL, LASIUS_API_URL_INTERNAL } = process.env;
const {
LASIUS_API_WEBSOCKET_URL,
LASIUS_API_URL,
LASIUS_API_URL_INTERNAL,
LASIUS_TELEMETRY_MATOMO_HOST,
LASIUS_TELEMETRY_MATOMO_ID,
LASIUS_DEMO_MODE,
} = process.env;

const nextConfiguration = {
redirects,
Expand Down Expand Up @@ -51,6 +58,9 @@ const nextConfiguration = {
LASIUS_API_WEBSOCKET_URL,
LASIUS_API_URL,
LASIUS_API_URL_INTERNAL,
LASIUS_TELEMETRY_MATOMO_HOST,
LASIUS_TELEMETRY_MATOMO_ID,
LASIUS_DEMO_MODE,
},
headers: async () => [
{
Expand Down
24 changes: 13 additions & 11 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lasius-frontend",
"private": true,
"version": "1.0.0-RC15",
"version": "1.0.0-beta2",
"description": "Lasius NextJS Frontend Application Server",
"author": "tegonal.com <info@tegonal.com>",
"license": "AGPL 3.0",
Expand All @@ -20,7 +20,7 @@
"cleaner": "yarn run clean && rm yarn.lock && yarn install && yarn rebuild",
"clean-prod": "yarn workspaces focus --production && yarn cache clean --all",
"up": "yarn upgrade-interactive",
"i18n-refresh": "i18next",
"i18n-extract": "i18next",
"_dev-backend-proxy": "docker run --add-host=host.docker.internal:host-gateway -p 3000:3000 -v $(pwd)/nginx-dev-proxy.conf:/etc/nginx/nginx.conf:ro --rm nginx:latest",
"_dev-backend-db": "docker run -p 27017:27017 --rm mongo:5.0.9",
"_dev-backend-sbt": "cd ../backend && sbt run -Dconfig.resource=demo.conf",
Expand All @@ -44,8 +44,9 @@
"cookie": "^0.5.0",
"date-fns": "^2.29.3",
"date-fns-tz": "^2.0.0",
"framer-motion": "^10.3.2",
"i18next": "^22.4.11",
"framer-motion": "^10.8.4",
"http-proxy": "^1.18.1",
"i18next": "^22.4.13",
"js-cookie": "^3.0.1",
"json-stable-stringify": "^1.0.2",
"lodash": "^4.17.21",
Expand All @@ -57,7 +58,7 @@
"react": "^18.2.0",
"react-async-hook": "^4.0.0",
"react-dom": "^18.2.0",
"react-hook-form": "7.43.5",
"react-hook-form": "7.43.7",
"react-i18next": "^12.2.0",
"react-popper": "^2.3.0",
"react-use-websocket": "^4.3.1",
Expand All @@ -72,19 +73,20 @@
"@openapitools/openapi-generator-cli": "^2.5.2",
"@types/cookie": "^0.5.1",
"@types/d3-shape": "^3.1.1",
"@types/http-proxy": "^1.17.10",
"@types/js-cookie": "^3.0.3",
"@types/json-stable-stringify": "^1.0.34",
"@types/lodash": "^4.14.191",
"@types/node": "18.15.3",
"@types/node": "18.15.5",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@typescript-eslint/eslint-plugin": "^5.55.0",
"@typescript-eslint/parser": "^5.55.0",
"@typescript-eslint/eslint-plugin": "^5.56.0",
"@typescript-eslint/parser": "^5.56.0",
"concurrently": "^7.6.0",
"eslint": "8.36.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-next": "^13.2.4",
"eslint-config-prettier": "^8.7.0",
"eslint-config-prettier": "^8.8.0",
"eslint-import-resolver-typescript": "^3.5.3",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsx-a11y": "^6.7.1",
Expand All @@ -93,10 +95,10 @@
"eslint-plugin-react": "^7.32.2",
"i18next-parser": "^7.7.0",
"orval": "^6.12.1",
"prettier": "^2.8.4",
"prettier": "^2.8.6",
"svgo": "^3.0.2",
"svgstore-cli": "^2.0.1",
"typescript": "4.9.5"
"typescript": "5.0.2"
},
"packageManager": "yarn@3.2.4"
}
Loading

0 comments on commit 02f9a7b

Please sign in to comment.