aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/md/Create-and-serve-multiple-Shaarlis-(farm).md
diff options
context:
space:
mode:
authornodiscc <nodiscc@gmail.com>2017-06-18 06:29:15 +0200
committernodiscc <nodiscc@gmail.com>2017-06-18 06:29:15 +0200
commit460ce50115e5f5a1183c3c410fd76636ee5c4716 (patch)
treefd7e75fcad770fd8681df02e9a40b92a09c3dfdf /doc/md/Create-and-serve-multiple-Shaarlis-(farm).md
parent53ed6d7d1e678d7486337ce67a2f17b30bac21ac (diff)
downloadShaarli-460ce50115e5f5a1183c3c410fd76636ee5c4716.tar.gz
Shaarli-460ce50115e5f5a1183c3c410fd76636ee5c4716.tar.zst
Shaarli-460ce50115e5f5a1183c3c410fd76636ee5c4716.zip
doc: rename "datastore hacks" -> "various hacks", move example scripts to gist.github.com, remove obsolete GH wiki _Sidebar.md
Diffstat (limited to 'doc/md/Create-and-serve-multiple-Shaarlis-(farm).md')
-rw-r--r--doc/md/Create-and-serve-multiple-Shaarlis-(farm).md57
1 files changed, 0 insertions, 57 deletions
diff --git a/doc/md/Create-and-serve-multiple-Shaarlis-(farm).md b/doc/md/Create-and-serve-multiple-Shaarlis-(farm).md
deleted file mode 100644
index d0d812a3..00000000
--- a/doc/md/Create-and-serve-multiple-Shaarlis-(farm).md
+++ /dev/null
@@ -1,57 +0,0 @@
1Example bash script (creates multiple shaarli instances and generates an HTML index of them)
2
3```bash
4#!/bin/bash
5set -o errexit
6set -o nounset
7
8#config
9shaarli_base_dir='/var/www/shaarli'
10accounts='bob john whatever username'
11shaarli_repo_url='https://github.com/shaarli/Shaarli'
12ref="master"
13
14#clone multiple shaarli instances
15if [ ! -d "$shaarli_base_dir" ]; then mkdir "$shaarli_base_dir"; fi
16
17for account in $accounts; do
18 if [ -d "$shaarli_base_dir/$account" ];
19 then echo "[info] account $account already exists, skipping";
20 else echo "[info] creating new account $account ..."; git clone --quiet "$shaarli_repo_url" -b "$ref" "$shaarli_base_dir/$account"; fi
21done
22
23#generate html index of shaarlis
24htmlhead='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
25<!-- Minimal html template thanks to http://www.sitepoint.com/a-minimal-html-document/ -->
26<html lang="en">
27 <head>
28 <meta http-equiv="content-type" content="text/html; charset=utf-8">
29 <title>My Shaarli farm</title>
30 <style>body {font-family: "Open Sans"}</style>
31 </head>
32 <body>
33 <div>
34 <h1>My Shaarli farm</h1>
35 <ul style="list-style-type: none;">'
36
37accountlinks=''
38
39htmlfooter='
40 </ul>
41 </div>
42 </body>
43</html>'
44
45
46
47for account in $accounts; do accountlinks="$accountlinks\n<li><a href=\"$account\">$account</a></li>"; done
48if [ -d "$shaarli_base_dir/index.html" ]; then echo "[removing old index.html]"; rm "$shaarli_base_dir/index.html" ]; fi
49echo "[info] generating new index of shaarlis"
50echo -e "$htmlhead $accountlinks $htmlfooter" > "$shaarli_base_dir/index.html"
51echo '[info] done.'
52echo "[info] list of accounts: $accounts"
53echo "[info] contents of $shaarli_base_dir:"
54tree -a -L 1 "$shaarli_base_dir"
55```
56
57This script just serves as an example. More precise or complex (applying custom configuration, etc) automation is possible using configuration management software like [Ansible](https://www.ansible.com/) \ No newline at end of file