Provide systemd unit file in .deb and .rpm packages (#4478)

Closes #2287.

Co-authored-by: Alexander Tobi Fashakin <fashakinalexander@gmail.com>
Co-authored-by: Alexey Palazhchenko <alexey.palazhchenko@ferretdb.io>
This commit is contained in:
authored and GitHub committed 2024-07-24 07:04:34 +00:00
1 parent b20325873d
commit f859bb1ca6
9 files changed
+70 -8

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
[Unit]
Description=FerretDB Database
Documentation=https://docs.ferretdb.io/
Wants=network-online.target
After=network-online.target
[Service]
ExecStart=/usr/bin/ferretdb
Restart=on-failure
# Configure the FerretDB service with `systemctl edit ferretdb`.
# For more configuration options check https://docs.ferretdb.io/configuration/flags/
Environment="FERRETDB_POSTGRESQL_URL=postgres://127.0.0.1:5432/ferretdb"
[Install]
WantedBy=multi-user.target
+2
View File
@@ -20,3 +20,5 @@ contents:
- src: tmp/build/linux_${DIR_ARCH}/ferretdb
dst: /usr/bin/ferretdb
expand: true
- src: build/ferretdb.service
dst: /etc/systemd/system/ferretdb.service
+2 -2
View File
@@ -29,8 +29,8 @@ sudo apt update
sudo apt install -y postgresql
```
Currently, our `.deb` package does not provide a SystemD unit for starting FerretDB automatically.
You have to do it manually by running `ferretdb` binary with the [correct flags](../configuration/flags.md).
The `.deb` package ships with the systemd unit for starting FerretDB automatically.
For more information about its configuration, please take a look at [systemd configuration guide](./systemd.md).
Find out more about:
+1 -1
View File
@@ -1,5 +1,5 @@
---
sidebar_position: 6
sidebar_position: 7
---
# Go
+1 -1
View File
@@ -1,5 +1,5 @@
---
sidebar_position: 4
sidebar_position: 5
---
# macOS
+2 -2
View File
@@ -28,8 +28,8 @@ To install PostgreSQL, run the following commands:
sudo yum install -y postgresql
```
Currently, our `.rpm` package does not provide a SystemD unit for starting FerretDB automatically.
You have to do it manually by running `ferretdb` binary with the [correct flags](../configuration/flags.md).
The `.rpm` package ships with the systemd unit for starting FerretDB automatically.
For more information about its configuration, please take a look at [systemd configuration guide](./systemd.md).
Find out more about:
+43
View File
@@ -0,0 +1,43 @@
---
sidebar_position: 4
---
# Systemd Unit
:::note
This feature is still experimental.
If you encounter any problem, please [join our community](/#community) to report it.
:::
With both DEB and RPM package we ship the systemd unit, to start FerretDB automatically.
If FerretDB is not installed yet, please refer to the [`.deb`](https://docs.ferretdb.io/quickstart-guide/deb/) or [`.rpm`](https://docs.ferretdb.io/quickstart-guide/rpm/) installation pages.
The unit file provides some basic environment variables as an example.
They should be overwritten with the proper [configuration](../configuration/flags.md).
```systemd
[Service]
ExecStart=/usr/bin/ferretdb
Restart=on-failure
# Configure the FerretDB service with `systemctl edit ferretdb`.
# For more configuration options check https://docs.ferretdb.io/configuration/flags/
Environment="FERRETDB_POSTGRESQL_URL=postgres://127.0.0.1:5432/ferretdb"
```
You can modify them by using `systemctl edit ferretdb` command.
This'll open a text editor that'll allow you to override the systemd options of choice.
For example, if we want to use SQLite backend instead of PostgreSQL, we could write something like:
```systemd
### Editing /etc/systemd/system/ferretdb.service.d/override.conf
### Anything between here and the comment below will become the new contents of the file
[Service]
Environment="FERRETDB_SQLITE_URL=file:/var/lib/ferretdb/data/"
Environment="FERRETDB_HANDLER=sqlite"
### Lines below this comment will be discarded
...
```
+1 -1
View File
@@ -1,5 +1,5 @@
---
sidebar_position: 5
sidebar_position: 6
---
# Windows
+1 -1
View File
@@ -152,7 +152,7 @@ const config = {
prism: {
theme: themes.github,
darkTheme: themes.dracula,
additionalLanguages: ['go', 'sql', 'json', 'json5'],
additionalLanguages: ['go', 'sql', 'json', 'json5', 'systemd'],
},
mermaid: {
theme: {light: 'default', dark: 'dark'},