First Run and Signing In
You finish this chapter signed in to
your own Miniflux, looking at an empty
unread page that says so. The checks:
/healthcheck answers OK, and the
signed-in page's title reads
Unread - Miniflux. Both were produced
by the lab's server in transcript t03.
Step one: let Miniflux build its tables
A fresh database is an empty room. Point Miniflux at it with the DATABASE_URL from chapter 3 and run the migrations:
DATABASE_URL='postgres://...' ./miniflux -migrate
The lab's run, on its private PostgreSQL, answered (transcript t02):
level=INFO msg="Running database migrations" current_version=0 latest_version=135
Version 0 to version 135 is the whole
history of the schema being applied in
order. What now exists, the lab
counted with PostgreSQL's own listing:
14 tables, including users, feeds,
entries, categories and
api_keys. On a package install the
same thing happens through the config
instead — RUN_MIGRATIONS=1 in
/etc/miniflux.conf — and on every
later upgrade the migrations run again
and stop at the new latest version.
An out-of-date schema is therefore
never something you repair by hand.
Step two: the first user is an admin
DATABASE_URL='postgres://...' ./miniflux -create-admin
This one asks its questions on the
terminal — Enter Username:,
Enter Password: — and will not run
at all without a terminal to ask on
(the lab's first attempt, in a
script, got exactly that refusal:
this is not an interactive terminal, exiting).
Answered, it writes the user into the
database as an administrator, and
the lab confirmed the row straight
from PostgreSQL (transcript t02):
id | username | is_admin
----+----------+----------
1 | admin | t
Pick the password like a password, not
like the lab's printed throwaway. For
unattended installs the same first user
can be made without questions:
CREATE_ADMIN=1 with ADMIN_USERNAME
and ADMIN_PASSWORD set when the
server first starts — taught from the
documentation; the interactive route
above is the one the lab ran.
Administrators can do two things other users cannot: create and remove users, and read the server's health in full. Ordinary readers — which is what extra accounts are — see only their own feeds and entries. Everyone's lists are private from everyone else's, admins included; an admin manages accounts, not other people's reading.
Step three: start it, and check its pulse
Package installs start the service; the bare binary is started like this:
DATABASE_URL='postgres://...' \
LISTEN_ADDR=127.0.0.1:8080 \
./miniflux
One log line is the sound of success:
level=INFO msg="Starting HTTP server" listen_address=127.0.0.1:8899
(8899 is the lab's port; 8080 the default.) Before signing in, ask the server the question it is always willing to answer, logged in or not:
curl -s http://127.0.0.1:8080/healthcheck
OK
That endpoint exists for watchers and
scripts: when it stops answering OK,
the program — not a feed, not a site —
needs attention. Chapter 12's
troubleshooting starts there too.
Step four: the sign-in, and the cookie lesson
Open the server's address in a browser. In 2.3.4 the sign-in form is served at the root address itself, and its title says what it is:
<title>Sign In - Miniflux</title>
Sign in with the admin name and password from step two. You land on the Unread page — empty, because you follow nothing yet:
There are no unread entries.
That emptiness is the correct first screen, and chapter 5 fixes it.
One script-shaped warning, learned by
the lab so you learn it cheaper
(transcript t03). If you ever sign in
with curl instead of a browser, the
form carries a hidden csrf token —
a one-time stamp tied to the cookie
the form page set. Fetch the form and
post it back with the same cookie
jar, token included, or the server
politely bounces you back to the
sign-in page with no error worth
reading. The browser does this without
telling you; scripts must be told.
Chapter 8 mostly avoids the form
entirely — the API has better manners.