Run in production
Settings and habits that keep an OpenTemplates server safe.
On this page
OpenTemplates holds your templates and answers your apps, so the server needs some care before others can reach it.
Set the primary access token first
Until a primary access token is set, anyone who reaches the server can open the interface. Set it right after the first start. See First start.
Use HTTPS
Tokens travel with every request. Put OpenTemplates behind a reverse proxy (for example Nginx or Caddy) that serves HTTPS, and let your apps use the https:// address only.
Listen only on the local address
By default OpenTemplates listens on all network interfaces. When a reverse proxy runs on the same server, make OpenTemplates listen only on 127.0.0.1. In index.js, change the line
// options.ip = '127.0.0.1';to
options.ip = '127.0.0.1';and restart OpenTemplates.
Start in release mode
npm start runs in debug mode, which shows error details to the caller. On a server, start OpenTemplates in release mode:
node index.js 8000 --releaseRestrict the interface
The interface and the render endpoint share one address. If you can, allow /setup/ and /api/ only from your own network in the reverse proxy, and keep / and /profiles/ open for your apps. Leave /download/ open if your documents use uploaded files.
Back up
Copy the data folder on a schedule. See Back up your data.