2015-07-26 21:32:30 +00:00
|
|
|
# Configuring the server
|
2013-06-11 13:50:55 +00:00
|
|
|
|
2018-05-03 04:35:37 +00:00
|
|
|
The server's config file at $HOME/.config/perkeep/server-config.json is
|
2017-02-28 22:52:53 +00:00
|
|
|
JSON. It can either be in [simple mode](#simplemode) (for basic configurations), or in
|
|
|
|
[low-level mode](#lowlevel) (for any sort of crazy configuration).
|
2013-06-11 13:50:55 +00:00
|
|
|
|
2017-02-28 22:52:53 +00:00
|
|
|
# Configuration Keys & Values {#simplemode}
|
2015-07-26 21:32:30 +00:00
|
|
|
|
2017-12-15 17:57:42 +00:00
|
|
|
**Note,** if you can't find what you're looking for here, check the API docs: [/pkg/types/serverconfig](https://perkeep.org/pkg/types/serverconfig/).
|
2015-11-25 17:14:37 +00:00
|
|
|
|
2015-07-26 21:32:30 +00:00
|
|
|
* `auth`: the authentication mechanism to use. Example values include:
|
|
|
|
|
|
|
|
* `none`: No authentication.
|
|
|
|
* `localhost`: Accept connections coming from localhost. On Linux, this means
|
|
|
|
connections from localhost that are also from the same user as the user
|
|
|
|
running the server.
|
|
|
|
* `userpass:alice:secret`: HTTP basic authentication. Username "alice",
|
|
|
|
password "secret". Only recommended if using HTTPS.
|
|
|
|
* `userpass:alice:secret:+localhost`: Same as above, but also accept
|
|
|
|
localhost auth
|
|
|
|
* `userpass:alice:secret:vivify=othersecret`: Alice has password "secret",
|
|
|
|
but her Android phone can use password "othersecret" to do a minimal set of
|
2016-10-10 04:39:27 +00:00
|
|
|
operations (upload new things, but not access anything).
|
2022-10-28 16:59:15 +00:00
|
|
|
* `tailscale:ARG`: permit access only over Tailscale, where ARG is one of:
|
|
|
|
* `full-access-to-tailnet`: to grant full read/write access to Perkeep to any
|
|
|
|
entity on the Tailscale tailnet which has network-level access to the Perkeep server;
|
|
|
|
* `foo@bar`: permit read/write Perkeep accesss only to the provided email (or email-like, e.g. `foo@github`) address.
|
2015-07-26 21:32:30 +00:00
|
|
|
|
|
|
|
* `baseURL`: Optional. If non-empty, this is the root of your URL prefix for
|
2017-12-15 17:57:42 +00:00
|
|
|
your Perkeep server. Useful for when running behind a reverse proxy.
|
2015-07-26 21:32:30 +00:00
|
|
|
Should not end in a slash. e.g. `https://yourserver.example.com`
|
|
|
|
|
2016-12-13 15:24:02 +00:00
|
|
|
* `https`: if "true", HTTPS is used.
|
2015-07-26 21:32:30 +00:00
|
|
|
|
|
|
|
* `httpsCert`: path to the HTTPS certificate file. This is the public file.
|
|
|
|
It should include the concatenation of any required intermediate certs as
|
|
|
|
well.
|
|
|
|
* `httpsKey`: path to the HTTPS private key file.
|
2016-12-13 15:24:02 +00:00
|
|
|
* If an explicit certificate and key are not provided, a certificate from
|
|
|
|
[Let's Encrypt](https://letsencrypt.org) is requested automatically if the
|
|
|
|
following conditions apply:
|
|
|
|
* A fully qualified domain name is specified in either `baseURL` or `listen`.
|
2017-12-15 17:57:42 +00:00
|
|
|
* Perkeep listens on port `443` in order to answer the TLS-SNI challenge
|
2016-12-13 15:24:02 +00:00
|
|
|
from Let's Encrypt.
|
|
|
|
* As a fallback, if no FQDN is found, a self-signed certificate is generated.
|
2015-07-26 21:32:30 +00:00
|
|
|
|
|
|
|
* `identity`: your GPG fingerprint. A keypair is created for new users on
|
|
|
|
start, but this may be changed if you know what you're doing.
|
|
|
|
|
|
|
|
* `identitySecretRing`: your GnuPG secret keyring file. A new keyring is
|
|
|
|
created on start for new users, but may be changed if you know what you're
|
|
|
|
doing.
|
|
|
|
|
|
|
|
* `listen`: The port (like "80" or ":80") or IP & port (like "10.0.0.2:8080")
|
2024-01-12 18:46:56 +00:00
|
|
|
to listen for HTTP(s) connections on. Alternatively, the value
|
|
|
|
can be `tailscale` or `tailscale:ARG` to run only on a Tailscale
|
|
|
|
network (tailnet). In that case, the optional `ARG` can be either
|
|
|
|
a directory in which to store the state (if it contains a slash)
|
|
|
|
or else just the name of an instance, in which case the state
|
|
|
|
directory is placed in `~/.config/tsnet-NAME`. The default name
|
|
|
|
is `perkeep`.
|
2015-07-26 21:32:30 +00:00
|
|
|
|
|
|
|
* `shareHandler`: if true, the server's sharing functionality is enabled,
|
|
|
|
letting your friends have access to any content you've specifically shared.
|
|
|
|
Its URL prefix path defaults to "`/share/`".
|
|
|
|
|
|
|
|
* `shareHandlerPath`: Optional. If non-empty, it specifies the URL prefix path
|
|
|
|
to the share handler, and the `shareHandler` value is ignored (i.e the share
|
|
|
|
handler is enabled). Example: "`/public/`".
|
|
|
|
|
|
|
|
* `runIndex`: defaults to true. If "false", no search, no UI, no indexing.
|
|
|
|
(These can be controlled at a more granular level by writing a low-level
|
|
|
|
config file)
|
|
|
|
|
|
|
|
* `copyIndexToMemory`: defaults to true. If "false", don't slurp the whole
|
|
|
|
index into memory on start-up. Specifying false will result in certain
|
|
|
|
queries being slow, unavailable, or unsorted (work in progress). This option
|
|
|
|
may be unsupported in the future. Keeping this set to "true" is recommended.
|
|
|
|
|
|
|
|
* `sourceRoot`: Optional. If non-empty, it specifies the path to an alternative
|
2017-12-15 17:57:42 +00:00
|
|
|
Perkeep source tree, in order to override the embedded UI and/or Closure
|
2018-04-21 18:04:53 +00:00
|
|
|
resources. The UI files will be expected in `<sourceRoot>/server/perkeepd/ui`
|
2015-07-26 21:32:30 +00:00
|
|
|
and the Closure library in `<sourceRoot>/third_party/closure/lib`.
|
|
|
|
|
|
|
|
|
|
|
|
## Storage options {#storage}
|
|
|
|
|
|
|
|
At least one of these must be set:
|
|
|
|
|
|
|
|
* `memoryStorage`: if true, blobs will be stored in memory only. This is
|
|
|
|
generally only useful for debugging & development.
|
|
|
|
* `blobPath`: local disk path to store blobs. (valid for diskpacked too).
|
2022-07-18 17:15:39 +00:00
|
|
|
* `s3`: "`accessKey:secretKey:bucketName[/optional/dir][:hostname]`"
|
|
|
|
* `b2`: "`accessKey:secretKey:bucketName[/optional/dir]:hostname`"
|
|
|
|
* `googlecloudstorage`: "`clientId:clientSecret:refreshToken:bucketName[/optional/dir]`"
|
2015-07-26 21:32:30 +00:00
|
|
|
|
2018-07-23 16:49:08 +00:00
|
|
|
The `s3` storage option's `hostname` value may be set to use an S3-compatible
|
|
|
|
endpoint instead of AWS S3, such as `my-minio-server.example.com`. A specific
|
|
|
|
region may be specified by using [Low-level Configuration](#lowlevel), though
|
|
|
|
the bucket's region will generally be detected automatically.
|
|
|
|
|
2021-01-03 03:28:44 +00:00
|
|
|
Additionally, there are two mutually exclusive options:
|
2015-07-26 21:32:30 +00:00
|
|
|
|
2015-11-25 17:14:37 +00:00
|
|
|
* `packRelated`: if true, blobs are automatically repacked for fast read access.
|
2019-06-22 05:06:40 +00:00
|
|
|
* `packBlobs`: if true, diskpacked is used instead of the default
|
|
|
|
filestorage. This gives better write throughput, at the cost of slower
|
|
|
|
read access.
|
2015-07-26 21:32:30 +00:00
|
|
|
|
|
|
|
For now, if more than one storage option is set, one of them is the primary
|
|
|
|
storage and the other ones are set up as mirrors. The precedence order is the
|
|
|
|
same as the order they are listed above.
|
|
|
|
|
|
|
|
Others aren't yet supported by the simple config mode. Patches to
|
2017-12-15 17:57:42 +00:00
|
|
|
[pkg/serverinit](https://perkeep.org/pkg/serverinit/genconfig.go) welcome.
|
2015-07-26 21:32:30 +00:00
|
|
|
|
2016-06-07 00:48:06 +00:00
|
|
|
Examples for [configuring storage backends](/doc/storage-examples.md)
|
2015-07-26 21:32:30 +00:00
|
|
|
|
|
|
|
## Indexing options {#indexing}
|
|
|
|
|
|
|
|
Unless `runIndex` is set to `false`, exactly one of these must be set:
|
|
|
|
|
|
|
|
* `sqlite`: path to SQLite database file to use for indexing
|
2022-04-01 12:51:26 +00:00
|
|
|
* `kvIndexFile`: path to kv (modernc.org/kv) database file to use for indexing
|
2015-07-26 21:32:30 +00:00
|
|
|
* `levelDB`: path to levelDB (https://github.com/syndtr/goleveldb) database file to use for indexing
|
|
|
|
* `mongo`: user:password@host
|
|
|
|
* `mysql`: user@host:password
|
|
|
|
* `postgres`: user@host:password
|
|
|
|
* `memoryIndex`: if true, a memory-only indexer is used.
|
|
|
|
|
pkg/serverinit: remove DBNames and provide consistent default instead
DBNames is supposed to provide configuration for the various databases
names. However,
1) I contend that nobody needs or wants to configure them as long as we
provide sane defaults.
2) it seems the only obvious user we have for this is to set up some of
the names on GCE.
3) having another external source for names complicates the code
further, especially when we already have the distinction between
database names for DBMS and file names for file-based databases.
4) writing a correct documentation for it is awkward.
Therefore, in this CL, I propose that we remove DBNames. Instead,
genconfig.go now sets some consistent default names for the various
queues and indexes set up on a DBMS (MySQL, PostGres, Mongo). To that
end, we introduce the new, but optional, DBUnique configuration
parameter, that is used as a part of all the database names, in order to
be able to run several Perkeep instances on the same DBMS, without name
conflicts.
In addition, the queue for the bs->index synchandler is now set up on
the same DBMS that is already in use for the index itself, instead of
using a file-base database.
And i think we could proceed likewise for the other queues.
Fixes #951
Change-Id: Ib6a638f088a563d881e3957e4042e932382b44f4
2017-09-18 18:23:32 +00:00
|
|
|
## Database-related options {#database}
|
|
|
|
|
|
|
|
* `dbname`: optional name of the index database if MySQL, PostgreSQL, or MongoDB,
|
|
|
|
is used. If empty, dbUnique is used as part of the database name.
|
|
|
|
* `dbUnique`: optionally provides a unique value to differentiate databases on a
|
|
|
|
DBMS shared by multiple Perkeep instances. It should not contain spaces or
|
|
|
|
punctuation. If empty, identity is used instead. If the latter is absent, the
|
|
|
|
current username (provided by the operating system) is used instead. For the
|
|
|
|
index database, dbname takes priority.
|
2015-07-26 21:32:30 +00:00
|
|
|
|
2016-12-11 20:25:07 +00:00
|
|
|
When using [MariaDB](https://downloads.mariadb.org/)
|
|
|
|
or [MySQL](https://dev.mysql.com/downloads/), the user will need to be able to
|
|
|
|
create a schema in addition to the default schema. You will need `grant create,
|
|
|
|
insert, update, delete, alter, show databases on *.*` permissions for your
|
pkg/serverinit: remove DBNames and provide consistent default instead
DBNames is supposed to provide configuration for the various databases
names. However,
1) I contend that nobody needs or wants to configure them as long as we
provide sane defaults.
2) it seems the only obvious user we have for this is to set up some of
the names on GCE.
3) having another external source for names complicates the code
further, especially when we already have the distinction between
database names for DBMS and file names for file-based databases.
4) writing a correct documentation for it is awkward.
Therefore, in this CL, I propose that we remove DBNames. Instead,
genconfig.go now sets some consistent default names for the various
queues and indexes set up on a DBMS (MySQL, PostGres, Mongo). To that
end, we introduce the new, but optional, DBUnique configuration
parameter, that is used as a part of all the database names, in order to
be able to run several Perkeep instances on the same DBMS, without name
conflicts.
In addition, the queue for the bs->index synchandler is now set up on
the same DBMS that is already in use for the index itself, instead of
using a file-base database.
And i think we could proceed likewise for the other queues.
Fixes #951
Change-Id: Ib6a638f088a563d881e3957e4042e932382b44f4
2017-09-18 18:23:32 +00:00
|
|
|
database user.
|
2015-07-26 21:32:30 +00:00
|
|
|
|
2018-08-23 23:58:36 +00:00
|
|
|
You can use the [pk dbinit](/cmd/pk/) command to initialize your
|
|
|
|
database, and see [dbinit.go](/cmd/pk/dbinit.go) and
|
pkg/serverinit: remove DBNames and provide consistent default instead
DBNames is supposed to provide configuration for the various databases
names. However,
1) I contend that nobody needs or wants to configure them as long as we
provide sane defaults.
2) it seems the only obvious user we have for this is to set up some of
the names on GCE.
3) having another external source for names complicates the code
further, especially when we already have the distinction between
database names for DBMS and file names for file-based databases.
4) writing a correct documentation for it is awkward.
Therefore, in this CL, I propose that we remove DBNames. Instead,
genconfig.go now sets some consistent default names for the various
queues and indexes set up on a DBMS (MySQL, PostGres, Mongo). To that
end, we introduce the new, but optional, DBUnique configuration
parameter, that is used as a part of all the database names, in order to
be able to run several Perkeep instances on the same DBMS, without name
conflicts.
In addition, the queue for the bs->index synchandler is now set up on
the same DBMS that is already in use for the index itself, instead of
using a file-base database.
And i think we could proceed likewise for the other queues.
Fixes #951
Change-Id: Ib6a638f088a563d881e3957e4042e932382b44f4
2017-09-18 18:23:32 +00:00
|
|
|
[dbschema.go](/pkg/sorted/mysql/dbschema.go) if you're curious about the
|
|
|
|
details.
|
2015-07-26 21:32:30 +00:00
|
|
|
|
|
|
|
## Publishing options {#publishing}
|
|
|
|
|
2017-12-15 17:57:42 +00:00
|
|
|
Perkeep uses Go html templates to publish pages, and publishing can be
|
2015-07-26 21:32:30 +00:00
|
|
|
configured through the `publish` key. There is already support for an image
|
|
|
|
gallery view, which can be enabled similarly to the example below (obviously,
|
2018-08-23 23:58:36 +00:00
|
|
|
the camliRoot will be different).
|
2015-07-26 21:32:30 +00:00
|
|
|
|
|
|
|
"publish": {
|
|
|
|
"/pics/": {
|
|
|
|
"camliRoot": "mypics",
|
2018-08-23 23:58:36 +00:00
|
|
|
"cacheRoot": "/home/joe/var/perkeep/blobs/cache",
|
2015-07-26 21:32:30 +00:00
|
|
|
"goTemplate": "gallery.html"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-28 00:12:47 +00:00
|
|
|
See the
|
2017-12-15 17:57:42 +00:00
|
|
|
[serverconfig.Publish](https://perkeep.org/pkg/types/serverconfig/#Publish)
|
2016-06-28 00:12:47 +00:00
|
|
|
type for all the configuration parameters.
|
|
|
|
|
2018-08-23 23:58:36 +00:00
|
|
|
One can create any permanode with **pk-put** or the web UI, and set its camliRoot
|
2015-07-26 21:32:30 +00:00
|
|
|
attribute to the value set in the config, to use it as the root permanode for
|
|
|
|
publishing.
|
|
|
|
|
2018-08-23 23:58:36 +00:00
|
|
|
One common use-case is for Perkeep (and the publisher app) to run behind a
|
|
|
|
reverse-proxy (such as Nginx), which takes care of the TLS termination, and
|
|
|
|
where therefore it might be acceptable for both perkeepd and publisher to listen
|
|
|
|
for non-TLS HTTP connections. In that case, the app handler configuration
|
|
|
|
parameters should be specified, such as in the example below. In addition,
|
|
|
|
please note that the reverse-proxy should not modify the Host header of the
|
|
|
|
incoming requests.
|
|
|
|
|
|
|
|
"publish": {
|
|
|
|
"/pics/": {
|
|
|
|
"camliRoot": "mypics",
|
|
|
|
"cacheRoot": "/home/joe/var/perkeep/blobs/cache",
|
|
|
|
"goTemplate": "gallery.html",
|
|
|
|
"apiHost": "http://localhost:3179/",
|
|
|
|
"listen": ":44352",
|
|
|
|
"backendURL": "http://localhost:44352/"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2017-01-18 06:52:08 +00:00
|
|
|
Please see the [publishing README](/doc/publishing/README) for further details
|
|
|
|
on how to set up permanodes for publishing, or if you want to
|
2015-07-26 21:32:30 +00:00
|
|
|
make/contribute more publishing views.
|
|
|
|
|
|
|
|
|
2016-03-21 04:28:33 +00:00
|
|
|
## Importers
|
|
|
|
|
2017-12-15 17:57:42 +00:00
|
|
|
Perkeep has several built-in importers, including:
|
2016-03-21 04:28:33 +00:00
|
|
|
|
|
|
|
* Feeds (RSS, Atom, and RDF)
|
|
|
|
* Flickr
|
|
|
|
* Foursquare
|
|
|
|
* Picasa
|
|
|
|
* Pinboard
|
|
|
|
* Twitter
|
2018-08-28 11:52:02 +00:00
|
|
|
* Instapaper
|
2016-03-21 04:28:33 +00:00
|
|
|
|
|
|
|
These can be setup by visiting the "`/importer/`" URL prefix path, e.g. `http://localhost:3179/importer/`
|
|
|
|
|
2015-07-26 21:32:30 +00:00
|
|
|
## Windows {#windows}
|
|
|
|
|
|
|
|
The default configuration comes with SQLite for the indexer. However, getting
|
|
|
|
[mattn go-sqlite3](https://github.com/mattn/go-sqlite3) to work on windows is
|
|
|
|
not straightforward, so we suggest using one of the other indexers, like MySQL.
|
|
|
|
|
2013-08-15 21:36:06 +00:00
|
|
|
The following steps should get you started with MySQL:
|
2015-07-26 21:32:30 +00:00
|
|
|
|
2022-04-28 23:04:07 +00:00
|
|
|
* Download and install [MariaDB](https://downloads.mariadb.org/mariadb/5.5.32/)
|
2015-07-26 21:32:30 +00:00
|
|
|
or [MySQL](http://dev.mysql.com/downloads/windows/installer/) (the latter
|
|
|
|
requires .NET).
|
|
|
|
* Edit your server configuration file (if it does not exit yet, running
|
2018-04-21 18:04:53 +00:00
|
|
|
**perkeepd** will automatically create it):
|
2015-07-26 21:32:30 +00:00
|
|
|
* Remove the <b>sqlite</b> option.
|
|
|
|
* Add a <b>dbname</b> option. (ex: "dbname": "camliprod")
|
|
|
|
* Add a <b>mysql</b> option. (ex: "mysql": "foo@localhost:bar")
|
|
|
|
* Create a dedicated user/password for your mysql server.
|
2018-08-23 23:58:36 +00:00
|
|
|
* Initialize the database with **pk**: `pk dbinit --user=foo
|
2015-07-26 21:32:30 +00:00
|
|
|
--password=bar --host=localhost --dbname=camliprod --wipe`
|
|
|
|
|
|
|
|
Setting up MongoDB is even simpler, but the MongoDB indexer is not as well
|
|
|
|
tested as the MySQL one.
|
|
|
|
|
|
|
|
|
2017-02-28 22:52:53 +00:00
|
|
|
# Low-level configuration {#lowlevel}
|
|
|
|
|
2018-04-21 18:04:53 +00:00
|
|
|
You can specify a low-level configuration file to perkeepd with the same
|
2017-02-28 22:52:53 +00:00
|
|
|
`-configfile` option that is used to specify the simple mode configuration file.
|
2017-12-15 17:57:42 +00:00
|
|
|
Perkeep tests for the presence of the `"handlerConfig": true` key/value
|
2017-02-28 22:52:53 +00:00
|
|
|
pair to determine whether the configuration should be considered low-level.
|
|
|
|
|
|
|
|
As the low-level configuration needs to be much more detailed and precise, it is
|
|
|
|
not advised to write one from scratch. Therefore, the easiest way to get started
|
2017-12-15 17:57:42 +00:00
|
|
|
is to first run Perkeep with a simple configuration (or none, as one will be
|
2017-02-28 22:52:53 +00:00
|
|
|
automatically generated), and to download the equivalent low-level configuration
|
2017-12-15 17:57:42 +00:00
|
|
|
that can be found at /debug/config on your Perkeep instance.
|
2017-02-28 22:52:53 +00:00
|
|
|
|
|
|
|
In the following are examples of features that can only be achieved through
|
|
|
|
low-level configuration, for now.
|
|
|
|
|
2017-12-15 17:57:42 +00:00
|
|
|
## Replication to another Perkeep instance {#replication}
|
2017-02-28 22:52:53 +00:00
|
|
|
|
|
|
|
If `"/bs"` is the storage for your primary instance, such as for example:
|
|
|
|
|
|
|
|
"/bs/": {
|
|
|
|
"handler": "storage-blobpacked",
|
|
|
|
"handlerArgs": {
|
|
|
|
"largeBlobs": "/bs-packed/",
|
|
|
|
"metaIndex": {
|
2018-08-23 23:58:36 +00:00
|
|
|
"file": "/home/you/var/perkeep/blobs/packed/packindex.leveldb",
|
2017-02-28 22:52:53 +00:00
|
|
|
"type": "leveldb"
|
|
|
|
},
|
|
|
|
"smallBlobs": "/bs-loose/"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
then instead of `"/bs"`, you can use everywhere else instead in the config the
|
|
|
|
prefix `"/bsrepl/"`, which can be defined as:
|
|
|
|
|
|
|
|
"/bsrepl/": {
|
|
|
|
"handler": "storage-replica",
|
|
|
|
"handlerArgs": {
|
|
|
|
"backends": [
|
|
|
|
"/bs/",
|
|
|
|
"/r1/"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2017-12-15 17:57:42 +00:00
|
|
|
where `"/r1/"` is the blobserver for your other Perkeep instance, such as:
|
2017-02-28 22:52:53 +00:00
|
|
|
|
|
|
|
"/r1/": {
|
|
|
|
"handler": "storage-remote",
|
|
|
|
"handlerArgs": {
|
|
|
|
"url": "https://example.com:3179",
|
|
|
|
"auth": "userpass:foo:bar",
|
|
|
|
"skipStartupCheck": false
|
|
|
|
}
|
|
|
|
},
|