Submit

Back to the channels

#primate

  1. blue hi phaleth
  2. phaleth hi blue
  3. phaleth is bun needed to run the website? https://pastequest.com/?b55864df229833ae#21oYrewhiVLj2Ct3kJm7jzpPRMvjDDKevHQm1vRBNZFU
  4. blue mise ERROR Failed to install tools: aqua:npm/cli@latest, npm:npm-check-updates@latest, npm:pnpm@11
  5. blue you have no idea how much I hate mise
  6. phaleth I don't have mise, is that needed?
  7. blue no
  8. blue and yes, I'm using bun right now for development, but it should work with pnpm too
  9. phaleth that means pnpx or whatever?
  10. blue While resolving: .@undefined
  11. phaleth I do have pnpm
  12. blue what is that...
  13. phaleth heh
  14. blue oh, nvm, the package is called like that
  15. blue let me rename it to @repopack/web
  16. blue ok, done. you can pull all the changes
  17. blue I just did `pnpm install`, and it worked
  18. phaleth cool, now I get: PostgresError: password authentication failed for user "repopack"
  19. phaleth or should I pull?
  20. blue good. now follow the readme, it says you need a postgres db
  21. phaleth I can just use pnpx I think
  22. blue you can use pnpx
  23. phaleth yeah, I do have postgres db, no clue why it does not connect
  24. blue did you create a user repopack with password, or change .env.local?
  25. blue DB_NAME=repopack
  26. blue DB_USERNAME=repopack
  27. blue DB_PASSWORD=repopack
  28. blue PODMAN_SOCKET=/run/user/1000/podman/podman.sock
  29. blue STORAGE_GIT=./storage/git
  30. blue STORAGE_APPS=./storage/apps
  31. blue the easiest is to just get devdb
  32. blue https://github.com/terrablue/devdb/releases/tag/v0.1.2
  33. nevet Release v0.1.2 · terrablue/devdb
  34. blue then run `./devdb x postgres@17 --name=repopack
  35. phaleth not sure about this https://pastequest.com/?99341d62d45c73de#3qHgkQ8faQU1yNRpDAprVC4Baz6x4QtVuJJbj7Yp6YCF
  36. phaleth I already got the postgres db
  37. phaleth I got rid of PODMAN_SOCKET=/run/user/1000/podman/podman.sock in the .env.local file, only TCP is needed
  38. blue oh ok, let me fixed that migrate
  39. blue fix*
  40. blue you can pull
  41. phaleth ok
  42. phaleth trying to run it in dev mode fails https://pastequest.com/?577abfb267ab66cc#3BznToQup2t3YWHtgP328n9e4UzzP11pEG83dBzmknLo
  43. blue that's weird, that file's not empty
  44. blue try `npx primate`
  45. blue or `pnpx primate`
  46. phaleth ok
  47. blue hm, I'm getting the same error
  48. phaleth different error with npx https://pastequest.com/?0ac1d96d643fb320#FTuRJBerfc7X5Cjpri2fXJ2DCB5XzzBWWrMwoYhugnc7
  49. blue did you pull the latest stuff?
  50. blue well, bun appears to be reliably crashing
  51. blue maybe it's just my computer though now
  52. phaleth that's just bun
  53. phaleth yeah, pulled latest
  54. blue well, it didn't crash yesterday, so I wonder what changed
  55. phaleth npm is slow today
  56. phaleth not responsive I mean
  57. phaleth it's like everybody decided to do maintenance on this shiny sunday
  58. blue omg, mise is a TOTAL piece of garbage
  59. blue I just did `mise uninstall bun` and then `yay -S bun`, now it's working
  60. phaleth I think bun, mise and all those shiny new tools just crash when the service they rely on gets unresponsive
  61. phaleth cause they only consider the happy path
  62. blue yeah, it's all the same happy broken nonsense
  63. blue mise I've been angry at for a while though, it's literally a scam
  64. blue the dude 'maintains' it and begs for donation, meanwhile everything isn't working
  65. blue btw I'm smelling bun 2.0 or bun 1.4 now with the rust rewrite, it's being a PR circus with anthropic
  66. blue anyway, is repopack working for you?
  67. phaleth I'd like to use the stable tools https://pastequest.com/?8fa5e741c0b2edf4#3Cs6B7MG637fKwExqUySLGUthrjGwehKdMdTGGDuPS5a
  68. phaleth but it seems like I have to install bun
  69. phaleth no clue what package is that
  70. phaleth trying npm install --force
  71. blue you can remove @plsp/svelte, it's not that important
  72. phaleth ok, got first app error https://pastequest.com/?dace3deaf1573fe7#AcsJcjtL1RHZrV47fmYu66KRt85ii4scMzurrpYBBXKm
  73. phaleth let me give you a link on how to setup the REST API connection over HTTP
  74. phaleth blue: this is what the code should use, there is no need for unix socket https://gitea.repopack.app/repopack/provision/src/branch/master/podman/README.md#setup-podman-tcp-listener
  75. phaleth it's cause podman has to run rootful
  76. phaleth also all podman commands have to be prepended with sudo
  77. blue but we're not issuing any commands, we're using the API
  78. blue PODMAN_SOCKET: expected string, got undefined [plugin primate/server/live-reload]
  79. blue you need to put it in .env.local
  80. phaleth yeah, I know, but we have to use the API over TCP, not over unix socket, the link above shows how to set that up
  81. phaleth otherwise there is no way to connect remotely and use rootful
  82. phaleth the API caller will not be priviledged and that's why it has to be a simple http client
  83. phaleth PODMAN_SOCKET has to be replaced with REST_HTTP_URL or soemthing like that
  84. blue we want to expose podman?
  85. blue also, this setup is working for me with local unix socket on this computer, I don't think we need to replicate the secure setup on our computers, no?
  86. phaleth it'll be behind haproxy
  87. phaleth but you are not running podman as rootful
  88. blue ya I'm running it as user systemd on my comp
  89. phaleth also there will be auth
  90. phaleth the goal is to run as rootful and still not require the JS runtime to execute sudo commands
  91. phaleth and just use any http client
  92. blue but is this the goal with local dev as well? I'm not sure we'll have haproxy on our computers
  93. blue eventually it would be nice to test locally with *.repopack.local domains and a selfsigned cert, but this isn't at the top of my priority
  94. phaleth nope, but the repopack app should still target TCP HTTP REST API of podman
  95. phaleth so that it's deployable
  96. blue is your local setup unix or tcp?
  97. phaleth TCP only, I didn't do any UNIX socket configuration
  98. phaleth actually deleted that from the docs
  99. phaleth things being able to connect remotely means more flexibility and we will actually need connectivity over TCP, cause podman builds will not be happening on the same machine as where containers run
  100. phaleth just make that a default and only option
  101. blue yeah but I want to run podman rootless on my comp, can I still do that with tcp?
  102. blue I guess I can
  103. phaleth if you modify the systemd unit file then sure
  104. phaleth but then you might not be able to test resource limits
  105. blue ok, commit incoming
  106. blue changed the env to PODMAN_HOST
  107. blue done, you can pull
  108. phaleth ok, good
  109. phaleth it works, looks good, very simple
  110. blue cool
  111. blue did you manage to create an app & deploy?
  112. phaleth nope, just created project
  113. phaleth I guess I should read the readme
  114. blue ah, ok
  115. blue btw, I'm patching primate to read an env HOST / PORT variable if the user didn't set config.http.{host,port} explicitly
  116. blue I might even backport it to 0.39 because I'm testing whether I can deploy apps/svelte or any other app from primate's repo
  117. blue the way it's done right now, every app gets a special port so they don't collide during testing
  118. blue but I want to transition them to containers, so they can all use 6161 or just env.get("PORT")
  119. blue also, I now have the problem that apps/svelte won't run in a container because the default host in primate is localhost
  120. phaleth it reminds me of arch repo, cause you just have to push to it
  121. blue that's why in apps/website, we have http.host: "0.0.0.0"
  122. phaleth it will not let you create empty repo on the site and then git clone it
  123. blue I think you can clone it after you the create the project, you'll get an empty repo
  124. phaleth the clone button at top right switches to a different tab
  125. blue it's not wired at all
  126. blue like, the functionality doesn't exist
  127. blue just clone directly from "storage/git/NAMESPACE/PROJECT"
  128. phaleth so this git remote add command seems to know the name of the project and namespace, but can it also figure out where the site is hosted? https://images4.imagebam.com/25/16/68/ME1DTXZ7_o.png
  129. phaleth assuming that the ssh server is on the same host as the website app
  130. phaleth which should always be the case
  131. blue yeah, it'll eventually figure it out
  132. blue for now though, I'm testing with just locally accessing the bare repo
  133. blue so I did `git remote add ~/projects/repopack/storage/git/primate/primate`
  134. blue or acutally I think you need the name before
  135. blue so I did `git remote add local ~/projects/repopack/storage/git/primate/primate`
  136. blue this will work, and be a bit faster locally than going over http
  137. blue or ssh
  138. blue you can put the repos wherever you want for now, so you can set STORAGE_GIT to a location outside the repopack repo
  139. blue on the server they'll be on an fs mount, I imagine
  140. phaleth I just went with the following
  141. phaleth STORAGE_GIT=./storage/git
  142. phaleth STORAGE_APPS=./storage/apps
  143. blue yeah, that works. in that case they're inside the location you cloned the repopack/website repo to
  144. phaleth no idea what that means, could not find storage subdir being created
  145. blue it should be created
  146. phaleth so anyway, I'm not sure about the ssh url
  147. phaleth what's shown on the picture is not valid
  148. blue yes, it's just nonsense, ignore it
  149. blue follow the readme
  150. blue in fact, let me update the repo
  151. blue readme*, since it's outdated in that respect
  152. phaleth ah, ok, so there is no ssh communication yet
  153. phaleth heh
  154. blue k, I've updated the readme
  155. blue and I just checked, when you create a new project, it should definitely create the storage/git directly
  156. blue directory*
  157. blue ssh communication requires major shenanigans
  158. phaleth ok, the storage dir is there
  159. blue since we need to move our normal ssh port to something else, and then configure ssh to pass to git
  160. blue good
  161. blue now you can add this local repo to primate's repo, git push local, create an app, and see the magic happen
  162. blue fyi https://github.com/primate-run/primate/commit/936731333293b02c2749af7f14f5f1f0b77f302f
  163. nevet core: use HOST/PORT fallback for config.http · primate-run/primate@9367313
  164. blue I'm now gonna try to deploy apps/svelte on my local RP instance, and I think it's gonna finally work
  165. phaleth not sure I understand what to do here, I was thinking that I'd not need to touch server side repo, but that's what the readme is saying https://pastequest.com/?75fa6c310bb494de#6vpUa76irt7rVvf6j5RJxVJRwsUWeefhZaoGYnGJK74m
  166. blue yes
  167. blue you're doing it wrong. those are bare repos
  168. blue what you need to do, is this
  169. phaleth heh
  170. blue clone primate somewhere, `git clone https://github.com/primate-run/primate`
  171. blue then enter that directly
  172. blue then issue
  173. blue git remote add local /home/user/repopack/website/storage/git/new-ns/new-prj
  174. blue then do `git push local`
  175. blue and now you've got the entire primate repo inside your local RP instance, and you can play with it
  176. phaleth that makes sense, so the readme is confusing
  177. blue s/directly/directory
  178. blue yeah, figures
  179. blue btw when the app is building, you can click on the `Build image` line to expand it. same for `Write Containerfile`
  180. phaleth tried to deploy 4 times, always fails the same way, no logs https://images4.imagebam.com/a6/0b/63/ME1DTZ9Z_o.png
  181. blue yay, it's working
  182. blue phaleth: https://gitea.repopack.app/repopack/website/commit/9bfab6010f6bd2248c0c0c046c5f8579a365758f
  183. blue now I can deploy apps/svelte, too :)
  184. phaleth doing a git pull now and trying again
  185. blue I don't think it's going to matter, but could you change the exact app path to `apps/website`?
  186. blue otherwise we're gonna need to debug if your podman api is working fine
  187. blue one way to do that is this:
  188. blue http://localhost:6161/new-ns/new-prj/apps/podman
  189. blue does it show a bunch of json info or errors?
  190. phaleth changed the path and got same error
  191. blue what does that url give you?
  192. blue should start with {"ok":true,
  193. phaleth yeah, a json that starts with {"ok":true,
  194. blue and you have podman 5x, right?
  195. blue yeah, otherwise the info call wouldn't have worked
  196. blue ok
  197. blue can you go to /home/user/repoopack/website/storage/apps ?
  198. blue enter the directory there, should be projects/1
  199. blue then enter apps/ and probably the 1 directory
  200. blue and then deployments, and the highest number
  201. blue do you have a `build.log` there?
  202. phaleth podman version 5.4.2
  203. blue ok, that's good
  204. phaleth the log only has this one line
  205. phaleth Podman POST /v5.0.0/libpod/local/build failed: 404 Not Found
  206. phaleth so maybe that's a newer API
  207. phaleth I think, not sure, otherwise makes no sense
  208. phaleth but it'd be great if that error showed up in server side node logs
  209. blue yeah I think it was added later
  210. phaleth yup, podman too old https://pastequest.com/?19b69d1205d29b10#8NxSAVR9VfRLuCuLLW1QFC58ctg738yX7ihSXQWyREaR
  211. blue https://gitea.repopack.app/repopack/website/commit/2c004238358d26096969ddaaaa03d0f6d6ae689a
  212. phaleth but don't worry about that, we need to get to podman 6.0 as soon as possible, cause there will be a fix that we need for REST API
  213. blue added server logging
  214. phaleth ok, let me try
  215. phaleth ok, it's logging in the console now, nice
  216. blue you did a v1.0 there though, try with v5.0.0
  217. blue $ curl -X POST \ "http://127.0.0.1:8080/v5.0.0/libpod/local/build?t=localhost/primate-site-runtime&localcontextdir=/home/user/repopack/provision/podman/deployments/primate-site/runtime&nocache=true"
  218. blue I converted apps/react, now trying to deploy that
  219. blue this is so nice, it's discovering deployment-related bugs
  220. blue "build": "npm run clean && tsgo && cp src/types/{index,app}.d.ts lib",
  221. blue this doesn't work inside a container properly, I guess since it assumes bash or whatever
  222. blue so need to make it two cp commands
  223. blue great, got apps/react running
  224. blue I now have apps/react, apps/svelte and apps/website running through RP all at the same time
  225. phaleth that still says Not Found, it's just old podman
  226. phaleth I will have to figure out how to install latest podman anyway
  227. blue fyi, I'm using podman 5.8.3 here
  228. blue is podman 6 not released yet?
  229. phaleth that's latest
  230. phaleth podman 6 is release candidate atm I think
  231. blue oh nice
  232. blue Required New Dependencies: Users must now use Pasta for rootless networking (replacing slirp4netns), cgroups v2, and SQLite (replacing BoltDB)
  233. blue Networking Modernization: The Netavark networking stack has switched from iptables to nftables to align with modern Linux standards.
  234. blue https://fedoraproject.org/wiki/Changes/Podman6
  235. nevet Changes/Podman6 - Fedora Project Wiki
  236. blue https://github.com/podman-container-tools/podman/releases/tag/v6.0.0-rc1
  237. nevet Release v6.0.0-RC1 · podman-container-tools/podman
  238. blue 2 days ago
  239. blue anyway, we can switch to it once it's GA and arch packages it
  240. blue get the latest podman so you can tinker around with rp :P
  241. blue I'm gonna convert all primate apps so they're deployable via containers
  242. blue eventually, I want the command-line tool `rp` to be able to deploy locally via a locally configured podman, but to still use a repopack subdomain for reverse proxy and being reachable from the web
  243. blue so you can do `rp dev` and it opens a subdomain for you that you can enter into google oauth or whatever
  244. blue I used to use ngrok for this but they charge for a stable subdomain
  245. blue no reason not to give it for free, within the limited free plan
  246. blue then I could finally test scld locally again
  247. phaleth heh
  248. blue man I hate geoblocking
  249. blue totally ruined the internet
  250. phaleth ok, got podman 5.8.2
  251. phaleth well, still getting the same error
  252. phaleth I guess it's because of one of the podman dependencies and I've only updated podman
  253. bot <discord:blue> Ya
  254. bot <discord:blue> Get debian sid
  255. bot <discord:blue> https://packages.debian.org/unstable/podman
  256. bot I Challenge Thee
  257. phaleth sort of trying to do that
  258. phaleth it's going to upgrade to latest kernel, will prolly break the fonts
  259. bot <discord:blue> Oh no
  260. bot <discord:blue> The Ubuntu community page is full of nonsense
  261. bot <discord:blue> "Debian is a volunteer project that has developed and maintained a GNU/Linux operating system for well over a decade"
  262. bot <discord:blue> More like three decades
  263. bot <discord:blue> Also who says GNU/Linux today other than pedantic buttholes
  264. bot <discord:blue> "Less dangerous, but still problematic behavior can be used as a teaching moment instead."
  265. phaleth very cool https://images4.imagebam.com/24/f9/98/ME1DU1FR_o.png
  266. bot <discord:blue> Why does everything sound like a soviet textbook
  267. phaleth can you expand that panel with build logs by default? so clicking on that is not necessary
  268. bot <discord:blue> Ya
  269. bot <discord:blue> Btw once it finishes building the logs might be red, I need to fix that
  270. bot <discord:blue> And after it finishes building you'll see real time stats on the right
  271. blue ok
  272. phaleth yeah, the logs at the bottom show
  273. phaleth Error: Podman GET /v5.0.0/libpod/containers/undefined/logs failed: 404 {"cause":"no such container","message":"no container with name or ID \"undefined\" found: no such container","response":404}
  274. blue yeah I know. if you refresh the page they'll show right
  275. blue btw if you want you can create another app and deploy from apps/svelte :)
  276. phaleth 50s to build the thing, not too bad since it's doing all that pnpm crap
  277. blue yeah, we need to optimise that but 50s is already great
  278. phaleth ok, so should I convert nevet docs to podman?
  279. blue we need a deployment plan for it, that's what we need to work on
  280. blue look into the plans directory
  281. blue those plans are going to move soon into a db table so we can edit them live, but for now they're in plans/*.yaml
  282. phaleth is that something custom or something podman specific?
  283. blue the plans themselves are custom, the Containerfile are standard podman with variables
  284. phaleth ok
  285. phaleth so we need containerfiles
  286. blue check primate_bun_v0.yaml and primate_bun_v0.Containerfile, I think you'll understand
  287. blue a repopack user can override the automatic detection of strategies by creating a `rp.yml` file
  288. blue s/strategies/plans
  289. blue then you put `plan: primate/static/v0` or whatever into rp.yml
  290. blue or I think I called that plan `node/static/v0`
  291. blue since I needed a node builder and a static runner for primate/openapi
  292. blue so essentially, just to understand the system, the naming convention is BUILDER/RUNNER/VERSION
  293. blue so `primate/bun/v0` builds primate and runs it on bun, `node/static/v0` uses node to build a static website (like the primate/openapi repo)
  294. blue we'll also have 'default' plans like `primate/v0`, which is just build with node, run with node
  295. blue this will be the default plan for primate projects unless you choose another plan (bun or deno), by specifying it explicitly in your rp.yml, or by selecting it during the plan detection phase, if more than one plan was detected
  296. blue currently the detection strategy just takes the first thing that matches the requirements, so you'll see the primate website is deployed by `primate/bun/v0`
  297. blue but technically `primate/deno/v0` matches as well, and in this case, since apps/website has no rp.yml stating a preference, the ui will offer you to choose (and remember your choice, if you wish)
  298. blue also, in the ui, when you create an app, I'll add a field 'deployment plan'. default will be "detect", but you'd be able to also manually select a plan
  299. blue it is my intention to version those deployment plans so they can work with different major versions of a framework/tech, if both are still supported
  300. blue we're gonna have next/v0, sveltekit/v0, etc., possibly with deno/bun variants
  301. phaleth docker.io/nginxinc/nginx-unprivileged:alpine is too big, can I update that Containerfile?
  302. blue yes, you should in fact
  303. blue just push it back
  304. blue after you update
  305. blue the plans and their containerfiles aren't gonna be in git for long. as I said I plan to add a DEPLOYMENT_PLAN table and then we'll be managing it under an /admin path
  306. blue because I don't want to redeploy the entire repopack app just to change a plan
  307. blue I also eventually would like users to submit their own plans, or to be able to use custom plans for their apps
  308. blue all of that kind of requires a database
  309. blue however, I think keeping a few plans as a way to seed the db when you're just starting locally is a good idea
  310. blue anyway, for now just edit in git
  311. blue phaleth: build image now autoexpands, logs / stats should autowire when build is finished now
  312. blue so you shouldn't need to manually expand the build image step or refresh the page after the build anymore
  313. phaleth I've opened up a PR? can you check your mailbox?
  314. phaleth nice
  315. blue ya
  316. blue yup, got three emails
  317. blue done, merged & deleted branch
  318. blue once we deploy RP on repopack.com, we can use it to manage repopack/web itself, it'll be great
  319. phaleth that's good
  320. blue but we still have a lot to do with ssh / haproxy
  321. blue and I haven't written any auth code
  322. phaleth you can take a look at how gitea is proxied in haproxy.cfg, it'll be the same for RP except port 22 will be used
  323. phaleth for ssh I have no clue, last time you mentioned some lib
  324. phaleth does not matter I guess as long as it's at the app level it's all fine
  325. blue yeah, we need to be able to cleverly check permissions
  326. blue so if you do `git clone ssh://git@repopack.com:repopack/web`, we need to be able to check first using the db if you have the permission to do
  327. blue the path to get to the check itself is clear: pubkey -> user -> acl
  328. blue but the difficult part is doing this before we let you clone/push/pull
  329. blue this is where I used the `ssh2` package before
  330. blue let me see if I can find the code somewhere
  331. phaleth can you take a look at the provison repo to podman/deployments/theanswerisc/nginx dir and can you tell how to include those additional files next to the Containerfile there?
  332. blue ya
  333. blue https://gitea.repopack.app/blue/adaptivecloud
  334. blue here is the old code
  335. blue https://gitea.repopack.app/blue/adaptivecloud/src/branch/master/server/app.js
  336. blue this is the key part, essentially
  337. blue it extracts the pubkey from the ssh request (`client.public_key`), and then passes it to the app alongside the project id, the app can then decide whether to allow the user or not, and whether to trigger any hooks after a push
  338. blue anyway, gonna look at the provision repo
  339. blue ah I see, you have nginx.conf and proxy_params
  340. blue those are mostly about passing to fly, no? we won't be having that anymore
  341. blue the question though, how to include additional files in a build, is valid
  342. phaleth yeah, also I'm not sure how to handle passwords
  343. blue one possibility we have is to not put the plans in the db
  344. blue but rather in a different repo, say repoack/plans
  345. blue and the repopack app periodically syncs them or whatever
  346. blue that solves the additional files issue
  347. blue you just have a dir, `primate_deno/v0/`, inside you'll have plan.yml, Containerfile, and any additional files you need
  348. blue in fact this is something we could do right now by restructuring the `plans` dir a bit
  349. blue the problem is really during development, when you iterate quickly on the plans. I think in production it'll be okay
  350. blue passwords/secrets we can inject into Containerfiles
  351. blue and the user can define them on the ui, probably
  352. phaleth I think it's best to have everything in db to not have more than single data source
  353. blue that's fair, remains the question how to deal with additional files
  354. blue also having the plans versioned in git is perhaps not bad
  355. phaleth each containerfile can have many additional_files
  356. phaleth and they are just blobs
  357. blue what kind of db column would that be?
  358. phaleth some binary
  359. blue could be another table
  360. blue deployment_plan_files
  361. phaleth yeah, for sure, another table cause of the one to many relatioship
  362. blue ya
  363. blue ok, that sounds good. so we're gonna have the deployment_plan table with plan: p.json and containerfile: p.string
  364. blue and then deployment_plan_files with deployment_plan_id: p.u32, contents: p.blob
  365. blue you only need the extra files if a plan is selected, anyway. so for the initial detection you don't need the related table
  366. blue I think for performance, the deployment_plan table will also have `family: p.u8` or so
  367. blue so the package_json family is 1 and so on
  368. blue the purpose of the family is just for detection. so if you have a package.json file in root, we only look in plans belonging to this family
  369. phaleth heh p.u8
  370. blue those won't be many families. package_json, pom_xml, composer_json, makefile, build_zig
  371. blue cargo_toml etc.
  372. phaleth not sure, there are many software technologies
  373. blue k, p.u16 then
  374. blue might be more than 256... but not more than 2^16

Search posts