Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(print): table of content #2562

Merged
merged 26 commits into from
Apr 10, 2022
Merged

feat(print): table of content #2562

merged 26 commits into from
Apr 10, 2022

Conversation

usu
Copy link
Member

@usu usu commented Mar 27, 2022

Based on #2554

Adds implementation for table of content

If no-one has started review for #2554 we can directly review this one and close #2554.

@usu usu added the deploy! Creates a feature branch deployment for this PR label Mar 27, 2022
@carlobeltrame carlobeltrame added deploy! Creates a feature branch deployment for this PR and removed deploy! Creates a feature branch deployment for this PR labels Mar 29, 2022
Copy link
Member

@carlobeltrame carlobeltrame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a first pass of reviewing. Will need to do a second one, and test it locally.

It doesn't seem to work yet on https://pr2562.ecamp3.ch/
The print container does not start, it shows the error:

ERROR Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at server.js:926:23
at promisify (.nuxt/utils.js:311:0)
at middlewareSeries (.nuxt/utils.js:291:0)
at module.exports.__webpack_exports__.default (.nuxt/server.js:158:0)

This can happen when some config value is undefined (could be an environment variable)

common/locales/en.json Show resolved Hide resolved
frontend/src/components/print/PrintConfigurator.vue Outdated Show resolved Hide resolved
frontend/src/components/print/PrintConfigurator.vue Outdated Show resolved Hide resolved
frontend/src/components/print/config/ActivityConfig.vue Outdated Show resolved Hide resolved
print/tailwind.config.js Show resolved Hide resolved
@carlobeltrame
Copy link
Member

The deployment works now, thanks! But in the default configuration I get only one page in the preview, even though it is numbered with "Page 1 of 10" at the bottom. Any ideas why this happens?

@usu
Copy link
Member Author

usu commented Mar 29, 2022

The deployment works now, thanks! But in the default configuration I get only one page in the preview, even though it is numbered with "Page 1 of 10" at the bottom. Any ideas why this happens?

Fixed with 9543a93

PostCSS shortens CSS selectors from double colon :: to single colon :
PagedJS doesn't like this

As PostCSS only runs in build mode but not in development mode I didn't recognize during local testing.

@usu usu requested a review from pmattmann April 4, 2022 04:55
Copy link
Member

@carlobeltrame carlobeltrame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merci für die Fixes! Habs gerade nochmals auf dem Deployment getestet, und es verhält sich momentan sehr seltsam. Was ich gemacht habe:

  1. Eingeloggt mit test-user, Sprache automatisch Englisch, Browser Firefox, in Lager GRGR auf Print Tab
  2. Nuxt Preview hat normal gerendert
  3. (Ich habe noch etwas mit der Mobile View gespielt, um auszutesten ob die Preview jetzt immer unter der Config ist)
  4. React Preview Tab angeklickt
  5. React Preview hat normal gerendert
  6. Picasso aus der Config entfernt
  7. React Preview hat normal gerendert
  8. Zurück auf Nuxt Tab
  9. Preview blieb weiss, Request an print-pr2562.ecamp3.ch wurde nicht abgeschlossen (und wenn er nicht gestorben ist lädt er noch heute)
  10. TOC an die zweitoberste Position verschoben, um zu sehen ob ein weiterer Request hilft. Der weitere Request kam mit HTTP 524 zurück (der erste ist immer noch pending)

Auf Kubernetes Dashboard war der Print-Container kurzzeitig nicht mehr healthy, im Log steht wiederholt folgendes:

 ERROR ServerException: Error trying to fetch "/activities/2a99033ce9c3" (status 520): Request failed with status code 520
at A (/app/node_modules/hal-json-vuex/dist/bundle.js:1:11027)
at /app/node_modules/hal-json-vuex/dist/bundle.js:1:9070
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Promise.all (index 1)
at async a.fetch (components/toc-program.js:47:5)
at async a.serverPrefetch (server.js:1941:5)
at async Promise.all (index 0)

