diff --git a/docs/install.md b/docs/install.md index 78242cce8c..b77cc55f17 100644 --- a/docs/install.md +++ b/docs/install.md @@ -361,7 +361,9 @@ In this instruction, we use [Caddy](https://caddyserver.com/) to make the Firefi sudo systemctl enable --now firefish ``` -## Upgrading +## Maintain the server + +### Upgrade Firefish version Please refer to the [upgrade instruction](./upgrade.md). Be sure to switch to `firefish` user and go to the Firefish directory before executing the `git` command: @@ -370,6 +372,77 @@ sudo su --login firefish cd ~/firefish ``` +### Rotate logs + +If the server runs long, the size of log files increases, filling up disk space. To prevent this, you should set up a log rotation (removing old logs automatically). + +You can edit the `SystemMaxUse` value in the `[journal]` section of `/etc/systemd/journald.conf` to do it: + +```conf +[journal] +... (omitted) +SystemMaxUse=500M +... +``` + +Make sure to remove the leading `#` to uncomment the line. After editing the config file, you need to restart `systemd-journald` service. + +```sh +sudo systemctl restart systemd-journald +``` + +It is also recommended that you change the [PGroonga log level](https://pgroonga.github.io/reference/parameters/log-level.html). The default level is `notice`, but this is too verbose for daily use. + +To control the log level, add this line to your `postgresql.conf`: + +```conf +pgroonga.log_level = error +``` + +You can check the `postgresql.conf` location by this command: + +```sh +psql --user postgres --command 'SHOW config_file' +``` + +The PGroonga log file (`pgroonga.log`) is located under this directory: + +```sh +psql --user postgres --command 'SHOW data_directory' +``` + +### Tune database configuration + +The default PostgreSQL configuration not suitable for running a Firefish server. Thus, it is highly recommended that you use [PGTune](https://pgtune.leopard.in.ua/) to tweak the configuration. + +Here is an example set of parameters you can provide to PGTune: + +| Parameter | Value | +|----------------------:|---------------------------------------------------------| +| DB version | 16 (your PostgreSQL major version) | +| OS Type | Linux | +| DB Type | Data warehouse | +| Total Memory | (total physical memory) - 700 MB | +| Number of CPUs | number of CPU threads (or lower value if you have many) | +| Number of connections | 200 | +| Data storage | SSD storage | + +Since this is not a dedicated database server, be sure to leave some memory space for other software such as Firefish and Redis. + +Once you have entered the appropriate values for your environment, click the "Generate" button to generate a configuration and replace the values in `postgresql.conf` with the suggested values. + +### VACUUM your database + +If the database runs long, "garbage" can degrade its performance or cause problems. To prevent this, you should execute the following commands regularly. + +```sh +sudo systemctl stop firefish +sudo --user=postgres psql --dbname=firefish_db --command='VACUUM FULL VERBOSE ANALYZE' +sudo systemctl start firefish +``` + +Note that this operation takes some time. + ## Customize - To add custom CSS for all users, edit `./custom/assets/instance.css`. diff --git a/docs/notice-for-admins.md b/docs/notice-for-admins.md index 0fad9caf8e..84d6194fa4 100644 --- a/docs/notice-for-admins.md +++ b/docs/notice-for-admins.md @@ -6,6 +6,10 @@ You can skip intermediate versions when upgrading from an old version, but pleas Please take a look at #10947. +## Unreleased + +This is not related to the recent changes, but we have added a new subsection called "[Maintain the server](https://firefish.dev/firefish/firefish/-/blob/develop/docs/install.md#maintain-the-server)" in the installation guide. We suggest that you take a look at it. + ## v20240607 The following environment variables are deprecated and no longer have any effect: