Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update administration.md #194

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion administration.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,26 @@ sogs -L

This includes details such as the number of messages, files, active users, and moderators. If you
also want to list each of the individual moderators in each room add `-v` to the end of the command.

## List room ids
With sqlite3 installed run
```
sqlite3 /var/lib/session-open-group-server/sogs.db 'select id,token from rooms;'
```
## Clear out old room messages
After getting the room id you can clear out messages stored on your server since this is not done automatically. In the example below our room id is 1 and messages older than 14 days are being deleted.
```
sqlite3 /var/lib/session-open-group-server/sogs.db "DELETE FROM message_details WHERE room = 1 AND posted < strftime('%s', 'now', '-14 days');"
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A better query here would be this so that you don't have to worry about the ID values at all:

DELETE FROM message_details WHERE room = (SELECT id FROM rooms WHERE token = 'someroom') AND posted < strftime('%s', 'now', '-14 days');

However, in general, I'd prefer that we moved such functionality into the sogs command-line tool as I'm rather wary of having people directly interact with the sqlite database.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, was saying this in the Session SOGS group. I'll look into it.

## Backup sogs
It is recommended to do periodic backups of your sogs instance. You can backup the needed files to your current directory by running
```
#stop sogs server so files can be backed up (assumes you you systemd service for sogs)
systemctl stop sogs;
#backup files to tar.xz in current directory with current date.
tar -cJvf pysogs_backup_$(date --iso-8601).tar.xz /var/lib/session-open-group-server /etc/sogs/sogs.ini;
#starts sogs (assumes you you systemd service for sogs)
systemctl start sogs;
ChillyKitty marked this conversation as resolved.
Show resolved Hide resolved
```
## More!

For other commands, such as listing all global moderators, deleting rooms, and removing
Expand Down