Chat Logs

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