aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/Copy-an-existing-installation-over-SSH-and-serve-it-locally.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/Copy-an-existing-installation-over-SSH-and-serve-it-locally.html')
-rw-r--r--doc/Copy-an-existing-installation-over-SSH-and-serve-it-locally.html58
1 files changed, 28 insertions, 30 deletions
diff --git a/doc/Copy-an-existing-installation-over-SSH-and-serve-it-locally.html b/doc/Copy-an-existing-installation-over-SSH-and-serve-it-locally.html
index edb1555f..9efb1ad6 100644
--- a/doc/Copy-an-existing-installation-over-SSH-and-serve-it-locally.html
+++ b/doc/Copy-an-existing-installation-over-SSH-and-serve-it-locally.html
@@ -52,13 +52,13 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
52<div id="local-sidebar"> 52<div id="local-sidebar">
53<ul> 53<ul>
54<li><a href="Home.html">Home</a></li> 54<li><a href="Home.html">Home</a></li>
55<li>Installation 55<li>Setup
56<ul> 56<ul>
57<li><a href="Download.html">Download</a></li> 57<li><a href="Download-and-Installation.html">Download and Installation</a></li>
58<li><a href="Upgrade-and-migration.html">Upgrade and migration</a></li>
58<li><a href="Server-requirements.html">Server requirements</a></li> 59<li><a href="Server-requirements.html">Server requirements</a></li>
59<li><a href="Server-configuration.html">Server configuration</a></li> 60<li><a href="Server-configuration.html">Server configuration</a></li>
60<li><a href="Server-security.html">Server security</a></li> 61<li><a href="Server-security.html">Server security</a></li>
61<li><a href="Shaarli-installation.html">Shaarli installation</a></li>
62<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li> 62<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
63<li><a href="Plugins.html">Plugins</a></li> 63<li><a href="Plugins.html">Plugins</a></li>
64</ul></li> 64</ul></li>
@@ -73,7 +73,6 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
73<li>How To 73<li>How To
74<ul> 74<ul>
75<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li> 75<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
76<li><a href="Upgrade-from-original-sebsauvage/Shaarli.html">Upgrade from original sebsauvage/Shaarli</a></li>
77<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li> 76<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
78<li><a href="Create-and-serve-multiple-Shaarlis-(farm).html">Create and serve multiple Shaarlis (farm)</a></li> 77<li><a href="Create-and-serve-multiple-Shaarlis-(farm).html">Create and serve multiple Shaarlis (farm)</a></li>
79<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li> 78<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
@@ -97,7 +96,6 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
97<ul> 96<ul>
98<li><a href="FAQ.html">FAQ</a></li> 97<li><a href="FAQ.html">FAQ</a></li>
99<li><a href="Community-&amp;-Related-software.html">Community &amp; Related software</a></li> 98<li><a href="Community-&amp;-Related-software.html">Community &amp; Related software</a></li>
100<li><a href="TODO.html">TODO</a></li>
101</ul></li> 99</ul></li>
102</ul> 100</ul>
103</div> 101</div>
@@ -111,55 +109,55 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
111<span class="co">#Usage: ./local-shaarli.sh</span> 109<span class="co">#Usage: ./local-shaarli.sh</span>
112<span class="co">#Author: nodiscc (nodiscc@gmail.com)</span> 110<span class="co">#Author: nodiscc (nodiscc@gmail.com)</span>
113<span class="co">#License: MIT (http://opensource.org/licenses/MIT)</span> 111<span class="co">#License: MIT (http://opensource.org/licenses/MIT)</span>
114<span class="kw">set</span> <span class="kw">-o</span> errexit 112<span class="kw">set</span> <span class="ex">-o</span> errexit
115<span class="kw">set</span> <span class="kw">-o</span> nounset 113<span class="kw">set</span> <span class="ex">-o</span> nounset
116 114
117<span class="co">##### CONFIG #################</span> 115<span class="co">##### CONFIG #################</span>
118<span class="co">#The port used by php&#39;s local server</span> 116<span class="co">#The port used by php&#39;s local server</span>
119<span class="ot">php_local_port=</span>7431 117<span class="va">php_local_port=</span>7431
120 118
121<span class="co">#Name of the SSH server and path where Shaarli is installed</span> 119<span class="co">#Name of the SSH server and path where Shaarli is installed</span>
122<span class="co">#TODO: pass these as command-line arguments</span> 120<span class="co">#TODO: pass these as command-line arguments</span>
123<span class="ot">remotehost=</span><span class="st">&quot;my.ssh.server&quot;</span> 121<span class="va">remotehost=</span><span class="st">&quot;my.ssh.server&quot;</span>
124<span class="ot">remote_shaarli_dir=</span><span class="st">&quot;/var/www/shaarli&quot;</span> 122<span class="va">remote_shaarli_dir=</span><span class="st">&quot;/var/www/shaarli&quot;</span>
125 123
126 124
127<span class="co">###### FUNCTIONS #############</span> 125<span class="co">###### FUNCTIONS #############</span>
128<span class="fu">_main()</span> <span class="kw">{</span> 126<span class="fu">_main()</span> <span class="kw">{</span>
129 <span class="kw">_CBSyncShaarli</span> 127 <span class="ex">_CBSyncShaarli</span>
130 <span class="kw">_CBServeShaarli</span> 128 <span class="ex">_CBServeShaarli</span>
131<span class="kw">}</span> 129<span class="kw">}</span>
132 130
133<span class="fu">_CBSyncShaarli()</span> <span class="kw">{</span> 131<span class="fu">_CBSyncShaarli()</span> <span class="kw">{</span>
134 <span class="ot">remote_temp_dir=$(</span><span class="kw">ssh</span> <span class="ot">$remotehost</span> mktemp -d<span class="ot">)</span> 132 <span class="va">remote_temp_dir=$(</span><span class="fu">ssh</span> <span class="va">$remotehost</span> mktemp -d<span class="va">)</span>
135 <span class="ot">remote_ssh_user=$(</span><span class="kw">ssh</span> <span class="ot">$remotehost</span> whoami<span class="ot">)</span> 133 <span class="va">remote_ssh_user=$(</span><span class="fu">ssh</span> <span class="va">$remotehost</span> whoami<span class="va">)</span>
136 <span class="kw">ssh</span> -t <span class="st">&quot;</span><span class="ot">$remotehost</span><span class="st">&quot;</span> sudo cp -r <span class="st">&quot;</span><span class="ot">$remote_shaarli_dir</span><span class="st">&quot;</span> <span class="st">&quot;</span><span class="ot">$remote_temp_dir</span><span class="st">&quot;</span> 134 <span class="fu">ssh</span> -t <span class="st">&quot;</span><span class="va">$remotehost</span><span class="st">&quot;</span> sudo cp -r <span class="st">&quot;</span><span class="va">$remote_shaarli_dir</span><span class="st">&quot;</span> <span class="st">&quot;</span><span class="va">$remote_temp_dir</span><span class="st">&quot;</span>
137 <span class="kw">ssh</span> -t <span class="st">&quot;</span><span class="ot">$remotehost</span><span class="st">&quot;</span> sudo chown -R <span class="st">&quot;</span><span class="ot">$remote_ssh_user</span><span class="st">&quot;</span>:<span class="st">&quot;</span><span class="ot">$remote_ssh_user</span><span class="st">&quot;</span> <span class="st">&quot;</span><span class="ot">$remote_temp_dir</span><span class="st">&quot;</span> 135 <span class="fu">ssh</span> -t <span class="st">&quot;</span><span class="va">$remotehost</span><span class="st">&quot;</span> sudo chown -R <span class="st">&quot;</span><span class="va">$remote_ssh_user</span><span class="st">&quot;</span>:<span class="st">&quot;</span><span class="va">$remote_ssh_user</span><span class="st">&quot;</span> <span class="st">&quot;</span><span class="va">$remote_temp_dir</span><span class="st">&quot;</span>
138 <span class="kw">scp</span> -rq <span class="st">&quot;</span><span class="ot">$remotehost</span><span class="st">&quot;</span>:<span class="st">&quot;</span><span class="ot">$remote_temp_dir</span><span class="st">&quot;</span> local-shaarli 136 <span class="fu">scp</span> -rq <span class="st">&quot;</span><span class="va">$remotehost</span><span class="st">&quot;</span>:<span class="st">&quot;</span><span class="va">$remote_temp_dir</span><span class="st">&quot;</span> local-shaarli
139 <span class="kw">ssh</span> <span class="st">&quot;</span><span class="ot">$remotehost</span><span class="st">&quot;</span> rm -r <span class="st">&quot;</span><span class="ot">$remote_temp_dir</span><span class="st">&quot;</span> 137 <span class="fu">ssh</span> <span class="st">&quot;</span><span class="va">$remotehost</span><span class="st">&quot;</span> rm -r <span class="st">&quot;</span><span class="va">$remote_temp_dir</span><span class="st">&quot;</span>
140<span class="kw">}</span> 138<span class="kw">}</span>
141 139
142<span class="fu">_CBServeShaarli()</span> <span class="kw">{</span> 140<span class="fu">_CBServeShaarli()</span> <span class="kw">{</span>
143 <span class="co">#TODO: allow serving a previously downloaded Shaarli</span> 141 <span class="co">#TODO: allow serving a previously downloaded Shaarli</span>
144 <span class="co">#TODO: ask before overwriting local copy, if it exists</span> 142 <span class="co">#TODO: ask before overwriting local copy, if it exists</span>
145 <span class="kw">cd</span> local-shaarli/ 143 <span class="bu">cd</span> local-shaarli/
146 <span class="kw">php</span> -S localhost:<span class="ot">${php_local_port}</span> 144 <span class="ex">php</span> -S localhost:<span class="va">${php_local_port}</span>
147 <span class="kw">echo</span> <span class="st">&quot;Please go to http://localhost:</span><span class="ot">${php_local_port}</span><span class="st">&quot;</span> 145 <span class="bu">echo</span> <span class="st">&quot;Please go to http://localhost:</span><span class="va">${php_local_port}</span><span class="st">&quot;</span>
148<span class="kw">}</span> 146<span class="kw">}</span>
149 147
150 148
151<span class="co">##### MAIN #################</span> 149<span class="co">##### MAIN #################</span>
152 150
153<span class="kw">_main</span></code></pre></div> 151<span class="ex">_main</span></code></pre></div>
154<p>This outputs:</p> 152<p>This outputs:</p>
155<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">./local-shaarli.sh</span> 153<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="ex">./local-shaarli.sh</span>
156<span class="kw">PHP</span> 5.6.0RC4 Development Server started at Mon Sep 1 21:56:19 2014 154<span class="ex">PHP</span> 5.6.0RC4 Development Server started at Mon Sep 1 21:56:19 2014
157<span class="kw">Listening</span> on http://localhost:7431 155<span class="ex">Listening</span> on http://localhost:7431
158<span class="kw">Document</span> root is /home/user/local-shaarli/shaarli 156<span class="ex">Document</span> root is /home/user/local-shaarli/shaarli
159<span class="kw">Press</span> Ctrl-C to quit. 157<span class="ex">Press</span> Ctrl-C to quit.
160 158
161[<span class="kw">Mon</span> Sep 1 21:56:27 2014] ::1:57868 [200]: /[](.html) 159[<span class="ex">Mon</span> Sep 1 21:56:27 2014] ::1:57868 [200]: /[](.html)
162[<span class="kw">Mon</span> Sep 1 21:56:27 2014] ::1:57869 [200]: /index.html[](.html) 160[<span class="ex">Mon</span> Sep 1 21:56:27 2014] ::1:57869 [200]: /index.html[](.html)
163[<span class="kw">Mon</span> Sep 1 21:56:37 2014] ::1:57881 [200]: /...[](.html)</code></pre></div> 161[<span class="ex">Mon</span> Sep 1 21:56:37 2014] ::1:57881 [200]: /...[](.html)</code></pre></div>
164</body> 162</body>
165</html> 163</html>