Submit

Back to the channels

#primate

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

Search posts