Add more tasks and tweak docs

main
Thomas Sileo 2022-09-16 17:38:19 +02:00
parent a55b06b252
commit 949365d8ba
3 changed files with 99 additions and 1 deletions

View File

@ -29,3 +29,15 @@ move-to:
.PHONY: self-destruct .PHONY: self-destruct
move-to: move-to:
-docker run --volume `pwd`/data:/app/data --volume `pwd`/app/static:/app/app/static microblogpub/microblogpub inv self-destruct -docker run --volume `pwd`/data:/app/data --volume `pwd`/app/static:/app/app/static microblogpub/microblogpub inv self-destruct
.PHONY: reset-password
reset-password:
-docker run --volume `pwd`/data:/app/data --volume `pwd`/app/static:/app/app/static microblogpub/microblogpub inv reset-password
.PHONY: check-config
check-config:
-docker run --volume `pwd`/data:/app/data --volume `pwd`/app/static:/app/app/static microblogpub/microblogpub inv check-config
.PHONY: compile-scss
compile-scss:
-docker run --volume `pwd`/data:/app/data --volume `pwd`/app/static:/app/app/static microblogpub/microblogpub inv compile-scss

View File

@ -33,6 +33,9 @@ Whenever one of these config items is updated, an `Update` activity will be sent
The server will need to be restarted for taking changes into account. The server will need to be restarted for taking changes into account.
Before restarting, you can ensure you haven't made any mistakes by running the [configuration checking task](/user_guide.html#configuration-checking).
### Profile metadata ### Profile metadata
You can add metadata to your profile with the `metadata` config item. You can add metadata to your profile with the `metadata` config item.
@ -283,7 +286,7 @@ make account=username@domain.tld webfinger
Edit the config. Edit the config.
#### Edit the config ### Edit the config
And add a reference to your old/existing account in `profile.toml`: And add a reference to your old/existing account in `profile.toml`:
@ -295,6 +298,61 @@ Restart the server, and you should be able to complete the move from your existi
## Tasks ## Tasks
### Configuration checking
You can confirm that your configuration file (`data/profile.toml`) is valid using the `check-config`
#### Python edition
```bash
poetry run inv check-config
```
#### Docker edition
```bash
make check-config
```
### Recompiling CSS files
You can ensure your custom theme is valid by recompiling the CSS manually using the `compile-scss` task.
#### Python edition
```bash
poetry run inv compile-scss
```
#### Docker edition
```bash
make compile-scss
```
### Password reset
If have lost your password, you can generate a new one using the `password-reset` task.
#### Python edition
```bash
# shutdown supervisord
poetry run inv password-reset
# edit data/profile.toml
# restart supervisord
```
#### Docker edition
```bash
docker compose stop
make password-reset
# edit data/profile.toml
docker compose up -d
```
### Pruning old data ### Pruning old data
You should prune old data from time to time to free disk space. You should prune old data from time to time to free disk space.
@ -388,3 +446,11 @@ poetry run inv self-destruct
# For a Docker install # For a Docker install
make self-destruct make self-destruct
``` ```
## Troubleshooting
If the server is not (re)starting, you can:
- [Ensure that the configuration is valid](/user_guide.html#configuration-checking)
- [Verify if you haven't any syntax error in the custom theme by recompiling the CSS](/user_guide.html#recompiling-css-files)
- Look at the log files

View File

@ -327,3 +327,23 @@ def reset_password(ctx):
print() print()
print("Update data/profile.toml with:") print("Update data/profile.toml with:")
print(f'admin_password = "{new_password}"') print(f'admin_password = "{new_password}"')
@task
def check_config(ctx):
# type: (Context) -> None
import sys
import traceback
from loguru import logger
logger.disable("app")
try:
from app import config # noqa: F401
except Exception as exc:
print("Config error, please fix data/profile.toml:\n")
print("".join(traceback.format_exception(exc)))
sys.exit(1)
else:
print("Config is OK")