github.com/slspeek/camlistore_namedsearch@v0.0.0-20140519202248-ed6f70f7721a/website/content/docs/server-config (about)

     1  <h1>Configuring the server</h1>
     2  
     3  <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>
     4  
     5  <p>This page documents the simple configuration mode.</p>
     6  
     7  <p>If you visit your Camlistore server's /setup page (by default, at
     8  http://localhost:3179/setup) you can modify the config file from your
     9  web browser and restart the server.</p>
    10  
    11  <h1>Configuration Keys &amp; Values</h1>
    12  
    13  <ul>
    14  <li><b><code>auth</code></b>: the authentication mechanism to use. Example values include:
    15      <table cellpadding=4 border=1>
    16       <tr><td><code>none</code></td><td>No authentication.</td></tr>
    17       <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>
    18       <tr><td><code>userpass:alice:secret</code></td><td>HTTP basic authentication. Username "alice", password "secret". Only recommended if using HTTPS.</td></tr>
    19       <tr><td><code>userpass:alice:secret:+localhost</code></td><td>Same as above, but also accept localhost auth</td></tr>
    20       <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>
    21      </table>
    22  </li>
    23  
    24  <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>
    25  
    26  <li><b><code>flickr</code></b>: Optional. Flickr importer. Should be a Flickr API key and secret formatted as <code>key</code>:<code>secret</code>. Get these values by filling out <a href="http://www.flickr.com/services/apps/create/noncommercial/">this form</a>. There's no UI yet, but you can run it by navigating to <code>/importer-flickr/?mode=start</code>. Progress is printed to the server's stdout.</li>
    27  
    28  <li><b><code>https</code></b>: if "true", HTTPS is used
    29    <ul>
    30      <li><b><code>httpsCert</code></b>: path to the HTTPS certificate file. This is the public file. It should include the concatenation of any required intermediate certs as well.</li>
    31      <li><b><code>httpsKey</code></b>: path to the HTTPS private key file.</li>
    32    </ul>
    33  </li>
    34  
    35  <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>
    36  <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>
    37  <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>
    38  <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>
    39  <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>
    40  <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>
    41  <li><b><code>memoryIndex</code></b>: 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. </li>
    42  <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>
    43  </ul>
    44  
    45  <h2 id="storage">Storage options</h2>
    46  <p>At least one of these must be set:</p>
    47  <ul>
    48  <li><b><code>blobPath</code></b>: local disk path to store blobs</li>
    49  <li><b><code>s3</code></b>: "<code>key:secret:bucket</code>" or "<code>key:secret:bucket:hostname</code>" (with colons, but no quotes).</li>
    50  <li><b><code>googlecloudstorage</code></b>: "<code>clientId:clientSecret:refreshToken:bucketName</code>"</li>
    51  </ul>
    52  <p>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.</p>
    53  <p>Others aren't yet supported by the simple config mode. Patches
    54  to <code>pkg/genconfig</code> welcome.</p>
    55  
    56  <h2 id="indexing">Indexing options</h2>
    57  <p>Unless <b><code>runIndex</code></b> is set to <code>false</code>, exactly one of these must be set:</p>
    58  <ul>
    59  <li><b><code>sqlite</code></b>: path to SQLite database file to use for indexing</li>
    60  <li><b><code>mongo</code></b>: user:password@host</li>
    61  <li><b><code>mysql</code></b>: user@host:password</li>
    62  <li><b><code>postgres</code></b>: user@host:password</li>
    63  </ul>
    64  
    65  <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>
    66  
    67  <p>There's also an in-memory index type, but only in the low-level
    68  config, as used by <code>devcam server</code>.</p>
    69  
    70  <h2 id="publishing">Publishing options</h2>
    71  <p>Camlistore uses Go html templates to publish pages, and publishing can be configured through the <b><code>publish</code></b> key. There is already support for an image gallery view, which can be enabled similarly to the example below (obviously, the rootPermanode will be different).</p>
    72  <pre>
    73  "publish": {
    74  	"/pics/": {
    75  		"rootPermanode": "sha1-6cbe9e1c35e854eab028cba43d099d35ceae0de8",
    76  		"style": "pics.css",
    77  		"js": "pics.js",
    78  		"goTemplate": "gallery.html"
    79  	}
    80  }
    81  </pre>
    82  <p>One can create any permanode with camput or the UI and use it as the rootPermanode.</p>
    83  
    84  <p>Please see the <a href="/gw/doc/publishing/README"">publishing README</a> if you want to make/contribute more publishing views.</p>
    85  
    86  <h2 id="windows">Windows</h2>
    87  
    88  <p>
    89  The default configuration comes with SQLite for the indexer. However, getting <a href="https://github.com/mattn/go-sqlite3">mattn go-sqlite3</a> to work on windows is not straightforward, so we suggest using one of the other indexers, like MySQL.
    90  </p>
    91  <p>
    92  The following steps should get you started with MySQL:
    93  <ul>
    94  <li> Dowload and install <a href="https://downloads.mariadb.org/mariadb/5.5.32/">MariaDB</a> or <a href="http://dev.mysql.com/downloads/windows/installer/">MySQL</a> (the latter requires .NET).</li>
    95  <li> Edit your server configuration file (if it does not exit yet, running <b>camlistored</b> will automatically create it):
    96  	<ul>
    97  	<li> Remove the <b>sqlite</b> option.</li>
    98  	<li> Add a <b>dbname</b> option. (ex: "dbname": "camliprod")</li>
    99  	<li> Add a <b>mysql</b> option. (ex: "mysql": "foo@localhost:bar")</li>
   100  	</ul></li>
   101  <li> Create a dedicated user/password for your mysql server.</li>
   102  <li> Initialize the database with <b>camtool</b>: <code>camtool dbinit --user=foo --password=bar --host=localhost --dbname=camliprod --wipe </code></li>
   103  </ul>
   104  </p>
   105  
   106  <p>
   107  Setting up MongoDB is even simpler, but the MongoDB indexer is not as well tested as the MySQL one.
   108  </p>
   109  
   110  <h2 id="appengine">App Engine</h2>
   111  
   112  <p>
   113  Most configuration doesn't apply on App Engine as it's pre-configured
   114  to use the App Engine Blobstore and Datastore, as well as App Engine's
   115  user auth mechanisms. But as of 2013-06-12 we don't yet recommend running
   116  on App Engine; there are still some sharp corners.
   117  </p>
   118  
   119  <p>
   120  The UI requires some static resources that are not included by default in the App Engine application directory (<code>server/appengine/</code>). You can define that directory in the server configuration file (<code>server/appengine/config.json</code>), with the <b><code>sourceRoot</code></b> parameter, like so:
   121  <pre>
   122    "/ui/": {
   123      "handler": "ui",
   124      "handlerArgs": {
   125        "sourceRoot": "dir_name",
   126        "jsonSignRoot": "/sighelper/"
   127      }
   128    },
   129  </pre>
   130  You will then have to populate that directory with all the necessary resources (UI static files and closure library files).</br>
   131  Alternatively, you can run <b><code>devcam appengine</code></b> once, which will create and populate the default directory (<code>server/appengine/source_root</code>). Please see the <a href="https://camlistore.googlesource.com/camlistore/+/master/HACKING">HACKING</a> doc to build devcam.
   132  </p>