Submit

Back to the channels

#primate

  1. blue phaleth: hi, I just shoved out a big commit, but you cannot simply redeploy without changing some things. in particular, you probably need the docs and snippets directory
  2. phaleth hi blue, ok I will make sure to test locally
  3. blue also, it doesn't yet include your PRs. I'm gonna see if I can get target=static done for this release, so I'm holding off merging them for a bit
  4. blue the markdown db/stores employ aggressive caching, so even if you redeploy at the current state, the website will be very fast, as fast as before
  5. phaleth I should still do some changes on that PR if it's open
  6. blue yes
  7. phaleth ok, but that's not the reason for flash
  8. blue it'll also start up very fast in dev/prod, but that's a bit misleading: it sends off a promise to load/transpile the .mds, so it means that for the first 2-4 seconds after startup, requests may block
  9. phaleth and currently there is still flash even when the cookie is handled server side
  10. blue ya
  11. phaleth feel free to do whatever, I can always rebase
  12. phaleth all I'm doing is learning primate
  13. phaleth I should not hack on the core, even tho I'm looking through the code for sure
  14. blue there are certainly areas I need to clean up. core contains a bit of old functionality from the time before esbuild
  15. phaleth old code > new code
  16. blue ha
  17. blue phaleth, wdyt about this
  18. blue inside app/config.ts, you can define entrypoints as a map
  19. blue so:
  20. blue entrypoints: { colorscheme: "client/colorscheme.js" },
  21. blue esbuild bundles client/colorscheme.js into client/colorscheme-SHA.js
  22. blue and %colorscheme% is available as a placeholder in html
  23. phaleth beautiful, but can I also prioritize them when the %head% is being put together?
  24. phaleth the thing is that one has to go before css
  25. blue yes, you'd be able to use %colorscheme% before %head%
  26. phaleth oh, ok, but the entrypoint key name is still custom?
  27. blue yes, it'd be anything you want, aside from "head"
  28. blue %colorscheme% would typically expand to <script src="/colorschema-SHA.js"></script> or wahtever
  29. phaleth ok, then I guess it should throw if somebody tries to use head
  30. blue yes, it would throw if someone tries to use head or body
  31. blue but essentially this would allow you to provide mini applications in your app
  32. blue and esbuild would be bundling it, so if you use imports in client/colorscheme.js, they'd be pulled in
  33. phaleth sounds good, then I could ditch a lot of the code from the Website.ts
  34. blue ya, probably
  35. blue I think the entrypoints idea is generally useful
  36. blue we might then stop autobundling stuff from static
  37. blue although css might still need to be autobundled, because there's no good way to include it, unless you have like a base layout that does import
  38. blue maybe I'm just old fashioned, I still think in terms of one central .css file you put in static
  39. blue but the modern way to go is some kind of css split up across components or other such idiocy
  40. blue thing is, primate currently supports both, and it's good that way
  41. blue if you place a css file in static, it will be bundled in, and if you have a <style> block in svelte or vue, it will be bundled in, and if you use some react library, probably too
  42. blue I think a coherent message is, static needs to remain static. anything you put in there is just going to be served as-is. that's the least surprising thing
  43. blue then, via entrypoints, you have full freedom. you want a central css file? do `entrypoints: { css: "client/master.css" }`
  44. blue and use %css% in your html
  45. blue what do you think, phaleth?
  46. blue I think that's a lot more coherent than the current model
  47. blue and it still maps old 'central css/js' versus new 'logic/style spread across components' well
  48. phaleth I've rebased the PR, brb, sorry
  49. phaleth it's ready to be merged now btw
  50. blue alright
  51. blue I'll add the entrypoints feature first, then I think your PR would make most sense, since you get full control
  52. blue we'd have { colorscheme: "colorscheme.js", css: "master.css" }, and then you can put %colorscheme% and %css% whereever you want in app.html
  53. blue and you put colorscheme.js, master.css and the fonts into `client`
  54. phaleth well, I can always do another PR
  55. phaleth that way I get to contribute more
  56. phaleth and the current PR changes should work with the feature you are going to implement, you don't have to update the website while doing that, can leave that up to me
  57. phaleth unless there is a gotcha, but I should be able to do that with your help
  58. phaleth css should be split just like js when there are chunks, yes
  59. phaleth static should remain static as you note
  60. phaleth I think splitting per components is dumb, but splitting per dynamic import is not
  61. phaleth cause dynamic import is a choice, as well a build entrypoint is a choice
  62. phaleth components should just be razor thin anyway
  63. phaleth will the new entrypoint thing allow to have a second component tree?
  64. phaleth `entrypoints: { more-svelte: "client/MoreSvelte.svelte" }`
  65. blue phaleth: yes. what you put through entrypoints will go through the normal esbuild client server
  66. blue so if you got svelte registered as a module, it should know what to do with it. it does mean it might spit out both a js and a css tag in that case though
  67. blue esbuild client bundler*
  68. phaleth then that's ideal
  69. phaleth btw let me know when should I redeploy the website
  70. phaleth locally it works fine right now
  71. phaleth there is no change to the Containerfile
  72. blue but the Containerfile needs snippets and docs to run now? they're now needed during runtime
  73. blue you can deploy it now if you want. I won't finish the entrypoints thing today anyway, hopefully tomorrow and then I can merge the PR.
  74. phaleth but you will put them to the build dir?
  75. phaleth the build dir is what is being copied to the final image
  76. blue yes, so the Containerfile needs to copy them there
  77. blue and then we should test if it works in isolation
  78. phaleth hmm? can the build system copy them? or not cause they are website specific?
  79. phaleth it's a common practice to have everything in build dir
  80. phaleth for production build at least
  81. blue the problem is markdown is now a db
  82. blue it doesn't participate in any aspect of the build system, at all, anymore
  83. blue the build system bundles config/markdown.db.ts and the stores, but it doesn't bundle the data, that's in docs and snippets
  84. blue the build system also only bundles config/markdown.db.ts and the stores because the routes import the stores. it's fully dynamic
  85. phaleth ok, then go ahead and merge and then I will update the Containerfile and redeploy
  86. blue how does your PR currently work without flashing?
  87. phaleth works well on librewolf, palemoon and epiphany
  88. blue ok -- but will be better with entrypoints, no?
  89. phaleth nope, the scheme-storage.ts is now being bundled
  90. phaleth as it's own separate chunk
  91. blue and then app.js dynamically loads it?
  92. phaleth so the entrypoints feature is in no hurry
  93. phaleth app.html loads it
  94. blue but how does esbuild know to bundle it if it's in client/scheme-storage.ts?
  95. phaleth there is an extra call to esbuild
  96. blue oh, in onBuild
  97. blue that's the code you wanna eliminate once we have entrypoints
  98. blue gotcha
  99. phaleth yeah, totally
  100. blue merged it, testing it now
  101. blue (I'm really bad with testing PRs on github)
  102. phaleth no worries, the master is supposed to be in flux anyway
  103. blue so right now if I copy build to /tmp/build and I run node server.js in it, it doesn't work
  104. blue steps to make it work: copy docs and snippest to build
  105. blue and create a package.json file with { "type": "module" }
  106. blue then it works
  107. blue those are three things you need to do in Containerfile
  108. blue we won't need this in the future with target=static
  109. phaleth package.json in build dir?
  110. blue but for now it's needed
  111. blue yes
  112. phaleth alright
  113. blue this is because markdown.db.ts uses that to discover root
  114. blue so I don't see any flash locally
  115. blue looks good to me
  116. phaleth cool
  117. phaleth the image has built succesfully
  118. blue rock n roll
  119. blue https://gitea.repopack.app/repopack/provision/commit/31fd771390da5e957e1fe21f4afad8a5293a8b29
  120. blue looks good
  121. phaleth deno is being picky: Uncaught (in promise) NotCapable: Requires read access to "/app/package.json", run again with the --allow-read flag
  122. phaleth there is no package.json in that dir, it's in the build dir, so should I make the same one there too?
  123. phaleth the /app dir is the root dir of the website
  124. phaleth I can just copy the package.json to the image
  125. blue can't you give it -A
  126. blue deno is a PITA
  127. phaleth nah, don't wanna do that
  128. phaleth so if the dir does not exist it looks into build?
  129. phaleth cause I'm getting another one Uncaught (in promise) NotCapable: Requires read access to "/app/docs", run again with the --allow-read flag
  130. phaleth looks like primate tries to look in there first
  131. phaleth I will let it allow read everywhere then
  132. phaleth actually not sure how to do that, but lets see
  133. blue -A
  134. phaleth yeah, I gave up and trying with --allow-all now
  135. phaleth cause I also need to go to sleep :D
  136. phaleth getting this error https://upaste.de/raw/Wm5
  137. phaleth deno is not involved in that, but maybe it's deno specific
  138. phaleth so lets try node then
  139. blue phaleth: that means it didn't find the package.json
  140. blue this depends on where you excute the command from
  141. phaleth deno build/server.js
  142. phaleth next to the build dir
  143. blue then try placing the package.json and docs and snippets in . instead of build
  144. phaleth ok
  145. blue or just run deno from build directly
  146. blue then it works too, just checked it locally
  147. blue deno -A server.js (inside build)
  148. phaleth ok, lets see
  149. phaleth I mean deno is great in making sure the deployment works
  150. phaleth oh, a problem
  151. phaleth ok, I've switched back to the old container
  152. phaleth looks like the extraneous esbuild call didn't go well, I will investigate that tomorow
  153. phaleth prolly deno's fault :)
  154. phaleth the new container is taking a lot of memory
  155. blue interesting
  156. blue significantly more than the old one?
  157. phaleth btw, blue, can I ask you to update the OS and reboot the VPS?
  158. blue yes phaleth, can I reboot now?
  159. phaleth there is a new patch for linux kernel since saturday, but since that kids you out
  160. phaleth yeah, sure
  161. blue done
  162. phaleth significantly more, yes
  163. blue we're now on 7.0.9
  164. blue so the main difference between the old container and the new container is that previously, all the markdown files were bundled in
  165. blue that means you only had to load server.js into memory
  166. blue now I suppose it's loading all the .mds too into memory, though that shouldn't be significantly more
  167. blue what's the difference?
  168. blue I personally don't mind reverting the markdown db idea if it turns out to be a memory hog
  169. phaleth couple hundreds of megs I think
  170. blue oof, that's unacceptable really
  171. phaleth check btop
  172. phaleth you will see three exe proceses and bellow also three exe processes
  173. phaleth the first three at the top are for the new container
  174. phaleth the second three are for the old container
  175. blue three exe, each 487M?
  176. blue oof, the old one was 159M
  177. blue why is that three times btw
  178. phaleth it's the isolation that does all those exes
  179. phaleth but yeah, memory hog
  180. phaleth time to crash, see ya
  181. blue well, we need to find out why it's so bad, 159 -> 487 is over 3x
  182. blue otherwise markdowndb needs to be reverted
  183. blue alright, nighty night

Search posts