Upgrade-and-migration.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="generator" content="pandoc">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
  7. <title>Shaarli – Upgrade and migration</title>
  8. <style type="text/css">code{white-space: pre;}</style>
  9. <style type="text/css">
  10. div.sourceCode { overflow-x: auto; }
  11. table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
  12. margin: 0; padding: 0; vertical-align: baseline; border: none; }
  13. table.sourceCode { width: 100%; line-height: 100%; }
  14. td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
  15. td.sourceCode { padding-left: 5px; }
  16. code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
  17. code > span.dt { color: #902000; } /* DataType */
  18. code > span.dv { color: #40a070; } /* DecVal */
  19. code > span.bn { color: #40a070; } /* BaseN */
  20. code > span.fl { color: #40a070; } /* Float */
  21. code > span.ch { color: #4070a0; } /* Char */
  22. code > span.st { color: #4070a0; } /* String */
  23. code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
  24. code > span.ot { color: #007020; } /* Other */
  25. code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
  26. code > span.fu { color: #06287e; } /* Function */
  27. code > span.er { color: #ff0000; font-weight: bold; } /* Error */
  28. code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
  29. code > span.cn { color: #880000; } /* Constant */
  30. code > span.sc { color: #4070a0; } /* SpecialChar */
  31. code > span.vs { color: #4070a0; } /* VerbatimString */
  32. code > span.ss { color: #bb6688; } /* SpecialString */
  33. code > span.im { } /* Import */
  34. code > span.va { color: #19177c; } /* Variable */
  35. code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
  36. code > span.op { color: #666666; } /* Operator */
  37. code > span.bu { } /* BuiltIn */
  38. code > span.ex { } /* Extension */
  39. code > span.pp { color: #bc7a00; } /* Preprocessor */
  40. code > span.at { color: #7d9029; } /* Attribute */
  41. code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
  42. code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
  43. code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
  44. code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
  45. </style>
  46. <link rel="stylesheet" href="github-markdown.css">
  47. <!--[if lt IE 9]>
  48. <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
  49. <![endif]-->
  50. </head>
  51. <body>
  52. <div id="local-sidebar">
  53. <ul>
  54. <li><a href="Home.html">Home</a></li>
  55. <li>Setup
  56. <ul>
  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>
  59. <li><a href="Server-requirements.html">Server requirements</a></li>
  60. <li><a href="Server-configuration.html">Server configuration</a></li>
  61. <li><a href="Server-security.html">Server security</a></li>
  62. <li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
  63. <li><a href="Plugins.html">Plugins</a></li>
  64. </ul></li>
  65. <li><a href="Docker.html">Docker</a></li>
  66. <li><a href="Usage.html">Usage</a>
  67. <ul>
  68. <li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
  69. <li><a href="Browsing-and-Searching.html">Browsing and Searching</a></li>
  70. <li><a href="Firefox-share.html">Firefox share</a></li>
  71. <li><a href="RSS-feeds.html">RSS feeds</a></li>
  72. </ul></li>
  73. <li>How To
  74. <ul>
  75. <li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</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>
  77. <li><a href="Create-and-serve-multiple-Shaarlis-(farm).html">Create and serve multiple Shaarlis (farm)</a></li>
  78. <li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
  79. <li><a href="Datastore-hacks.html">Datastore hacks</a></li>
  80. </ul></li>
  81. <li><a href="Troubleshooting.html">Troubleshooting</a></li>
  82. <li><a href="Development.html">Development</a>
  83. <ul>
  84. <li><a href="GnuPG-signature.html">GnuPG signature</a></li>
  85. <li><a href="Coding-guidelines.html">Coding guidelines</a></li>
  86. <li><a href="Directory-structure.html">Directory structure</a></li>
  87. <li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
  88. <li><a href="Plugin-System.html">Plugin System</a></li>
  89. <li><a href="Release-Shaarli.html">Release Shaarli</a></li>
  90. <li><a href="Security.html">Security</a></li>
  91. <li><a href="Static-analysis.html">Static analysis</a></li>
  92. <li><a href="Theming.html">Theming</a></li>
  93. <li><a href="Unit-tests.html">Unit tests</a></li>
  94. </ul></li>
  95. <li>About
  96. <ul>
  97. <li><a href="FAQ.html">FAQ</a></li>
  98. <li><a href="Community-&amp;-Related-software.html">Community &amp; Related software</a></li>
  99. </ul></li>
  100. </ul>
  101. </div>
  102. <h1 id="upgrade-and-migration">Upgrade and migration</h1>
  103. <h2 id="preparation">Preparation</h2>
  104. <h3 id="backup-your-data">Backup your data</h3>
  105. <p>Shaarli stores all user data under the <code>data</code> directory:</p>
  106. <ul>
  107. <li><code>data/config.php</code> - main configuration file</li>
  108. <li><code>data/datastore.php</code> - bookmarked links</li>
  109. <li><code>data/ipbans.php</code> - banned IP addresses</li>
  110. </ul>
  111. <p>See <a href="Shaarli-configuration.html">Shaarli configuration</a> for more information about Shaarli resources.</p>
  112. <p>It is recommended to backup this repository <em>before</em> starting updating/upgrading Shaarli:</p>
  113. <ul>
  114. <li>users with SSH access: copy or archive the directory to a temporary location</li>
  115. <li>users with FTP access: download a local copy of your Shaarli installation using your favourite client</li>
  116. </ul>
  117. <h3 id="migrating-data-from-a-previous-installation">Migrating data from a previous installation</h3>
  118. <p>As all user data is kept under <code>data</code>, this is the only directory you need to worry about when migrating to a new installation, which corresponds to the following steps:</p>
  119. <ul>
  120. <li>backup the <code>data</code> directory</li>
  121. <li>install or update Shaarli:
  122. <ul>
  123. <li>fresh installation - see <a href="Download-and-installation.html">Download and installation</a></li>
  124. <li>update - see the following sections</li>
  125. </ul></li>
  126. <li>check or restore the <code>data</code> directory</li>
  127. </ul>
  128. <h2 id="upgrading-from-release-archives">Upgrading from release archives</h2>
  129. <p>All tagged revisions can be downloaded as tarballs or ZIP archives from the <a href="https://github.com/shaarli/Shaarli/releases">releases</a> page.<a href=".html"></a></p>
  130. <p>We <em>recommend</em> using the releases from the <code>stable</code> branch, which are available as:</p>
  131. <ul>
  132. <li>gzipped tarball - <a href="https://github.com/shaarli/Shaarli/archive/stable.tar.gz" class="uri">https://github.com/shaarli/Shaarli/archive/stable.tar.gz</a></li>
  133. <li>ZIP archive - <a href="https://github.com/shaarli/Shaarli/archive/stable.zip" class="uri">https://github.com/shaarli/Shaarli/archive/stable.zip</a></li>
  134. </ul>
  135. <p>Once downloaded, extract the archive locally and update your remote installation (e.g. via FTP) -be sure you keep the contents of the <code>data</code> directory!</p>
  136. <p>After upgrading, access your fresh Shaarli installation from a web browser; the configuration will then be automatically updated, and new settings added to <code>data/config.php</code> (see <a href="Shaarli-configuration.html">Shaarli configuration</a> for more details).</p>
  137. <h2 id="upgrading-with-git">Upgrading with Git</h2>
  138. <h3 id="updating-a-community-shaarli">Updating a community Shaarli</h3>
  139. <p>If you have installed Shaarli from the <a href="Download#clone-with-git-recommended">community Git repository</a>, simply <a href="https://www.git-scm.com/docs/git-pull">pull new changes</a> from your local clone:<a href=".html"></a></p>
  140. <div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="bu">cd</span> /path/to/shaarli
  141. $ <span class="fu">git</span> pull
  142. <span class="ex">From</span> github.com:shaarli/Shaarli
  143. <span class="ex">*</span> branch master -<span class="op">&gt;</span> FETCH_HEAD
  144. <span class="ex">Updating</span> ebd67c6..521f0e6
  145. <span class="ex">Fast-forward</span>
  146. <span class="ex">application/Url.php</span> <span class="kw">|</span> <span class="ex">1</span> +
  147. <span class="ex">shaarli_version.php</span> <span class="kw">|</span> <span class="ex">2</span> +-
  148. <span class="ex">tests/Url/UrlTest.php</span> <span class="kw">|</span> <span class="ex">1</span> +
  149. <span class="ex">3</span> files changed, 3 insertions(+), <span class="ex">1</span> deletion(-)</code></pre></div>
  150. <p>Shaarli &gt;= <code>v0.8.x</code>: install/update third-party PHP dependencies using <a href="https://getcomposer.org/">Composer</a>:<a href=".html"></a></p>
  151. <div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="ex">composer</span> update --no-dev
  152. <span class="ex">Loading</span> composer repositories with package information
  153. <span class="ex">Updating</span> dependencies
  154. <span class="ex">-</span> Installing shaarli/netscape-bookmark-parser (v1.0.1)
  155. <span class="ex">Downloading</span>: 100%</code></pre></div>
  156. <h3 id="migrating-and-upgrading-from-sebsauvages-repository">Migrating and upgrading from Sebsauvage's repository</h3>
  157. <p>If you have installed Shaarli from <a href="https://github.com/sebsauvage/Shaarli">Sebsauvage's original Git repository</a>, you can use <a href="https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes">Git remotes</a> to update your working copy.<a href=".html"></a></p>
  158. <p>The following guide assumes that:</p>
  159. <ul>
  160. <li>you have a basic knowledge of Git <a href="https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell">branching</a> and <a href="https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes">remote repositories</a><a href=".html"></a></li>
  161. <li>the default remote is named <code>origin</code> and points to Sebsauvage's repository</li>
  162. <li>the current branch is <code>master</code>
  163. <ul>
  164. <li>if you have personal branches containing customizations, you will need to <a href="https://git-scm.com/book/en/v2/Git-Branching-Rebasing">rebase them</a> after the upgrade; beware though, a lot of changes have been made since the community fork has been created, so things are very likely to break<embed src=".html" /></li>
  165. </ul></li>
  166. <li>the working copy is clean:
  167. <ul>
  168. <li>no versioned file has been locally modified</li>
  169. <li>no untracked files are present</li>
  170. </ul></li>
  171. </ul>
  172. <h4 id="step-0-show-repository-information">Step 0: show repository information</h4>
  173. <div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="bu">cd</span> /path/to/shaarli
  174. $ <span class="fu">git</span> remote -v
  175. <span class="ex">origin</span> https://github.com/sebsauvage/Shaarli (fetch)
  176. <span class="ex">origin</span> https://github.com/sebsauvage/Shaarli (push)
  177. $ <span class="fu">git</span> branch -vv
  178. <span class="ex">*</span> master 029f75f [origin/master] Update README.md[](.html)
  179. $ <span class="fu">git</span> status
  180. <span class="ex">On</span> branch master
  181. <span class="ex">Your</span> branch is up-to-date with <span class="st">&#39;origin/master&#39;</span>.
  182. <span class="ex">nothing</span> to commit, working directory clean</code></pre></div>
  183. <h4 id="step-1-update-git-remotes">Step 1: update Git remotes</h4>
  184. <pre><code>$ git remote rename origin sebsauvage
  185. $ git remote -v
  186. sebsauvage https://github.com/sebsauvage/Shaarli (fetch)
  187. sebsauvage https://github.com/sebsauvage/Shaarli (push)
  188. $ git remote add origin https://github.com/shaarli/Shaarli
  189. $ git fetch origin
  190. remote: Counting objects: 3015, done.
  191. remote: Compressing objects: 100% (19/19), done.
  192. remote: Total 3015 (delta 446), reused 457 (delta 446), pack-reused 2550
  193. Receiving objects: 100% (3015/3015), 2.59 MiB | 918.00 KiB/s, done.
  194. Resolving deltas: 100% (1899/1899), completed with 48 local objects.
  195. From https://github.com/shaarli/Shaarli
  196. * [new branch] master -&gt; origin/master[](.html)
  197. * [new branch] stable -&gt; origin/stable[](.html)
  198. [...][](.html)
  199. * [new tag] v0.6.4 -&gt; v0.6.4[](.html)
  200. * [new tag] v0.7.0 -&gt; v0.7.0[](.html)</code></pre>
  201. <h4 id="step-2-use-the-stable-community-branch">Step 2: use the stable community branch</h4>
  202. <div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="fu">git</span> checkout origin/stable -b stable
  203. <span class="ex">Branch</span> stable set up to track remote branch stable from origin.
  204. <span class="ex">Switched</span> to a new branch <span class="st">&#39;stable&#39;</span>
  205. $ <span class="fu">git</span> branch -vv
  206. <span class="ex">master</span> 029f75f [sebsauvage/master] Update README.md[](.html)
  207. <span class="ex">*</span> stable 890afc3 [origin/stable] Merge pull request <span class="co">#509 from ArthurHoaro/v0.6.5[](.html)</span></code></pre></div>
  208. <p>Shaarli &gt;= <code>v0.8.x</code>: install/update third-party PHP dependencies using <a href="https://getcomposer.org/">Composer</a>:<a href=".html"></a></p>
  209. <div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="ex">composer</span> update --no-dev
  210. <span class="ex">Loading</span> composer repositories with package information
  211. <span class="ex">Updating</span> dependencies
  212. <span class="ex">-</span> Installing shaarli/netscape-bookmark-parser (v1.0.1)
  213. <span class="ex">Downloading</span>: 100%</code></pre></div>
  214. <p>Optionally, you can delete information related to the legacy version:</p>
  215. <div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="fu">git</span> branch -D master
  216. <span class="ex">Deleted</span> branch master (was 029f75f)<span class="ex">.</span>
  217. $ <span class="fu">git</span> remote remove sebsauvage
  218. $ <span class="fu">git</span> remote -v
  219. <span class="ex">origin</span> https://github.com/shaarli/Shaarli (fetch)
  220. <span class="ex">origin</span> https://github.com/shaarli/Shaarli (push)
  221. $ <span class="fu">git</span> gc
  222. <span class="ex">Counting</span> objects: 3317, done.
  223. <span class="ex">Delta</span> compression using up to 8 threads.
  224. <span class="ex">Compressing</span> objects: 100% (1237/1237), <span class="kw">done</span><span class="ex">.</span>
  225. <span class="ex">Writing</span> objects: 100% (3317/3317), <span class="kw">done</span><span class="ex">.</span>
  226. <span class="ex">Total</span> 3317 (delta 2050), <span class="ex">reused</span> 3301 (delta 2034)<span class="ex">to</span></code></pre></div>
  227. <h4 id="step-3-configuration">Step 3: configuration</h4>
  228. <p>After migrating, access your fresh Shaarli installation from a web browser; the configuration will then be automatically updated, and new settings added to <code>data/config.php</code> (see <a href="Shaarli-configuration.html">Shaarli configuration</a> for more details).</p>
  229. </body>
  230. </html>