Skip to content

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 ​

  1. 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.

  2. In .env, change POSTGRES_PASSWORD, and set APP_SECRET to the output of openssl rand -base64 48.

  3. Set ADMIN_LOGIN and ADMIN_PASSWORD for the first admin, or create it with the CLI after step 4.

  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:

VariableDefaultPurpose
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_PORT8080Host port for the server
LOG_LEVELinfotrace, 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_URLunsetThe 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_NAMEunsetWhat 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_URLunsetWhere 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_TRACEfalsetrue logs every TTRSS and Google Reader API call with its parameters (credentials redacted), to diagnose a client
TRUST_PROXYfalsetrue, 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_MINUTES30Default minutes between fetches of a feed (5–1440)
FEED_PURGE_DAYS180Default age in days after which entries are deleted unless starred, published, noted, labelled, or shared; 0 keeps everything
ARCHIVE_ENABLEDtrueKeeps 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_FAILURES20Consecutive failed fetches after which a feed is disabled until refreshed
FETCH_ALLOW_PRIVATE_NETWORKSunsetFeeds 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_PASSWORDunsetFirst admin, created at startup only while no users exist; remove once created. Well-known logins such as admin and root are refused
BACKUP_RETENTION_DAYS14Days of nightly dumps kept by the backup service
OPS_RETENTION_DAYS90Days of activity, request, site, and job statistics, and resolved alerts, kept for the Operations page
AUDIT_RETENTION_DAYS365Days of audit events kept
OPS_HOST_HOURLY_BUDGET200Requests to one site in an hour above which an alert opens
SMTP_URLunsetMail server the server emails users and alerts through, e.g. smtps://user:password@mail.example.com:465; unset sends no email
MAIL_FROMNewses <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_TOunsetAddress alerts are emailed to; needs SMTP_URL. Unset keeps alerts on the Operations page only
ALERT_EMAIL_FROMMAIL_FROMSender of alert emails
OTEL_EXPORTER_OTLP_ENDPOINTunsetOTLP/HTTP endpoint for traces, metrics, and logs, e.g. http://lgtm:4318 for the observability profile; unset turns OpenTelemetry off
OTEL_EXPORTER_OTLP_HEADERSunsetHeaders for the endpoint, e.g. authorization=Bearer …
OTEL_TRACES_SAMPLER, OTEL_TRACES_SAMPLER_ARGparentbased_always_on, 1Trace sampling, e.g. parentbased_traceidratio and 0.1
OTEL_METRIC_EXPORT_INTERVAL15000Milliseconds between metric exports
DEPLOYMENT_ENVIRONMENTself-hosteddeployment.environment.name on all telemetry
GRAFANA_PORT3000Port of Grafana on 127.0.0.1 (observability profile)
NEWSES_IMAGEThe release's image; in a checkout, newses:latestImage to run; in a checkout, the tag it builds
COMPOSE_PROJECT_NAMEnewsesPrefix of container and volume names; a stack created as rss-reader keeps that name to keep its volumes
VIRTUAL_HOST, LETSENCRYPT_HOSTunsetPublic hostname for nginx-proxy and acme-companion (compose.nginx-proxy.yaml)
PLUGINSunsetPlugins to install with compose.plugins.yaml: npm packages at exact versions, separated by spaces, e.g. @newses/plugin-webhook@1.0.0
COMPOSE_PROFILESunsetOptional services every C command runs, comma-separated: backup (Backups), observability (Monitoring), ntfy (Push to Android)
COMPOSE_FILEunsetThe 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_HOSTunsetHostname 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_PORT8081Host port the bundled ntfy is published on, for your proxy
NTFY_AUTH_ACCESS*:up*:woThe bundled ntfy's access for everyone: *:up*:deny lets only users given access publish (Push to Android)
PUSH_TOKENSunsetntfy access tokens the server publishes with, comma-separated host=token pairs, for a ntfy that only lets users publish
NGINX_PROXY_NETWORKnginx-proxyExisting Docker network of nginx-proxy
RELEASE_TAGunsetThe tag your app downloads are built from, the installed version's, e.g. v1.2.3 (Your own app downloads)
APPS_PLATFORMSlinux,windows,androidThe apps built: linux, windows, android, comma-separated
ANDROID_KEYSTORE_BASE64, ANDROID_KEYSTORE_PASSWORD, ANDROID_KEY_ALIAS, ANDROID_KEY_PASSWORDemptyYour Android release keystore, base64, its password, key alias, and key password, which sign the APK; empty builds no APK
WIN_CERTIFICATE_BASE64, WIN_CERTIFICATE_PASSWORDemptyA 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_NAMEemptyAzure Artifact Signing instead of a certificate file
WIN_PUBLISHER_NAMEemptyThe signing certificate's CN (common name), needed to sign: installed Windows apps update only to builds carrying it

