site/wiki/pages/administration.md

94 lines
2.7 KiB
Markdown
Raw Normal View History

2018-06-10 01:16:31 +00:00
---
2018-10-25 21:15:54 +00:00
author: ~ben and ~khuxkm
2018-08-09 14:28:14 +00:00
published: true
2018-06-10 01:16:31 +00:00
title: administration
description: ~team admin guide
2018-08-03 04:53:24 +00:00
category:
2018-06-10 01:16:31 +00:00
- main
---
# administration
2018-10-25 21:15:54 +00:00
1. [adding users](#adding-users)
2. [backups](#backups)
3. [bypassing resource limits as services user](#bypassing-resource-limits)
2019-09-02 23:51:32 +00:00
4. [runaway processes/excessive resource usage](#runaway-processes)
2018-06-10 01:16:31 +00:00
## adding users
2019-09-02 23:51:32 +00:00
> see the [makeuser](https://tildegit.org/team/makeuser) script's documentation
2018-06-11 01:37:24 +00:00
2020-05-01 01:41:23 +00:00
the signup page ([source](
https://tildegit.org/team/site/src/branch/master/signup/signup-handler.php))
writes `makeuser` commands into `/var/signups`.
once you've looked through signups and removed spam (by just commenting that
line in the signups file), you can run
sh /var/signups
and enter your sudo password to approve all pending requests
2018-06-10 01:16:31 +00:00
## backups
2019-09-02 23:51:32 +00:00
tilde.team uses [borg](https://borgbackup.readthedocs.io/en/stable/) (via
[borgmatic](https://torsion.org/borgmatic)) for backups and is configured
to save 7 daily backups, 4 weekly backups, 6 monthly, and 1 yearly backup.
backups run once daily during the night.
2018-06-10 01:16:31 +00:00
to see a list of the backups:
2018-08-09 14:28:14 +00:00
2019-09-02 23:51:32 +00:00
sudo borgmatic list
to see general backup stats:
sudo borgmatic info
2018-06-10 01:16:31 +00:00
to restore a backup:
2018-08-09 14:28:14 +00:00
2020-05-01 01:41:23 +00:00
sudo borgmatic extract --archive <archive name> --progress --path /path/to/restore
2018-06-10 01:16:31 +00:00
we keep backups of:
* `/home`
* `/etc`
2019-09-02 23:51:32 +00:00
* mysql and postgres databases (dumped before each backup run)
* [nextcloud](https://cloud.tilde.team/) data
* [tildegit](https://tildegit.org) database and repos
* `/var/spool/cron` - your crontabs
* `/tilde` - user-submitted scripts
* [mailman3](https://lists.tildeverse.org) list and archive data
2018-06-10 01:16:31 +00:00
## bypassing resource limits
(by [~khuxkm](https://khuxkm.tilde.team/))
2019-09-02 23:51:32 +00:00
So occasionally, when you're working with the services user, you'll run into
"error: fork: retry: Resource temporarily unavailable" errors.
Here's how to fix it:
07:11 <~khuxkm> so this is seriously dumb
07:11 <~khuxkm> so how you fix limits is
07:12 <~khuxkm> sudo -iu services
07:12 <~khuxkm> use ps -aux to find the bash process ("-bash")
07:12 <~khuxkm> then `sudo prlimit --pid <pid> --nproc 1000000:100000000`
07:12 <~khuxkm> then do what you need to do
07:12 <~khuxkm> then exit the bash session
2018-10-25 16:32:54 +00:00
2019-09-02 23:51:32 +00:00
## runaway processes
2018-10-25 16:32:54 +00:00
2019-09-02 23:51:32 +00:00
if a user consistently uses a lot of resources, send them a note via email
to request that they mind their usage levels. if they fail to respond within
a day or two, feel free to kill the process by pid or with `killall`. if they
resume using excessive resources and haven't responded to communications, then
feel free to lock them out by changing their shell to `/usr/sbin/nologin`.
2018-10-25 16:32:54 +00:00
2019-09-02 23:51:32 +00:00
sudo chsh -s /usr/sbin/nologin <username>
2018-10-25 16:32:54 +00:00
2019-09-02 23:51:32 +00:00
don't forget to kill their existing session with:
2018-10-25 16:32:54 +00:00
2019-09-02 23:51:32 +00:00
sudo loginctl terminate-user <username>
2018-10-25 16:32:54 +00:00