Chat Logs

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