Application variables, set in compose.yaml:

VariableDefaultPurpose
DATABASE_URL—PostgreSQL connection URL
HOST, PORT0.0.0.0, 8080Server bind address inside the container
BLOB_DIR/data/blobsFavicon and image cache, and the archive (blobs volume)
DOWNLOADS_DIR/data/downloadsYour own app downloads, served at /downloads/ (downloads volume); unset serves none
PUSH_DISTRIBUTOR_URLhttps:// and NTFY_HOSTUnifiedPush distributor the Android app suggests to readers
PUSH_TRUSTED_HOSTSNTFY_HOSTComma-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:

MessageMeaning
Slow requestA response took over 2 s
Client closed the connection before the response was sentThe 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:

TabShows
AlertsOpen alerts and those resolved in the last 7 days; a banner when the worker's checks stopped
SitesRequests to each site in 24 hours or 7 days: outcomes, share answered "not modified", busiest hour against the budget, Retry-After pauses
JobsRuns, failures, and durations of feed fetches, favicons, full text, plugins, and the scheduled tasks
UsersLast seen, requests by app, and articles read over 7 and 30 days
Audit logSign-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:

  1. In .env, set OTEL_EXPORTER_OTLP_ENDPOINT=http://lgtm:4318 and add observability to COMPOSE_PROFILES.
  2. C up -d
  3. Open http://127.0.0.1:3000 (on the Docker host; tunnel with ssh -L 3000:127.0.0.1:3000 from elsewhere). Grafana allows anonymous admin access, so keep it off public interfaces. The newses folder 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.

  1. In .env, set PLUGINS to the packages at exact versions, separated by spaces: PLUGINS=@newses/plugin-webhook@1.0.0.

  2. 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 build first, and again after each git pull, then C -f docker/compose.plugins.yaml up -d --build.

  3. From then on, C names both files, and every up adds --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, set COMPOSE_FILE=compose.yaml:compose.plugins.yaml in .env, and run plain docker compose in 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:

  1. In the plugin's folder, pack it into a plugins folder beside compose.yaml (in a checkout, docker/plugins): npm pack --pack-destination /path/to/plugins.
  2. List the file in PLUGINS by its path, beside packages from npm: PLUGINS=@newses/plugin-webhook@1.0.0 ./plugins/newses-plugin-example-0.1.0.tgz.
  3. 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 ​

  1. In .env, set VIRTUAL_HOST (and LETSENCRYPT_HOST when acme-companion issues certificates). If nginx-proxy's Docker network is not called nginx-proxy, set NGINX_PROXY_NETWORK.

  2. 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.

  3. From then on, C names both files: docker compose -f compose.yaml -f compose.nginx-proxy.yaml, in a checkout docker compose -f docker/compose.yaml -f docker/compose.nginx-proxy.yaml; or set COMPOSE_FILE=compose.yaml:compose.nginx-proxy.yaml in .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:

