X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=doc%2FCreate-and-serve-multiple-Shaarlis-%28farm%29.html;h=672e4bf372d574b9364f61ee2aa3c5b9cbd10ece;hb=5ebc1d504bc8a8f29f49a8a4fc1c421f78677b2a;hp=933144e468c81b2618371afe4b95a5320acc6a7f;hpb=08dcd8ea58c07cd8258567ca14260aa18ba2660f;p=github%2Fshaarli%2FShaarli.git diff --git a/doc/Create-and-serve-multiple-Shaarlis-(farm).html b/doc/Create-and-serve-multiple-Shaarlis-(farm).html index 933144e4..672e4bf3 100644 --- a/doc/Create-and-serve-multiple-Shaarlis-(farm).html +++ b/doc/Create-and-serve-multiple-Shaarlis-(farm).html @@ -52,13 +52,13 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
Example bash script (creates multiple shaarli instances and generates an HTML index of them)
#!/bin/bash
-set -o errexit
-set -o nounset
+set -o errexit
+set -o nounset
#config
-shaarli_base_dir='/var/www/shaarli'
-accounts='bob john whatever username'
-shaarli_repo_url='https://github.com/shaarli/Shaarli'
-ref="master"
+shaarli_base_dir='/var/www/shaarli'
+accounts='bob john whatever username'
+shaarli_repo_url='https://github.com/shaarli/Shaarli'
+ref="master"
#clone multiple shaarli instances
-if [ ! -d "$shaarli_base_dir" ]; then mkdir "$shaarli_base_dir"; fi[](.html)
+if [ ! -d "$shaarli_base_dir" ]; then mkdir "$shaarli_base_dir"; fi[](.html)
-for account in $accounts; do
- if [ -d "$shaarli_base_dir/$account" ];[](.html)
- then echo "[info] account $account already exists, skipping";[](.html)
- else echo "[info] creating new account $account ..."; git clone --quiet "$shaarli_repo_url" -b "$ref" "$shaarli_base_dir/$account"; fi[](.html)
+for account in $accounts; do
+ if [ -d "$shaarli_base_dir/$account" ];[](.html)
+ then echo "[info] account $account already exists, skipping";[](.html)
+ else echo "[info] creating new account $account ..."; git clone --quiet "$shaarli_repo_url" -b "$ref" "$shaarli_base_dir/$account"; fi[](.html)
done
#generate html index of shaarlis
-htmlhead='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+htmlhead='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!-- Minimal html template thanks to http://www.sitepoint.com/a-minimal-html-document/ -->
<html lang="en">
<head>
@@ -136,9 +134,9 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
<h1>My Shaarli farm</h1>
<ul style="list-style-type: none;">'
-accountlinks=''
+accountlinks=''
-htmlfooter='
+htmlfooter='
</ul>
</div>
</body>
@@ -146,14 +144,14 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
-for account in $accounts; do accountlinks="$accountlinks\n<li><a href=\"$account\">$account</a></li>"; done
-if [ -d "$shaarli_base_dir/index.html" ]; then echo "[removing old index.html]"; rm "$shaarli_base_dir/index.html" ]; fi[](.html)
-echo "[info] generating new index of shaarlis"[](.html)
-echo -e "$htmlhead $accountlinks $htmlfooter" > "$shaarli_base_dir/index.html"
-echo '[info] done.'[](.html)
-echo "[info] list of accounts: $accounts"[](.html)
-echo "[info] contents of $shaarli_base_dir:"[](.html)
-tree -a -L 1 "$shaarli_base_dir"
This script just serves as an example. More precise or complex (applying custom configuration, etc) automation is possible using configuration management software like Ansible