Home Download Docs Code Community

Configuring the server

The server’s config file at $HOME/.config/perkeep/server-config.json is JSON. It can either be in simple mode (for basic configurations), or in low-level mode (for any sort of crazy configuration).

Configuration Keys & Values

Note, if you can’t find what you’re looking for here, check the API docs: /pkg/types/serverconfig.

Storage options

At least one of these must be set:

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, though the bucket’s region will generally be detected automatically.

Additionally, there are two mutually exclusive options:

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 pkg/serverinit welcome.

Examples for configuring storage backends

Indexing options

Unless runIndex is set to false, exactly one of these must be set:

Database-related options

When using MariaDB or MySQL, 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 database user.

You can use the pk dbinit command to initialize your database, and see dbinit.go and dbschema.go if you’re curious about the details.

Publishing options

Perkeep uses Go html templates to publish pages, and publishing can be configured through the publish key. There is already support for an image gallery view, which can be enabled similarly to the example below (obviously, the camliRoot will be different).

"publish": {
  "/pics/": {
    "camliRoot": "mypics",
    "cacheRoot": "/home/joe/var/perkeep/blobs/cache",
    "goTemplate": "gallery.html"
  }
}

See the serverconfig.Publish type for all the configuration parameters.

One can create any permanode with pk-put or the web UI, and set its camliRoot attribute to the value set in the config, to use it as the root permanode for publishing.

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/"
    }
},

Please see the publishing README for further details on how to set up permanodes for publishing, or if you want to make/contribute more publishing views.

Importers

Perkeep has several built-in importers, including:

These can be setup by visiting the “/importer/” URL prefix path, e.g. http://localhost:3179/importer/

Windows

The default configuration comes with SQLite for the indexer. However, getting mattn go-sqlite3 to work on windows is not straightforward, so we suggest using one of the other indexers, like MySQL.

The following steps should get you started with MySQL:

Setting up MongoDB is even simpler, but the MongoDB indexer is not as well tested as the MySQL one.

Low-level configuration

You can specify a low-level configuration file to perkeepd with the same -configfile option that is used to specify the simple mode configuration file. Perkeep tests for the presence of the "handlerConfig": true key/value 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 is to first run Perkeep with a simple configuration (or none, as one will be automatically generated), and to download the equivalent low-level configuration that can be found at /debug/config on your Perkeep instance.

In the following are examples of features that can only be achieved through low-level configuration, for now.

Replication to another Perkeep instance

If "/bs" is the storage for your primary instance, such as for example:

    "/bs/": {
        "handler": "storage-blobpacked",
        "handlerArgs": {
            "largeBlobs": "/bs-packed/",
            "metaIndex": {
                "file": "/home/you/var/perkeep/blobs/packed/packindex.leveldb",
                "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/"
            ]
        }
    },

where "/r1/" is the blobserver for your other Perkeep instance, such as:

	"/r1/": {
		"handler": "storage-remote",
		"handlerArgs": {
			"url": "https://example.com:3179",
			"auth": "userpass:foo:bar",
			"skipStartupCheck": false
		}
	},
Website layout inspired by memcached.
Content by the authors.