Self-hosting with Docker
Newses runs from a folder holding a release's compose.yaml and its settings in .env, on a linux/amd64 or linux/arm64 host with Docker Compose 2.23.1 or later. Commands run in that folder, and C stands for docker compose. In a checkout (Building from source), commands run from its root, C stands for docker compose -f docker/compose.yaml, and the settings are in docker/.env.
Install
Download the compose file, and the sample settings as
.env, into a new folder:The commands are in the Server section of the latest release's downloads.
In
.env, changePOSTGRES_PASSWORD, and setAPP_SECRETto the output ofopenssl rand -base64 48.Set
ADMIN_LOGINandADMIN_PASSWORDfor the first admin, or create it with the CLI after step 4.C up -d
migrate runs once and exits. server and worker start after it succeeds. The app listens on HTTP_PORT (default 8080): open it in a browser and sign in. GET /healthz returns 200 with {"status":"ok"} when the database and job queue are reachable.
The image is signed. To check it with cosign:
The commands are in the Server section of the latest release's downloads.
Configuration
.env:
| Variable | Default | Purpose |
|---|---|---|
POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB | — | Database credentials; also used to build DATABASE_URL |
APP_SECRET | — | At least 32 characters; keys for encrypting stored 2FA secrets and feed passwords and for signing tokens. Back it up with the database: changing or losing it disables 2FA for every user, feeds with a login stop updating until their readers enter the password again, and the unsubscribe links in digests already sent stop working |
HTTP_PORT | 8080 | Host port for the server |
LOG_LEVEL | info | trace, debug, info, warn, error, fatal; debug and trace log request, feed, page, and image URLs (secret keys stay redacted), which reach OTLP too when it is on |
PUBLIC_URL | unset | The address readers use, e.g. https://reader.example.com; makes published-feed links absolute, and email digests need it for their links. Unset uses each request's address, which needs a proxy that forwards Host |
INSTANCE_NAME | unset | What the desktop and Android apps call this server, e.g. Home (up to 100 characters), naming its profiles user @ Home; unset uses the host |
SOURCE_URL | unset | Where Settings > "About" sends readers for this server's source code. Set it if you run changed code, as the AGPL requires; unset links the Newses repository at the image's version |
COMPAT_TRACE | false | true logs every TTRSS and Google Reader API call with its parameters (credentials redacted), to diagnose a client |
TRUST_PROXY | false | true, the number of proxy hops, or the reverse proxy's address/CIDR, so client IPs (login throttling) and HTTPS (secure cookies) come from forwarded headers |
FEED_UPDATE_INTERVAL_MINUTES | 30 | Default minutes between fetches of a feed (5–1440) |
FEED_PURGE_DAYS | 180 | Default age in days after which entries are deleted unless starred, published, noted, labelled, or shared; 0 keeps everything |
ARCHIVE_ENABLED | true | Keeps entries that purge deletes in a cold-storage archive in the blobs volume, where users browse and restore them; false deletes them for good |
FEED_DISABLE_AFTER_FAILURES | 20 | Consecutive failed fetches after which a feed is disabled until refreshed |
FETCH_ALLOW_PRIVATE_NETWORKS | unset | Feeds on private or loopback addresses are blocked; set true or comma-separated CIDRs (e.g. 192.168.1.0/24) to allow LAN feeds |
ADMIN_LOGIN, ADMIN_PASSWORD | unset | First admin, created at startup only while no users exist; remove once created. Well-known logins such as admin and root are refused |
BACKUP_RETENTION_DAYS | 14 | Days of nightly dumps kept by the backup service |
OPS_RETENTION_DAYS | 90 | Days of activity, request, site, and job statistics, and resolved alerts, kept for the Operations page |
AUDIT_RETENTION_DAYS | 365 | Days of audit events kept |
OPS_HOST_HOURLY_BUDGET | 200 | Requests to one site in an hour above which an alert opens |
SMTP_URL | unset | Mail server the server emails users and alerts through, e.g. smtps://user:password@mail.example.com:465; unset sends no email |
MAIL_FROM | Newses <newses@host> | Sender of every email, on your PUBLIC_URL host (else localhost); use an address your mail server may send from. Users' own addresses only appear as reply-to |
ALERT_EMAIL_TO | unset | Address alerts are emailed to; needs SMTP_URL. Unset keeps alerts on the Operations page only |
ALERT_EMAIL_FROM | MAIL_FROM | Sender of alert emails |
OTEL_EXPORTER_OTLP_ENDPOINT | unset | OTLP/HTTP endpoint for traces, metrics, and logs, e.g. http://lgtm:4318 for the observability profile; unset turns OpenTelemetry off |
OTEL_EXPORTER_OTLP_HEADERS | unset | Headers for the endpoint, e.g. authorization=Bearer … |
OTEL_TRACES_SAMPLER, OTEL_TRACES_SAMPLER_ARG | parentbased_always_on, 1 | Trace sampling, e.g. parentbased_traceidratio and 0.1 |
OTEL_METRIC_EXPORT_INTERVAL | 15000 | Milliseconds between metric exports |
DEPLOYMENT_ENVIRONMENT | self-hosted | deployment.environment.name on all telemetry |
GRAFANA_PORT | 3000 | Port of Grafana on 127.0.0.1 (observability profile) |
NEWSES_IMAGE | The release's image; in a checkout, newses:latest | Image to run; in a checkout, the tag it builds |
COMPOSE_PROJECT_NAME | newses | Prefix of container and volume names; a stack created as rss-reader keeps that name to keep its volumes |
VIRTUAL_HOST, LETSENCRYPT_HOST | unset | Public hostname for nginx-proxy and acme-companion (compose.nginx-proxy.yaml) |
PLUGINS | unset | Plugins to install with compose.plugins.yaml: npm packages at exact versions, separated by spaces, e.g. @newses/plugin-webhook@1.0.0 |
COMPOSE_PROFILES | unset | Optional services every C command runs, comma-separated: backup (Backups), observability (Monitoring), ntfy (Push to Android) |
COMPOSE_FILE | unset | The compose files docker compose uses when run in the folder with .env and given no -f, separated by colons, e.g. compose.yaml:compose.plugins.yaml |
NTFY_HOST | unset | Hostname of the bundled ntfy (ntfy profile), e.g. ntfy.example.com; the Android app suggests it, and the server reaches it even on a private address |
NTFY_PORT | 8081 | Host port the bundled ntfy is published on, for your proxy |
NTFY_AUTH_ACCESS | *:up*:wo | The bundled ntfy's access for everyone: *:up*:deny lets only users given access publish (Push to Android) |
PUSH_TOKENS | unset | ntfy access tokens the server publishes with, comma-separated host=token pairs, for a ntfy that only lets users publish |
NGINX_PROXY_NETWORK | nginx-proxy | Existing Docker network of nginx-proxy |
RELEASE_TAG | unset | The tag your app downloads are built from, the installed version's, e.g. v1.2.3 (Your own app downloads) |
APPS_PLATFORMS | linux,windows,android | The apps built: linux, windows, android, comma-separated |
ANDROID_KEYSTORE_BASE64, ANDROID_KEYSTORE_PASSWORD, ANDROID_KEY_ALIAS, ANDROID_KEY_PASSWORD | empty | Your Android release keystore, base64, its password, key alias, and key password, which sign the APK; empty builds no APK |
WIN_CERTIFICATE_BASE64, WIN_CERTIFICATE_PASSWORD | empty | A code signing certificate (.pfx), base64, and its password, which sign the Windows apps |
AZURE_CLIENT_SECRET, AZURE_TENANT_ID, AZURE_CLIENT_ID, WIN_SIGNING_ENDPOINT, WIN_SIGNING_ACCOUNT_NAME, WIN_SIGNING_PROFILE_NAME | empty | Azure Artifact Signing instead of a certificate file |
WIN_PUBLISHER_NAME | empty | The signing certificate's CN (common name), needed to sign: installed Windows apps update only to builds carrying it |
Application variables, set in compose.yaml:
| Variable | Default | Purpose |
|---|---|---|
DATABASE_URL | — | PostgreSQL connection URL |
HOST, PORT | 0.0.0.0, 8080 | Server bind address inside the container |
BLOB_DIR | /data/blobs | Favicon and image cache, and the archive (blobs volume) |
DOWNLOADS_DIR | /data/downloads | Your own app downloads, served at /downloads/ (downloads volume); unset serves none |
PUSH_DISTRIBUTOR_URL | https:// and NTFY_HOST | UnifiedPush distributor the Android app suggests to readers |
PUSH_TRUSTED_HOSTS | NTFY_HOST | Comma-separated hosts whose push endpoints may be on private addresses, without allowing feeds there |
Users
Admins manage users through the admin API (/api/v1/admin/users). From the host, with the stack running:
- Create:
echo 'the password' | C exec -T server newses cli user create <login> [--admin] - Reset a password, sign the user out everywhere, and revoke their app passwords:
echo 'new password' | C exec -T server newses cli user reset-password <login> - Turn off a user's two-factor authentication and sign them out everywhere:
C exec server newses cli user reset-2fa <login>
Logs
C logs server worker shows JSON logs. Warnings from the server about slowness:
| Message | Meaning |
|---|---|
Slow request | A response took over 2 s |
Client closed the connection before the response was sent | The browser or proxy gave up waiting |
Both include pool (waiting > 0: requests queued for a database connection) and eventLoopDelayMaxMs (high: the server was blocked). Neither high points at the database or at password hashing.
With OpenTelemetry on, log lines inside a request or job carry trace_id and span_id.
Monitoring
Admins open Settings > Operations:
| Tab | Shows |
|---|---|
| Alerts | Open alerts and those resolved in the last 7 days; a banner when the worker's checks stopped |
| Sites | Requests to each site in 24 hours or 7 days: outcomes, share answered "not modified", busiest hour against the budget, Retry-After pauses |
| Jobs | Runs, failures, and durations of feed fetches, favicons, full text, plugins, and the scheduled tasks |
| Users | Last seen, requests by app, and articles read over 7 and 30 days |
| Audit log | Sign-ins, failed sign-ins, password, 2FA, app-password, user, and plugin changes |
The worker checks for problems every 5 minutes and emails changes to ALERT_EMAIL_TO when SMTP_URL is set.
Traces, metrics, and logs:
- In
.env, setOTEL_EXPORTER_OTLP_ENDPOINT=http://lgtm:4318and addobservabilitytoCOMPOSE_PROFILES. C up -d- Open
http://127.0.0.1:3000(on the Docker host; tunnel withssh -L 3000:127.0.0.1:3000from elsewhere). Grafana allows anonymous admin access, so keep it off public interfaces. Thenewsesfolder has dashboards for the overview, API, jobs, remote sites, and runtime; Explore searches traces (Tempo) and logs (Loki).
Any OTLP/HTTP backend works instead of the bundled one. Telemetry carries route patterns and host names, never credentials, feed URLs, or article content.
Upgrade
Download the newer release's compose file over yours, and start it; .env stays:
The commands are in the Server section of the latest release's downloads.
Migrations apply before the new server and worker start. Settings new in the release are in its sample settings (Download).
In a checkout: git pull && C up -d --build.
With your own app downloads, build them again from the new version's tag, so the apps update too.
Plugins
Plugins are npm packages installed into an image built from the release's, when you build it, never while Newses runs. They run inside the server with access to all its data, and the way they are written may still change: install only plugins you trust. Turning them on and setting them up is in Plugins.
In
.env, setPLUGINSto the packages at exact versions, separated by spaces:PLUGINS=@newses/plugin-webhook@1.0.0.Download the override, beside
compose.yaml, and build and start with both (Docker Compose 2.24.4 or later):The commands are in the Server section of the latest release's downloads.
In a checkout, the override builds on the checkout's image, which it does not build itself: run
docker compose -f docker/compose.yaml buildfirst, and again after eachgit pull, thenC -f docker/compose.plugins.yaml up -d --build.From then on,
Cnames both files, and everyupadds--build:docker compose -f compose.yaml -f compose.plugins.yaml up -d --build. With nginx-proxy, name all three files. To name them once instead, setCOMPOSE_FILE=compose.yaml:compose.plugins.yamlin.env, and run plaindocker composein its folder (in a checkout,docker).
To upgrade or remove plugins, change PLUGINS and run C up -d --build again; upgrading Newses rebuilds them on the new release. The build fails on a package that is not at an exact version, has known high or critical vulnerabilities, brings its own copy of zod or @newses/plugin-api, or has a licence Newses cannot ship with. A plugin that installs but that this version of Newses refuses, such as one written for another version of the plugin API, is left out, with the reason in the plugin.refused alert.
Trying a plugin before it is published
A plugin can be installed from a file packed with npm pack, to try a build that is not on npm:
- In the plugin's folder, pack it into a
pluginsfolder besidecompose.yaml(in a checkout,docker/plugins):npm pack --pack-destination /path/to/plugins. - List the file in
PLUGINSby its path, beside packages from npm:PLUGINS=@newses/plugin-webhook@1.0.0 ./plugins/newses-plugin-example-0.1.0.tgz. - Run
C up -d --build. Settings > Plugins shows the plugin's source as that path.
After a change, pack it again and run C up -d --build: the build installs the new file, even under the same name. The same checks apply as to packages from npm. To stop, remove it from PLUGINS and run C up -d --build.
Reverse proxy and TLS
nginx-proxy
In
.env, setVIRTUAL_HOST(andLETSENCRYPT_HOSTwhen acme-companion issues certificates). If nginx-proxy's Docker network is not callednginx-proxy, setNGINX_PROXY_NETWORK.Download the override, beside
compose.yaml, and start with both:The commands are in the Server section of the latest release's downloads.
In a checkout:
C -f docker/compose.nginx-proxy.yaml up -d.From then on,
Cnames both files:docker compose -f compose.yaml -f compose.nginx-proxy.yaml, in a checkoutdocker compose -f docker/compose.yaml -f docker/compose.nginx-proxy.yaml; or setCOMPOSE_FILE=compose.yaml:compose.nginx-proxy.yamlin.env, as for plugins.
The server then joins the proxy network and is not published on the host. TRUST_PROXY defaults to 1, the proxy being the only hop.
Other proxies
Forward to the server's port 8080 and pass X-Forwarded-For and X-Forwarded-Proto. Set TRUST_PROXY to the number of proxies in front of the server or to the proxy's address. true also trusts X-Forwarded-For entries sent by clients, which lets them evade per-IP login throttling.
The desktop and mobile apps need HTTPS. The proxy must forward the Authorization and Origin headers and OPTIONS requests, which carry the apps' bearer tokens and CORS preflights.
/api/v1/events is a long-lived event stream. nginx and nginx-proxy need no extra configuration. Other proxies must not buffer its responses and must allow at least 30 s between bytes (the server sends a heartbeat every 25 s).
The bundled ntfy needs its own virtual host for NTFY_HOST, forwarding to NTFY_PORT with WebSocket upgrades and the same long-lived connections (it sends a keepalive every 45 s), and X-Forwarded-For.
Email
The server sends email through a mail server you give it in SMTP_URL; it does not deliver mail itself. Use your mail provider's SMTP submission service, or a relay you run:
| Provider | SMTP_URL |
|---|---|
| Gmail (an app password) | smtps://you%40gmail.com:app-password@smtp.gmail.com:465 |
| Fastmail (an app password) | smtps://you%40fastmail.com:app-password@smtp.fastmail.com:465 |
| Amazon SES (SMTP credentials) | smtp://user:password@email-smtp.us-east-1.amazonaws.com:587 |
| Mailgun | smtp://postmaster%40mg.example.com:password@smtp.mailgun.org:587 |
| Postfix relay on your network | smtp://mail.lan:25 |
Percent-encode @ and other reserved characters in the user name and password. Set MAIL_FROM to an address the provider lets you send from; recipients' servers reject or file as spam mail from a domain whose SPF and DKIM records don't cover the sender.
Push to Android
The server pushes new entries to the Android app through the reader's UnifiedPush distributor, so it syncs within minutes even while closed; without one it syncs every 30 minutes. Readers can use the public ntfy.sh, or a ntfy you run beside Newses:
Give ntfy its own hostname, such as
ntfy.example.combesidereader.example.com, with a DNS record pointing at the server (a wildcard record covers it). ntfy does not run under a path of the reader's address.In
.env, setNTFY_HOSTand addntfytoCOMPOSE_PROFILES, thenC up -d.Route
NTFY_HOSTto it over HTTPS: nginx-proxy does with the override (nginx-proxy); other proxies forward it toNTFY_PORT(Other proxies).Give each reader an ntfy user that can read UnifiedPush topics, and tell them its name and password:
shC exec ntfy ntfy user add <name> C exec ntfy ntfy access <name> 'up*' read-only
Anyone can publish to up* topics, as servers push there; reading them, and every other topic, needs a user. Its users and messages are in the ntfy volume. Readers then set up the app (Push on Android).
To let only Newses publish there, give it a user of its own with a token:
Create the user, let it publish to UnifiedPush topics, and make its token:
shC exec ntfy ntfy user add newses C exec ntfy ntfy access newses 'up*' write-only C exec ntfy ntfy token add newsesIn
.env, setPUSH_TOKENS=ntfy.example.com=tk_…(yourNTFY_HOSTand the token) andNTFY_AUTH_ACCESS=*:up*:deny, thenC up -d.
Other apps' servers can then no longer push to readers through it.
Apps
Install the desktop and Android apps from Download and enter the server's HTTPS address at first launch; see Desktop and Android apps. The proxy needs the headers above.
Your own app downloads
Your server can offer the desktop app for Linux and Windows and the Android app at https://<your server>/downloads/, built from the Newses source of your installed version. Apps installed from there update from your server rather than from the project's downloads. macOS apps are not built.
The build runs from a checkout, on a linux/amd64 host (on arm64 Docker emulates it, slowly), and takes a few GB of disk and a while the first time.
Set
PUBLIC_URLin.envto the server'shttps://address: the apps check it for updates, over HTTPS only.For the Android app, create a release keystore, which signs every version you build. From a checkout, with JDK 21's
keytool, and a folder on a drive you keep offline as the backup:shscripts/android-signing-setup.sh --backup /media/backup --dockerIt writes the keystore to the backup folder, prints its password to keep in your password manager, and sets the
ANDROID_KEYSTORE_*andANDROID_KEY_*values in the checkout'sdocker/.env; copy those four lines to your install's.envif it is elsewhere. Losing the keystore or its password means installed apps can never be updated again. To build without the Android app, leaveandroidout ofAPPS_PLATFORMSinstead.For the Windows apps, optionally, sign them, so that Windows runs them without a warning and the installer updates itself. Unsigned, they work, but the installer updates only through the downloads page. Either:
- set
WIN_CERTIFICATE_BASE64to your code signing certificate (.pfx,base64 -w0 cert.pfx),WIN_CERTIFICATE_PASSWORDto its password, andWIN_PUBLISHER_NAMEto its CN; or - with an Azure Artifact Signing account and certificate profile, run
scripts/windows-signing-setup.sh --dockerfrom a checkout, signed in withaz login, which sets those values and the publisher in the checkout'sdocker/.env. Each run replaces its app registration's secret.
Keep
WIN_CERTIFICATE_BASE64,WIN_CERTIFICATE_PASSWORD,AZURE_CLIENT_SECRET, and the four Android lines in.enveven when empty: Compose refuses to build without them.- set
Get the source of your installed version (the version in
compose.yaml's image), and setRELEASE_TAGin.envto its tag:shgit clone --depth 1 --branch v<version> https://github.com/newses-app/newses newses-sourceBuild, with your install's
.env:shdocker compose --env-file ~/newses/.env -f newses-source/docker/compose.yaml \ -f newses-source/docker/compose.apps.yaml --profile apps run --rm appsIn a checkout's own stack:
C -f docker/compose.apps.yaml --profile apps run --rm apps.
The apps, their checksums, and their bills of materials are then at /downloads/, with commands to install each; the server serves them from the downloads volume. Building again replaces them, and a release replaces the prerelease before it.
An Android app signed with your keystore cannot update one installed from the project's downloads, or the reverse: to switch, uninstall the app first, which deletes its offline articles and sign-ins. A Windows installer updates only to builds signed for the same publisher.
Backups
- Enable nightly dumps by adding
backuptoCOMPOSE_PROFILESin.env, thenC up -d. Dumps go to thebackupsvolume asnewses-YYYYMMDD-HHMMSS.dumpand are pruned afterBACKUP_RETENTION_DAYS. - Take an ad-hoc dump with
C exec db sh -c 'pg_dump -U "$POSTGRES_USER" -Fc "$POSTGRES_DB"' > newses.dump. - Back up the
blobsvolume too. Favicons and cached images re-fetch, but the archive (archive/in the volume) is not in the dumps and cannot be re-fetched.scripts/export-instance.shwrites both to one bundle, whichscripts/restore-instance.shloads (Moving to another instance).
Restore
C stop server worker- Restore one of:
- From the backups volume:
C exec backup pg_restore --clean --if-exists -d "$POSTGRES_DB" /backups/<file>.dump - From a local file:
C exec -T db sh -c 'pg_restore -U "$POSTGRES_USER" -d "$POSTGRES_DB" --clean --if-exists' < newses.dump
- From the backups volume:
C start server worker
Scripts
Exporting, restoring, and importing from TTRSS run scripts that drive Docker from the host, from a checkout of newses-app/newses at the installed version's tag (the version in compose.yaml's image). Name the install's compose files with --compose, once for each:
git clone --depth 1 --branch v<version> https://github.com/newses-app/newses newses-scripts
newses-scripts/scripts/export-instance.sh newses-bundle --compose ~/newses/compose.yamlA checkout's own stack needs no --compose. The scripts warn when the install runs a version other than their checkout's.
Moving to another instance
Moves everything to another Docker host or an AWS stage, or from an AWS stage to Docker (--aws dev|prod on either script; bundle contents in Architecture). The target must run the same version of Newses or a newer one.
- Start the target:
C up -don the new host, with its ownAPP_SECRET. - On the source:
scripts/export-instance.sh newses-bundle --freeze. The source stays stopped;C start server workerrestarts it. Without--freezeit keeps running, and changes after the export are lost. - Copy
newses-bundle/to the target host privately (it holds password hashes and the source'sAPP_SECRET), e.g.scp -r. - On the target:
scripts/restore-instance.sh newses-bundle --dry-run, then without--dry-run. The target's database is saved first asnewses-pre-restore-<time>.dump. - Point DNS or the proxy at the target, and set
PUBLIC_URLthere if the address changed. - Delete the bundle.
Everyone signs in again, two-factor authentication included; the apps need the new address if it changed. Feed passwords move with the bundle.
Building from source
A checkout builds the image itself:
git clone https://github.com/newses-app/newses
cd newses
cp docker/.env.example docker/.envThen follow Install from step 2, in docker/.env, and start with C up -d --build.
Moving a checkout's stack to the published image
The release's compose file has the checkout's project name (newses, or COMPOSE_PROJECT_NAME) and volumes, so the stack keeps its data. The release must be the checkout's version or newer.
- Download the files as in Install step 1, then copy the checkout's
docker/.envover.env, and removeNEWSES_IMAGEfrom it if set. - In the checkout:
docker compose -f docker/compose.yaml down. The volumes stay. - In the new folder:
docker compose up -d.
Without Compose
Platforms that run containers without Compose (Kubernetes, Unraid, Portainer without a stack) run the release's image:
The commands are in the Server section of the latest release's downloads.
Each role is the container's command, with the settings as environment variables, the same APP_SECRET in each, and DATABASE_URL pointing at PostgreSQL (the compose file runs version 18) with the unaccent extension available, as it is wherever PostgreSQL's contrib modules are installed:
| Role | Runs | Volume | Health check |
|---|---|---|---|
migrate | Applies migrations and exits; before server and worker start, at install and after each upgrade | — | — |
server | The web app and API, on port 8080 | /data/blobs | wget -qO- http://127.0.0.1:8080/healthz |
worker | Feed fetches and scheduled tasks | /data/blobs, the same volume as server | newses worker-health |
The containers run as user node (UID 1000), which must be able to write /data/blobs. cli runs the user commands.