Easier Web Application Deployments #103
Labels
No Label
priority
high
priority
low
priority
medium
priority
very high
BUG
Feature
High Priority
Low Priority
Medium Priority
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: public/pyceo#103
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This proposal aims to replace existing multiplexer-based application deployments with systemd files.
Deliverables
~/.config/systemd/user/
PrivateTmp=yes
,PrivateDevices
depending on application,ProtectSystem=full
, etc.NoNewPrivileges
but I don’t see how it would do anything when systemd is run at the user levelsystemctl --user start/stop/restart
etc../script restart
aliases tosystemctl --user daemon-reload && systemctl --user start
Probably not a good idea, but is very technically feasible via. FastAPI or similar
systemctl status
outputloginctl enable-linger myuser
if myuser has systemd userspace services enabled, andloginctl disable-linger
if myuser is set to nologinNotes
systemctl --user
fails when yousu - myuser
; usemachinectl shell myuser@
insteadloginctl enable-linger myuser
Existing comment chain on the web interface (ported over from the doc):
Nathan
what's your advice? suggest against it? would each club have this or are just just hosting one for ourselves (for something)?
Eric
I'm not sure - this can be a killer feature that helps clubs a lot, but it's also a lot more work compared to just throwing together a wrapper that only creates/modifies systemd files.
As for implementation, it's probably best if each club spins up its own api server - the flow would just be "user calls web interface/API with API key -> API server calls interactive script -> stdout/stderr is returned to the user"
We can think about the web interface later. Let's focus on the main use case for now.
I'm going to discourage the use of
loginctl enable-linger
for the following reasons:Here's why we don't want members to directly create their own systemd services:
Here's what I suggest instead:
csclub.uwaterloo.ca/~username/path/to/your/app
). No URL path is needed if the app doesn't need to be publicly exposed (e.g. a Discord bot). The systemd unit file should be a template unit file so that we can keep common directives in one place, e.g.csc-member-app@.service
.~/www/.htaccess
to redirect the path above to the host + port on which the app is running. (TODO: figure out how to resolve port conflicts. If this is going to run on a general-use machine, we can't prevent other members from re-using that port.)Bonus: figure out how to run the apps on a machine with Kerberized NFS. Then we could run it from one of the cloud machines, which would actually make our life a lot easier.
Some ideas for the ceo CLI:
ceo app add --name myapp -e MY_ENV_VAR=1 -c "npm start" --path myapp
ceo app delete myapp
ceo app restart myapp
(this should SSH into the machine where the app is running and runsystemctl restart
)ceo logs myapp
(this should SSH into the machine where the app is running and runjournalctl
)Hey Max, thanks for the feedback!
Couple things off the top of my head:
re 1.2: enabled/disabled lingers are just empty files that live in
/var/lib/systemd/linger
- no official api, but it should be trivial to make one ourselvesre 2.2: template files seem like a really good idea
And for the rest, I mostly steered clear of those because I wanted to keep the scope of this as small as possible - this project will probably be best as a drop in replacement for
tmux
, and we can fix the other validation issues later down the line as separate projects so things don't end up bogging down. I'm also a bit leery of making a ceo api, since that turns this project from essentially zero additional attack surface (only superuser related addition would beloginctl
) to one with many attack surfaces.(I know the web interface does run counter to the low scope philosophy, but that's just because it's a bit of a toy project for me.)
Actually, clarifying my earlier comment, I think integrating this into the ceo api superficially (
ceo app
aliases topythonscript
) would be a good idea from a UX perspective - it's just that I don't have enough knowledge of the ceo backend that I'm worried about breaking things if I do any changes that are more complex.Not sure if I recall correctly, but was it mentioned on IRC that we should avoid using LXC containers? So is the plan now to go with Systemd units?
These systemd units could be created from club accounts using
ceo app ...
?My understanding was that the current plan is to go
systemd
because it's the easiest. LXC containers will take too much space and have other feasibility concerns (@merenber), and will take a lot more work compared to manipulating config units so they're a long term solution at best (my thoughts). Might have misunderstood the consensus though.Thought some more about this, and I think there's two ideas for how this project should go forward. One is for this to be a singular improvement (<10 hours + tests) and another is for this to address other outstanding issues so that we won't have to junk this in the future because of side effects that become apparent after a couple of years.
I'm personally in favour of the former: I can do it, while I definitely don't have the experience or expertise to do the latter without a lot of help. Curious to hear everyone's opinions on this - I'd be happy to start hacking on the latter as well if that's the coding philosophy CSC wants to take.