perkeep/website/content/docs/server-config

87 lines
5.4 KiB
Plaintext

<h1>Configuring the server</h1>
<p>The server's config file at $HOME/.config/camlistore/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).</p>
<p>This page documents the simple configuration mode.</p>
<p>If you visit your Camlistore server's /setup page (by default, at
http://localhost:3179/setup) you can modify the config file from your
web browser and restart the server.</p>
<h1>Configuration Keys &amp; Values</h1>
<ul>
<li><b><code>auth</code></b>: the authentication mechanism to use. Example values include:
<table cellpadding=4 border=1>
<tr><td><code>none</code></td><td>No authentication.</td></tr>
<tr><td><code>localhost</code></td><td>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.</td></tr>
<tr><td><code>userpass:alice:secret</code></td><td>HTTP basic authentication. Username "alice", password "secret". Only recommended if using HTTPS.</td></tr>
<tr><td><code>userpass:alice:secret:+localhost</code></td><td>Same as above, but also accept localhost auth</td></tr>
<tr><td><code>userpass:alice:secret:vivify=othersecret</code></td><td>Alice has password "secret", but her Android phone can use password "othersecret" to do a minimal set of operations (upload new things, but not access anything)r</td></tr>
</table>
</li>
<li><b><code>baseURL</code></b>: Optional. If non-empty, this is the root of your URL prefix for your Camlistore server. Useful for when running behind a reverse proxy. Should not end in a slash. e.g. <code>https://yourserver.example.com</code></li>
<li><b><code>https</code></b>: if "true", HTTPS is used
<ul>
<li><b><code>HTTPSCertFile</code></b>: if using https</li>
<li><b><code>HTTPSKeyFile</code></b>: if using https</li>
</ul>
</li>
<li><b><code>identity</code></b>: your GPG fingerprint. A keypair is created for new users on start, but this may be changed if you know what you're doing.</li>
<li><b><code>identitySecretRing</code></b>: 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.</li>
<li><b><code>listen</code></b>: The port (like "80" or ":80") or IP & port (like "10.0.0.2:8080") to listen for HTTP(s) connections on.</li>
<li><b><code>shareHandler</code></b>: 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 "<code>/share/</code>".</li>
<li><b><code>shareHandlerPath</code></b>: Optional. If non-empty, it specifies the URL prefix path to the share handler, and the <b><code>shareHandler</code></b> value is ignored (i.e the share handler is enabled). Example: "<code>/public/</code>".</li>
<li><b><code>runIndex</code></b>: 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)</li>
<li><b><code>sourceRoot</code></b>: Optional. If non-empty, it specifies the path to an alternative Camlistore source tree, in order to override the embedded UI and/or Closure resources. The UI files will be expected in <code><b>&lt;sourceRoot&gt;</b>/server/camlistored/ui</code> and the Closure library in <code><b>&lt;sourceRoot&gt;</b>/third_party/closure/lib</code>.</li>
</ul>
<h2>Storage options</h2>
<p>At least one of these must be set:</p>
<ul>
<li><b><code>blobPath</code></b>: local disk path to store blobs</li>
<li><b><code>s3</code></b>: "<code>key:secret:bucket</code>" (with colons, but no quotes).</li>
<li><b><code>google</code></b>: "<code>clientId:clientSecret:refreshToken:bucketName</code>"</li>
</ul>
<p>Others aren't yet supported by the simple config mode. Patches
to <code>pkg/genconfig</code> welcome.</p>
<h2>Indexing options</h2>
<p>Unless <b><code>runIndex</code></b> is set to <code>false</code>, exactly one of these must be set:</p>
<ul>
<li><b><code>sqlite</code></b>: path to SQLite database file to use for indexing</li>
<li><b><code>mongo</code></b>: user@host:password</li>
<li><b><code>mysql</code></b>: user@host:password</li>
<li><b><code>postgres</code></b>: user@host:password</li>
</ul>
<p>Additionally, mongo, mysql, and postgres require the <b><code>dbname</code></b> value set. Initialize your database with <a href="/cmd/camtool/">camtool dbinit</a>.</p>
<p>There's also an in-memory index type, but only in the low-level
config, as used by <code>devcam server</code>.</p>
<h2>Publishing options</h2>
<p>Although limited, publishing can be configured through the <b><code>publish</code></b> key. There is only support for an image gallery view (even though it will display thumbnails for other kinds of items), which is not really customizable. Here is an example of a value if one wanted to publish some items under <code>/pics/</code>:</p>
<pre>
{
"/pics/": {
"rootPermanode": "sha1-09888624be84fcb3ae67e8aa2f29682b4ff515d7",
"style": "pics.css",
"template": "gallery"
}
}
</pre>
<p>One can create any permanode with camput or the UI and use it as the rootPermanode.</p>
<h2>App Engine</h2>
<p>
Most configuration doesn't apply on App Engine as it's pre-configured
to use the App Engine Blobstore and Datastore, as well as App Engine's
user auth mechanisms. But as of 2013-06-12 we don't yet recommend running
on App Engine; there are still some sharp corners.
</p>