Chat Logs

  1. * phaleth joined #primate
  2. phalethI had no clue that traefik works with podman
  3. phalethblue: https://gitea.repopack.app/repopack/provision/commit/4c9ab41ae44ef3a83bf07d3f043d7585f6a4134d
  4. * phaleth joined #primate
  5. bluehi phaleth
  6. bluetook me a while to realise I need to use port 2222 now :P
  7. bluebut yeah, checked in gitea and got it now
  8. blueanyway, traefik works like a charm on my comp locally
  9. blueI first tried to update haproxy on every app creation but it a bit of a pain
  10. blueit was*
  11. bluenow, traefik just reads podman container labels and automatically updates, pretty fast too, and there's a dashboard we could put under traefik.repopack.com or so and behind http basic auth
  12. blueI also moved back the plans to disk and added tests. the plans in the db thing wasn't well testable
  13. blueI also added a js/next-js plan which works
  14. blueand a go/binary plan which works as well
  15. bluephaleth: working on ssh now
  16. phalethhi blue
  17. phalethyeah, traefik looks convenient
  18. phalethso that'll be another priviledged container for traefik
  19. blueyes
  20. bluephaleth: we'll probably need to have the repopack repo in /opt, so that the git user can execute stuff there
  21. blueat least until we containerise it, then we need a different solution for that
  22. phalethdata that needs to be persisted will be stored in a volume somewhere in /opt/podman
  23. bluemhm
  24. phalethanyway, everything should be a git repo and ideally stored to postgres in real-time https://nesbitt.io/2026/02/26/git-in-postgres.html
  25. bluesounds great
  26. phalethyeah, best way is to have no volumes at all, configs can be provided at build time
  27. phalethif you need to have some files on host during testing then you can for sure create a volume, but for production usage postgres is the place to keep data I think
  28. phalethwe had this discussion long ago about two data targets that need to be kept in sync and coming up with yet another forgejo/gitea should be a mistake
  29. blueso you want to put git in the db?
  30. blueI've added ssh auth support. you can now add pubkeys under your account, and access the repo via ssh/git. the clone button is also wired
  31. phalethyeah, totally
  32. phalethnice
  33. blueI would be in favour of moving git into postgres, but I'd consider this an optimisation, because there's a lot of work involving parsing git-upload-pack and on pull generating git-receive-pack
  34. bluefor now shelling out to git is the cheapest, even if it's not the cleanest
  35. blueanyway, the last missing piece for us to deploy repopack.com is the mail login in and acl
  36. blueI might be able to finish it today, so we can start playing around with it on the server
  37. bluecurrently, login is restricted to @repopack.com addresses; only those can sign-up. that's a good low-effect limitation for now
  38. bluebut I still need to put it acl and make sure no one can access any repos
  39. blueput in*
  40. phalethok, we can test repopack with bare repos being on disk, but as soon as there are clients expecting uptime and fast redeployments and so on then I'd like to not end up in a migration situation
  41. phaleththe biggest advantage of having everything in db is that there can be a standalone VM just for db, so the whole system is much easier to maintain
  42. phalethall that will need to be backed up is the db VM, the rest can be considered temporary, if something strange starts happening, then the solution is to just redeploy on another VM while shutting down whatever garbage was running on the previous VM to maybe ban somebody after
  43. bluefair enough, we'll add the git-in-postgres as a high prio item
  44. * phaleth joined #primate
  45. phaleththis guy seems to like postgres https://nesbitt.io/2026/03/10/just-use-postgres.html
  46. blueya
  47. bluephaleth: auth codes coming
  48. bluethe mailer works, already verified
  49. bluephaleth: once I merge the acl stuff, do you think we could have a first go and trying to run repopack.com, or too early?
  50. blueI would consider it a pre-alpha, in the sense that it's wild testing and we could reset the db at any point, but I'd like to see if live if possible
  51. bluesee it*
  52. bluethe acl is pretty primitive, too: namespaces have an owner_id and you can only view namespaces you own (ones you created, or the initial namespace that's the same as your user), and their projects. but that's ok for now
  53. phalethyeah, sure, we can add basic auth to repopack.com and whitelist whoever is needed via haproxy
  54. phalethI know there will be auth, but it's just to disable any response for now
  55. bluefair enough
  56. blueok, let's do it
  57. bluethe acl code is in. I've recycled the db locally and tested a full run:
  58. blue- created a user with a @repopack.com address, using /auth/signup
  59. blue- got code, logged in with it, user created + namespace with the same name
  60. phaleththe readme is a bit out of place
  61. blue- created a project in that name
  62. blue- add my pubkey, clone project, created a minimal primate app, pushed, created app in the ui, deployment
  63. blueout of place?
  64. phalethI mean out of order
  65. blueoh
  66. phalethI think it's safe to remove the @repopack.com restriction since there is gonna be basic auth
  67. phalethcause we also need to know if e-mails are sent outside of the mail server
  68. bluefair enough
  69. blueI'll do it
  70. bluemy goal is that we can work on repopack itself at https://repopack.com/repopack/web asap, but for that I need to improve the `items` view. and also the `code` view so it can show commit diffs
  71. bluefor now, it's just no collaborative, but that's ok, will change soon
  72. bluenot collborative*
  73. phalethok, I don't understand all this SSH stuff in the readme, is that needed for deployment?
  74. blueyes
  75. bluewhat do you not understand? we need to edit /etc/ssh/sshd_config to run a script for the git user, whenever someone uses it
  76. blue AuthorizedKeysCommand /usr/local/bin/repopack-authorized-keys %u %t %k
  77. bluethis is one of two scripts we need to put in a place the git user can read them
  78. blueor well, wrappers, not scripts
  79. blueyou'll find those wrappers in the `dev` directory
  80. phalethyeah, well, it's not saying that
  81. blueThey should be executed through small system wrappers. The wrappers set the
  82. bluecurrent working directory to the Repopack project root before starting Bun.
  83. blueThat matters because `@rcompat/env` loads `.env.local` from the current working
  84. bluedirectory.
  85. blueTemplate wrappers live in:
  86. blue```txt
  87. phalethok, so the dev dir needs to be part of the image
  88. bluedev/repopack-authorized-keys
  89. bluedev/repopack-git-shell
  90. blue```
  91. bluethe flow is this
  92. bluesomeone does `git clone git@repopack.com:primate/primate
  93. bluesshd reads its config, sees it has an AuthorizedKeysCommand for user git
  94. blueso it executes
  95. blueAuthorizedKeysCommand /usr/local/bin/repopack-authorized-keys %u %t %k
  96. bluethis path needs to be executable by the git user on the host
  97. blueit could be in a container, but the host git user needs to be able to executable it
  98. blueto execute*
  99. blueall this wrapper does really it execute the script `authorized-keys.ts` inside the repopack repo, with the proper cwd
  100. phalethcurrently it's not just about running `npx primate build` and only having to copy over the build dir right?
  101. blueyes, for repopack app we need to do more
  102. phalethI understand git user needs to be created
  103. blueyes. but we already have that user, I think
  104. blue[blue@vmd170320 ~]$ id git
  105. blueuid=971(git) gid=971(git) groups=971(git)
  106. blueunless you just created it
  107. phalethno, wait
  108. blueiirc it gets autocreated if youinstall git
  109. phalethrepopack will be in it's own priviledged container
  110. bluethis is ok, but you still need a git user on the host
  111. blueand that git user needs to call into that container
  112. phalethtake a look at how it's done in gitea image https://gitea.repopack.app/repopack/provision/src/branch/master/nspawn/containers/gitea/gitea.md
  113. phaleththere is no need for git and git user on host OS, it just has to be able to reach podman
  114. phalethand also traefik, but traefik should be another priviledged container
  115. blueso when someone does `git clone git@repopack.com:primate/primate`, what happens?
  116. phalethhaproxy will route SSH traffic to repopack container
  117. phalethbut you know why I want to deploy all this to containers right? it's just to have the whole thing to be sort of modular and for the host OS to stay pure
  118. phalethanyway, can you uninstall @plsp/svelte from the project?
  119. phalethI think deploying with node is a better idea
  120. phalethI'll brb, need to get some groceries
  121. blueremoved @plsp/svelte
  122. blue16:00 < phaleth> but you know why I want to deploy all this to containers right? it's just to have the whole thing to be sort of modular and for the host OS to stay pure
  123. blueyes
  124. bluejust remember the ultimate goal should be to deploy repopack via itself, if that makes sense. maybe it wouldn't be 100% possible but it would be cool
  125. blue16:00 < phaleth> but you know why I want to deploy all this to containers right? it's just to have the whole thing to be sort of modular and for the host OS to stay pure16:00 < phaleth> but you know why I want to deploy all this to containers right? it's just to have the whole thing to be sort of modular and for the host OS to stay pure
  126. bluesorry, no idea how this message got sent, my laptop is developing its own personality
  127. bluebut I think it's the trackpadp
  128. phalethyeah, it'll be three containers: postgres, traefik and repopack, so far it seems
  129. bluecool
  130. * skillbot joined #primate
  131. bluephaleth: if you need any help getting repopack.com live, tell me
  132. phalethjust taking notes still, will see if there is any knowledge gap
  133. bluek
  134. phalethis repopack-git-shell used?
  135. blueyes
  136. blueGIT_SHELL_COMMAND=/usr/local/bin/repopack-git-shell
  137. blue const command = env.get("GIT_SHELL_COMMAND");
  138. blue const options = [
  139. blue "no-port-forwarding",
  140. blue `command="${quote(`${command} ${key.id}`)}"`,
  141. blue "no-X11-forwarding",
  142. blue "no-agent-forwarding",
  143. blue "no-pty",
  144. blue ];
  145. blue console.log(`${options.join(",")} ${key.public_key}`);
  146. blue(in scripts/authorized-keys.ts)
  147. bluethis console.log is actually significant: because sshd reads what you output to stdout, as the command to be executed
  148. phalethok, does that executable end up in the build dir after npx primate build executes?
  149. bluedev/repopoack-git-shell? no, currently not.
  150. bluethe setup as I have it locally, is that I copy dev/repopack-git-shell and dev/repopack-authorized-keys to /usr/local/bin
  151. phalethah, it's in dev dir
  152. bluewell, i copy them and edit REPOPACK_ROOT and BUN, as the readme says
  153. bluethis is /usr/local/bin/repopack-git-shell looks like on my comp
  154. blue#!/bin/sh
  155. bluecd /home/blue/git/repopack || exit 1
  156. blueexec /usr/bin/bun scripts/git-shell.ts "$@"
  157. bluerepopoack-authorized-keys is similar, just with scripts/authorized-keys.ts
  158. phalethomg bun :D
  159. phalethso I will use bun container then
  160. blueya
  161. blueI'm using bun.lock anyway with rp
  162. phalethnot sure if I need to use this install cmd
  163. phalethis that available on alpine?
  164. phalethI guess I can just copy those scripts to /usr/local/bin and make them executable
  165. blueya
  166. blueyou can
  167. phalethcan I put REPOPACK_ROOT into the .env.local? seems like I can't
  168. blueREPOPACK_ROOT is not an actual env variable
  169. blueit's meant to be replaced with wherever the repo is at
  170. phalethif I set that var in the image then it will not be available
  171. blueyes
  172. phaleththe repo is at? I actually don't understand the purpose of this var
  173. phalethand it looks like a troublemaker
  174. phalethboth of these scripts do as well
  175. bluethis doesn't really matter
  176. blueall you need to know is that when an ssh request comes out, we need to execute scripts/authorized-keys.ts, which will spit out a command for sshd, which will then need to executed scripts/git-shell.ts
  177. blueif you can do it without those wrappers, better
  178. blueto execute*
  179. bluethe wrappers I need to make it work locally, but I'm not running rp locally like you do on the server, inside containers
  180. phalethsounds like bun should do that
  181. blueif you can make it work without the wrappers, all the better
  182. blueI'm dumb so I went that way, you probably have a better solution :P
  183. phalethno clue what does "$@" mean, too cryptic
  184. blueall arguments, iirc
  185. phalethah, ok, but how are you executing these scripts? from repopack code?
  186. phalethI think these make the solution undeployable if the application needs them
  187. bot<discord:blue> So basically, we need a way to tell sshd to execute a script
  188. bot<discord:blue> I did it by hardcoding stuff into /etc/ssh/sshd_config
  189. bot<discord:blue> If you pass ssh traffic via haproxy to the container, still need this sshd_config executing a command when ssh is used
  190. bot<discord:blue> This all can take place in the container, I think
  191. phalethok, the bun alpine container does not have openssh-server
  192. phalethand two daemons should not run in the same container anyway
  193. phaleththat means another openssh-server container is needed
  194. phalethbut then how do I tell bun about this pretty much remote ssh server?
  195. phalethalso then I guess those two containers should share a volume, the question is which volume
  196. phalethI mean which path on disk, the one defined by REPOPACK_ROOT
  197. phalethI guess
  198. phalethI was hoping JS runtime could somehow act as sshd
  199. bot<discord:blue> That was the original idea with ssh2
  200. phaleth:)
  201. bot<discord:blue> Which we can still do, but this is a bit more straightforward
  202. bot<discord:blue> Can't we install openssh in the rp container?
  203. phaleththis is difficul to deploy, I'd have to use special image that can run two or more daemons and install both openssh-server and repopack website on top of that
  204. bot<discord:blue> Ok
  205. bot<discord:blue> I will look into ssh2 then
  206. bot<discord:blue> I have done it before
  207. bot<discord:blue> I can do it again
  208. phalethgreat :)
  209. phaleththere could be an openssh-server container if you can turn those local scripts into ssh clients (JS based)
  210. bot<discord:blue> Well, ssh2 is more beneficial if I want longterm to have git in the db
  211. bot<discord:blue> So
  212. bot<discord:blue> I guess now is bettet
  213. phalethok, agree
  214. bot<discord:blue> I think this should be the rp motto
  215. bot<discord:blue> Now is better
  216. bot<discord:blue> 🙂
  217. phalethyeah, sounds simple enough, people will like
  218. bot<discord:blue> Ya
  219. blueplan forward
  220. bluebun install ssh2
  221. bluethen create a primate module that wraps around it, starts the ssh server during onInit
  222. blueinternally, it can run on whatever port we like. so 2222 or whatever
  223. bluethen, when I use locally, the clone urls are localhost:2222/primate/primate or so
  224. bluewhen we use repopack.com, haproxy hands off 22 traffic to 2222 in the container
  225. bluemakes sense?
  226. phaleththe container can just use internal port 22, just like traefik does use 80, the outbound port will be randomly chosen
  227. phalethecho $((RANDOM % (65535 - 10000 + 1) + 10000))
  228. blueok
  229. blueI don't really care. the only difference to me is that I need to run port 22 locally with sudo
  230. blueso locally I'll do 2222, so we'll make the port configurable as SSH_PORT in .env.local
  231. phalethyeah, configurable is best
  232. bluek
  233. bluephaleth: ssh2 pivot almost done
  234. * jreicher joined #primate