(bzw. zuerst stand noch dasselbe mit /content-types/1a2b3c4d)

Caddy und PHP wollen gemäss Logs von einem Status 520 nichts wissen, waren aber auch kurzzeitig nicht healthy (Indikator ist inzwischen wieder grün, aber in den Events ists protokolliert)

Entsprechend entstandene Sentry-Issues sind:
https://sentry.io/organizations/ecamp/issues/3158505352/
https://sentry.io/organizations/ecamp/issues/3158504107/
https://sentry.io/organizations/ecamp/issues/3158504241/

Der Print Container ist nach dem beschriebenen Reproduktions-Ablauf permanent zerschossen, und kriegt sich erst wieder ein wenn ich manuell den Print-Pod lösche und vom Deployment automatisch wieder ein neuer hochgezogen wird. Mit "zerschossen" meine ich, manchmal kann man nicht mal mehr die Logs des Containers anschauen:

Get "https://10.114.0.7:10250/containerLogs/default/ecamp3-pr2562-print-74b57db55c-747hf/ecamp3-print?tailLines=5000&timestamps=true": net/http: TLS handshake timeout

Ich konnte das gerade nur 2 von 4 Mal reproduzieren. Danach waren auch noch kurzzeitig die meisten anderen Pods in unserem Cluster down. Ist schwer zu sagen ob das wirklich ich ausgelöst habe oder ob DO gerade etwas an der Infrastruktur gemacht hat. Aber bei den zwei fehlerhaften Versuchen hats immer zuerst geklappt, und erst beim Zurückkommen vom React Tab dann nicht mehr.

@carlobeltrame
Copy link
Member

carlobeltrame commented Apr 4, 2022

Noch etwas: Wenn ich auf der standard Print Config die "print day overview" Checkbox spamme, kommt vom Print Service ein 500er zurück. In den Logs sagt er dann, von der API komme ein 503 (Service Unavailable), in den Caddy Logs steht 502 (Bad Gateway) und im PHP Container folgendes:

[04-Apr-2022 15:56:25] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
[...]
[04-Apr-2022 15:56:31] ALERT: oops, unknown child (157) exited with code 0. Please open a bug report (https://bugs.php.net).

Wenn ich das richtig verstehe crasht dabei der PHP-Prozess, und wird dann im gleichen Pod wieder gestartet (hat nachher weiterhin PID 1, aber die vormaligen Logs verschwinden).

Das max_children tritt auch immer wieder mal auf wenn ich nicht gerade am printen bin, sondern nur viele Requests gleichzeitig zur API kommen. Aber das unknown child exited ist mir bisher nur beim spammen der Checkbox im Nuxt-Modus passiert.

@usu
Copy link
Member Author

usu commented Apr 4, 2022

Wenn ich das richtig verstehe crasht dabei der PHP-Prozess

Ich würde behaupten, du hast gerade die erste DoS-Attache auf ecamp gefahren 🤣
Sollte mit #2571 deutlich besser sein. Wenn wir die Preview später auch noch haben wollen, braucht es wahrscheinlich ein Throttle. Mache im Epic eine Notiz dazu.

@usu
Copy link
Member Author

usu commented Apr 4, 2022

Caddy und PHP wollen gemäss Logs von einem Status 520 nichts wissen, waren aber auch kurzzeitig nicht healthy

520 ist von cloudflare (https://support.cloudflare.com/hc/en-us/articles/115003011431-Troubleshooting-Cloudflare-5XX-errors#520error) und heisst wahrscheinlich, dass PHP/Caddy tot ist. PHP abschiessen konnte ich reproduzieren, Print-Server bisher noch nicht.

frontend/src/locales/de.json Outdated Show resolved Hide resolved
print/components/Toc/TocToc.vue Show resolved Hide resolved
@usu usu merged commit acad2bf into ecamp:devel Apr 10, 2022
@usu usu deleted the feat/print-nuxt-toc branch November 6, 2022 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy! Creates a feature branch deployment for this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants