Chat Logs

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