Submit

Back to the channels

#primate

  1. phaleth I had no clue that traefik works with podman
  2. phaleth blue: https://gitea.repopack.app/repopack/provision/commit/4c9ab41ae44ef3a83bf07d3f043d7585f6a4134d
  3. blue hi phaleth
  4. blue took me a while to realise I need to use port 2222 now :P
  5. blue but yeah, checked in gitea and got it now
  6. blue anyway, traefik works like a charm on my comp locally
  7. blue I first tried to update haproxy on every app creation but it a bit of a pain
  8. blue it was*
  9. blue now, 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. blue I also moved back the plans to disk and added tests. the plans in the db thing wasn't well testable
  11. blue I also added a js/next-js plan which works
  12. blue and a go/binary plan which works as well
  13. blue phaleth: working on ssh now
  14. phaleth hi blue
  15. phaleth yeah, traefik looks convenient
  16. phaleth so that'll be another priviledged container for traefik
  17. blue yes
  18. blue phaleth: we'll probably need to have the repopack repo in /opt, so that the git user can execute stuff there
  19. blue at least until we containerise it, then we need a different solution for that
  20. phaleth data that needs to be persisted will be stored in a volume somewhere in /opt/podman
  21. blue mhm
  22. phaleth anyway, 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. blue sounds great
  24. phaleth yeah, best way is to have no volumes at all, configs can be provided at build time
  25. phaleth if 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. phaleth we 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. blue so you want to put git in the db?
  28. blue I'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. phaleth yeah, totally
  30. phaleth nice
  31. blue I 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. blue for now shelling out to git is the cheapest, even if it's not the cleanest
  33. blue anyway, the last missing piece for us to deploy repopack.com is the mail login in and acl
  34. blue I might be able to finish it today, so we can start playing around with it on the server
  35. blue currently, login is restricted to @repopack.com addresses; only those can sign-up. that's a good low-effect limitation for now
  36. blue but I still need to put it acl and make sure no one can access any repos
  37. blue put in*
  38. phaleth ok, 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. phaleth the 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. phaleth all 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. blue fair enough, we'll add the git-in-postgres as a high prio item
  42. phaleth this guy seems to like postgres https://nesbitt.io/2026/03/10/just-use-postgres.html
  43. blue ya
  44. blue phaleth: auth codes coming
  45. blue the mailer works, already verified
  46. blue phaleth: 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. blue I 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. blue see it*
  49. blue the 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. phaleth yeah, sure, we can add basic auth to repopack.com and whitelist whoever is needed via haproxy
  51. phaleth I know there will be auth, but it's just to disable any response for now
  52. blue fair enough
  53. blue ok, let's do it
  54. blue the 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. phaleth the 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. blue out of place?
  61. phaleth I mean out of order
  62. blue oh
  63. phaleth I think it's safe to remove the @repopack.com restriction since there is gonna be basic auth
  64. phaleth cause we also need to know if e-mails are sent outside of the mail server
  65. blue fair enough
  66. blue I'll do it
  67. blue my 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. blue for now, it's just no collaborative, but that's ok, will change soon
  69. blue not collborative*
  70. phaleth ok, I don't understand all this SSH stuff in the readme, is that needed for deployment?
  71. blue yes
  72. blue what 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. blue this is one of two scripts we need to put in a place the git user can read them
  75. blue or well, wrappers, not scripts
  76. blue you'll find those wrappers in the `dev` directory
  77. phaleth yeah, well, it's not saying that
  78. blue They should be executed through small system wrappers. The wrappers set the
  79. blue current working directory to the Repopack project root before starting Bun.
  80. blue That matters because `@rcompat/env` loads `.env.local` from the current working
  81. blue directory.
  82. blue Template wrappers live in:
  83. blue ```txt
  84. phaleth ok, so the dev dir needs to be part of the image
  85. blue dev/repopack-authorized-keys
  86. blue dev/repopack-git-shell
  87. blue ```
  88. blue the flow is this
  89. blue someone does `git clone git@repopack.com:primate/primate
  90. blue sshd reads its config, sees it has an AuthorizedKeysCommand for user git
  91. blue so it executes
  92. blue AuthorizedKeysCommand /usr/local/bin/repopack-authorized-keys %u %t %k
  93. blue this path needs to be executable by the git user on the host
  94. blue it could be in a container, but the host git user needs to be able to executable it
  95. blue to execute*
  96. blue all this wrapper does really it execute the script `authorized-keys.ts` inside the repopack repo, with the proper cwd
  97. phaleth currently it's not just about running `npx primate build` and only having to copy over the build dir right?
  98. blue yes, for repopack app we need to do more
  99. phaleth I understand git user needs to be created
  100. blue yes. but we already have that user, I think
  101. blue [blue@vmd170320 ~]$ id git
  102. blue uid=971(git) gid=971(git) groups=971(git)
  103. blue unless you just created it
  104. phaleth no, wait
  105. blue iirc it gets autocreated if youinstall git
  106. phaleth repopack will be in it's own priviledged container
  107. blue this is ok, but you still need a git user on the host
  108. blue and that git user needs to call into that container
  109. phaleth take 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. phaleth there is no need for git and git user on host OS, it just has to be able to reach podman
  111. phaleth and also traefik, but traefik should be another priviledged container
  112. blue so when someone does `git clone git@repopack.com:primate/primate`, what happens?
  113. phaleth haproxy will route SSH traffic to repopack container
  114. 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
  115. phaleth anyway, can you uninstall @plsp/svelte from the project?
  116. phaleth I think deploying with node is a better idea
  117. phaleth I'll brb, need to get some groceries
  118. blue removed @plsp/svelte
  119. blue 16: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. blue yes
  121. blue just 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. blue 16: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. blue sorry, no idea how this message got sent, my laptop is developing its own personality
  124. blue but I think it's the trackpadp
  125. phaleth yeah, it'll be three containers: postgres, traefik and repopack, so far it seems
  126. blue cool
  127. blue phaleth: if you need any help getting repopack.com live, tell me
  128. phaleth just taking notes still, will see if there is any knowledge gap
  129. blue k
  130. phaleth is repopack-git-shell used?
  131. blue yes
  132. blue GIT_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. blue this console.log is actually significant: because sshd reads what you output to stdout, as the command to be executed
  144. phaleth ok, does that executable end up in the build dir after npx primate build executes?
  145. blue dev/repopoack-git-shell? no, currently not.
  146. blue the setup as I have it locally, is that I copy dev/repopack-git-shell and dev/repopack-authorized-keys to /usr/local/bin
  147. phaleth ah, it's in dev dir
  148. blue well, i copy them and edit REPOPACK_ROOT and BUN, as the readme says
  149. blue this is /usr/local/bin/repopack-git-shell looks like on my comp
  150. blue #!/bin/sh
  151. blue cd /home/blue/git/repopack || exit 1
  152. blue exec /usr/bin/bun scripts/git-shell.ts "$@"
  153. blue repopoack-authorized-keys is similar, just with scripts/authorized-keys.ts
  154. phaleth omg bun :D
  155. phaleth so I will use bun container then
  156. blue ya
  157. blue I'm using bun.lock anyway with rp
  158. phaleth not sure if I need to use this install cmd
  159. phaleth is that available on alpine?
  160. phaleth I guess I can just copy those scripts to /usr/local/bin and make them executable
  161. blue ya
  162. blue you can
  163. phaleth can I put REPOPACK_ROOT into the .env.local? seems like I can't
  164. blue REPOPACK_ROOT is not an actual env variable
  165. blue it's meant to be replaced with wherever the repo is at
  166. phaleth if I set that var in the image then it will not be available
  167. blue yes
  168. phaleth the repo is at? I actually don't understand the purpose of this var
  169. phaleth and it looks like a troublemaker
  170. phaleth both of these scripts do as well
  171. blue this doesn't really matter
  172. blue all 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. blue if you can do it without those wrappers, better
  174. blue to execute*
  175. blue the wrappers I need to make it work locally, but I'm not running rp locally like you do on the server, inside containers
  176. phaleth sounds like bun should do that
  177. blue if you can make it work without the wrappers, all the better
  178. blue I'm dumb so I went that way, you probably have a better solution :P
  179. phaleth no clue what does "$@" mean, too cryptic
  180. blue all arguments, iirc
  181. phaleth ah, ok, but how are you executing these scripts? from repopack code?
  182. phaleth I 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. phaleth ok, the bun alpine container does not have openssh-server
  188. phaleth and two daemons should not run in the same container anyway
  189. phaleth that means another openssh-server container is needed
  190. phaleth but then how do I tell bun about this pretty much remote ssh server?
  191. phaleth also then I guess those two containers should share a volume, the question is which volume
  192. phaleth I mean which path on disk, the one defined by REPOPACK_ROOT
  193. phaleth I guess
  194. phaleth I 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. phaleth this 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. phaleth great :)
  205. phaleth there 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. phaleth ok, 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. phaleth yeah, sounds simple enough, people will like
  214. bot <discord:blue> Ya
  215. blue plan forward
  216. blue bun install ssh2
  217. blue then create a primate module that wraps around it, starts the ssh server during onInit
  218. blue internally, it can run on whatever port we like. so 2222 or whatever
  219. blue then, when I use locally, the clone urls are localhost:2222/primate/primate or so
  220. blue when we use repopack.com, haproxy hands off 22 traffic to 2222 in the container
  221. blue makes sense?
  222. phaleth the container can just use internal port 22, just like traefik does use 80, the outbound port will be randomly chosen
  223. phaleth echo $((RANDOM % (65535 - 10000 + 1) + 10000))
  224. blue ok
  225. blue I don't really care. the only difference to me is that I need to run port 22 locally with sudo
  226. blue so locally I'll do 2222, so we'll make the port configurable as SSH_PORT in .env.local
  227. phaleth yeah, configurable is best
  228. blue k
  229. blue phaleth: ssh2 pivot almost done

Search posts