Skip to content

Imroved systemd example#19

Merged
markmnl merged 4 commits intomainfrom
systemd
Apr 17, 2026
Merged

Imroved systemd example#19
markmnl merged 4 commits intomainfrom
systemd

Conversation

@markmnl
Copy link
Copy Markdown
Owner

@markmnl markmnl commented Apr 17, 2026

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves deployment documentation by adding a sample environment file and expanding the systemd unit example for running fmsgd.

Changes:

  • Added src/.env.example with required fmsgd and Postgres environment variables.
  • Expanded the README’s systemd unit example with network-online dependencies, restart policy, hardening, and logging settings.
  • Added an inline example of the /opt/fmsgd/env file contents in the README.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/.env.example Introduces a canonical example set of required env vars (including Postgres/libpq env vars).
README.md Updates systemd service guidance and adds an example env-file block for deployments.

Comment thread src/.env.example
PGUSER=
PGPASSWORD=
PGDATABASE=fmsgd
PGSSLMODE=disable
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

PGSSLMODE=disable is an insecure default for many deployments (it disables TLS to Postgres). Consider omitting it from the example or setting a safer default (e.g., require/verify-full) and adding a short comment indicating when disable is appropriate (local socket / trusted localhost only).

Suggested change
PGSSLMODE=disable
# Use disable only for local socket or trusted localhost development.
PGSSLMODE=require

Copilot uses AI. Check for mistakes.
Comment thread README.md
RestartSec=3

# --- Filesystem access ---
ReadWritePaths=/opt/fmsgd
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

ReadWritePaths=/opt/fmsgd grants write access to the installation directory. The daemon code appears to write only under FMSG_DATA_DIR (e.g., filepath.Join(DataDir, ...) in src/host.go), so this is broader than necessary. For least privilege, consider removing write access to /opt/fmsgd (keep it read-only) and only allow writes to /var/lib/fmsgd (or whatever FMSG_DATA_DIR is set to).

Suggested change
ReadWritePaths=/opt/fmsgd

Copilot uses AI. Check for mistakes.
Comment thread README.md
Comment on lines +112 to 132
```
FMSG_DATA_DIR=/var/lib/fmsgd/
FMSG_DOMAIN=example.com
FMSG_ID_URL=http://127.0.0.1:8080


FMSG_MAX_MSG_SIZE=10240
FMSG_MAX_PAST_TIME_DELTA=604800
FMSG_MAX_FUTURE_TIME_DELTA=300
FMSG_MIN_DOWNLOAD_RATE=5000
FMSG_MIN_UPLOAD_RATE=5000
FMSG_READ_BUFFER_SIZE=1600

PGHOST=127.0.0.1
PGPORT=5432
PGUSER=
PGPASSWORD=
PGDATABASE=fmsgd
```

```
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

The environment-variable example is now duplicated here and in src/.env.example, and they already diverge (e.g., .env.example includes PGSSLMODE but this README block does not). To avoid future drift, consider referencing/including the .env.example file from the README (or ensure both lists stay identical, including the Postgres variables you expect users to set).

Suggested change
```
FMSG_DATA_DIR=/var/lib/fmsgd/
FMSG_DOMAIN=example.com
FMSG_ID_URL=http://127.0.0.1:8080
FMSG_MAX_MSG_SIZE=10240
FMSG_MAX_PAST_TIME_DELTA=604800
FMSG_MAX_FUTURE_TIME_DELTA=300
FMSG_MIN_DOWNLOAD_RATE=5000
FMSG_MIN_UPLOAD_RATE=5000
FMSG_READ_BUFFER_SIZE=1600
PGHOST=127.0.0.1
PGPORT=5432
PGUSER=
PGPASSWORD=
PGDATABASE=fmsgd
```
```
See `src/.env.example` for the canonical environment-variable example and the full, current set of `FMSG_*` and PostgreSQL `PG*` variables to configure.

Copilot uses AI. Check for mistakes.
@markmnl markmnl merged commit a558294 into main Apr 17, 2026
2 checks passed
@markmnl markmnl deleted the systemd branch April 17, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants