Skip to content

Commit c5703b6

Browse files
committed
docs: moving some alliander-specific steps out
1 parent de2eee8 commit c5703b6

File tree

1 file changed

+3
-63
lines changed

1 file changed

+3
-63
lines changed

docs/MONITORING.md

Lines changed: 3 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
* [Frontend monitoring](#introduction)
44
1. [Getting your APM Server URL](#1-getting-your-apm-server-url)
55
2. [Using the /public/init-js script](#2-using-the-publicinit-js-script)
6-
3. [Cloning private git repo using Kubernetes initContainers and Kubernetes Secrets](#3-cloning-private-git-repo-using-kubernetes-initcontainers-and-kubernetes-secrets)
7-
4. [Web server configuration (optional)](#4-web-server-configuration-optional)
8-
5. [References](#5-references)
6+
3. [References](#3-references)
97

108

119
## Frontend monitoring <a name="introduction"></a>
@@ -37,7 +35,7 @@ The __compas-open-scd__ project features a reference to an "empty" javascript re
3735

3836
This init javascript file has the purpose to allow for dynamic configuration of each compas-open-scd deployment.
3937

40-
In a private repository create a copy of `init.js` (or edit if you already have your own copy of the file with custom init scripts) in a folder, let's call it `path-to-init-js` and add the following code:
38+
Make sure to include in your `init.js` file the following code:
4139

4240
```js
4341
const script = document.createElement('script');
@@ -56,65 +54,7 @@ script.onload = function () {
5654
document.querySelector('head').appendChild(script);
5755
```
5856

59-
### 3. Cloning private git repo using Kubernetes initContainers and Kubernetes Secrets <a name="init-containers"></a>
60-
Start by generating a personal acccess token in Github and make sure you authorize your token to access your private repo (configure SSO if needed), your token must have checked the write:packages scope checkbox.
61-
62-
Then you must create your Kubernetes Secret:
63-
```sh
64-
kubectl create secret generic test-secret --from-literal=username='foo' --from-literal=password='ghp_12345yourgithubtoken'
65-
```
66-
67-
Modify your YAML deployment template to include an initContainers section:
68-
```yaml
69-
containers:
70-
(...)
71-
volumeMounts:
72-
- mountPath: /app/public/init-js
73-
name: "data-volume"
74-
subPath: init-js
75-
(...)
76-
initContainers:
77-
- name: "init-clone-repo"
78-
image: alpine/git
79-
imagePullPolicy: Always
80-
args:
81-
- clone
82-
- --single-branch
83-
- --branch
84-
- --
85-
- 'https://$(GIT_USERNAME):$(GIT_PASSWORD)@gitlab.company.com>/path/to/repo.git'
86-
- '/path-to-init-js/'
87-
env:
88-
- name: GIT_USERNAME
89-
valueFrom:
90-
secretKeyRef:
91-
key: username
92-
name: test-secret
93-
- name: GIT_PASSWORD
94-
valueFrom:
95-
secretKeyRef:
96-
key: password
97-
name: test-secret
98-
volumeMounts:
99-
- mountPath: /path-to-init-js
100-
name: "data-volume"
101-
volumes:
102-
- name: "data-volume"
103-
emptyDir: {}
104-
```
105-
106-
Now apply changes to deployment with the new persistent volume init:
107-
108-
```sh
109-
kubectl apply -f your-yaml-template.yaml
110-
```
111-
112-
Your pod should be up now with an initContainer that clones your private repo and copies the contents of `/path-to-init-js/` to compas-open-scd's `/app/public/init-js/`.
113-
114-
### 4. Web server configuration (optional) <a name="web-server"></a>
115-
If you're using a web server like nginx or apache and the APM Server runs in an origin different than your server's origin, make sure to [configure CORS](https://www.elastic.co/guide/en/apm/agent/rum-js/master/configuring-cors.html) or setup a directive that allows for POST, OPTIONS http requests to your `serverUrl`.
116-
117-
### 5. References <a name="references"></a>
57+
### 3. References <a name="references"></a>
11858

11959
* [Full documentation about APM Real User Monitoring JavaScript Agent](https://www.elastic.co/guide/en/apm/agent/rum-js/5.x/intro.html)
12060

0 commit comments

Comments
 (0)