ProviderSMTP_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
Mailgunsmtp://postmaster%40mg.example.com:password@smtp.mailgun.org:587
Postfix relay on your networksmtp://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:

  1. Give ntfy its own hostname, such as ntfy.example.com beside reader.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.

  2. In .env, set NTFY_HOST and add ntfy to COMPOSE_PROFILES, then C up -d.

  3. Route NTFY_HOST to it over HTTPS: nginx-proxy does with the override (nginx-proxy); other proxies forward it to NTFY_PORT (Other proxies).

  4. Give each reader an ntfy user that can read UnifiedPush topics, and tell them its name and password:

    sh
    C 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:

  1. Create the user, let it publish to UnifiedPush topics, and make its token:

    sh
    C exec ntfy ntfy user add newses
    C exec ntfy ntfy access newses 'up*' write-only
    C exec ntfy ntfy token add newses
  2. In .env, set PUSH_TOKENS=ntfy.example.com=tk_… (your NTFY_HOST and the token) and NTFY_AUTH_ACCESS=*:up*:deny, then C 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.

  1. Set PUBLIC_URL in .env to the server's https:// address: the apps check it for updates, over HTTPS only.

  2. 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:

    sh
    scripts/android-signing-setup.sh --backup /media/backup --docker

    It writes the keystore to the backup folder, prints its password to keep in your password manager, and sets the ANDROID_KEYSTORE_* and ANDROID_KEY_* values in the checkout's docker/.env; copy those four lines to your install's .env if it is elsewhere. Losing the keystore or its password means installed apps can never be updated again. To build without the Android app, leave android out of APPS_PLATFORMS instead.

  3. 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_BASE64 to your code signing certificate (.pfx, base64 -w0 cert.pfx), WIN_CERTIFICATE_PASSWORD to its password, and WIN_PUBLISHER_NAME to its CN; or
    • with an Azure Artifact Signing account and certificate profile, run scripts/windows-signing-setup.sh --docker from a checkout, signed in with az login, which sets those values and the publisher in the checkout's docker/.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 .env even when empty: Compose refuses to build without them.

  4. Get the source of your installed version (the version in compose.yaml's image), and set RELEASE_TAG in .env to its tag:

    sh
    git clone --depth 1 --branch v<version> https://github.com/newses-app/newses newses-source
  5. Build, with your install's .env:

    sh
    docker compose --env-file ~/newses/.env -f newses-source/docker/compose.yaml \
      -f newses-source/docker/compose.apps.yaml --profile apps run --rm apps

    In 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 backup to COMPOSE_PROFILES in .env, then C up -d. Dumps go to the backups volume as newses-YYYYMMDD-HHMMSS.dump and are pruned after BACKUP_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 blobs volume 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.sh writes both to one bundle, which scripts/restore-instance.sh loads (Moving to another instance).

Restore ​

  1. C stop server worker
  2. 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
  3. 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:

sh
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.yaml

A 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.

  1. Start the target: C up -d on the new host, with its own APP_SECRET.
  2. On the source: scripts/export-instance.sh newses-bundle --freeze. The source stays stopped; C start server worker restarts it. Without --freeze it keeps running, and changes after the export are lost.
  3. Copy newses-bundle/ to the target host privately (it holds password hashes and the source's APP_SECRET), e.g. scp -r.
  4. On the target: scripts/restore-instance.sh newses-bundle --dry-run, then without --dry-run. The target's database is saved first as newses-pre-restore-<time>.dump.
  5. Point DNS or the proxy at the target, and set PUBLIC_URL there if the address changed.
  6. 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:

sh
git clone https://github.com/newses-app/newses
cd newses
cp docker/.env.example docker/.env

Then 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.

  1. Download the files as in Install step 1, then copy the checkout's docker/.env over .env, and remove NEWSES_IMAGE from it if set.
  2. In the checkout: docker compose -f docker/compose.yaml down. The volumes stay.
  3. 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:

RoleRunsVolumeHealth check
migrateApplies migrations and exits; before server and worker start, at install and after each upgrade——
serverThe web app and API, on port 8080/data/blobswget -qO- http://127.0.0.1:8080/healthz
workerFeed fetches and scheduled tasks/data/blobs, the same volume as servernewses worker-health

The containers run as user node (UID 1000), which must be able to write /data/blobs. cli runs the user commands.

Released under the AGPL-3.0-or-later license.