Move mitractl documentation to docs/mitractl.md

This commit is contained in:
silverpill 2022-11-25 18:23:41 +00:00
parent 5ff2d19837
commit 109168b5eb
2 changed files with 101 additions and 98 deletions

112
README.md
View file

@ -47,7 +47,7 @@ Ethereum contracts: https://codeberg.org/silverpill/mitra-contracts
Run: Run:
``` ```shell
cargo build --release --features production cargo build --release --features production
``` ```
@ -64,7 +64,7 @@ Create configuration file by copying `contrib/mitra_config.yaml` and configure t
Start Mitra: Start Mitra:
``` ```shell
./mitra ./mitra
``` ```
@ -78,7 +78,7 @@ To run Mitra as a systemd service, check out the [systemd unit file example](./c
Download and install Mitra package: Download and install Mitra package:
``` ```shell
dpkg -i mitra.deb dpkg -i mitra.deb
``` ```
@ -93,7 +93,7 @@ Open configuration file `/etc/mitra/config.yaml` and configure the instance.
Start Mitra: Start Mitra:
``` ```shell
systemctl start mitra systemctl start mitra
``` ```
@ -123,13 +123,13 @@ See [CONTRIBUTING.md](./CONTRIBUTING.md)
### Start database server ### Start database server
``` ```shell
docker-compose up -d docker-compose up -d
``` ```
Test connection: Test connection:
``` ```shell
psql -h localhost -p 55432 -U mitra mitra psql -h localhost -p 55432 -U mitra mitra
``` ```
@ -137,7 +137,7 @@ psql -h localhost -p 55432 -U mitra mitra
(this step is optional) (this step is optional)
``` ```shell
docker-compose --profile monero up -d docker-compose --profile monero up -d
``` ```
@ -145,31 +145,31 @@ docker-compose --profile monero up -d
Create config file, adjust settings if needed: Create config file, adjust settings if needed:
``` ```shell
cp config.yaml.example config.yaml cp config.yaml.example config.yaml
``` ```
Compile and run service: Compile and run service:
``` ```shell
cargo run cargo run
``` ```
### Run CLI ### Run CLI
``` ```shell
cargo run --bin mitractl cargo run --bin mitractl
``` ```
### Run linter ### Run linter
``` ```shell
cargo clippy cargo clippy
``` ```
### Run tests ### Run tests
``` ```shell
cargo test cargo test
``` ```
@ -179,99 +179,15 @@ See [FEDERATION.md](./FEDERATION.md)
## Client API ## Client API
### Mastodon API
Most methods are similar to Mastodon API, but Mitra is not fully compatible. Most methods are similar to Mastodon API, but Mitra is not fully compatible.
[OpenAPI spec](./docs/openapi.yaml) [OpenAPI spec](./docs/openapi.yaml)
## CLI ## CLI
Commands must be run as the same user as the web service: `mitractl` is a command-line tool for performing instance maintenance.
``` [Documentation](./docs/mitractl.md)
su mitra -c "mitractl generate-invite-code"
```
### Commands
Print help:
```shell
mitractl --help
```
Generate RSA private key:
```
mitractl generate-rsa-key
```
Generate invite code:
```
mitractl generate-invite-code
```
List generated invites:
```
mitractl list-invite-codes
```
Set or change password:
```
mitractl set-password <user-id> <password>
```
Delete profile:
```
mitractl delete-profile 55a3005f-f293-4168-ab70-6ab09a879679
```
Delete post:
```
mitractl delete-post 55a3005f-f293-4168-ab70-6ab09a879679
```
Remove remote posts and media older than 30 days:
```
mitractl delete-extraneous-posts 30
```
Delete attachments that don't belong to any post:
```
mitractl delete-unused-attachments 5
```
Delete empty remote profiles:
```
mitractl delete-empty-profiles 100
```
Generate ethereum address:
```
mitractl generate-ethereum-address
```
Update synchronization starting block of Ethereum blockchain:
```shell
mitractl update-current-block 2000000
```
Create Monero wallet:
```shell
mitractl create-monero-wallet "mitra-wallet" "passw0rd"
```
## License ## License

87
docs/mitractl.md Normal file
View file

@ -0,0 +1,87 @@
# mitractl: a tool for instance administrators
Commands must be run as the same user as the web service:
```shell
su mitra -c "mitractl generate-invite-code"
```
---
Print help:
```shell
mitractl --help
```
Generate RSA private key:
```shell
mitractl generate-rsa-key
```
Generate invite code:
```shell
mitractl generate-invite-code
```
List generated invites:
```shell
mitractl list-invite-codes
```
Set or change password:
```shell
mitractl set-password <user-id> <password>
```
Delete profile:
```shell
mitractl delete-profile 55a3005f-f293-4168-ab70-6ab09a879679
```
Delete post:
```shell
mitractl delete-post 55a3005f-f293-4168-ab70-6ab09a879679
```
Remove remote posts and media older than 30 days:
```shell
mitractl delete-extraneous-posts 30
```
Delete attachments that don't belong to any post:
```shell
mitractl delete-unused-attachments 5
```
Delete empty remote profiles:
```shell
mitractl delete-empty-profiles 100
```
Generate ethereum address:
```shell
mitractl generate-ethereum-address
```
Update synchronization starting block of Ethereum blockchain:
```shell
mitractl update-current-block 2000000
```
Create Monero wallet:
```shell
mitractl create-monero-wallet "mitra-wallet" "passw0rd"
```