Submit

Back to the channels

#primate

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

Search posts