mirror of https://github.com/perkeep/perkeep.git
serverinit: shared camli-cache for multiple publish roots
czninc/kv cannot be shared (locks), so a separate directory is needed in the multiple publish root case, for the thumbs caches. Change-Id: I8c07302778e597a2ccf9b3265111a503dd037249
This commit is contained in:
parent
4ab503399d
commit
46da1cdcdb
|
@ -55,7 +55,8 @@ func addPublishedConfig(prefixes jsonconfig.Obj,
|
|||
sourceRoot string) ([]interface{}, error) {
|
||||
pubPrefixes := []interface{}{}
|
||||
for k, v := range published {
|
||||
rootName := strings.Replace(k, "/", "", -1) + "Root"
|
||||
name := strings.Replace(k, "/", "", -1)
|
||||
rootName := name + "Root"
|
||||
if !v.Root.Valid() {
|
||||
return nil, fmt.Errorf("Invalid or missing \"rootPermanode\" key in configuration for %s.", k)
|
||||
}
|
||||
|
@ -86,7 +87,7 @@ func addPublishedConfig(prefixes jsonconfig.Obj,
|
|||
thumbsCacheDir := filepath.Join(tempDir(), "camli-cache")
|
||||
handlerArgs["scaledImage"] = map[string]interface{}{
|
||||
"type": "kv",
|
||||
"file": filepath.Join(thumbsCacheDir, "thumbnails.kv"),
|
||||
"file": filepath.Join(thumbsCacheDir, name+"-thumbnails.kv"),
|
||||
}
|
||||
if err := os.MkdirAll(thumbsCacheDir, 0700); err != nil {
|
||||
return nil, fmt.Errorf("Could not create cache dir %s: %v", thumbsCacheDir, err)
|
||||
|
|
|
@ -0,0 +1,159 @@
|
|||
{
|
||||
"auth": "userpass:camlistore:pass3179",
|
||||
"https": false,
|
||||
"listen": "localhost:3179",
|
||||
"prefixes": {
|
||||
"/": {
|
||||
"handler": "root",
|
||||
"handlerArgs": {
|
||||
"blobRoot": "/bs-and-maybe-also-index/",
|
||||
"ownerName": "Alice",
|
||||
"searchRoot": "/my-search/",
|
||||
"statusRoot": "/status/",
|
||||
"stealth": false
|
||||
}
|
||||
},
|
||||
"/bs-and-index/": {
|
||||
"handler": "storage-replica",
|
||||
"handlerArgs": {
|
||||
"backends": [
|
||||
"/bs/",
|
||||
"/index-kv/"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/bs-and-maybe-also-index/": {
|
||||
"handler": "storage-cond",
|
||||
"handlerArgs": {
|
||||
"read": "/bs/",
|
||||
"write": {
|
||||
"else": "/bs/",
|
||||
"if": "isSchema",
|
||||
"then": "/bs-and-index/"
|
||||
}
|
||||
}
|
||||
},
|
||||
"/bs/": {
|
||||
"handler": "storage-filesystem",
|
||||
"handlerArgs": {
|
||||
"path": "/tmp/blobs"
|
||||
}
|
||||
},
|
||||
"/cache/": {
|
||||
"handler": "storage-filesystem",
|
||||
"handlerArgs": {
|
||||
"path": "/tmp/blobs/cache"
|
||||
}
|
||||
},
|
||||
"/index-kv/": {
|
||||
"handler": "storage-kvfileindexer",
|
||||
"handlerArgs": {
|
||||
"blobSource": "/bs/",
|
||||
"file": "/path/to/indexkv.db"
|
||||
}
|
||||
},
|
||||
"/my-search/": {
|
||||
"handler": "search",
|
||||
"handlerArgs": {
|
||||
"index": "/index-kv/",
|
||||
"owner": "sha1-f2b0b7da718b97ce8c31591d8ed4645c777f3ef4",
|
||||
"slurpToMemory": true
|
||||
}
|
||||
},
|
||||
|
||||
"/pics/": {
|
||||
"handler": "publish",
|
||||
"handlerArgs": {
|
||||
"blobRoot": "/bs-and-maybe-also-index/",
|
||||
"cache": "/cache/",
|
||||
"css": [
|
||||
"pics.css"
|
||||
],
|
||||
"goTemplate": "gallery.html",
|
||||
"js": [
|
||||
"pics.js"
|
||||
],
|
||||
"rootName": "picsRoot",
|
||||
"rootPermanode": [
|
||||
"/sighelper/",
|
||||
"sha1-046c6aae4ec8245dfe63edc4a2abb407824a4b5a"
|
||||
],
|
||||
"scaledImage": {
|
||||
"file": "/tmp/camli-cache/pics-thumbnails.kv",
|
||||
"type": "kv"
|
||||
},
|
||||
"searchRoot": "/my-search/"
|
||||
}
|
||||
},
|
||||
"/music/": {
|
||||
"handler": "publish",
|
||||
"handlerArgs": {
|
||||
"blobRoot": "/bs-and-maybe-also-index/",
|
||||
"cache": "/cache/",
|
||||
"css": [
|
||||
"pics.css"
|
||||
],
|
||||
"goTemplate": "gallery.html",
|
||||
"js": [
|
||||
"pics.js"
|
||||
],
|
||||
"rootName": "musicRoot",
|
||||
"rootPermanode": [
|
||||
"/sighelper/",
|
||||
"sha1-999c6aae4ec8245dfe63edc4a2abb407824a4b5a"
|
||||
],
|
||||
"scaledImage": {
|
||||
"file": "/tmp/camli-cache/music-thumbnails.kv",
|
||||
"type": "kv"
|
||||
},
|
||||
"searchRoot": "/my-search/"
|
||||
}
|
||||
},
|
||||
"/setup/": {
|
||||
"handler": "setup"
|
||||
},
|
||||
"/share/": {
|
||||
"handler": "share",
|
||||
"handlerArgs": {
|
||||
"blobRoot": "/bs/"
|
||||
}
|
||||
},
|
||||
"/sighelper/": {
|
||||
"handler": "jsonsign",
|
||||
"handlerArgs": {
|
||||
"keyId": "26F5ABDA",
|
||||
"publicKeyDest": "/bs-and-index/",
|
||||
"secretRing": "/path/to/secring"
|
||||
}
|
||||
},
|
||||
"/status/": {
|
||||
"handler": "status"
|
||||
},
|
||||
"/sync/": {
|
||||
"handler": "sync",
|
||||
"handlerArgs": {
|
||||
"from": "/bs/",
|
||||
"queue": {
|
||||
"file": "/tmp/blobs/sync-to-index-queue.kv",
|
||||
"type": "kv"
|
||||
},
|
||||
"to": "/index-kv/"
|
||||
}
|
||||
},
|
||||
"/ui/": {
|
||||
"handler": "ui",
|
||||
"handlerArgs": {
|
||||
"cache": "/cache/",
|
||||
"jsonSignRoot": "/sighelper/",
|
||||
"publishRoots": [
|
||||
"/pics/",
|
||||
"/music/"
|
||||
],
|
||||
"scaledImage": {
|
||||
"file": "/tmp/blobs/thumbmeta.kv",
|
||||
"type": "kv"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"listen": "localhost:3179",
|
||||
"auth": "userpass:camlistore:pass3179",
|
||||
"blobPath": "/tmp/blobs",
|
||||
"kvIndexFile": "/path/to/indexkv.db",
|
||||
"identity": "26F5ABDA",
|
||||
"identitySecretRing": "/path/to/secring",
|
||||
"ownerName": "Alice",
|
||||
"shareHandlerPath": "/share/",
|
||||
"publish": {
|
||||
"/pics/": {
|
||||
"rootPermanode": "sha1-046c6aae4ec8245dfe63edc4a2abb407824a4b5a",
|
||||
"style": "pics.css",
|
||||
"js": "pics.js",
|
||||
"goTemplate": "gallery.html"
|
||||
},
|
||||
"/music/": {
|
||||
"rootPermanode": "sha1-999c6aae4ec8245dfe63edc4a2abb407824a4b5a",
|
||||
"style": "pics.css",
|
||||
"js": "pics.js",
|
||||
"goTemplate": "gallery.html"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,7 +28,7 @@
|
|||
],
|
||||
"scaledImage": {
|
||||
"type": "kv",
|
||||
"file": "/tmp/camli-cache/thumbnails.kv"
|
||||
"file": "/tmp/camli-cache/blog-thumbnails.kv"
|
||||
},
|
||||
"searchRoot": "/my-search/"
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
],
|
||||
"scaledImage": {
|
||||
"type": "kv",
|
||||
"file": "/tmp/camli-cache/thumbnails.kv"
|
||||
"file": "/tmp/camli-cache/pics-thumbnails.kv"
|
||||
},
|
||||
"searchRoot": "/my-search/"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue