From 91a21c272960889afd4eaa431a3d29b7785b6efc Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sat, 16 May 2020 12:54:51 +0200 Subject: **General rewording, proof-reading, deduplication, shortening, reordering, simplification, cleanup/formatting/standardization** - standardize page names, rework documentation structure, update TOC - use same example paths everywhere - level 1 titles on all pages - fix broken links - .md suffix on all page links (works both from readthedocs and github repository views) **Server:** A full and concise installation guide with examples is a frequent request. The documentation should provide such a guide for basic installation needs, while explaining alternative/advanced configuration at the end. Links to reference guides and documentation should be used more frequently to avoid recommending an outdated or excessively complex configuration. - server: move most server-related info to server-configuration.md, cleanup/shorten - server: update list of php dependencies/libraries, link to composer.json - server: installation: support 3 install methods (from release zip, from sources, using docker) - server: installation: use rsync instead of mv as mv results will change depending of taget directory already existing or not - server: add example/basic usage of certbot - server, upgrade, installation: update file permissions setup, use sudo for upgrade operations in webserver document root - server: apache: add comments to configuration, fix and factorize file permissions setup, set cache-control header, deny access to dotfiles, add missing apache config steps, add http->https redirect example - server: nginx: refactor nginx configuration, add comments, DO log access to denied/protected files - server: add links to MDN for x-forwarded-* http headers explanation, cleanup/clarify robots.txt and crawlers section - server: bump file upload size limit to 100MB we have reports of bookmark exports weighing +40MB - i have a 13MB one here - server: simplify phpinfo documentation - server: move backup and restore information to dedicated page - docker: move all docker docs to Docker.md, simplify/ docker setup, add docker-compose.yml example, replace docker-101 with docker cheatsheet - troubleshooting: move all troubleshooting documentation to troubleshooting.md **Usage:** - index: add getting started section on index page - features/usage: move all usage-related documentation to usage.md, add links from the main feature list to corresponding usage docs, clarify/reword features list - shaarli configuration: add note about configuring from web interface **Removed:** - remove obsolete/orphan images - remove obsolete shaarchiver example - remove outdated "decode datastore content" snippet **Development:** - development: move development-related docs (static analysis, CI, unit tests, 3rd party libs, link structure/directory, guidelines, security....) to dev/ directory - development: Merge several pages to development.md - **Breaking change?:** remove mentions of 'stable' branch, switch to new branch/release model (master=latest commit, release=latest tag) - **Breaking change?:** refer to base sharing unit as "Shaare" everywhere (TODO: reflect changes in the code?) doc: update featues list/link to usage.md for details - development: directory structure: add note about required file permissions - .travis-ci.yml: add comments - .htaccess: add comment --- doc/md/3rd-party-libraries.md | 21 - doc/md/Backup-and-restore.md | 11 + doc/md/Browsing-and-searching.md | 37 - doc/md/Community-&-Related-software.md | 78 --- doc/md/Community-and-related-software.md | 98 +++ doc/md/Continuous-integration-tools.md | 32 - doc/md/Development-guidelines.md | 13 - doc/md/Directory-structure.md | 54 -- doc/md/Docker.md | 207 ++++++ doc/md/Download-and-Installation.md | 124 ---- doc/md/FAQ.md | 46 -- doc/md/GnuPG-signature.md | 78 --- doc/md/Installation.md | 84 +++ doc/md/Link-structure.md | 18 - doc/md/Plugin-System.md | 752 -------------------- doc/md/Plugins.md | 51 +- doc/md/REST-API.md | 159 ++--- doc/md/RSS-feeds.md | 28 - doc/md/Release-Shaarli.md | 161 ----- doc/md/Reverse-proxy.md | 116 ++++ doc/md/Security.md | 25 - doc/md/Server-configuration.md | 582 ++++++++-------- doc/md/Server-security.md | 76 --- doc/md/Shaarli-configuration.md | 213 +++--- doc/md/Sharing-content.md | 71 -- doc/md/Static-analysis.md | 13 - doc/md/Theming.md | 83 --- doc/md/Translations.md | 164 ----- doc/md/Troubleshooting.md | 113 ++- doc/md/Unit-tests.md | 119 ---- doc/md/Upgrade-and-migration.md | 154 ++--- doc/md/Usage.md | 109 +++ doc/md/Versioning-and-Branches.md | 75 -- doc/md/dev/Development.md | 179 +++++ doc/md/dev/GnuPG-signature.md | 70 ++ doc/md/dev/Plugin-system.md | 758 +++++++++++++++++++++ doc/md/dev/Release-Shaarli.md | 145 ++++ doc/md/dev/Theming.md | 85 +++ doc/md/dev/Translations.md | 157 +++++ doc/md/dev/Unit-tests.md | 138 ++++ doc/md/dev/Versioning.md | 63 ++ doc/md/dev/images/poedit-1.jpg | Bin 0 -> 72956 bytes doc/md/docker/docker-101.md | 140 ---- doc/md/docker/resources.md | 19 - doc/md/docker/reverse-proxy-configuration.md | 123 ---- doc/md/docker/shaarli-images.md | 118 ---- doc/md/guides/backup-restore-import-export.md | 64 -- doc/md/guides/images/01-create-droplet-distro.jpg | Bin 20909 -> 0 bytes doc/md/guides/images/02-create-droplet-region.jpg | Bin 21603 -> 0 bytes doc/md/guides/images/03-create-droplet-size.jpg | Bin 20860 -> 0 bytes doc/md/guides/images/04-finalize.jpg | Bin 28233 -> 0 bytes doc/md/guides/images/05-droplet.jpg | Bin 11977 -> 0 bytes doc/md/guides/images/06-domain.jpg | Bin 4499 -> 0 bytes doc/md/guides/images/07-installation.jpg | Bin 42832 -> 0 bytes .../install-shaarli-with-debian9-and-docker.md | 257 ------- doc/md/guides/various-hacks.md | 24 - doc/md/images/07-installation.jpg | Bin 0 -> 42832 bytes doc/md/images/bookmarklet.png | Bin 53346 -> 0 bytes doc/md/images/firefoxshare.png | Bin 715 -> 0 bytes doc/md/images/install-shaarli.png | Bin 33827 -> 0 bytes doc/md/images/poedit-1.jpg | Bin 72956 -> 0 bytes doc/md/index.md | 127 ++-- 62 files changed, 2909 insertions(+), 3523 deletions(-) delete mode 100644 doc/md/3rd-party-libraries.md create mode 100644 doc/md/Backup-and-restore.md delete mode 100644 doc/md/Browsing-and-searching.md delete mode 100644 doc/md/Community-&-Related-software.md create mode 100644 doc/md/Community-and-related-software.md delete mode 100644 doc/md/Continuous-integration-tools.md delete mode 100644 doc/md/Development-guidelines.md delete mode 100644 doc/md/Directory-structure.md create mode 100644 doc/md/Docker.md delete mode 100644 doc/md/Download-and-Installation.md delete mode 100644 doc/md/FAQ.md delete mode 100644 doc/md/GnuPG-signature.md create mode 100644 doc/md/Installation.md delete mode 100644 doc/md/Link-structure.md delete mode 100644 doc/md/Plugin-System.md delete mode 100644 doc/md/RSS-feeds.md delete mode 100644 doc/md/Release-Shaarli.md create mode 100644 doc/md/Reverse-proxy.md delete mode 100644 doc/md/Security.md delete mode 100644 doc/md/Server-security.md delete mode 100644 doc/md/Sharing-content.md delete mode 100644 doc/md/Static-analysis.md delete mode 100644 doc/md/Theming.md delete mode 100644 doc/md/Translations.md delete mode 100644 doc/md/Unit-tests.md create mode 100644 doc/md/Usage.md delete mode 100644 doc/md/Versioning-and-Branches.md create mode 100644 doc/md/dev/Development.md create mode 100644 doc/md/dev/GnuPG-signature.md create mode 100644 doc/md/dev/Plugin-system.md create mode 100644 doc/md/dev/Release-Shaarli.md create mode 100644 doc/md/dev/Theming.md create mode 100644 doc/md/dev/Translations.md create mode 100644 doc/md/dev/Unit-tests.md create mode 100644 doc/md/dev/Versioning.md create mode 100644 doc/md/dev/images/poedit-1.jpg delete mode 100644 doc/md/docker/docker-101.md delete mode 100644 doc/md/docker/resources.md delete mode 100644 doc/md/docker/reverse-proxy-configuration.md delete mode 100644 doc/md/docker/shaarli-images.md delete mode 100644 doc/md/guides/backup-restore-import-export.md delete mode 100644 doc/md/guides/images/01-create-droplet-distro.jpg delete mode 100644 doc/md/guides/images/02-create-droplet-region.jpg delete mode 100644 doc/md/guides/images/03-create-droplet-size.jpg delete mode 100644 doc/md/guides/images/04-finalize.jpg delete mode 100644 doc/md/guides/images/05-droplet.jpg delete mode 100644 doc/md/guides/images/06-domain.jpg delete mode 100644 doc/md/guides/images/07-installation.jpg delete mode 100644 doc/md/guides/install-shaarli-with-debian9-and-docker.md delete mode 100644 doc/md/guides/various-hacks.md create mode 100644 doc/md/images/07-installation.jpg delete mode 100644 doc/md/images/bookmarklet.png delete mode 100644 doc/md/images/firefoxshare.png delete mode 100644 doc/md/images/install-shaarli.png delete mode 100644 doc/md/images/poedit-1.jpg (limited to 'doc') diff --git a/doc/md/3rd-party-libraries.md b/doc/md/3rd-party-libraries.md deleted file mode 100644 index 7e7dd334..00000000 --- a/doc/md/3rd-party-libraries.md +++ /dev/null @@ -1,21 +0,0 @@ -## CSS - -- Yahoo UI [CSS Reset](http://yuilibrary.com/yui/docs/cssreset/) - standardize cross-browser rendering - -## Javascript - -- [Awesomeplete](https://leaverou.github.io/awesomplete/) ([GitHub](https://github.com/LeaVerou/awesomplete)) - autocompletion in input forms -- [bLazy](http://dinbror.dk/blazy/) ([GitHub](https://github.com/dinbror/blazy)) - lazy loading for thumbnails -- [qr.js](http://neocotic.com/qr.js/) ([GitHub](https://github.com/neocotic/qr.js)) - QR code generation - -## PHP - -- [RainTPL](https://github.com/rainphp/raintpl) - HTML templating for PHP - -### Composer - -Library | Usage ----|--- -[`shaarli/netscape-bookmark-parser`](https://packagist.org/packages/shaarli/netscape-bookmark-parser) | Import bookmarks from Netscape files -[`erusev/parsedown`](https://packagist.org/packages/erusev/parsedown) | Parse MarkDown syntax for the MarkDown plugin -[`slim/slim`](https://packagist.org/packages/slim/slim) | Handle routes and middleware for the REST API diff --git a/doc/md/Backup-and-restore.md b/doc/md/Backup-and-restore.md new file mode 100644 index 00000000..e7e2775c --- /dev/null +++ b/doc/md/Backup-and-restore.md @@ -0,0 +1,11 @@ +## Backup and restore + +All data and [configuration](Shaarli-configuration.md) is kept in the `data` directory. Backup this directory: + +```bash +rsync -avzP my.server.com:/var/www/shaarli.mydomain.org/data ~/backups/shaarli-data-$(date +%Y-%m-%d_%H%M) +``` + +It is strongly recommended to do periodic, automatic backups to a seperate machine. You can automate the command above using a cron job or full-featured backup solutions such as [rsnapshot](https://rsnapshot.org/) + +To restore a backup, simply put back the `data/` directory in place, owerwriting any existing files. \ No newline at end of file diff --git a/doc/md/Browsing-and-searching.md b/doc/md/Browsing-and-searching.md deleted file mode 100644 index 16c69855..00000000 --- a/doc/md/Browsing-and-searching.md +++ /dev/null @@ -1,37 +0,0 @@ -## Plain text search - -Use the `Search text` field to search in _any_ of the fields of all links (Title, URL, Description...) - -**Exclude text/tags:** Use the `-` operator before a word or tag (example `-uninteresting`) to prevent entries containing (or tagged) `uninteresting` from showing up in the search results. - -**Exact text search:** Use double-quotes (example `"exact search"`) to search for the exact expression. - -Both exclude patterns and exact searches can be combined with normal searches (example `"exact search" term otherterm -notthis "very exact" stuff -notagain`) - -## Tags search - -Use the `Filter by tags` field to restrict displayed links to entries tagged with one or multiple tags (use space to separate tags). - -**Hidden tags:** Tags starting with a dot `.` (example `.secret`) are private. They can only be seen and searched when logged in. - -### Tag cloud - -The `Tag cloud` page diplays a "cloud" view of all tags in your Shaarli. - - * The most frequently used tags are displayed with a bigger font size. - * When sorting by `Most used` or `Alphabetical`, tags are displayed as a _list_, along with counters and edit/delete buttons for each tag. - * Clicking on any tag will display a list of all Shaares matching this tag. - * Clicking on the counter next to a tag `example`, will filter the tag cloud to only display tags found in Shaares tagged `example`. Repeat this any number of times to further filter the tag cloud. Click `List all links with those tags` to display Shaares matching your current tag filter. - -## Filtering RSS feeds/Picture wall - -RSS feeds can also be restricted to only return items matching a text/tag search: see [RSS feeds](RSS-feeds). - -## Filter buttons - -Filter buttons can be found at the top left of the link list. They allow you to apply different filters to the list: - - * **Private links:** When this toggle button is enabled, only shaares set to `private` will be shown. - * **Untagged links:** When the this toggle button is enabled (top left of the link list), only shaares _without any tags_ will be shown in the link list. - -Filter buttons are only available when logged in. diff --git a/doc/md/Community-&-Related-software.md b/doc/md/Community-&-Related-software.md deleted file mode 100644 index 54f18c8e..00000000 --- a/doc/md/Community-&-Related-software.md +++ /dev/null @@ -1,78 +0,0 @@ -_Unofficial but related work on Shaarli. If you maintain one of these, -please get in touch with us to help us find a way to adapt your work to our fork._ - -## Related software - - -### REST API clients -See [REST API](REST-API) for a list of official and community clients. - - -### Third party plugins -- [autosave](https://github.com/kalvn/shaarli-plugin-autosave) by [@kalvn](https://github.com/kalvn): Automatically saves data when editing a link to avoid any loss in case of crash or unexpected shutdown. -- [Code Coloration](https://github.com/ArthurHoaro/code-coloration) by [@ArthurHoaro](https://github.com/ArthurHoaro): client side code syntax highlighter. -- [Disqus](https://github.com/kalvn/shaarli-plugin-disqus) by [@kalvn](https://github.com/kalvn): Adds Disqus comment system to your Shaarli. -- [google analytics](https://github.com/ericjuden/Shaarli-Google-Analytics-Plugin) by [@ericjuden](http://github.com/ericjuden): Adds Google Analytics tracking support -- [launch](https://github.com/ArthurHoaro/launch-plugin) - Launch Plugin is a plugin designed to enhance and customize Launch Theme for Shaarli. -- [markdown-toolbar](https://github.com/immanuelfodor/shaarli-markdown-toolbar) by [@immanuelfodor](https://github.com/immanuelfodor) - Easily insert markdown syntax into the Description field when editing a link. -- [related](https://github.com/ilesinge/shaarli-related) by [@ilesinge](https://github.com/ilesinge) - Show related links based on the number of identical tags. -- [social](https://github.com/alexisju/social) by [@alexisju](https://github.com/alexisju): share links to social networks. -- [shaarli2twitter](https://github.com/ArthurHoaro/shaarli2twitter) by [@ArthurHoaro](https://github.com/ArthurHoaro) - Automatically tweet your shared links from Shaarli -- [shaarli2mastodon](https://github.com/kalvn/shaarli2mastodon) by [@kalvn](https://github.com/kalvn) - This Shaarli plugin allows you to automatically publish links you post on your Mastodon timeline. -- [shaarli-descriptor](https://github.com/immanuelfodor/shaarli-descriptor) by [@immanuelfodor](https://github.com/immanuelfodor) - Customize the default height/number of rows of the Description field when editing a link. -- [urlextern](https://github.com/trailjeep/shaarli-urlextern) by [@trailjeep](https://github.com/trailjeep) - Shaarli plugin to open external links in a new tab/window. -- [favicons](https://github.com/trailjeep/shaarli-favicons) by [@trailjeep](https://github.com/trailjeep) - Shaarli plugin to add favicon/filetype icons to links. - -### Third-party themes -See [Theming](Theming) for a list of community-contributed themes, and an installation guide. - - -### Integration with other platforms -- [tt-rss-shaarli](https://github.com/jcsaaddupuy/tt-rss-shaarli) - [Tiny-Tiny RSS](http://tt-rss.org/) plugin that adds support for sharing articles with Shaarli -- [octopress-shaarli](https://github.com/ahmet2mir/octopress-shaarli) - Octopress plugin to retrieve Shaarli links on the sidebar -- [Scuttle to Shaarli](https://github.com/q2apro/scuttle-to-shaarli) - Import bookmarks from Scuttle -- [Shaarli app for Cloudron](https://git.cloudron.io/cloudron/shaarli-app) - Effortlessly run Shaarli with the help of [Cloudron](https://cloudron.io/) [![Install](https://cloudron.io/img/button.svg)](https://cloudron.io/button.html?app=com.github.shaarli) -- [Shaarli_ynh](https://github.com/YunoHost-Apps/shaarli_ynh) - Shaarli is available as a [Yunohost](https://yunohost.org) app [![Install Shaarli with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=shaarli) -- [pelican](https://blog.getpelican.com) static blog generator plugin to auto-post articles on a Shaarli instance: [shaarli_poster](https://github.com/getpelican/pelican-plugins/tree/master/shaarli_poster) - -### Mobile Apps -- [ShaarliOS](https://github.com/mro/ShaarliOS) - Apple iOS share extension. -- [Shaarli for Android](http://sebsauvage.net/links/?ZAyDzg) - Android application that adds Shaarli as a sharing provider -- [Shaarlier for Android](https://github.com/dimtion/Shaarlier) - Android application to simply add links directly into your Shaarli -- [Stakali for Android](https://stakali.toneiv.eu) - Stakali is a personal bookmark manager which synchronizes with Shaarli - -### Desktop Apps -- [Ulauncher Extension](https://github.com/sebw/ulauncher-shaarli) - Ulauncher is an an application launcher for Linux, this extension allows research in your Shaarli - -### Browser addons -- [Shaarli Firefox Extension](https://github.com/ikipatang/shaarli-web-extension) - toolbar button to share your current tab with Shaarli. -- [Shaarli Chrome Extension](https://github.com/octplane/Shiny-Shaarli) - toolbar button to share your current tab with Shaarli. - -### Server apps -- [shaarchiver](https://github.com/nodiscc/shaarchiver) - Archive your Shaarli bookmarks and their content -- [shaarli-river](https://github.com/mknexen/shaarli-river) - An aggregator for shaarlis with many features -- [Shaarlo](https://github.com/DMeloni/shaarlo) - An aggregator for shaarlis with many features (a very popular running instance among French shaarliers: [shaarli.fr](http://shaarli.fr/)) -- [Shaarlimages](https://github.com/BoboTiG/shaarlimages) - An image-oriented aggregator for Shaarlis -- [mknexen/shaarli-api](https://github.com/mknexen/shaarli-api) - A REST API for Shaarli -- [Self dead link](https://framagit.org/qwertygc/shaarli-dev-code/blob/master/self-dead-link.php) - Detect dead links on shaarli. This version use the database of shaarli. [Another version](https://framagit.org/qwertygc/shaarli-dev-code/blob/master/dead-link.php), can be used for other shaarli instances (but is more resource consuming). -- [Bookmark Archiver](https://github.com/pirate/bookmark-archiver) - Save an archived copy of all websites starred using browser bookmarks/Shaarli/Delicious/Instapaper/Unmark.it/Pocket/Pinboard. Outputs browseable html. - -## Alternatives to Shaarli -See [awesome-selfhosted: bookmarks & link sharing](https://github.com/Kickball/awesome-selfhosted/#bookmarks--link-sharing). - -## Community -- [Liens en vrac de sebsauvage](http://sebsauvage.net/links/) - the original Shaarli -- [A large list of Shaarlis](http://porneia.free.fr/pub/links/ou-est-shaarli.html) -- [A list of working Shaarli aggregators](https://raw.githubusercontent.com/Oros42/find_shaarlis/master/annuaires.json) -- [A list of some known Shaarlis](https://github.com/Oros42/shaarlis_list) -- [Adieu Delicious, Diigo et StumbleUpon. Salut Shaarli ! - sebsauvage.net](http://sebsauvage.net/rhaa/index.php?2011/09/16/09/29/58-adieu-delicious-diigo-et-stumbleupon-salut-shaarli-) (fr) _16/09/2011 - the original post about Shaarli_ -- [Original ideas/fixme/TODO page](http://sebsauvage.net/wiki/doku.php?id=php:shaarli:ideas) -- [Original discussion page](http://sebsauvage.net/wiki/doku.php?id=php:shaarli:discussion) (fr) -- [Original revisions history](http://sebsauvage.net/wiki/doku.php?id=php:shaarli:history) -- [Shaarli.fr/my](https://www.shaarli.fr/my.php) - Unofficial, unsupported (old fork) hosted Shaarlis provider, courtesy of [DMeloni](https://github.com/DMeloni) - -### Articles and social media discussions -- 2016-09-22 - Hacker News - https://news.ycombinator.com/item?id=12552176 -- 2015-08-15 - Reddit - [Question about migrating from WordPress to Shaarli.](https://www.reddit.com/r/selfhosted/comments/3h3zwh/question_about_migrating_from_wordpress_to_shaarli/) -- 2015-06-22 - Hacker News - https://news.ycombinator.com/item?id=9755366 -- 2015-05-12 - Reddit - [shaarli - Self hosted Bookmarking / Delicious (PHP, MySQL)](https://www.reddit.com/r/selfhosted/comments/35pkkc/shaarli_self_hosted_bookmarking_delicious_php/) diff --git a/doc/md/Community-and-related-software.md b/doc/md/Community-and-related-software.md new file mode 100644 index 00000000..eac9d074 --- /dev/null +++ b/doc/md/Community-and-related-software.md @@ -0,0 +1,98 @@ +# Community & related software + +_Unofficial but related work on Shaarli. If you maintain one of these, +please get in touch with us to help us find a way to adapt your work to our fork._ + + +## Related software + +### REST API clients +See [REST API](REST-API) for a list of official and community clients. + + +### Third party plugins + +- [autosave](https://github.com/kalvn/shaarli-plugin-autosave) by [@kalvn](https://github.com/kalvn): Automatically saves data when editing a Shaare to avoid any loss in case of crash or unexpected shutdown. +- [Code Coloration](https://github.com/ArthurHoaro/code-coloration) by [@ArthurHoaro](https://github.com/ArthurHoaro): client side code syntax highlighter. +- [Disqus](https://github.com/kalvn/shaarli-plugin-disqus) by [@kalvn](https://github.com/kalvn): Adds Disqus comment system to your Shaarli. +- [google analytics](https://github.com/ericjuden/Shaarli-Google-Analytics-Plugin) by [@ericjuden](http://github.com/ericjuden): Adds Google Analytics tracking support +- [launch](https://github.com/ArthurHoaro/launch-plugin) - Launch Plugin is a plugin designed to enhance and customize Launch Theme for Shaarli. +- [markdown-toolbar](https://github.com/immanuelfodor/shaarli-markdown-toolbar) by [@immanuelfodor](https://github.com/immanuelfodor) - Easily insert markdown syntax into the Description field when editing a Shaare. +- [related](https://github.com/ilesinge/shaarli-related) by [@ilesinge](https://github.com/ilesinge) - Show related Shaares based on the number of identical tags. +- [social](https://github.com/alexisju/social) by [@alexisju](https://github.com/alexisju): share links to social networks. +- [shaarli2twitter](https://github.com/ArthurHoaro/shaarli2twitter) by [@ArthurHoaro](https://github.com/ArthurHoaro) - Automatically tweet your Shaares from Shaarli +- [shaarli2mastodon](https://github.com/kalvn/shaarli2mastodon) by [@kalvn](https://github.com/kalvn) - This Shaarli plugin allows you to automatically publish links you post on your Mastodon timeline. +- [shaarli-descriptor](https://github.com/immanuelfodor/shaarli-descriptor) by [@immanuelfodor](https://github.com/immanuelfodor) - Customize the default height/number of rows of the Description field when editing a Shaare. +- [urlextern](https://github.com/trailjeep/shaarli-urlextern) by [@trailjeep](https://github.com/trailjeep) - Shaarli plugin to open external links in a new tab/window. +- [favicons](https://github.com/trailjeep/shaarli-favicons) by [@trailjeep](https://github.com/trailjeep) - Shaarli plugin to add favicon/filetype icons to Shaares. + + +### Third-party themes + +See [Theming](Theming) for a list of community-contributed themes, and an installation guide. + + +### Integration with other platforms + +- [tt-rss-shaarli](https://github.com/jcsaaddupuy/tt-rss-shaarli) - [Tiny-Tiny RSS](http://tt-rss.org/) plugin that adds support for sharing articles with Shaarli +- [octopress-shaarli](https://github.com/ahmet2mir/octopress-shaarli) - Octopress plugin to retrieve Shaarli Shaares on the sidebar +- [Scuttle to Shaarli](https://github.com/q2apro/scuttle-to-shaarli) - Import bookmarks from Scuttle +- [Shaarli app for Cloudron](https://git.cloudron.io/cloudron/shaarli-app) - Effortlessly run Shaarli with the help of [Cloudron](https://cloudron.io/) [![Install](https://cloudron.io/img/button.svg)](https://cloudron.io/button.html?app=com.github.shaarli) +- [Shaarli_ynh](https://github.com/YunoHost-Apps/shaarli_ynh) - Shaarli is available as a [Yunohost](https://yunohost.org) app [![Install Shaarli with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=shaarli) +- [pelican](https://blog.getpelican.com) static blog generator plugin to auto-post articles on a Shaarli instance: [shaarli_poster](https://github.com/getpelican/pelican-plugins/tree/master/shaarli_poster) + + +### Mobile Apps + +- [ShaarliOS](https://github.com/mro/ShaarliOS) - Apple iOS share extension. +- [Shaarli for Android](http://sebsauvage.net/links/?ZAyDzg) - Android application that adds Shaarli as a sharing provider +- [Shaarlier for Android](https://github.com/dimtion/Shaarlier) - Android application to simply add Shaares directly into your Shaarli +- [Stakali for Android](https://stakali.toneiv.eu) - Stakali is a personal bookmark manager which synchronizes with Shaarli + + +### Desktop Apps + +- [Ulauncher Extension](https://github.com/sebw/ulauncher-shaarli) - Ulauncher is an an application launcher for Linux, this extension allows research in your Shaarli + + +### Browser addons + +- [Shaarli Firefox Extension](https://github.com/ikipatang/shaarli-web-extension) - toolbar button to share your current tab with Shaarli. +- [Shaarli Chrome Extension](https://github.com/octplane/Shiny-Shaarli) - toolbar button to share your current tab with Shaarli. + + +### Server apps + +- [shaarchiver](https://github.com/nodiscc/shaarchiver) - Archive your Shaarli bookmarks and their content +- [shaarli-river](https://github.com/mknexen/shaarli-river) - An aggregator for shaarlis with many features +- [Shaarlo](https://github.com/DMeloni/shaarlo) - An aggregator for shaarlis with many features (a very popular running instance among French shaarliers: [shaarli.fr](http://shaarli.fr/)) +- [Shaarlimages](https://github.com/BoboTiG/shaarlimages) - An image-oriented aggregator for Shaarlis +- [mknexen/shaarli-api](https://github.com/mknexen/shaarli-api) - A REST API for Shaarli +- [Self dead link](https://framagit.org/qwertygc/shaarli-dev-code/blob/master/self-dead-link.php) - Detect dead links on shaarli. This version use the database of shaarli. [Another version](https://framagit.org/qwertygc/shaarli-dev-code/blob/master/dead-link.php), can be used for other shaarli instances (but is more resource consuming). +- [Bookmark Archiver](https://github.com/pirate/bookmark-archiver) - Save an archived copy of all websites starred using browser bookmarks/Shaarli/Delicious/Instapaper/Unmark.it/Pocket/Pinboard. Outputs browseable html. + + +## Alternatives to Shaarli + +See [awesome-selfhosted: bookmarks & link sharing](https://github.com/Kickball/awesome-selfhosted/#bookmarks--link-sharing). + + +## Community + +- [Liens en vrac de sebsauvage](http://sebsauvage.net/links/) - the original Shaarli +- [A large list of Shaarlis](http://porneia.free.fr/pub/links/ou-est-shaarli.html) +- [A list of working Shaarli aggregators](https://raw.githubusercontent.com/Oros42/find_shaarlis/master/annuaires.json) +- [A list of some known Shaarlis](https://github.com/Oros42/shaarlis_list) +- [Adieu Delicious, Diigo et StumbleUpon. Salut Shaarli ! - sebsauvage.net](http://sebsauvage.net/rhaa/index.php?2011/09/16/09/29/58-adieu-delicious-diigo-et-stumbleupon-salut-shaarli-) (fr) _16/09/2011 - the original post about Shaarli_ +- [Original ideas/fixme/TODO page](http://sebsauvage.net/wiki/doku.php?id=php:shaarli:ideas) +- [Original discussion page](http://sebsauvage.net/wiki/doku.php?id=php:shaarli:discussion) (fr) +- [Original revisions history](http://sebsauvage.net/wiki/doku.php?id=php:shaarli:history) +- [Shaarli.fr/my](https://www.shaarli.fr/my.php) - Unofficial, unsupported (old fork) hosted Shaarlis provider, courtesy of [DMeloni](https://github.com/DMeloni) + + +### Articles and social media discussions + +- 2016-09-22 - Hacker News - https://news.ycombinator.com/item?id=12552176 +- 2015-08-15 - Reddit - [Question about migrating from WordPress to Shaarli.](https://www.reddit.com/r/selfhosted/comments/3h3zwh/question_about_migrating_from_wordpress_to_shaarli/) +- 2015-06-22 - Hacker News - https://news.ycombinator.com/item?id=9755366 +- 2015-05-12 - Reddit - [shaarli - Self hosted Bookmarking / Delicious (PHP, MySQL)](https://www.reddit.com/r/selfhosted/comments/35pkkc/shaarli_self_hosted_bookmarking_delicious_php/) diff --git a/doc/md/Continuous-integration-tools.md b/doc/md/Continuous-integration-tools.md deleted file mode 100644 index f7819d5a..00000000 --- a/doc/md/Continuous-integration-tools.md +++ /dev/null @@ -1,32 +0,0 @@ -## Local development -A [`Makefile`](https://github.com/shaarli/Shaarli/blob/master/Makefile) is available to perform project-related operations: - -- Documentation - generate a local HTML copy of the GitHub wiki -- [Static analysis](Static-analysis) - check that the code is compliant to PHP conventions -- [Unit tests](Unit-tests) - ensure there are no regressions introduced by new commits - -## Automatic builds -[Travis CI](http://docs.travis-ci.com/) is a Continuous Integration build server, that runs a build: - -- each time a commit is merged to the mainline (`master` branch) -- each time a Pull Request is submitted or updated - -A build is composed of several jobs: one for each supported PHP version (see [Server requirements](Server requirements)). - -Each build job: - -- updates Composer -- installs 3rd-party test dependencies with Composer -- runs [Unit tests](Unit-tests) -- runs ESLint check - -After all jobs have finished, Travis returns the results to GitHub: - -- a status icon represents the result for the `master` branch: [![](https://api.travis-ci.org/shaarli/Shaarli.svg)](https://travis-ci.org/shaarli/Shaarli) -- Pull Requests are updated with the Travis result - - Green: all tests have passed - - Red: some tests failed - - Orange: tests are pending - -## Documentation -[mkdocs](https://www.mkdocs.org/) is used to convert markdown documentation to HTML pages. The [public documentation](https://shaarli.readthedocs.io/en/master/) website is rendered and hosted by [readthedocs.org](https://readthedocs.org/). A copy of the documentation is also included in prebuilt [release archives](https://github.com/shaarli/Shaarli/releases) (`doc/html/` path in your Shaarli installation). To generate the HTML documentation locally, install a recent version of Python `setuptools` and run `make doc`. diff --git a/doc/md/Development-guidelines.md b/doc/md/Development-guidelines.md deleted file mode 100644 index 46b7c6f8..00000000 --- a/doc/md/Development-guidelines.md +++ /dev/null @@ -1,13 +0,0 @@ -## Development guidelines - -Please have a look at the following pages: - -- [Contributing to Shaarli](https://github.com/shaarli/Shaarli/tree/master/CONTRIBUTING.md) -- [Static analysis](Static-analysis) - patches should try to stick to the -[PHP Standard Recommendations](http://www.php-fig.org/psr/) (PSR), especially: - - [PSR-1](http://www.php-fig.org/psr/psr-1/) - Basic Coding Standard - - [PSR-2](http://www.php-fig.org/psr/psr-2/) - Coding Style Guide -- [Unit tests](Unit-tests) -- Javascript linting - Shaarli uses [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript). -Run `make eslint` to check JS style. -- [GnuPG signature](GnuPG-signature) for tags/releases diff --git a/doc/md/Directory-structure.md b/doc/md/Directory-structure.md deleted file mode 100644 index c0b49393..00000000 --- a/doc/md/Directory-structure.md +++ /dev/null @@ -1,54 +0,0 @@ -## Directory structure - -Here is the directory structure of Shaarli and the purpose of the different files: - -```bash - index.php # Main program - application/ # Shaarli classes - ├── LinkDB.php - - ... - - └── Utils.php - tests/ # Shaarli unitary & functional tests - ├── LinkDBTest.php - - ... - - ├── utils # utilities to ease testing - │ └── ReferenceLinkDB.php - └── UtilsTest.php - assets/ - ├── common/ # Assets shared by multiple themes - ├── ... - ├── default/ # Assets for the default template, before compilation - ├── fonts/ # Font files - ├── img/ # Images used by the default theme - ├── js/ # JavaScript files in ES6 syntax - ├── scss/ # SASS files - └── vintage/ # Assets for the vintage template, before compilation - └── ... - COPYING # Shaarli license - inc/ # static assets and 3rd party libraries - └── rain.tpl.class.php # RainTPL templating library - images/ # Images and icons used in Shaarli - data/ # data storage: bookmark database, configuration, logs, banlist... - ├── config.json.php # Shaarli configuration (login, password, timezone, title...) - ├── datastore.php # Your link database (compressed). - ├── ipban.php # IP address ban system data - ├── lastupdatecheck.txt # Update check timestamp file - └── log.txt # login/IPban log. - tpl/ # RainTPL templates for Shaarli. They are used to build the pages. - ├── default/ # Default Shaarli theme - ├── fonts/ # Font files - ├── img/ # Images - ├── js/ # JavaScript files compiled by Babel and compatible with all browsers - ├── css/ # CSS files compiled with SASS - └── vintage/ # Legacy Shaarli theme - └── ... - cache/ # thumbnails cache - # This directory is automatically created. You can erase it anytime you want. - tmp/ # Temporary directory for compiled RainTPL templates. - # This directory is automatically created. You can erase it anytime you want. - vendor/ # Third-party dependencies. This directory is created by Composer -``` diff --git a/doc/md/Docker.md b/doc/md/Docker.md new file mode 100644 index 00000000..bcd8cff2 --- /dev/null +++ b/doc/md/Docker.md @@ -0,0 +1,207 @@ +# Docker + +[Docker](https://docs.docker.com/get-started/overview/) is an open platform for developing, shipping, and running applications + +## Install Docker + +Install [Docker](https://www.docker.com/), by following the instructions relevant to your OS / distribution, and start the service. For example on [Debian](https://docs.docker.com/engine/install/debian/): + +```bash +# update your package lists +$ sudo apt update +# remove old versions +$ sudo apt-get remove docker docker-engine docker.io containerd runc +# install requirements +$ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common +# add docker's GPG signing key +curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - +# add the repository +$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" +# install docker engine +$ sudo apt-get update +$ sudo apt-get install docker-ce docker-ce-cli containerd.io +# verify that Docker is properly configured +root@stretch-shaarli-02:~$ docker run hello-world +``` + + +## Get and run a Shaarli image + +Shaarli images are available on [DockerHub](https://hub.docker.com/r/shaarli/shaarli/): + +- `latest`: latest branch +- `master`: master branch + +These images are built automatically on DockerHub and rely on: + +- [Alpine Linux](https://www.alpinelinux.org/) +- [PHP7-FPM](http://php-fpm.org/) +- [Nginx](http://nginx.org/) + +Additional Dockerfiles are provided for the `arm32v7` platform, relying on [Linuxserver.io Alpine armhf images](https://hub.docker.com/r/lsiobase/alpine.armhf/). These images must be built using [`docker build`](https://docs.docker.com/engine/reference/commandline/build/) on an `arm32v7` machine or using an emulator such as [qemu](https://resin.io/blog/building-arm-containers-on-any-x86-machine-even-dockerhub/). + +```bash +# download the 'latest' image from dockerhub +docker pull shaarli/shaarli + +# create persistent data volumes/directories on the host +docker volume create shaarli-data +docker volume create shaarli-cache + +# create a new container using the Shaarli image +# --detach: run the container in background +# --name: name of the created container/instance +# --publish: map the host's :8000 port to the container's :80 port +# --rm: automatically remove the container when it exits +# --volume: mount persistent volumes in the container ($volume_name:$volume_mountpoint) +docker run --detach \ + --name myshaarli \ + --publish 8000:80 \ + --rm \ + --volume shaarli-data:/var/www/shaarli/data \ + --volume shaarli-cache:/var/www/shaarli/cache \ + shaarli/shaarli + +# verify that the container is running +docker ps | grep myshaarli + +# to completely remove the container +docker stop myshaarli # stop the running container +docker ps | grep myshaarli # verify the container is no longer running +docker ps -a | grep myshaarli # verify the container is stopped +docker rm myshaarli # destroy the container +docker ps -a | grep myshaarli # verify th container has been destroyed + +``` + +## Docker Compose + +A [Compose file](https://docs.docker.com/compose/compose-file/) is a common format for defining and running multi-container Docker applications. + +A `docker-compose.yml` file can be used to run a persistent/autostarted shaarli service using [Docker Compose](https://docs.docker.com/compose/) or in a [Docker stack](https://docs.docker.com/engine/reference/commandline/stack_deploy/). + +Shaarli provides configuration file for Docker Compose, that will setup a Shaarli instance, a [Træfik](https://hub.docker.com/_/traefik/) instance with [Let's Encrypt](https://letsencrypt.org/) certificates, a Docker network, and volumes for Shaarli data and Træfik TLS configuration and certificates. + +```bash +Download docker-compose from the [release page](https://docs.docker.com/compose/install/): + +```shell +$ sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose +$ sudo chmod +x /usr/local/bin/docker-compose +# create a new directory to store the configuration: +$ mkdir shaarli && cd shaarli +# Download the current version of Shaarli's docker-compose.yml +$ curl -L https://raw.githubusercontent.com/shaarli/Shaarli/master/docker-compose.yml -o docker-compose.yml +# Create the .env file and fill in your VPS and domain information +# (replace and with your actual information) +$ echo 'SHAARLI_VIRTUAL_HOST=shaarli.mydomain.org' > .env +$ echo 'SHAARLI_LETSENCRYPT_EMAIL=admin@mydomain.org' >> .env +# Pull the Docker images +$ docker-compose pull +# Run! +$ docker-compose up -d +``` + + + +### Running dockerized Shaarli as a systemd service + +It is possible to start a dockerized Shaarli instance as a systemd service (systemd is the service management tool on several distributions). After installing Docker, use the following steps to run your shaarli container Shaarli to run on system start. + +As root, create `/etc/systemd/system/docker.shaarli.service`: + +```ini +[Unit] +Description=Shaarli Bookmark Manager Container +After=docker.service +Requires=docker.service + + +[Service] +Restart=always + +# Put any environment you want in an included file, like $host- or $domainname in this example +EnvironmentFile=/etc/sysconfig/box-environment + +# It's just an example.. +ExecStart=/usr/bin/docker run \ + -p 28010:80 \ + --name ${hostname}-shaarli \ + --hostname shaarli.${domainname} \ + -v /srv/docker-volumes-local/shaarli-data:/var/www/shaarli/data:rw \ + -v /etc/localtime:/etc/localtime:ro \ + shaarli/shaarli:latest + +ExecStop=/usr/bin/docker rm -f ${hostname}-shaarli + +[Install] +WantedBy=multi-user.target +``` + +```bash +# reload systemd services definitions +systemctl daemon-reload +# start the servie and enable it a boot time +systemctl enable docker.shaarli.service --now +# verify that the service is running +systemctl status docker.* +# inspect system log if needed +journalctl -f +``` + + + +## Docker cheatsheet + +```bash +# pull/update an image +$ docker pull shaarli:release +# run a container from an image +$ docker run shaarli:latest +# list available images +$ docker images ls +# list running containers +$ docker ps +# list running AND stopped containers +$ docker ps -a +# run a command in a running container +$ docker exec -ti bash +# follow logs of a running container +$ docker logs -f +# delete unused images to free up disk space +$ docker system prune --images +# delete unused volumes to free up disk space (CAUTION all data in unused volumes will be lost) +$ docker system prunt --volumes +# delete unused containers +$ docker system prune +``` + + +## References + +- [Docker: using volumes](https://docs.docker.com/storage/volumes/) +- [Dockerfile best practices](https://docs.docker.com/articles/dockerfile_best-practices/) +- [Dockerfile reference](https://docs.docker.com/reference/builder/) +- [DockerHub: GitHub automated build](https://docs.docker.com/docker-hub/github/) +- [DockerHub: Repositories](https://docs.docker.com/userguide/dockerrepos/) +- [DockerHub: Teams and organizations](https://docs.docker.com/docker-hub/orgs/) +- [Get Docker CE for Debian](https://docs.docker.com/install/linux/docker-ce/debian/) +- [Install Docker Compose](https://docs.docker.com/compose/install/) +- [Interactive Docker training portal](https://www.katacoda.com/courses/docker/) on [Katakoda](https://www.katacoda.com/) +- [Service management: Nginx in the foreground](http://nginx.org/en/docs/ngx_core_module.html#daemon) +- [Service management: Using supervisord](https://docs.docker.com/articles/using_supervisord/) +- [Volumes](https://docs.docker.com/storage/volumes/) +- [Volumes](https://docs.docker.com/userguide/dockervolumes/) +- [Where are Docker images stored?](http://blog.thoward37.me/articles/where-are-docker-images-stored/) +- [docker create](https://docs.docker.com/engine/reference/commandline/create/) +- [Docker Documentation](https://docs.docker.com/) +- [docker exec](https://docs.docker.com/engine/reference/commandline/exec/) +- [docker images](https://docs.docker.com/engine/reference/commandline/images/) +- [docker logs](https://docs.docker.com/engine/reference/commandline/logs/) +- [docker logs](https://docs.docker.com/engine/reference/commandline/logs/) +- [Docker Overview](https://docs.docker.com/engine/docker-overview/) +- [docker ps](https://docs.docker.com/engine/reference/commandline/ps/) +- [docker pull](https://docs.docker.com/engine/reference/commandline/pull/) +- [docker run](https://docs.docker.com/engine/reference/commandline/run/) +- [docker-compose logs](https://docs.docker.com/compose/reference/logs/) +- Træfik: [Getting Started](https://docs.traefik.io/), [Docker backend](https://docs.traefik.io/configuration/backends/docker/), [Let's Encrypt](https://docs.traefik.io/user-guide/docker-and-lets-encrypt/), [Docker image](https://hub.docker.com/_/traefik/) \ No newline at end of file diff --git a/doc/md/Download-and-Installation.md b/doc/md/Download-and-Installation.md deleted file mode 100644 index ec68762e..00000000 --- a/doc/md/Download-and-Installation.md +++ /dev/null @@ -1,124 +0,0 @@ -To install Shaarli, simply place the files in a directory under your webserver's -Document Root (or directly at the document root). - -Also, please make sure your server is properly [configured](Server-configuration.md). - -Multiple releases branches are available: - -- latest (last release) -- stable (previous major release) -- master (development) - -Using one of the following methods: - -- by downloading full release archives including all dependencies -- by downloading Github archives -- by cloning the Git repository -- using Docker: [see the documentation](docker/shaarli-images.md) - --------------------------------------------------------------------------------- - -## Latest release (recommended) - -### Download as an archive - -In most cases, you should download the latest Shaarli release from the [releases](https://github.com/shaarli/Shaarli/releases) page. Download our **shaarli-full** archive to include dependencies. - -The current latest released version is `v0.10.4` - -```bash -$ wget https://github.com/shaarli/Shaarli/releases/download/v0.10.4/shaarli-v0.10.4-full.zip -$ unzip shaarli-v0.10.4-full.zip -$ mv Shaarli /path/to/shaarli/ -``` - -### Using git - -Cloning using `git` or downloading Github branches as zip files requires additional steps: - - * Install [Composer](Unit-tests.md#install_composer) to manage third-party [PHP dependencies](3rd-party-libraries.md#composer). - * Install [yarn](https://yarnpkg.com/lang/en/docs/install/) to build the frontend dependencies. - * Install [python3-virtualenv](https://pypi.python.org/pypi/virtualenv) to build the local HTML documentation. - -``` -$ mkdir -p /path/to/shaarli && cd /path/to/shaarli/ -$ git clone -b latest https://github.com/shaarli/Shaarli.git . -$ composer install --no-dev --prefer-dist -$ make build_frontend -$ make translate -$ make htmldoc -``` - --------------------------------------------------------------------------------- - -## Stable version - -The stable version has been experienced by Shaarli users, and will receive security updates. - - -### Download as an archive - -As a .zip archive: - -```bash -$ wget https://github.com/shaarli/Shaarli/archive/stable.zip -$ unzip stable.zip -$ mv Shaarli-stable /path/to/shaarli/ -``` - -As a .tar.gz archive : - -```bash -$ wget https://github.com/shaarli/Shaarli/archive/stable.tar.gz -$ tar xvf stable.tar.gz -$ mv Shaarli-stable /path/to/shaarli/ -``` - -### Using git - -Install [Composer](Unit-tests.md#install_composer) to manage Shaarli dependencies. - -```bash -$ git clone https://github.com/shaarli/Shaarli.git -b stable /path/to/shaarli/ -# install/update third-party dependencies -$ cd /path/to/shaarli/ -$ composer install --no-dev --prefer-dist -``` - - --------------------------------------------------------------------------------- - -## Development version (mainline) - -_Use at your own risk!_ - -Install [Composer](Unit-tests.md#install_composer) to manage Shaarli PHP dependencies, -and [yarn](https://yarnpkg.com/lang/en/docs/install/) -for front-end dependencies. - -To get the latest changes from the `master` branch: - -```bash -# clone the repository -$ git clone https://github.com/shaarli/Shaarli.git -b master /path/to/shaarli/ -# install/update third-party dependencies -$ cd /path/to/shaarli -$ composer install --no-dev --prefer-dist -$ make build_frontend -$ make translate -$ make htmldoc -``` - -------------------------------------------------------------------------------- - -## Finish Installation - -Once Shaarli is downloaded and files have been placed at the correct location, open it this location your favorite browser. - -![install screenshot](images/install-shaarli.png) - -Setup your Shaarli installation, and it's ready to use! - -## Updating Shaarli - -See [Upgrade and Migration](Upgrade-and-migration) diff --git a/doc/md/FAQ.md b/doc/md/FAQ.md deleted file mode 100644 index a2ec7d57..00000000 --- a/doc/md/FAQ.md +++ /dev/null @@ -1,46 +0,0 @@ -### Why did you create Shaarli ? - -I was a StumbleUpon user. Then I got fed up with they big toolbar. I switched to delicious, which was lighter, faster and more beautiful. Until Yahoo bought it. Then the export API broke all the time, delicious became slow and was ditched by Yahoo. I switched to Diigo, which is not bad, but does too much. And Diigo is sslllooooowww and their Firefox extension a bit buggy. And… oh… **their Firefox addon sends to Diigo every single URL you visit** (Don't believe me ? Use [Tamper Data](https://addons.mozilla.org/en-US/firefox/addon/tamper-data/) and open any page). - -Enough is enough. Saving simple links should not be a complicated heavy thing. I ditched them all and wrote my own: Shaarli. It's simple, but it does the job and does it well. And my data is not hosted on a foreign server, but on my server. - -### Why use Shaarli and not Delicious/Diigo ? - -With Shaarli: - -- The data is yours: It's hosted on your server. -- Never fear of having your data locked-in. -- Never fear to have your data sold to third party. -- Your private links are not hosted on a third party server. -- You are not tracked by browser addons (like Diigo does) -- You can change the look and feel of the pages if you want. -- You can change the behaviour of the program. -- It's magnitude faster than most bookmarking services. - -### What does Shaarli mean? - -Shaarli stands for _shaaring_ your _links_. - -### My Shaarli is broken! -First of all, ensure that both the [web server](Server-configuration) and -[Shaarli](Shaarli-configuration) are correctly configured, and that your -installation is [supported](Server-configuration). - -If everything looks right but the issue(s) remain(s), please: - -- take a look at the [troubleshooting](Troubleshooting) section -- come [chat with us](https://gitter.im/shaarli/Shaarli) on Gitter, we'll be happy to help ;-) -- browse active [issues](https://github.com/shaarli/Shaarli/issues) and [Pull Requests](https://github.com/shaarli/Shaarli/pulls) - - if you find one that is related to the issue, feel free to comment and provide additional details (host/Shaarli setup) - - else, [open a new issue](https://github.com/shaarli/Shaarli/issues/new), and provide information about the problem: - - _what happens?_ - display glitches, invalid data, security flaws... - - _what is your configuration?_ - OS, server version, activated extensions, web browser... - - _is it reproducible?_ - -### Why not use a real database? Files are slow! - -Does browsing [this page](http://sebsauvage.net/links/) feel slow? Try browsing older pages, too. - -It's not slow at all, is it? And don't forget the database contains more than 16000 links, and it's on a shared host, with 32000 visitors/day for my website alone. And it's still damn fast. Why? - -The data file is only 3.7 Mb. It's read 99% of the time, and is probably already in the operation system disk cache. So generating a page involves no I/O at all most of the time. diff --git a/doc/md/GnuPG-signature.md b/doc/md/GnuPG-signature.md deleted file mode 100644 index d1fc10a5..00000000 --- a/doc/md/GnuPG-signature.md +++ /dev/null @@ -1,78 +0,0 @@ -## Introduction -### PGP and GPG -[Gnu Privacy Guard](https://gnupg.org/) (GnuPG) is an Open Source implementation of the -[Pretty Good Privacy](https://en.wikipedia.org/wiki/Pretty_Good_Privacy#OpenPGP) -(OpenPGP) specification. Its main purposes are digital authentication, signature and encryption. - -It is often used by the [FLOSS](https://en.wikipedia.org/wiki/Free_and_open-source_software) community to verify: - -- Linux package signatures: Debian [SecureApt](https://wiki.debian.org/SecureApt), ArchLinux [Master -Keys](https://www.archlinux.org/master-keys/) -- [SCM](https://en.wikipedia.org/wiki/Revision_control) releases & maintainer identity - -### Trust -To quote Phil Pennock (the author of the [SKS](https://bitbucket.org/skskeyserver/sks-keyserver/wiki/Home) key server - http://sks.spodhuis.org/): - -> You MUST understand that presence of data in the keyserver (pools) in no way connotes trust. Anyone can generate a key, with any name or email address, and upload it. All security and trust comes from evaluating security at the “object level”, via PGP Web-Of-Trust signatures. This keyserver makes it possible to retrieve keys, looking them up via various indices, but the collection of keys in this public pool is KNOWN to contain malicious and fraudulent keys. It is the common expectation of server operators that users understand this and use software which, like all known common OpenPGP implementations, evaluates trust accordingly. This expectation is so common that it is not normally explicitly stated. - -Trust can be gained by having your key signed by other people (and signing their key back, too :) ), for instance during [key signing parties](https://en.wikipedia.org/wiki/Key_signing_party), see: - -- [The Keysigning party HOWTO](http://www.cryptnet.net/fdp/crypto/keysigning_party/en/keysigning_party.html) -- [Web of trust](https://en.wikipedia.org/wiki/Web_of_trust) - -## Generate a GPG key -- [Generating a GPG key for Git tagging](http://stackoverflow.com/a/16725717) (StackOverflow) -- [Generating a GPG key](https://help.github.com/articles/generating-a-gpg-key/) (GitHub) - -### gpg - provide identity information -```bash -$ gpg --gen-key - -gpg (GnuPG) 2.1.6; Copyright (C) 2015 Free Software Foundation, Inc. -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Note: Use "gpg2 --full-gen-key" for a full featured key generation dialog. - -GnuPG needs to construct a user ID to identify your key. - -Real name: Marvin the Paranoid Android -Email address: marvin@h2g2.net -You selected this USER-ID: - "Marvin the Paranoid Android " - -Change (N)ame, (E)mail, or (O)kay/(Q)uit? o -We need to generate a lot of random bytes. It is a good idea to perform -some other action (type on the keyboard, move the mouse, utilize the -disks) during the prime generation; this gives the random number -generator a better chance to gain enough entropy. -``` - -### gpg - entropy interlude -At this point, you will: -- be prompted for a secure password to protect your key (the input method will depend on your Desktop Environment and configuration) -- be asked to use your machine's input devices (mouse, keyboard, etc.) to generate random entropy; this step _may take some time_ - -### gpg - key creation confirmation -```bash -gpg: key A9D53A3E marked as ultimately trusted -public and secret key created and signed. - -gpg: checking the trustdb -gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model -gpg: depth: 0 valid: 2 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 2u -pub rsa2048/A9D53A3E 2015-07-31 - Key fingerprint = AF2A 5381 E54B 2FD2 14C4 A9A3 0E35 ACA4 A9D5 3A3E -uid [ultimate] Marvin the Paranoid Android -sub rsa2048/8C0EACF1 2015-07-31 -``` - -### gpg - submit your public key to a PGP server (Optional) -``` bash -$ gpg --keyserver pgp.mit.edu --send-keys A9D53A3E -gpg: sending key A9D53A3E to hkp server pgp.mit.edu -``` - -## Create and push a GPG-signed tag - -See [Release Shaarli](Release Shaarli). diff --git a/doc/md/Installation.md b/doc/md/Installation.md new file mode 100644 index 00000000..1286a6b2 --- /dev/null +++ b/doc/md/Installation.md @@ -0,0 +1,84 @@ +# Installation + +Once your server is [configured](Server-configuration.md), install Shaarli: + +## From release ZIP + +To install Shaarli, simply place the files from the latest [release .zip archive](https://github.com/shaarli/Shaarli/releases) under your webserver's document root (directly at the document root, or in a subdirectory). Download the **shaarli-vX.X.X-full** archive to include dependencies. + +```bash +wget https://github.com/shaarli/Shaarli/releases/download/v0.10.4/shaarli-v0.10.4-full.zip +unzip shaarli-v0.10.4-full.zip +sudo rsync -avP Shaarli/ /var/www/shaarli.mydomain.org/ +``` + +## From sources + +These components are required to build Shaarli: + +- [Composer](dev/Development.md#install-composer) to manage third-party [PHP dependencies](dev/Development#third-party-libraries). +- [yarn](https://yarnpkg.com/lang/en/docs/install/) to build frontend dependencies. +- [python3-virtualenv](https://pypi.python.org/pypi/virtualenv) to build local HTML documentation. + +Clone the repository, either pointing to: + +- any [tagged release](https://github.com/shaarli/Shaarli/releases) +- `latest`: the latest tagged release +- `master`: development branch + +```bash +# clone the branch/tag of your choice +$ git clone -b latest https://github.com/shaarli/Shaarli.git /home/me/Shaarli +# OR download/extract the tar.gz/zip: wget https://github.com/shaarli/Shaarli/archive/latest.tar.gz... + +# enter the directory +$ cd /home/me/Shaarli +# install 3rd-party PHP dependencies +$ composer install --no-dev --prefer-dist +# build frontend static assets +$ make build_frontend +# build translations +$ make translate +# build HTML documentation +$ make htmldoc +# copy the resulting shaarli directory under your webserver's document root +$ rsync -avP /home/me/Shaarli/ /var/www/shaarli.mydomain.org/ +``` + +## Set file permissions + +Regardless of the installation method, appropriate [file permissions](dev/Development.md#directory-structure) must be set: + +```bash +# by default, deny access to everything to the web server +sudo chown -R root:www-data /var/www/shaarli.mydomain.org +sudo chmod -R u=rwX /var/www/shaarli.mydomain.org +# allow read-only access to these files/directories +sudo chmod -R g+rX /var/www/shaarli.mydomain.org/{index.php,application/,plugins/,inc/} +# allow read/write access to these directories +sudo chmod -R g+rwX /var/www/shaarli.mydomain.org/{cache/,data/,pagecache/,tmp/} +``` + + +## Using Docker + +[See the documentation](Docker.md) + + + +## Finish Installation + +Once Shaarli is downloaded and files have been placed at the correct location, open this location your web browser. + +Enter basic settings for your Shaarli installation, and it's ready to use! + +![](images/07-installation.jpg) + +Congratulations! Your Shaarli is now available at `https://shaarli.mydomain.org`. + +You can further [configure Shaarli](Shaarli-configuration.md), setup [Plugins](Plugins.md) or [additional software](Community-and-related-software.md). + + +## Upgrading Shaarli + +See [Upgrade and Migration](Upgrade-and-migration) diff --git a/doc/md/Link-structure.md b/doc/md/Link-structure.md deleted file mode 100644 index 0a2d0f88..00000000 --- a/doc/md/Link-structure.md +++ /dev/null @@ -1,18 +0,0 @@ -## Link structure - -Every link available through the `LinkDB` object is represented as an array -containing the following fields: - - * `id` (integer): Unique identifier. - * `title` (string): Title of the link. - * `url` (string): URL of the link. Used for displayable links (without redirector, url encoding, etc.). - Can be absolute or relative for Notes. - * `real_url` (string): Real destination URL, can be redirected, encoded, etc. - * `shorturl` (string): Permalink small hash. - * `description` (string): Link text description. - * `private` (boolean): whether the link is private or not. - * `tags` (string): all link tags separated by a single space - * `thumbnail` (string|boolean): relative path of the thumbnail cache file, or false if there isn't any. - * `created` (DateTime): link creation date time. - * `updated` (DateTime): last modification date time. - \ No newline at end of file diff --git a/doc/md/Plugin-System.md b/doc/md/Plugin-System.md deleted file mode 100644 index 87a2638d..00000000 --- a/doc/md/Plugin-System.md +++ /dev/null @@ -1,752 +0,0 @@ -[**I am a developer: ** Developer API](#developer-api) - -[**I am a template designer: ** Guide for template designers](#guide-for-template-designer) - ---- - -## Developer API - -### What can I do with plugins? - -The plugin system let you: - -- insert content into specific places across templates. -- alter data before templates rendering. -- alter data before saving new links. - -### How can I create a plugin for Shaarli? - -First, chose a plugin name, such as `demo_plugin`. - -Under `plugin` folder, create a folder named with your plugin name. Then create a .meta file and a .php file in that folder. - -You should have the following tree view: - -``` -| index.php -| plugins/ -|---| demo_plugin/ -| |---| demo_plugin.meta -| |---| demo_plugin.php -``` - -### Plugin initialization - -At the beginning of Shaarli execution, all enabled plugins are loaded. At this point, the plugin system looks for an `init()` function in the .php to execute and run it if it exists. This function must be named this way, and takes the `ConfigManager` as parameter. - - _init($conf) - -This function can be used to create initial data, load default settings, etc. But also to set *plugin errors*. If the initialization function returns an array of strings, they will be understand as errors, and displayed in the header to logged in users. - -The plugin system also looks for a `description` variable in the .meta file, to be displayed in the plugin administration page. - - description="The plugin does this and that." - -### Understanding hooks - -A plugin is a set of functions. Each function will be triggered by the plugin system at certain point in Shaarli execution. - -These functions need to be named with this pattern: - -``` -hook__($data, $conf) -``` - -Parameters: - -- data: see [$data section](https://shaarli.readthedocs.io/en/master/Plugin-System/#plugins-data) -- conf: the `ConfigManager` instance. - -For example, if my plugin want to add data to the header, this function is needed: - - hook_demo_plugin_render_header - -If this function is declared, and the plugin enabled, it will be called every time Shaarli is rendering the header. - -### Plugin's data - -#### Parameters - -Every hook function has a `$data` parameter. Its content differs for each hooks. - -**This parameter needs to be returned every time**, otherwise data is lost. - - return $data; - -#### Special data - -Special additional data are passed to every hook through the -`$data` parameter to give you access to additional context, and services. - -Complete list: - - * `_PAGE_` (string): if the current hook is used to render a template, its name is passed through this additional parameter. - * `_LOGGEDIN_` (bool): whether the user is logged in or not. - * `_BASE_PATH_` (string): if Shaarli instance is hosted under a subfolder, contains the subfolder path to `index.php` (e.g. `https://domain.tld/shaarli/` -> `/shaarli/`). - * `_BOOKMARK_SERVICE_` (`BookmarkServiceInterface`): bookmark service instance, for advanced usage. - -Example: - -```php -if ($data['_PAGE_'] === TemplatePage::LINKLIST && $data['LOGGEDIN'] === true) { - // Do something for logged in users when the link list is rendered -} -``` - -#### Filling templates placeholder - -Template placeholders are displayed in template in specific places. - -RainTPL displays every element contained in the placeholder's array. These element can be added by plugins. - -For example, let's add a value in the placeholder `top_placeholder` which is displayed at the top of my page: - -```php -$data['top_placeholder'][] = 'My content'; -# OR -array_push($data['top_placeholder'], 'My', 'content'); - -return $data; -``` - -#### Data manipulation - -When a page is displayed, every variable send to the template engine is passed to plugins before that in `$data`. - -The data contained by this array can be altered before template rendering. - -For example, in linklist, it is possible to alter every title: - -```php -// mind the reference if you want $data to be altered -foreach ($data['links'] as &$value) { - // String reverse every title. - $value['title'] = strrev($value['title']); -} - -return $data; -``` - -### Metadata - -Every plugin needs a `.meta` file, which is in fact an `.ini` file (`KEY="VALUE"`), to be listed in plugin administration. - -Each file contain two keys: - -- `description`: plugin description -- `parameters`: user parameter names, separated by a `;`. -- `parameter.`: add a text description the specified parameter. - -> Note: In PHP, `parse_ini_file()` seems to want strings to be between by quotes `"` in the ini file. - -### It's not working! - -Use `demo_plugin` as a functional example. It covers most of the plugin system features. - -If it's still not working, please [open an issue](https://github.com/shaarli/Shaarli/issues/new). - -### Hooks - -| Hooks | Description | -| ------------- |:-------------:| -| [render_header](#render_header) | Allow plugin to add content in page headers. | -| [render_includes](#render_includes) | Allow plugin to include their own CSS files. | -| [render_footer](#render_footer) | Allow plugin to add content in page footer and include their own JS files. | -| [render_linklist](#render_linklist) | It allows to add content at the begining and end of the page, after every link displayed and to alter link data. | -| [render_editlink](#render_editlink) | Allow to add fields in the form, or display elements. | -| [render_tools](#render_tools) | Allow to add content at the end of the page. | -| [render_picwall](#render_picwall) | Allow to add content at the top and bottom of the page. | -| [render_tagcloud](#render_tagcloud) | Allow to add content at the top and bottom of the page, and after all tags. | -| [render_taglist](#render_taglist) | Allow to add content at the top and bottom of the page, and after all tags. | -| [render_daily](#render_daily) | Allow to add content at the top and bottom of the page, the bottom of each link and to alter data. | -| [render_feed](#render_feed) | Allow to do add tags in RSS and ATOM feeds. | -| [save_link](#save_link) | Allow to alter the link being saved in the datastore. | -| [delete_link](#delete_link) | Allow to do an action before a link is deleted from the datastore. | -| [save_plugin_parameters](#save_plugin_parameters) | Allow to manipulate plugin parameters before they're saved. | - - - -#### render_header - -Triggered on every page. - -Allow plugin to add content in page headers. - -##### Data - -`$data` is an array containing: - - - [Special data](#special-data) - -##### Template placeholders - -Items can be displayed in templates by adding an entry in `$data['']` array. - -List of placeholders: - -- `buttons_toolbar`: after the list of buttons in the header. - -![buttons_toolbar_example](http://i.imgur.com/ssJUOrt.png) - -- `fields_toolbar`: after search fields in the header. - -> Note: This will only be called in linklist. - -![fields_toolbar_example](http://i.imgur.com/3GMifI2.png) - -#### render_includes - -Triggered on every page. - -Allow plugin to include their own CSS files. - -##### Data - -`$data` is an array containing: - - - [Special data](#special-data) - -##### Template placeholders - -Items can be displayed in templates by adding an entry in `$data['']` array. - -List of placeholders: - -- `css_files`: called after loading default CSS. - -> Note: only add the path of the CSS file. E.g: `plugins/demo_plugin/custom_demo.css`. - -#### render_footer - -Triggered on every page. - -Allow plugin to add content in page footer and include their own JS files. - -##### Data - -`$data` is an array containing: - - - [Special data](#special-data) - -##### Template placeholders - -Items can be displayed in templates by adding an entry in `$data['']` array. - -List of placeholders: - -- `text`: called after the end of the footer text. -- `endofpage`: called at the end of the page. - -![text_example](http://i.imgur.com/L5S2YEH.png) - -- `js_files`: called at the end of the page, to include custom JS scripts. - -> Note: only add the path of the JS file. E.g: `plugins/demo_plugin/custom_demo.js`. - -#### render_linklist - -Triggered when `linklist` is displayed (list of links, permalink, search, tag filtered, etc.). - -It allows to add content at the begining and end of the page, after every link displayed and to alter link data. - -##### Data - -`$data` is an array containing: - - - All templates data, including links. - - [Special data](#special-data) - -##### Template placeholders - -Items can be displayed in templates by adding an entry in `$data['']` array. - -List of placeholders: - -- `action_plugin`: next to the button "private only" at the top and bottom of the page. - -![action_plugin_example](http://i.imgur.com/Q12PWg0.png) - -- `link_plugin`: for every link, between permalink and link URL. - -![link_plugin_example](http://i.imgur.com/3oDPhWx.png) - -- `plugin_start_zone`: before displaying the template content. - -![plugin_start_zone_example](http://i.imgur.com/OVBkGy3.png) - -- `plugin_end_zone`: after displaying the template content. - -![plugin_end_zone_example](http://i.imgur.com/6IoRuop.png) - -#### render_editlink - -Triggered when the link edition form is displayed. - -Allow to add fields in the form, or display elements. - -##### Data - -`$data` is an array containing: - - - All templates data. - - [Special data](#special-data) - -##### Template placeholders - -Items can be displayed in templates by adding an entry in `$data['']` array. - -List of placeholders: - -- `edit_link_plugin`: after tags field. - -![edit_link_plugin_example](http://i.imgur.com/5u17Ens.png) - -#### render_tools - -Triggered when the "tools" page is displayed. - -Allow to add content at the end of the page. - -##### Data - -`$data` is an array containing: - - - All templates data. - - [Special data](#special-data) - -##### Template placeholders - -Items can be displayed in templates by adding an entry in `$data['']` array. - -List of placeholders: - -- `tools_plugin`: at the end of the page. - -![tools_plugin_example](http://i.imgur.com/Bqhu9oQ.png) - -#### render_picwall - -Triggered when picwall is displayed. - -Allow to add content at the top and bottom of the page. - -##### Data - -`$data` is an array containing: - - - All templates data. - - [Special data](#special-data) - -##### Template placeholders - -Items can be displayed in templates by adding an entry in `$data['']` array. - -List of placeholders: - -- `plugin_start_zone`: before displaying the template content. -- `plugin_end_zone`: after displaying the template content. - -![plugin_start_end_zone_example](http://i.imgur.com/tVTQFER.png) - -#### render_tagcloud - -Triggered when tagcloud is displayed. - -Allow to add content at the top and bottom of the page. - -##### Data - -`$data` is an array containing: - - - All templates data. - - [Special data](#special-data) - -##### Template placeholders - -Items can be displayed in templates by adding an entry in `$data['']` array. - -List of placeholders: - -- `plugin_start_zone`: before displaying the template content. -- `plugin_end_zone`: after displaying the template content. - -For each tag, the following placeholder can be used: - -- `tag_plugin`: after each tag - -![plugin_start_end_zone_example](http://i.imgur.com/vHmyT3a.png) - - -#### render_taglist - -Triggered when taglist is displayed. - -Allow to add content at the top and bottom of the page. - -##### Data - -`$data` is an array containing: - - - All templates data. - - [Special data](#special-data) - -##### Template placeholders - -Items can be displayed in templates by adding an entry in `$data['']` array. - -List of placeholders: - -- `plugin_start_zone`: before displaying the template content. -- `plugin_end_zone`: after displaying the template content. - -For each tag, the following placeholder can be used: - -- `tag_plugin`: after each tag - -#### render_daily - -Triggered when tagcloud is displayed. - -Allow to add content at the top and bottom of the page, the bottom of each link and to alter data. - -##### Data - -`$data` is an array containing: - - - All templates data, including links. - - [Special data](#special-data) - -##### Template placeholders - -Items can be displayed in templates by adding an entry in `$data['']` array. - -List of placeholders: - -- `link_plugin`: used at bottom of each link. - -![link_plugin_example](http://i.imgur.com/hzhMfSZ.png) - -- `plugin_start_zone`: before displaying the template content. -- `plugin_end_zone`: after displaying the template content. - -#### render_feed - -Triggered when the ATOM or RSS feed is displayed. - -Allow to add tags in the feed, either in the header or for each items. Items (links) can also be altered before being rendered. - -##### Data - -`$data` is an array containing: - - - All templates data, including links. - - [Special data](#special-data) - -##### Template placeholders - -Tags can be added in feeds by adding an entry in `$data['']` array. - -List of placeholders: - -- `feed_plugins_header`: used as a header tag in the feed. - -For each links: - -- `feed_plugins`: additional tag for every link entry. - -#### save_link - -Triggered when a link is save (new link or edit). - -Allow to alter the link being saved in the datastore. - -##### Data - -`$data` is an array containing the link being saved: - -- id -- title -- url -- shorturl -- description -- private -- tags -- created -- updated - -Also [special data](#special-data). - - -#### delete_link - -Triggered when a link is deleted. - -Allow to execute any action before the link is actually removed from the datastore - -##### Data - -`$data` is an array containing the link being deleted: - -- id -- title -- url -- shorturl -- description -- private -- tags -- created -- updated - -Also [special data](#special-data). - -#### save_plugin_parameters - -Triggered when the plugin parameters are saved from the plugin administration page. - -Plugins can perform an action every times their settings are updated. -For example it is used to update the CSS file of the `default_colors` plugins. - -##### Data - -`$data` input contains the `$_POST` array. - -So if the plugin has a parameter called `MYPLUGIN_PARAMETER`, -the array will contain an entry with `MYPLUGIN_PARAMETER` as a key. - -Also [special data](#special-data). - -## Guide for template designer - -### Plugin administration - -Your theme must include a plugin administration page: `pluginsadmin.html`. - -> Note: repo's template link needs to be added when the PR is merged. - -Use the default one as an example. - -Aside from classic RainTPL loops, plugins order is handle by JavaScript. You can just include `plugin_admin.js`, only if: - -- you're using a table. -- you call orderUp() and orderUp() onclick on arrows. -- you add data-line and data-order to your rows. - -Otherwise, you can use your own JS as long as this field is send by the form: - - - -### Placeholder system - -In order to make plugins work with every custom themes, you need to add variable placeholder in your templates. - -It's a RainTPL loop like this: - - {loop="$plugin_variable"} - {$value} - {/loop} - -You should enable `demo_plugin` for testing purpose, since it uses every placeholder available. - -### List of placeholders - -**page.header.html** - -At the end of the menu: - - {loop="$plugins_header.buttons_toolbar"} - {$value} - {/loop} - -At the end of file, before clearing floating blocks: - - {if="!empty($plugin_errors) && $is_logged_in"} -
    - {loop="plugin_errors"} -
  • {$value}
  • - {/loop} -
- {/if} - -**includes.html** - -At the end of the file: - -```html -{loop="$plugins_includes.css_files"} - -{/loop} -``` - -**page.footer.html** - -At the end of your footer notes: - -```html -{loop="$plugins_footer.text"} - {$value} -{/loop} -``` - -At the end of file: - -```html -{loop="$plugins_footer.js_files"} - -{/loop} -``` - -**linklist.html** - -After search fields: - -```html -{loop="$plugins_header.fields_toolbar"} - {$value} -{/loop} -``` - -Before displaying the link list (after paging): - -```html -{loop="$plugin_start_zone"} - {$value} -{/loop} -``` - -For every links (icons): - -```html -{loop="$value.link_plugin"} - {$value} -{/loop} -``` - -Before end paging: - -```html -{loop="$plugin_end_zone"} - {$value} -{/loop} -``` - -**linklist.paging.html** - -After the "private only" icon: - -```html -{loop="$action_plugin"} - {$value} -{/loop} -``` - -**editlink.html** - -After tags field: - -```html -{loop="$edit_link_plugin"} - {$value} -{/loop} -``` - -**tools.html** - -After the last tool: - -```html -{loop="$tools_plugin"} - {$value} -{/loop} -``` - -**picwall.html** - -Top: - -```html -
- {loop="$plugin_start_zone"} - {$value} - {/loop} -
-``` - -Bottom: - -```html -
- {loop="$plugin_end_zone"} - {$value} - {/loop} -
-``` - -**tagcloud.html** - -Top: - -```html -
- {loop="$plugin_start_zone"} - {$value} - {/loop} -
-``` - -Bottom: - -```html -
- {loop="$plugin_end_zone"} - {$value} - {/loop} -
-``` - -**daily.html** - -Top: - -```html -
- {loop="$plugin_start_zone"} - {$value} - {/loop} -
-``` - -After every link: - -```html -
- {loop="$link.link_plugin"} - {$value} - {/loop} -
-``` - -Bottom: - -```html -
- {loop="$plugin_end_zone"} - {$value} - {/loop} -
-``` - -**feed.atom.xml** and **feed.rss.xml**: - -In headers tags section: -```xml -{loop="$feed_plugins_header"} - {$value} -{/loop} -``` - -After each entry: -```xml -{loop="$value.feed_plugins"} - {$value} -{/loop} -``` diff --git a/doc/md/Plugins.md b/doc/md/Plugins.md index 3e261815..49a51f51 100644 --- a/doc/md/Plugins.md +++ b/doc/md/Plugins.md @@ -1,14 +1,13 @@ -## Plugin installation +# Plugins -There is a bunch of plugins shipped with Shaarli, where there is nothing to do to install them. +## Installation -If you want to install a third party plugin: +For plugins shipped with Shaarli, no installation is required. -- Download it. -- Put it in the `plugins` directory in Shaarli's installation folder. -- Make sure you put it correctly: +If you want to install a third party plugin, download it to the `plugins` directory in Shaarli's installation folder: -``` +```bash +# example directory structure | index.php | plugins/ |---| custom_plugin/ @@ -17,34 +16,34 @@ If you want to install a third party plugin: ``` - * Make sure your webserver can read and write the files in your plugin folder. +Make sure your webserver can read and write the files in your plugin folder. -## Plugin configuration -In Shaarli's administration page (`Tools` link), go to `Plugin administration`. +## Configuration -Here you can enable and disable all plugins available, and configure them. +From Shaarli's administration page (`Tools` link), go to `Plugin administration`. Here you can enable and disable all plugins available, and configure them. ![administration screenshot](https://camo.githubusercontent.com/5da68e191969007492ca0fbeb25f3b2357b748cc/687474703a2f2f692e696d6775722e636f6d2f766837544643712e706e67) -## Plugin order + +## Order In the plugin administration page, you can move enabled plugins to the top or bottom of the list. The first plugins in the list will be processed first. -This is important in case plugins are depending on each other. Read plugins README details for more information. +This is important in case plugins depend on each other. Read plugins READMEs for more information. **Use case**: The (non existent) plugin `shaares_footer` adds a footer to every shaare in Markdown syntax. It needs to be processed *before* (higher in the list) the Markdown plugin. Otherwise its syntax won't be translated in HTML. -## File mode -Enabled plugin are stored in your `config.json.php` parameters file, under the `array`: +## Configuration file + +Enabled plugins are stored in your [Configuration file](Shaarli-configuration), under the array: ```php $GLOBALS['config']['ENABLED_PLUGINS'] ``` -You can edit them manually here. -Example: +You can edit them manually here. For example: ```php $GLOBALS['config']['ENABLED_PLUGINS'] = array( @@ -55,25 +54,25 @@ $GLOBALS['config']['ENABLED_PLUGINS'] = array( ); ``` -### Plugin usage -#### Official plugins +## Usage + +### Official plugins Usage of each plugin is documented in it's README file: - * `addlink-toolbar`: Adds the addlink input on the linklist page - * `archiveorg`: For each link, add an Archive.org icon + * `addlink-toolbar`: Adds the addlink input on the Shaares list page + * `archiveorg`: For each Shaare, add a link to the archived page on Archive.org * `default_colors`: Override default theme colors. * `isso`: Let visitor comment your shaares on permalinks with Isso. * [`markdown`](https://github.com/shaarli/Shaarli/blob/master/plugins/markdown/README.md): Render shaare description with Markdown syntax. * `piwik`: A plugin that adds Piwik tracking code to Shaarli pages. * [`playvideos`](https://github.com/shaarli/Shaarli/blob/master/plugins/playvideos/README.md): Add a button in the toolbar allowing to watch all videos. * `pubsubhubbub`: Enable PubSubHubbub feed publishing - * `qrcode`: For each link, add a QRCode icon. - * [`wallabag`](https://github.com/shaarli/Shaarli/blob/master/plugins/wallabag/README.md): For each link, add a Wallabag icon to save it in your instance. - + * `qrcode`: For each Shaare, add a QRCode icon. + * [`wallabag`](https://github.com/shaarli/Shaarli/blob/master/plugins/wallabag/README.md): For each Shaare, add a Wallabag icon to save it in your instance. -#### Third party plugins +### Third party plugins -See [Community & related software](https://shaarli.readthedocs.io/en/master/Community-&-Related-software/) +See [Community & related software](https://shaarli.readthedocs.io/en/master/Community-and-Related-software/) diff --git a/doc/md/REST-API.md b/doc/md/REST-API.md index 11bd1cd2..01071d8e 100644 --- a/doc/md/REST-API.md +++ b/doc/md/REST-API.md @@ -1,101 +1,24 @@ -## Usage and Prerequisites +# REST API -See the [REST API documentation](http://shaarli.github.io/api-documentation/) -for a list of available endpoints and parameters. +## Server requirements -Please ensure that your server meets the -[requirements](Server-configuration#prerequisites) and is properly -[configured](Server-configuration): +See the **[REST API documentation](http://shaarli.github.io/api-documentation/)** for a list of available endpoints and parameters. + +Please ensure that your server meets the requirements and is properly [configured](Server-configuration): - URL rewriting is enabled (see specific Apache and Nginx sections) - the server's timezone is properly defined -- the server's clock is synchronized with - [NTP](https://en.wikipedia.org/wiki/Network_Time_Protocol) - -The host where the API client is invoked should also be synchronized with NTP, -see [token expiration](#payload). - -## Authentication - -All requests to Shaarli's API must include a JWT token to verify their authenticity. - -This token has to be included as an HTTP header called `Authentication: Bearer `. - -JWT resources : - -- [jwt.io](https://jwt.io) (including a list of client per language). -- RFC : https://tools.ietf.org/html/rfc7519 -- https://float-middle.com/json-web-tokens-jwt-vs-sessions/ -- HackerNews thread: https://news.ycombinator.com/item?id=11929267 - - -### Shaarli JWT Token - -JWT tokens are composed by three parts, separated by a dot `.` and encoded in base64: - -``` -[header].[payload].[signature] -``` - -#### Header - -Shaarli only allow one hash algorithm, so the header will always be the same: - -```json -{ - "typ": "JWT", - "alg": "HS512" -} -``` - -Encoded in base64, it gives: - -``` -ewogICAgICAgICJ0eXAiOiAiSldUIiwKICAgICAgICAiYWxnIjogIkhTNTEyIgogICAgfQ== -``` - -#### Payload - -**Token expiration** - -To avoid infinite token validity, JWT tokens must include their creation date -in UNIX timestamp format (timezone independent - UTC) under the key `iat` (issued at). -This token will be valid during **9 minutes**. - -```json -{ - "iat": 1468663519 -} -``` - -See [RFC reference](https://tools.ietf.org/html/rfc7519#section-4.1.6). - +- the server's clock is synchronized with [NTP](https://en.wikipedia.org/wiki/Network_Time_Protocol) -#### Signature - -The signature authenticate the token validity. It contains the base64 of the header and the body, separated by a dot `.`, hashed in SHA512 with the API secret available in Shaarli administration page. - -Signature example with PHP: - -```php -$content = base64_encode($header) . '.' . base64_encode($payload); -$signature = hash_hmac('sha512', $content, $secret); -``` +The host where the API client is invoked should also be synchronized with NTP, see _payload/token expiration_ ## Clients and examples -### Android, Java, Kotlin - -- [Android client example with Kotlin](https://gitlab.com/snippets/1665808) - by [Braincoke](https://github.com/Braincoke) - -### Javascript, NodeJS -- [shaarli-client](https://www.npmjs.com/package/shaarli-client) - ([source code](https://github.com/laBecasse/shaarli-client)) - by [laBecasse](https://github.com/laBecasse) +- **[python-shaarli-client](https://github.com/shaarli/python-shaarli-client)** - the reference API client ([Documentation](http://python-shaarli-client.readthedocs.io/en/latest/)) +- [shaarli-client](https://www.npmjs.com/package/shaarli-client) - NodeJs client ([source code](https://github.com/laBecasse/shaarli-client)) by [laBecasse](https://github.com/laBecasse) +- [Android client example with Kotlin](https://gitlab.com/snippets/1665808) by [Braincoke](https://github.com/Braincoke) -### PHP This example uses the [PHP cURL](http://php.net/manual/en/book.curl.php) library. @@ -145,13 +68,57 @@ function getInfo($baseUrl, $secret) { var_dump(getInfo($baseUrl, $secret)); ``` +## Implementation + +### Authentication + +- All requests to Shaarli's API must include a **JWT token** to verify their authenticity. +- This token must be included as an HTTP header called `Authentication: Bearer `. +- JWT tokens are composed by three parts, separated by a dot `.` and encoded in base64: + +``` +[header].[payload].[signature] +``` + +##### Header + +Shaarli only allow one hash algorithm, so the header will always be the same: + +```json +{ + "typ": "JWT", + "alg": "HS512" +} +``` + +Encoded in base64, it gives: -### Python +``` +ewogICAgICAgICJ0eXAiOiAiSldUIiwKICAgICAgICAiYWxnIjogIkhTNTEyIgogICAgfQ== +``` + +##### Payload + +Token expiration: To avoid infinite token validity, JWT tokens must include their creation date in UNIX timestamp format (timezone independent - UTC) under the key `iat` (issued at) field ([1](https://tools.ietf.org/html/rfc7519#section-4.1.6)). This token will be valid during **9 minutes**. + +```json +{ + "iat": 1468663519 +} +``` + +##### Signature + +The signature authenticates the token validity. It contains the base64 of the header and the body, separated by a dot `.`, hashed in SHA512 with the API secret available in Shaarli administration page. + +Example signature with PHP: + +```php +$content = base64_encode($header) . '.' . base64_encode($payload); +$signature = hash_hmac('sha512', $content, $secret); +``` -See the reference API client: -- [Documentation](http://python-shaarli-client.readthedocs.io/en/latest/) on ReadTheDocs -- [python-shaarli-client](https://github.com/shaarli/python-shaarli-client) on Github ## Troubleshooting @@ -171,3 +138,13 @@ to get the actual error message in the HTTP response body with: } } ``` + +## References + +- [jwt.io](https://jwt.io) (including a list of client per language). +- [RFC - JSON Web Token (JWT)](https://tools.ietf.org/html/rfc7519) +- [JSON Web Tokens (JWT) vs Sessions](https://float-middle.com/json-web-tokens-jwt-vs-sessions/), [HackerNews thread](https://news.ycombinator.com/item?id=11929267) + + + + diff --git a/doc/md/RSS-feeds.md b/doc/md/RSS-feeds.md deleted file mode 100644 index ecbff09a..00000000 --- a/doc/md/RSS-feeds.md +++ /dev/null @@ -1,28 +0,0 @@ -### Feeds options - -Feeds are available in ATOM with `/feed/atom` and RSS with `/feed/rss`. - -Options: - -- You can use `permalinks` in the feed URL to get permalink to Shaares instead of direct link to shaared URL. - - E.G. `https://my.shaarli.domain/feed/atom?permalinks`. -- You can use `nb` parameter in the feed URL to specify the number of Shaares you want in a feed (default if not specified: `50`). The keyword `all` is available if you want everything. - - `https://my.shaarli.domain/feed/atom?permalinks&nb=42` - - `https://my.shaarli.domain/feed/atom?permalinks&nb=all` - -### RSS Feeds or Picture Wall for a specific search/tag - -It is possible to filter RSS/ATOM feeds and Picture Wall on a Shaarli to **only display results of a specific search, or for a specific tag**. - -For example, if you want to subscribe only to links tagged `photography`: - -- Go to the desired Shaarli instance. -- Search for the `photography` tag in the _Filter by tag_ box. Links tagged `photography` are displayed. -- Click on the `RSS Feed` button. -- You are presented with an RSS feed showing only these links. Subscribe to it to receive only updates with this tag. -- The same method **also works for a full-text search** (_Search_ box) **and for the Picture Wall** (want to only see pictures about `nature`?) -- You can also build the URLs manually: - - `https://my.shaarli.domain/?do=rss&searchtags=nature` - - `https://my.shaarli.domain/links/picture-wall?searchterm=poney` - -![](images/rss-filter-1.png) ![](images/rss-filter-2.png) diff --git a/doc/md/Release-Shaarli.md b/doc/md/Release-Shaarli.md deleted file mode 100644 index e22eabc9..00000000 --- a/doc/md/Release-Shaarli.md +++ /dev/null @@ -1,161 +0,0 @@ -See [Git - Maintaining a project - Tagging your -releases](http://git-scm.com/book/en/v2/Distributed-Git-Maintaining-a-Project#Tagging-Your-Releases). - -## Prerequisites -This guide assumes that you have: - -- a GPG key matching your GitHub authentication credentials - - i.e., the email address identified by the GPG key is the same as the one in your `~/.gitconfig` -- a GitHub fork of Shaarli -- a local clone of your Shaarli fork, with the following remotes: - - `origin` pointing to your GitHub fork - - `upstream` pointing to the main Shaarli repository -- maintainer permissions on the main Shaarli repository, to: - - push the signed tag - - create a new release -- [Composer](https://getcomposer.org/) needs to be installed -- The [venv](https://docs.python.org/3/library/venv.html) Python 3 module needs to be installed for HTML documentation generation. - -## GitHub release draft and `CHANGELOG.md` -See http://keepachangelog.com/en/0.3.0/ for changelog formatting. - -### GitHub release draft -GitHub allows drafting the release note for the upcoming release, from the [Releases](https://github.com/shaarli/Shaarli/releases) page. This way, the release note can be drafted while contributions are merged to `master`. - -### `CHANGELOG.md` -This file should contain the same information as the release note draft for the upcoming version. - -Update it to: - -- add new entries (additions, fixes, etc.) -- mark the current version as released by setting its date and link -- add a new section for the future unreleased version - -```bash -$ cd /path/to/shaarli - -$ nano CHANGELOG.md - -[...] -## vA.B.C - UNRELEASED -TBA - -## [vX.Y.Z](https://github.com/shaarli/Shaarli/releases/tag/vX.Y.Z) - YYYY-MM-DD -[...] -``` - - -## Increment the version code, update docs, create and push a signed tag -### Update the list of Git contributors -```bash -$ make authors -$ git commit -s -m "Update AUTHORS" -``` - -### Create and merge a Pull Request -This one is pretty straightforward ;-) - -### Bump Shaarli version to v0.x branch - -```bash -$ git checkout master -$ git fetch upstream -$ git pull upstream master - -# IF the branch doesn't exists -$ git checkout -b v0.5 -# OR if the branch already exists -$ git checkout v0.5 -$ git rebase upstream/master - -# Bump shaarli version from dev to 0.5.0, **without the `v`** -$ vim shaarli_version.php -$ git add shaarli_version -$ git commit -s -m "Bump Shaarli version to v0.5.0" -$ git push upstream v0.5 -``` - -### Create and push a signed tag -```bash -# update your local copy -$ git checkout v0.5 -$ git fetch upstream -$ git pull upstream v0.5 - -# create a signed tag -$ git tag -s -m "Release v0.5.0" v0.5.0 - -# push it to "upstream" -$ git push --tags upstream -``` - -### Verify a signed tag -[`v0.5.0`](https://github.com/shaarli/Shaarli/releases/tag/v0.5.0) is the first GPG-signed tag pushed on the Community Shaarli. - -Let's have a look at its signature! - -```bash -$ cd /path/to/shaarli -$ git fetch upstream - -# get the SHA1 reference of the tag -$ git show-ref tags/v0.5.0 -f7762cf803f03f5caf4b8078359a63783d0090c1 refs/tags/v0.5.0 - -# verify the tag signature information -$ git verify-tag f7762cf803f03f5caf4b8078359a63783d0090c1 -gpg: Signature made Thu 30 Jul 2015 11:46:34 CEST using RSA key ID 4100DF6F -gpg: Good signature from "VirtualTam " [ultimate] -``` - -## Publish the GitHub release -### Update release badges -Update `README.md` so version badges display and point to the newly released Shaarli version(s), in the `master` branch. - -### Create a GitHub release from a Git tag -From the previously drafted release: - -- edit the release notes (if needed) -- specify the appropriate Git tag -- publish the release -- profit! - -### Generate and upload all-in-one release archives -Users with a shared hosting may have: - -- no SSH access -- no possibility to install PHP packages or server extensions -- no possibility to run scripts - -To ease Shaarli installations, it is possible to generate and upload additional release archives, -that will contain Shaarli code plus all required third-party libraries. - -**From the `v0.5` branch:** - -```bash -$ make release_archive -``` - -This will create the following archives: - -- `shaarli-vX.Y.Z-full.tar` -- `shaarli-vX.Y.Z-full.zip` - -The archives need to be manually uploaded on the previously created GitHub release. - -### Update `stable` and `latest` branches - -``` -$ git checkout latest -# latest release -$ git merge v0.5.0 -# fix eventual conflicts -$ make test -$ git push upstream latest -$ git checkout stable -# latest previous major -$ git merge v0.4.5 -# fix eventual conflicts -$ make test -$ git push upstream stable -``` diff --git a/doc/md/Reverse-proxy.md b/doc/md/Reverse-proxy.md new file mode 100644 index 00000000..2c1c601e --- /dev/null +++ b/doc/md/Reverse-proxy.md @@ -0,0 +1,116 @@ +# Reverse proxy + +If Shaarli is hosted on a server behind a [reverse proxy](https://en.wikipedia.org/wiki/Reverse_proxy) (i.e. there is a proxy server between clients and the web server hosting Shaarli), configure it accordingly. See [Reverse proxy](Reverse-proxy.md) configuration. In this example: + +- The Shaarli application server exposes port `10080` to the proxy (for example docker container started with `--publish 127.0.0.1:10080:80`). +- The Shaarli application server runs at `127.0.0.1` (container). Replace with the server's IP address if running on a different machine. +- Shaarli's Fully Qualified Domain Name (FQDN) is `shaarli.mydomain.org`. +- No HTTPS is setup on the application server, SSL termination is done at the reverse proxy. + +In your [Shaarli configuration](Shaarli-configuration) `data/config.json.php`, add the public IP of your proxy under `security.trusted_proxies`. + +See also [proxy-related](https://github.com/shaarli/Shaarli/issues?utf8=%E2%9C%93&q=label%3Aproxy+) issues. + + +## Apache + +```apache + + ServerName shaarli.mydomain.org + # Redirect HTTP to HTTPS + Redirect permanent / https://shaarli.mydomain.org + + + + ServerName shaarli.mydomain.org + + SSLEngine on + SSLCertificateFile /path/to/certificate + SSLCertificateKeyFile /path/to/private/key + + LogLevel warn + ErrorLog /var/log/apache2/error.log + CustomLog /var/log/apache2/access.log combined + + # let the proxied shaarli server/container know HTTPS URLs should be served + RequestHeader set X-Forwarded-Proto "https" + + # send the original SERVER_NAME to the proxied host + ProxyPreserveHost On + + # pass requests to the proxied host + # sets X-Forwarded-For, X-Forwarded-Host and X-Forwarded-Server headers + ProxyPass / http://127.0.0.1:10080/ + ProxyPassReverse / http://127.0.0.1:10080/ + +``` + + +## HAProxy + + +```conf +global + [...] + +defaults + [...] + +frontend http-in + bind :80 + redirect scheme https code 301 if !{ ssl_fc } + bind :443 ssl crt /path/to/cert.pem + default_backend shaarli + +backend shaarli + mode http + option http-server-close + option forwardfor + reqadd X-Forwarded-Proto: https + server shaarli1 127.0.0.1:10080 +``` + + +## Nginx + + +```nginx +http { + [...] + + index index.html index.php; + + root /home/john/web; + access_log /var/log/nginx/access.log combined; + error_log /var/log/nginx/error.log; + + server { + listen 80; + server_name shaarli.mydomain.org; + # redirect HTTP to HTTPS + return 301 https://shaarli.mydomain.org$request_uri; + } + + server { + listen 443 ssl http2; + server_name shaarli.mydomain.org; + + ssl_certificate /path/to/certificate + ssl_certificate_key /path/to/private/key + + location / { + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $host; + + # pass requests to the proxied host + proxy_pass http://localhost:10080/; + proxy_set_header Host $host; + proxy_connect_timeout 30s; + proxy_read_timeout 120s; + } + } +} +``` + diff --git a/doc/md/Security.md b/doc/md/Security.md deleted file mode 100644 index 65db4225..00000000 --- a/doc/md/Security.md +++ /dev/null @@ -1,25 +0,0 @@ -## Client browser -- Shaarli relies on `HTTP_REFERER` for some functions (like redirects and clicking on tags). If you have disabled or masqueraded `HTTP_REFERER` in your browser, some features of Shaarli may not work - -## Server and sessions -- Directories are protected using `.htaccess` files -- Forms are protected against XSRF (Cross-site requests forgery): - - Forms which act on data (save,delete…) contain a token generated by the server. - - Any posted form which does not contain a valid token is rejected. - - Any token can only be used once. - - Tokens are attached to the session and cannot be reused in another session. -- Sessions automatically expire after 60 minutes. -- Sessions are protected against hijacking: the session ID cannot be used from a different IP address. - -## Shaarli datastore and configuration -- The password is salted, hashed and stored in the data subdirectory, in a PHP file, and protected by htaccess. Even if the webserver does not support htaccess, the hash is not readable by URL. Even if the .php file is stolen, the password cannot deduced from the hash. The salt prevents rainbow-tables attacks. -- Links are stored as an associative array which is serialized, compressed (with deflate), base64-encoded and saved as a comment in a `.php` file. -- Even if the server does not support `.htaccess` files, the data file will still not be readable by URL. -- The database looks like this: - -```php - -``` - -- Small hashes are used to make a link to an entry in Shaarli. They are unique. In fact, the date of the items (eg. `20110923_150523`) is hashed with CRC32, then converted to base64 and some characters are replaced. They are always 6 characters longs and use only `A-Z a-z 0-9 - _` and `@`. diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index f9ea2ed2..5c45942c 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -1,17 +1,29 @@ +# Server configuration -- [Prerequisites](#prerequisistes) -- [Apache](#apache) -- [Nginx](#nginx) -- [Proxies](#proxies) -- [See also](#see-also) -## Prerequisites -### Shaarli -- A web server and PHP interpreter module/service have been installed. -- You have write access to the Shaarli installation directory. -- The correct read/write permissions have been granted to the web server user and group. -- Your PHP interpreter is compatible with supported PHP versions: +## Requirements + +### Operating system and web server + +Shaarli can be hosted on dedicated/virtual servers, or shared hosting. The smallest DigitalOcean VPS (Droplet with 1 CPU, 1 GiB RAM and 25 GiB SSD) costs about $5/month and will run any Shaarli installation without problems. + +You need write access to the Shaarli installation directory - you should have received instructions from your hosting provider on how to connect to the server using SSH (or FTP for shared hosts). + +Examples in this documentation are given for [Debian](https://www.debian.org/), a GNU/Linux distribution widely used in server environments. Please adapt them to your specific Linux distribution. + +### Network and domain name + +Try to host the server in a region that is geographically close to your users. + +A domain name ([DNS record](https://opensource.com/article/17/4/introduction-domain-name-system-dns)) pointing to the server's public IP address is required to obtain a SSL/TLS certificate and setup HTTPS to secure client traffic to your Shaarli instance. + +You can obtain a domain name from a [registrar](https://en.wikipedia.org/wiki/Domain_name_registrar) ([1](https://www.ovh.co.uk/domains), [2](https://www.gandi.net/en/domain)), or from free subdomain providers ([1](https://freedns.afraid.org/)). If you don't have a domain name, please set up a private domain name ([FQDN](ttps://en.wikipedia.org/wiki/Fully_qualified_domain_name) in your clients' [hosts files](https://en.wikipedia.org/wiki/Hosts_(file)) to access the server (direct access by IP address can result in unexpected behavior). + + +### PHP + +Supported PHP versions: Version | Status | Shaarli compatibility :---:|:---:|:---: @@ -23,7 +35,7 @@ Version | Status | Shaarli compatibility 5.4 | EOL: 2015-09-14 | Yes (up to Shaarli 0.8.x) 5.3 | EOL: 2014-08-14 | Yes (up to Shaarli 0.8.x) -- The following PHP extensions are installed on the server: +Required PHP extensions: Extension | Required? | Usage ---|:---:|--- @@ -34,60 +46,108 @@ Extension | Required? | Usage [`php-intl`](http://php.net/manual/en/book.intl.php) | optional | localized text sorting (e.g. `e->è->f`) [`php-curl`](http://php.net/manual/en/book.curl.php) | optional | using cURL for fetching webpages and thumbnails in a more robust way [`php-gettext`](http://php.net/manual/en/book.gettext.php) | optional | Use the translation system in gettext mode (faster) --------------------------------------------------------------------------------- -### SSL/TLS configuration +Some [plugins](Plugins.md) may require additional configuration. + + +## SSL/TLS (HTTPS) -To setup HTTPS / SSL on your webserver (recommended), you must generate a public/private **key pair** and a **certificate**, and install, configure and activate the appropriate **webserver SSL extension**. +We recommend setting up [HTTPS](https://en.wikipedia.org/wiki/HTTPS) on your webserver for secure communication between clients and the server. -#### Let's Encrypt +For public-facing web servers this can be done using free SSL/TLS certificates from [Let's Encrypt](https://en.wikipedia.org/wiki/Let's_Encrypt), a non-profit certificate authority provididing free certificates. -[Let's Encrypt](https://en.wikipedia.org/wiki/Let%27s_Encrypt) is a certificate authority that provides free TLS/X.509 certificates via an automated process. + - [How to secure Apache with Let's Encrypt](https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-debian-10) + - [How to secure Nginx with Let's Encrypt](https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-debian-10) + - [How To Use Certbot Standalone Mode to Retrieve Let's Encrypt SSL Certificates](https://www.digitalocean.com/community/tutorials/how-to-use-certbot-standalone-mode-to-retrieve-let-s-encrypt-ssl-certificates-on-debian-10). - * Install `certbot` using the appropriate method described on https://certbot.eff.org/. - -Location of the `certbot` program and template configuration files may vary depending on which installation method was used. Change the file paths below accordingly. Here is an easy way to create a signed certificate using `certbot`, it assumes `certbot` was installed through APT on a Debian-based distribution: +In short: - * Stop the apache2/nginx service. - * Run `certbot --agree-tos --standalone --preferred-challenges tls-sni --email "youremail@example.com" --domain yourdomain.example.com` - * For the Apache webserver, copy `/usr/lib/python2.7/dist-packages/certbot_apache/options-ssl-apache.conf` to `/etc/letsencrypt/options-ssl-apache.conf` (paths may vary depending on installation method) - * For Nginx: TODO - * Setup your webserver as described below - * Restart the apache2/nginx service. +```bash +# install certbot +sudo apt install certbot -#### Self-signed certificates +# stop your webserver if you already have one running +# certbot in standalone mode needs to bind to port 80 (only needed on initial generation) +sudo systemctl stop apache2 +sudo systemctl stop nginx -If you don't want to request a certificate from Let's Encrypt, or are unable to (for example, webserver on a LAN, or domain name not registered in the public DNS system), you can generate a self-signed certificate. This certificate will trigger security warnings in web browsers, unless you add it to the browser's SSL store manually. +# generate initial certificates - Let's Encrypt ACME servers must be able to access your server! +# (DNS records must be correctly pointing to it, firewall/NAT on port 80/443 must be open) +sudo certbot certonly --standalone --noninteractive --agree-tos --email "admin@shaarli.mydomain.org" -d shaarli.mydomain.org +# this will generate a private key and certificate at /etc/letsencrypt/live/shaarli.mydomain.org/{privkey,fullchain}.pem -* Apache: run `make-ssl-cert generate-default-snakeoil --force-overwrite` -* Nginx: TODO +# restart the web server +sudo systemctl start apache2 +sudo systemctl start nginx +``` + +If you don't want to rely on a certificate authority, or the server can only be accessed from your own network, you can also generate self-signed certificates. Not that this will generate security warnings in web browsers/clients trying to access Shaarli: + +- [How To Create a Self-Signed SSL Certificate for Apache](https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-apache-on-debian-10) +- [How To Create a Self-Signed SSL Certificate for Nginx](https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-nginx-on-debian-10) -------------------------------------------------------------------------------- -## Apache +## Examples + +The following examples assume a Debian-based operating system is installed. On other distributions you may have to adapt details such as package installation procedures, configuration file locations, and webserver username/group (`www-data` or `httpd` are common values). + +In these examples we assume the document root for your web server/virtualhost is at `/var/www/shaarli.mydomain.org/`: + +```bash +sudo mkdir -p /var/www/shaarli.mydomain.org/ +``` + +You can install Shaarli at the root of your virtualhost, or in a subdirectory as well. See [Directory structure](Directory-structure) + -Here is a basic configuration example for the Apache web server with `mod_php`. +### Apache -In `/etc/apache2/sites-available/shaarli.conf`: +```bash +# Install apache + mod_php and PHP modules +sudo apt update +sudo apt install apache2 libapache2-mod-php php-json php-mbstring php-gd php-intl php-curl php-gettext + +# Edit the virtualhost configuration file with your favorite editor +sudo nano /etc/apache2/sites-available/shaarli.mydomain.org.conf +``` ```apache + + ServerName shaarli.mydomain.org + DocumentRoot /var/www/shaarli.mydomain.org/ + + # Log level. Possible values include: debug, info, notice, warn, error, crit, alert, emerg. + LogLevel warn + # Log file locations + ErrorLog /var/log/apache2/error.log + CustomLog /var/log/apache2/access.log combined + + # Redirect HTTP requests to HTTPS + RewriteEngine on + RewriteRule ^.well-known/acme-challenge/ - [L] + # except for Let's Encrypt ACME challenge requests + RewriteCond %{HTTP_HOST} =shaarli.mydomain.org + RewriteRule ^ https://shaarli.mydomain.org%{REQUEST_URI} [END,NE,R=permanent] + + - ServerName shaarli.my-domain.org - DocumentRoot /absolute/path/to/shaarli/ + ServerName shaarli.mydomain.org + DocumentRoot /var/www/shaarli.mydomain.org/ - # Logging - # Possible values include: debug, info, notice, warn, error, crit, alert, emerg. + # Log level. Possible values include: debug, info, notice, warn, error, crit, alert, emerg. LogLevel warn - ErrorLog /var/log/apache2/shaarli-error.log - CustomLog /var/log/apache2/shaarli-access.log combined + # Log file locations + ErrorLog /var/log/apache2/error.log + CustomLog /var/log/apache2/access.log combined - # Let's Encrypt SSL configuration (recommended) + # SSL/TLS configuration (for Let's Encrypt certificates) SSLEngine on - SSLCertificateFile /etc/letsencrypt/live/yourdomain.example.com/fullchain.pem - SSLCertificateKeyFile /etc/letsencrypt/live/yourdomain.example.com/privkey.pem + SSLCertificateFile /etc/letsencrypt/live/shaarli.mydomain.org/fullchain.pem + SSLCertificateKeyFile /etc/letsencrypt/live/shaarli.mydomain.org/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf - # Self-signed SSL cert configuration + # SSL/TLS configuration (for self-signed certificates) #SSLEngine on #SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem #SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key @@ -98,345 +158,259 @@ In `/etc/apache2/sites-available/shaarli.conf`: #php_value error_reporting 2147483647 #php_value error_log /var/log/apache2/shaarli-php-error.log - - #Required for .htaccess support + + # Required for .htaccess support AllowOverride All Order allow,deny Allow from all - - Options Indexes FollowSymLinks MultiViews #TODO is Indexes/Multiviews required? - - # Optional - required for playvideos plugin - #Header set Content-Security-Policy "script-src 'self' 'unsafe-inline' https://www.youtube.com https://s.ytimg.com 'unsafe-eval'" - -``` - -Enable this configuration with `sudo a2ensite shaarli` - -_Note: If you use Apache 2.2 or lower, you need [mod_version](https://httpd.apache.org/docs/current/mod/mod_version.html) to be installed and enabled._ + + # Prevent accessing dotfiles + RedirectMatch 404 ".*" + -_Note: Apache module `mod_rewrite` must be enabled to use the REST API._ + + # allow client-side caching of static files + Header set Cache-Control "max-age=2628000, public, must-revalidate, proxy-revalidate" + + # serve the Shaarli favicon from its custom location + Alias favicon.ico /var/www/shaarli.mydomain.org/images/favicon.ico -## Nginx + +``` -Here is a basic configuration example for the Nginx web server, using the [php-fpm](http://php-fpm.org) PHP FastCGI Process Manager, and Nginx's [FastCGI](https://en.wikipedia.org/wiki/FastCGI) module. +```bash +# Enable the virtualhost +sudo a2ensite shaarli - +# mod_ssl must be enabled to use TLS/SSL certificates +# https://httpd.apache.org/docs/current/mod/mod_ssl.html +sudo a2enmod ssl -### Common setup -Once Nginx and PHP-FPM are installed, we need to ensure: +# mod_rewrite must be enabled to use the REST API +# https://httpd.apache.org/docs/current/mod/mod_rewrite.html +sudo a2enmod rewrite -- Nginx and PHP-FPM are running using the _same user and group_ -- both these user and group have - - `read` permissions for Shaarli resources - - `execute` permissions for Shaarli directories _AND_ their parent directories +# mod_version must only be enabled if you use Apache 2.2 or lower +# https://httpd.apache.org/docs/current/mod/mod_version.html +# sudo a2enmod version -On a production server: +# restart the apache service +systemctl restart apache +``` -- `user:group` will likely be `http:http`, `www:www` or `www-data:www-data` -- files will be located under `/var/www`, `/var/http` or `/usr/share/nginx` +See [How to install the Apache web server](https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-debian-10) for a complete guide. -On a development server: +### Nginx -- files may be located in a user's home directory -- in this case, make sure both Nginx and PHP-FPM are running as the local user/group! +Guide on setting up the Nginx web server: [How to install the Nginx web server](https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-debian-10) -For all following configuration examples, this user/group pair will be used: +You will also need to install the [PHP-FPM](http://php-fpm.org) interpreter as detailed [here](https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mariadb-php-lemp-stack-on-debian-10#step-3-%E2%80%94-installing-php-for-processing). Nginx and PHP-FPM must be running using the same user and group, here we assume the user/group to be `www-data:www-data` but this may vary depending on your Linux distribution. -- `user:group = john:users`, -which corresponds to the following service configuration: +```bash +# install nginx and php-fpm +sudo apt update +sudo apt install nginx php-fpm -```ini -; /etc/php/php-fpm.conf -user = john -group = users - -[...] -listen.owner = john -listen.group = users +# Edit the virtualhost configuration file with your favorite editor +sudo nano /etc/nginx/sites-available/shaarli.mydomain.org ``` ```nginx -# /etc/nginx/nginx.conf -user john users; +server { + listen 80; + server_name shaarli.mydomain.org; -http { - [...] + # redirect all plain HTTP requests to HTTPS + return 301 https://shaarli.mydomain.org$request_uri; } -``` -### (Optional) Increase the maximum file upload size -Some bookmark dumps generated by web browsers can be _huge_ due to the presence of Base64-encoded images and favicons, as well as extra verbosity when nesting links in (sub-)folders. +server { + listen 443 ssl; + server_name shaarli.mydomain.org; + root /var/www/shaarli.mydomain.org; -To increase upload size, you will need to modify both nginx and PHP configuration: - -```nginx -# /etc/nginx/nginx.conf - -http { - [...] - - client_max_body_size 10m; - - [...] -} -``` - -```ini -# /etc/php//fpm/php.ini - -[...] -post_max_size = 10M -[...] -upload_max_filesize = 10M -``` + # log file locations + # combined log format prepends the virtualhost/domain name to log entries + access_log /var/log/nginx/access.log combined; + error_log /var/log/nginx/error.log; -### Minimal -_WARNING: Use for development only!_ + # paths to private key and certificates for SSL/TLS + ssl_certificate /etc/ssl/shaarli.mydomain.org.crt; + ssl_certificate_key /etc/ssl/private/shaarli.mydomain.org.key; -```nginx -user john users; -worker_processes 1; -events { - worker_connections 1024; -} + # increase the maximum file upload size if needed: by default nginx limits file upload to 1MB (413 Entity Too Large error) + client_max_body_size 100m; -http { - include mime.types; - default_type application/octet-stream; - keepalive_timeout 20; - - index index.html index.php; - - server { - listen 80; - server_name localhost; - root /home/john/web; - - access_log /var/log/nginx/access.log; - error_log /var/log/nginx/error.log; - - location /shaarli/ { - try_files $uri /shaarli/index.php$is_args$args; - access_log /var/log/nginx/shaarli.access.log; - error_log /var/log/nginx/shaarli.error.log; - } - - location ~ (index)\.php$ { - try_files $uri =404; - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; - fastcgi_index index.php; - include fastcgi.conf; - } + # relative path to shaarli from the root of the webserver + location / { + # default index file when no file URI is requested + index index.php; + try_files $uri /index.php$is_args$args; } -} -``` -### Modular -The previous setup is sufficient for development purposes, but has several major caveats: + location ~ (index)\.php$ { + try_files $uri =404; + # slim API - split URL path into (script_filename, path_info) + fastcgi_split_path_info ^(.+\.php)(/.+)$; + # pass PHP requests to PHP-FPM + fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; + fastcgi_index index.php; + include fastcgi.conf; + } -- every content that does not match the PHP rule will be sent to client browsers: - - dotfiles - in our case, `.htaccess` - - temporary files, e.g. Vim or Emacs files: `index.php~` -- asset / static resource caching is not optimized -- if serving several PHP sites, there will be a lot of duplication: `location /shaarli/`, `location /mysite/`, etc. + location ~ \.php$ { + # deny access to all other PHP scripts + # disable this if you host other PHP applications on the same virtualhost + deny all; + } -To solve this, we will split Nginx configuration in several parts, that will be included when needed: + location ~ /\. { + # deny access to dotfiles + deny all; + } -```nginx -# /etc/nginx/deny.conf -location ~ /\. { - # deny access to dotfiles - access_log off; - log_not_found off; - deny all; -} + location ~ ~$ { + # deny access to temp editor files, e.g. "script.php~" + deny all; + } -location ~ ~$ { - # deny access to temp editor files, e.g. "script.php~" - access_log off; - log_not_found off; - deny all; -} -``` + location = /favicon.ico { + # serve the Shaarli favicon from its custom location + alias /var/www/shaarli/images/favicon.ico; + } -```nginx -# /etc/nginx/php.conf -location ~ (index)\.php$ { - # Slim - split URL path into (script_filename, path_info) - try_files $uri =404; - fastcgi_split_path_info ^(.+\.php)(/.+)$; - - # filter and proxy PHP requests to PHP-FPM - fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; - fastcgi_index index.php; - include fastcgi.conf; -} + # allow client-side caching of static files + location ~* \.(?:ico|css|js|gif|jpe?g|png)$ { + expires max; + add_header Cache-Control "public, must-revalidate, proxy-revalidate"; + # HTTP 1.0 compatibility + add_header Pragma public; + } -location ~ \.php$ { - # deny access to all other PHP scripts - deny all; } ``` -```nginx -# /etc/nginx/static_assets.conf -location ~* \.(?:ico|css|js|gif|jpe?g|png)$ { - expires max; - add_header Pragma public; - add_header Cache-Control "public, must-revalidate, proxy-revalidate"; -} +```bash +# enable the configuration/virtualhost +sudo ln -s /etc/nginx/sites-available/shaarli.mydomain.org /etc/nginx/sites-enabled/shaarli.mydomain.org +# reload nginx configuration +sudo systemctl reload nginx ``` -```nginx -# /etc/nginx/nginx.conf -[...] - -http { - [...] - - root /home/john/web; - access_log /var/log/nginx/access.log; - error_log /var/log/nginx/error.log; - server { - # virtual host for a first domain - listen 80; - server_name my.first.domain.org; +## Reverse proxies - location /shaarli/ { - # Slim - rewrite URLs - try_files $uri /shaarli/index.php$is_args$args; +If Shaarli is hosted on a server behind a [reverse proxy](https://en.wikipedia.org/wiki/Reverse_proxy) (i.e. there is a proxy server between clients and the web server hosting Shaarli), configure it accordingly. See [Reverse proxy](Reverse-proxy.md) configuration. - access_log /var/log/nginx/shaarli.access.log; - error_log /var/log/nginx/shaarli.error.log; - } - location = /shaarli/favicon.ico { - # serve the Shaarli favicon from its custom location - alias /var/www/shaarli/images/favicon.ico; - } - include deny.conf; - include static_assets.conf; - include php.conf; - } +## Allow import of large browser bookmarks export - server { - # virtual host for a second domain - listen 80; - server_name second.domain.com; +Web browser bookmark exports can be large due to the presence of base64-encoded images and favicons/long subfolder names. Edit the PHP configuration file. - location /minigal/ { - access_log /var/log/nginx/minigal.access.log; - error_log /var/log/nginx/minigal.error.log; - } +- Apache: `/etc/php//apache2/php.ini` +- Nginx + PHP-FPM: `/etc/php//fpm/php.ini` (in addition to `client_max_body_size` in the [Nginx configuration](#nginx)) - include deny.conf; - include static_assets.conf; - include php.conf; - } -} -``` - -### Redirect HTTP to HTTPS -Assuming you have generated a (self-signed) key and certificate, and they are -located under `/home/john/ssl/localhost.{key,crt}`, it is pretty straightforward -to set an HTTP (:80) to HTTPS (:443) redirection to force SSL/TLS usage. - -```nginx -# /etc/nginx/nginx.conf +```ini [...] +# (optional) increase the maximum file upload size: +post_max_size = 100M +[...] +# (optional) increase the maximum file upload size: +upload_max_filesize = 100M +``` -http { - [...] - - index index.html index.php; - - root /home/john/web; - access_log /var/log/nginx/access.log; - error_log /var/log/nginx/error.log; - - server { - listen 80; - server_name localhost; +To verify PHP settings currently set on the server, create a `phpinfo.php` in your webserver's document root - return 301 https://localhost$request_uri; - } +```bash +# example +echo '' | sudo tee /var/www/shaarli.mydomain.org/phpinfo.php +#give read-only access to this file to the webserver user +sudo chown www-data:root /var/www/shaarli.mydomain.org/phpinfo.php +sudo chmod 0400 /var/www/shaarli.mydomain.org/phpinfo.php +``` - server { - listen 443 ssl; - server_name localhost; +Access the file from a web browser (eg. and look at the _Loaded Configuration File_ and _Scan this dir for additional .ini files_ entries - ssl_certificate /home/john/ssl/localhost.crt; - ssl_certificate_key /home/john/ssl/localhost.key; +It is recommended to remove the `phpinfo.php` when no longer needed as it publicly discloses details about your webserver configuration. - location /shaarli/ { - # Slim - rewrite URLs - try_files $uri /index.php$is_args$args; - access_log /var/log/nginx/shaarli.access.log; - error_log /var/log/nginx/shaarli.error.log; - } +## Robots and crawlers - location = /shaarli/favicon.ico { - # serve the Shaarli favicon from its custom location - alias /var/www/shaarli/images/favicon.ico; - } +To opt-out of indexing your Shaarli instance by search engines, create a `robots.txt` file at the root of your virtualhost: - include deny.conf; - include static_assets.conf; - include php.conf; - } -} +``` +User-agent: * +Disallow: / ``` -## Proxies - -If Shaarli is served behind a proxy (i.e. there is a proxy server between clients and the web server hosting Shaarli), please refer to the proxy server documentation for proper configuration. In particular, you have to ensure that the following server variables are properly set: +By default Shaarli already disallows indexing of your local copy of the documentation by default, using `` HTML tags. Your Shaarli instance may still be indexed by various robots on the public Internet, that do not respect this header or the robots standard. -- `X-Forwarded-Proto` -- `X-Forwarded-Host` -- `X-Forwarded-For` +- [Robots exclusion standard](https://en.wikipedia.org/wiki/Robots_exclusion_standard) +- [Introduction to robots.txt](https://support.google.com/webmasters/answer/6062608?hl=en) +- [Robots meta tag, data-nosnippet, and X-Robots-Tag specifications](https://developers.google.com/search/reference/robots_meta_tag) +- [About robots.txt](http://www.robotstxt.org) +- [About the robots META tag](https://www.robotstxt.org/meta.html) -In you [Shaarli configuration](Shaarli-configuration) `data/config.json.php`, add the public IP of your proxy under `security.trusted_proxies`. -See also [proxy-related](https://github.com/shaarli/Shaarli/issues?utf8=%E2%9C%93&q=label%3Aproxy+) issues. +## Fail2ban -## Robots and crawlers +[fail2ban](http://www.fail2ban.org/wiki/index.php/Main_Page) is an intrusion prevention framework that reads server (Apache, SSH, etc.) and uses `iptables` profiles to block brute-force attempts. You need to create a filter to detect shaarli login failures in logs, and a jail configuation to configure the behavior when failed login attempts are detected: -Shaarli disallows indexing and crawling of your local documentation pages by search engines, using `` HTML tags. -Your Shaarli instance and other pages you host may still be indexed by various robots on the public Internet. -You may want to setup a robots.txt file or other crawler control mechanism on your server. -See [[1]](https://en.wikipedia.org/wiki/Robots_exclusion_standard), [[2]](https://support.google.com/webmasters/answer/6062608?hl=en) and [[3]](https://developers.google.com/search/reference/robots_meta_tag) - -## See also +```ini +# /etc/fail2ban/filter.d/shaarli-auth.conf +[INCLUDES] +before = common.conf +[Definition] +failregex = \s-\s\s-\sLogin failed for user.*$ +ignoreregex = +``` - * [Server security](Server-security.md) +```ini +# /etc/fail2ban/jail.local +[shaarli-auth] +enabled = true +port = https,http +filter = shaarli-auth +logpath = /var/www/shaarli.mydomain.org/data/log.txt +# allow 3 login attempts per IP address +# (over a period specified by findtime = in /etc/fail2ban/jail.conf) +maxretry = 3 +# permanently ban the IP address after reaching the limit +bantime = -1 +``` -#### Webservers +#### References -- [Apache/PHP - error log per VirtualHost](http://stackoverflow.com/q/176) (StackOverflow) +- [Apache/PHP - error log per VirtualHost - StackOverflow](http://stackoverflow.com/q/176) - [Apache - PHP: php_value vs php_admin_value and the use of php_flag explained](https://ma.ttias.be/php-php_value-vs-php_admin_value-and-the-use-of-php_flag-explained/) -- [Server-side TLS (Apache)](https://wiki.mozilla.org/Security/Server_Side_TLS#Apache) (Mozilla) +- [Server-side TLS (Apache) - Mozilla](https://wiki.mozilla.org/Security/Server_Side_TLS#Apache) - [Nginx Beginner's guide](http://nginx.org/en/docs/beginners_guide.html) - [Nginx ngx_http_fastcgi_module](http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html) - [Nginx Pitfalls](http://wiki.nginx.org/Pitfalls) -- [Nginx PHP configuration examples](http://kbeezie.com/nginx-configuration-examples/) (Karl Blessing) -- [Server-side TLS (Nginx)](https://wiki.mozilla.org/Security/Server_Side_TLS#Nginx) (Mozilla) +- [Nginx PHP configuration examples - Karl Blessing](http://kbeezie.com/nginx-configuration-examples/) +- [Apache 2.4 documentation](https://httpd.apache.org/docs/2.4/) +- [Apache mod_proxy](https://httpd.apache.org/docs/2.4/mod/mod_proxy.html) +- [Apache Reverse Proxy Request Headers](https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#x-headers) +- [HAProxy documentation](https://cbonte.github.io/haproxy-dconv/) +- [Nginx documentation](https://nginx.org/en/docs/) +- [`X-Forwarded-Proto`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto) +- [`X-Forwarded-Host`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Host) +- [`X-Forwarded-For`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For) +- [Server-side TLS (Nginx) - Mozilla](https://wiki.mozilla.org/Security/Server_Side_TLS#Nginx) - [How to Create Self-Signed SSL Certificates with OpenSSL](http://www.xenocafe.com/tutorials/linux/centos/openssl/self_signed_certificates/index.php) - [How do I create my own Certificate Authority?](https://workaround.org/certificate-authority) - -#### PHP - - [Travis configuration](https://github.com/shaarli/Shaarli/blob/master/.travis.yml) - [PHP: Supported versions](http://php.net/supported-versions.php) -- [PHP: Unsupported versions](http://php.net/eol.php) _(EOL - End Of Life)_ +- [PHP: Unsupported versions (EOL/End-of-life)](http://php.net/eol.php) - [PHP 7 Changelog](http://php.net/ChangeLog-7.php) - [PHP 5 Changelog](http://php.net/ChangeLog-5.php) - [PHP: Bugs](https://bugs.php.net/) +- [Transport Layer Security](https://en.wikipedia.org/wiki/Transport_Layer_Security) +- Hosting providers: [DigitalOcean](https://www.digitalocean.com/) ([1](https://www.digitalocean.com/docs/droplets/overview/), [2](https://www.digitalocean.com/pricing/), [3](https://www.digitalocean.com/docs/droplets/how-to/create/), [How to Add SSH Keys to Droplets](https://www.digitalocean.com/docs/droplets/how-to/add-ssh-keys/), [4](https://www.digitalocean.com/community/tutorials/initial-server-setup-with-debian-8), [5](https://www.digitalocean.com/community/tutorials/an-introduction-to-securing-your-linux-vps)), [Gandi](https://www.gandi.net/en), [OVH](https://www.ovh.co.uk/), [RackSpace](https://www.rackspace.com/), etc. + + diff --git a/doc/md/Server-security.md b/doc/md/Server-security.md deleted file mode 100644 index ea1b637d..00000000 --- a/doc/md/Server-security.md +++ /dev/null @@ -1,76 +0,0 @@ -## php.ini -PHP settings are defined in: - -- a main configuration file, usually found under `/etc/php/$php_version/php.ini`; some distributions provide different configuration environments, e.g. - - `/etc/php/$php_version/cli/php.ini` - used when running console scripts - - `/etc/php/$php_version/apache2/php.ini` - used when a client requests PHP resources from Apache - - `/etc/php/$php_version/php-fpm.conf` - used when PHP requests are proxied to PHP-FPM -- additional configuration files/entries, depending on the installed/enabled extensions: - - `/etc/php/conf.d/xdebug.ini` - -### Locate .ini files -#### Console environment -```bash -$ php --ini -Configuration File (php.ini) Path: /etc/php -Loaded Configuration File: /etc/php/php.ini -Scan for additional .ini files in: /etc/php/conf.d -Additional .ini files parsed: /etc/php/conf.d/xdebug.ini -``` - -#### Server environment -- create a `phpinfo.php` script located in a path supported by the web server, e.g. - - Apache (with user dirs enabled): `/home/myself/public_html/phpinfo.php` - - `/var/www/test/phpinfo.php` -- make sure the script is readable by the web server user/group (usually, `www`, `www-data` or `httpd`) -- access the script from a web browser -- look at the _Loaded Configuration File_ and _Scan this dir for additional .ini files_ entries -```php - -``` - -## fail2ban -`fail2ban` is an intrusion prevention framework that reads server (Apache, SSH, etc.) and uses `iptables` profiles to block brute-force attempts: - -- [Official website](http://www.fail2ban.org/wiki/index.php/Main_Page) -- [Source code](https://github.com/fail2ban/fail2ban) - -### Read Shaarli logs to ban IPs -Example configuration: -- allow 3 login attempts per IP address -- after 3 failures, permanently ban the corresponding IP adddress - -`/etc/fail2ban/jail.local` -```ini -[shaarli-auth] -enabled = true -port = https,http -filter = shaarli-auth -logpath = /var/www/path/to/shaarli/data/log.txt -maxretry = 3 -bantime = -1 -``` - -`/etc/fail2ban/filter.d/shaarli-auth.conf` -```ini -[INCLUDES] -before = common.conf -[Definition] -failregex = \s-\s\s-\sLogin failed for user.*$ -ignoreregex = -``` - -## Robots - Restricting search engines and web crawler traffic - -Creating a `robots.txt` with the following contents at the root of your Shaarli installation will prevent _honest_ web crawlers from indexing each and every link and Daily page from a Shaarli instance, thus getting rid of a certain amount of unsollicited network traffic. - -``` -User-agent: * -Disallow: / -``` - -See: - -- http://www.robotstxt.org -- http://www.robotstxt.org/robotstxt.html -- http://www.robotstxt.org/meta.html diff --git a/doc/md/Shaarli-configuration.md b/doc/md/Shaarli-configuration.md index 2462e20e..e93ee245 100644 --- a/doc/md/Shaarli-configuration.md +++ b/doc/md/Shaarli-configuration.md @@ -1,126 +1,19 @@ -## Foreword - -**Do not edit configuration options in index.php! Your changes would be lost.** +# Shaarli configuration Once your Shaarli instance is installed, the file `data/config.json.php` is generated: -* it contains all settings in JSON format, and can be edited to customize values -* it defines which [plugins](Plugin-System) are enabled -* its values override those defined in `index.php` -* it is wrap in a PHP comment to prevent anyone accessing it, regardless of server configuration - -## File and directory permissions - -The server process running Shaarli must have: - -- `read` access to the following resources: - - PHP scripts: `index.php`, `application/*.php`, `plugins/*.php` - - 3rd party PHP and Javascript libraries: `inc/*.php`, `inc/*.js` - - static assets: - - CSS stylesheets: `inc/*.css` - - `images/*` - - RainTPL templates: `tpl/*.html` -- `read`, `write` and `execution` access to the following directories: - - `cache` - thumbnail cache - - `data` - link data store, configuration options - - `pagecache` - Atom/RSS feed cache - - `tmp` - RainTPL page cache - -On a Linux distribution: - -- the web server user will likely be `www` or `http` (for Apache2) -- it will be a member of a group of the same name: `www:www`, `http:http` -- to give it access to Shaarli, either: - - unzip Shaarli in the default web server location (usually `/var/www/`) and set the web server user as the owner - - put users in the same group as the web server, and set the appropriate access rights -- if you have a domain / subdomain to serve Shaarli, [configure the server](Server-configuration) accordingly - -## Configuration - -In `data/config.json.php`. - -See also [Plugin System](Plugin-System). - -### Credentials - -_These settings should not be edited_ - -- **login**: Login username. -- **hash**: Generated password hash. -- **salt**: Password salt. - -### General - -- **title**: Shaarli's instance title. -- **header_link**: Link to the homepage. -- **links_per_page**: Number of shaares displayed per page. -- **timezone**: See [the list of supported timezones](http://php.net/manual/en/timezones.php). -- **enabled_plugins**: List of enabled plugins. -- **default_note_title**: Default title of a new note. -- **retrieve_description** (boolean): If set to true, for every new links Shaarli will try -to retrieve the description and keywords from the HTML meta tags. - -### Security - -- **session_protection_disabled**: Disable session cookie hijacking protection (not recommended). - It might be useful if your IP adress often changes. -- **ban_after**: Failed login attempts before being IP banned. -- **ban_duration**: IP ban duration in seconds. -- **open_shaarli**: Anyone can add a new link while logged out if enabled. -- **trusted_proxies**: List of trusted IP which won't be banned after failed login attemps. Useful if Shaarli is behind a reverse proxy. -- **allowed_protocols**: List of allowed protocols in shaare URLs or markdown-rendered descriptions. Useful if you want to store `javascript:` links (bookmarklets) in Shaarli (default: `["ftp", "ftps", "magnet"]`). - -### Resources - -- **data_dir**: Data directory. -- **datastore**: Shaarli's links database file path. -- **history**: Shaarli's operation history file path. -- **updates**: File path for the ran updates file. -- **log**: Log file path. -- **update_check**: Last update check file path. -- **raintpl_tpl**: Templates directory. -- **raintpl_tmp**: Template engine cache directory. -- **thumbnails_cache**: Thumbnails cache directory. -- **page_cache**: Shaarli's internal cache directory. -- **ban_file**: Banned IP file path. -### Translation +- it contains all settings in JSON format, and can be edited to customize values +- it defines which [plugins](Plugins.md) are enabled +- its values override those defined in `index.php` +- it is wrapped in a PHP comment so that its contents are never served by the web server, regardless of configuration -- **language**: translation language (also see [Translations](Translations)) - - **auto** (default): The translation language is chosen from the browser locale. - It means that the language can be different for 2 different visitors depending on their locale. - - **en**: Use the English translation. - - **fr**: Use the French translation. -- **mode**: - - **auto** or **php** (default): Use the PHP implementation of gettext (slower) - - **gettext**: Use PHP builtin gettext extension - (faster, but requires `php-gettext` to be installed and to reload the web server on update) -- **extension**: Translation extensions for custom themes or plugins. -Must be an associative array: `translation domain => translation path`. - -### Updates - -- **check_updates**: Enable or disable update check to the git repository. -- **check_updates_branch**: Git branch used to check updates (e.g. `stable` or `master`). -- **check_updates_interval**: Look for new version every N seconds (default: every day). - -### Privacy - -- **default_private_links**: Check the private checkbox by default for every new link. -- **hide_public_links**: All links are hidden while logged out. -- **force_login**: if **hide_public_links** and this are set to `true`, all anonymous users are redirected to the login page. -- **hide_timestamps**: Timestamps are hidden. -- **remember_user_default**: Default state of the login page's *remember me* checkbox - - `true`: checked by default, `false`: unchecked by default - -### Feed +**Do not edit configuration options in index.php! Your changes would be lost.** -- **rss_permalinks**: Enable this to redirect RSS links to Shaarli's permalinks instead of shaared URL. -- **show_atom**: Display ATOM feed button. +## Tools menu -### Thumbnail +Some settings can be configured directly from a web browser by accesing the `Tools` menu. Values are read/written to/from the configuration file. -- **enable_thumbnails**: Enable or disable thumbnail display. -- **enable_localcache**: Enable or disable local cache. +![](https://i.imgur.com/boaaibC.png) ### LDAP @@ -236,9 +129,89 @@ Must be an associative array: `translation domain => translation path`. } ?> ``` -## Additional configuration +## Settings + +### Credentials + +_These settings should not be edited_ + +- **login**: Login username. +- **hash**: Generated password hash. +- **salt**: Password salt. + +### General + +- **title**: Shaarli's instance title. +- **header_link**: Link to the homepage. +- **links_per_page**: Number of Shaares displayed per page. +- **timezone**: See [the list of supported timezones](http://php.net/manual/en/timezones.php). +- **enabled_plugins**: List of enabled plugins. +- **default_note_title**: Default title of a new note. +- **retrieve_description** (boolean): If set to true, for every new Shaare Shaarli will try to retrieve the description and keywords from the HTML meta tags. + +### Security + +- **session_protection_disabled**: Disable session cookie hijacking protection (not recommended). + It might be useful if your IP adress often changes. +- **ban_after**: Failed login attempts before being IP banned. +- **ban_duration**: IP ban duration in seconds. +- **open_shaarli**: Anyone can add a new Shaare while logged out if enabled. +- **trusted_proxies**: List of trusted IP which won't be banned after failed login attemps. Useful if Shaarli is behind a reverse proxy. +- **allowed_protocols**: List of allowed protocols in shaare URLs or markdown-rendered descriptions. Useful if you want to store `javascript:` links (bookmarklets) in Shaarli (default: `["ftp", "ftps", "magnet"]`). + +### Resources + +- **data_dir**: Data directory. +- **datastore**: Shaarli's Shaares database file path. +- **history**: Shaarli's operation history file path. +- **updates**: File path for the ran updates file. +- **log**: Log file path. +- **update_check**: Last update check file path. +- **raintpl_tpl**: Templates directory. +- **raintpl_tmp**: Template engine cache directory. +- **thumbnails_cache**: Thumbnails cache directory. +- **page_cache**: Shaarli's internal cache directory. +- **ban_file**: Banned IP file path. + +### Translation + +- **language**: translation language (also see [Translations](Translations)) + - **auto** (default): The translation language is chosen from the browser locale. + It means that the language can be different for 2 different visitors depending on their locale. + - **en**: Use the English translation. + - **fr**: Use the French translation. +- **mode**: + - **auto** or **php** (default): Use the PHP implementation of gettext (slower) + - **gettext**: Use PHP builtin gettext extension + (faster, but requires `php-gettext` to be installed and to reload the web server on update) +- **extension**: Translation extensions for custom themes or plugins. +Must be an associative array: `translation domain => translation path`. + +### Updates + +- **check_updates**: Enable or disable update check to the git repository. +- **check_updates_branch**: Git branch used to check updates (e.g. `stable` or `master`). +- **check_updates_interval**: Look for new version every N seconds (default: every day). + +### Privacy + +- **default_private_links**: Check the private checkbox by default for every new Shaare. +- **hide_public_links**: All Shaares are hidden while logged out. +- **force_login**: if **hide_public_links** and this are set to `true`, all anonymous users are redirected to the login page. +- **hide_timestamps**: Timestamps are hidden. +- **remember_user_default**: Default state of the login page's *remember me* checkbox + - `true`: checked by default, `false`: unchecked by default + +### Feed + +- **rss_permalinks**: Enable this to redirect RSS links to Shaarli's permalinks instead of shaared URL. +- **show_atom**: Display ATOM feed button. + +### Thumbnail + +- **enable_thumbnails**: Enable or disable thumbnail display. +- **enable_localcache**: Enable or disable local cache. -The `playvideos` plugin may require that you adapt your server's -[Content Security Policy](https://github.com/shaarli/Shaarli/blob/master/plugins/playvideos/README.md#troubleshooting) -configuration to work properly. +## Plugins configuration +See [Plugins](Plugins.md) \ No newline at end of file diff --git a/doc/md/Sharing-content.md b/doc/md/Sharing-content.md deleted file mode 100644 index 9a16fc62..00000000 --- a/doc/md/Sharing-content.md +++ /dev/null @@ -1,71 +0,0 @@ -Content posted to Shaarli is separated in items called _Shaares_. For each Shaare, -you can customize the following aspects: - - * URL to link to - * Title - * Free-text description - * Tags - * Public/private status - --------------------------------------------------------------------------------- - -## Adding new Shaares - -While logged in to your Shaarli, you can add new Shaares in several ways: - - * [+Shaare button](#shaare-button) - * [Bookmarklet](#bookmarklet) - * Third-party [apps and browser addons](Community-&-Related-software.md#mobile-apps) - * [REST API](https://shaarli.github.io/api-documentation/) - -### +Shaare button - - * While logged in to your Shaarli, click the **`+Shaare`** button located in the toolbar. - * Enter the URL of a link you want to share. - * Click `Add link` - * The `New Shaare` dialog appears, allowing you to fill in the details of your Shaare. - * The Description, Title, and Tags will help you find your Shaare later using tags or full-text search. - * You can also check the “Private” box so that the link is saved but only visible to you (the logged-in user). - * Click `Save`. - - - -### Bookmarklet - -The _Bookmarklet_ \[[1](https://en.wikipedia.org/wiki/Bookmarklet)\] is a special -browser bookmark you can use to add new content to your Shaarli. This bookmarklet is -compatible with Firefox, Opera, Chrome and Safari. To set it up: - - * Access the `Tools` page from the button in the toolbar. - * Drag the **`✚Shaare link` button** to your browser's bookmarks bar. - -Once this is done, you can shaare any URL you are visiting simply by clicking the -bookmarklet in your browser! The same `New Shaare` dialog as above is displayed. - -| Note | Websites which enforce Content Security Policy (CSP), such as github.com, disallow usage of bookmarklets. Unfortunately, there is nothing Shaarli can do about it. \[[1](https://github.com/shaarli/Shaarli/issues/196)]\ \[[2](https://bugzilla.mozilla.org/show_bug.cgi?id=866522)]\ \[[3](https://code.google.com/p/chromium/issues/detail?id=233903)]\ | -|---------|---------| - -| Note | Under Opera, you can't drag'n drop the button: You have to right-click on it and add a bookmark to your personal toolbar. | -|---------|---------| - -![](images/bookmarklet.png) - - --------------------------------------------------------------------------------- - -## Editing Shaares - -Any Shaare can edited by clicking its ![](images/edit_icon.png) `Edit` button. - -Editing a Shaare will not change it's permalink, each permalink always points to the -latest revision of a Shaare. - --------------------------------------------------------------------------------- - -## Using shaarli as a blog, notepad, pastebin... - -While adding or editing a link, leave the URL field blank to create a text-only -("note") post. This allows you to post any kind of text content, such as blog -articles, private or public notes, snippets... There is no character limit! You can -access your Shaare from its permalink. - diff --git a/doc/md/Static-analysis.md b/doc/md/Static-analysis.md deleted file mode 100644 index 29d98362..00000000 --- a/doc/md/Static-analysis.md +++ /dev/null @@ -1,13 +0,0 @@ -## WIP -This topic is currently being discussed here: - -- [Fix coding style (static analysis)](https://github.com/shaarli/Shaarli/issues/95) (#95) -- [Continuous Integration tools & features](https://github.com/shaarli/Shaarli/issues/130) (#130) - -### Usage -Static analysis tools can be installed with Composer, and used through Shaarli's [Makefile](https://github.com/shaarli/Shaarli/blob/master/Makefile). - -For an overview of the available features, see: - -- [Code quality: Makefile to run static code checkers](https://github.com/shaarli/Shaarli/pull/124) (#124) -- [Run PHPCS against different coding standards](https://github.com/shaarli/Shaarli/pull/276) (#276) diff --git a/doc/md/Theming.md b/doc/md/Theming.md deleted file mode 100644 index eb84e11c..00000000 --- a/doc/md/Theming.md +++ /dev/null @@ -1,83 +0,0 @@ -## Foreword - -There are two ways of customizing how Shaarli looks: - -1. by using a custom CSS to override Shaarli's CSS -2. by using a full theme that provides its own RainTPL templates, CSS and Javascript resources - -## Custom CSS - -Shaarli's appearance can be modified by adding CSS rules to: - -- Shaarli < `v0.9.0`: `inc/user.css` -- Shaarli >= `v0.9.0`: `data/user.css` - -This file allows overriding rules defined in the template CSS files (only add changed rules), or define a whole new theme. - -**Note**: Do not edit `tpl/default/css/shaarli.css`! Your changes would be overridden when updating Shaarli. - -## Themes - -Installation: - -- find a theme you'd like to install -- copy or clone the theme folder under `tpl/` -- enable the theme: - - Shaarli < `v0.9.0`: edit `data/config.json.php` and set the value of `raintpl_tpl` to the new theme name: - `"raintpl_tpl": "tpl\/my-template\/"` - - Shaarli >= `v0.9.0`: select the theme through the _Tools_ page - -## Community CSS & themes - -### Custom CSS - -- [mrjovanovic/serious-theme-shaarli](https://github.com/mrjovanovic/serious-theme-shaarli) - A serious theme for Shaarli -- [shaarli/shaarli-themes](https://github.com/shaarli/shaarli-themes) - -### Themes - -- [AkibaTech/Shaarli Superhero Theme](https://github.com/AkibaTech/Shaarli---SuperHero-Theme) - A template/theme for Shaarli -- [alexisju/albinomouse-template](https://github.com/alexisju/albinomouse-template) - A full template for Shaarli -- [ArthurHoaro/shaarli-launch](https://github.com/ArthurHoaro/shaarli-launch) - Customizable Shaarli theme -- [dhoko/ShaarliTemplate](https://github.com/dhoko/ShaarliTemplate) - A template/theme for Shaarli -- [kalvn/shaarli-blocks](https://github.com/kalvn/shaarli-blocks) - A template/theme for Shaarli -- [kalvn/Shaarli-Material](https://github.com/kalvn/Shaarli-Material) - A theme (template) based on Google's Material Design for Shaarli, the superfast delicious clone -- [ManufacturaInd/shaarli-2004licious-theme](https://github.com/ManufacturaInd/shaarli-2004licious-theme) - A template/theme as a humble homage to the early looks of the del.icio.us site - -### Shaarli forks - -- [misterair/Limonade](https://github.com/misterair/limonade) - A fork of (legacy) Shaarli with a new template -- [vivienhaese/shaarlitheme](https://github.com/vivienhaese/shaarlitheme) - A Shaarli fork meant to be run in an openshift instance - -## Example installation: AlbinoMouse theme - -With the following configuration: - -- Apache 2 / PHP 5.6 -- user sites are enabled, e.g. `/home/user/public_html/somedir` is served as `http://localhost/~user/somedir` -- `http` is the name of the Apache user - -```bash -$ cd ~/public_html - -# clone repositories -$ git clone https://github.com/shaarli/Shaarli.git shaarli -$ pushd shaarli/tpl -$ git clone https://github.com/alexisju/albinomouse-template.git -$ popd - -# set access rights for Apache -$ chgrp -R http shaarli -$ chmod g+rwx shaarli shaarli/cache shaarli/data shaarli/pagecache shaarli/tmp -``` - -Get config written: -- go to the freshly installed site -- fill the install form -- log in to Shaarli - -Edit Shaarli's [configuration](Shaarli-configuration): -```bash -# the file should be owned by Apache, thus not writeable => sudo -$ sudo sed -i s=tpl=tpl/albinomouse-template=g shaarli/data/config.php -``` diff --git a/doc/md/Translations.md b/doc/md/Translations.md deleted file mode 100644 index c23ec962..00000000 --- a/doc/md/Translations.md +++ /dev/null @@ -1,164 +0,0 @@ -## Translations - -Shaarli supports [gettext](https://www.gnu.org/software/gettext/manual/gettext.html) translations -since `>= v0.9.2`. - -Note that only the `default` theme supports translations. - -### Contributing - -We encourage the community to contribute to Shaarli's translation either by improving existing -translations or submitting a new language. - -Contributing to the translation does not require development skill. - -Please submit a pull request with the `.po` file updated/created. Note that the compiled file (`.mo`) -is not stored on the repository, and is generated during the release process. - -### How to - -First, install [Poedit](https://poedit.net/) tool. - -Poedit will extract strings to translate from the PHP source code. - -**Important**: due to the usage of a template engine, it's important to generate PHP cache files to extract -every translatable string. - -You can either use [this script](https://gist.github.com/ArthurHoaro/5d0323f758ab2401ef444a53f54e9a07) (recommended) -or visit every template page in your browser to generate cache files, while logged in. - -Here is a list : - -``` -http:/// -http:///?nonope -http:///admin/add-shaare -http:///admin/password -http:///admin/tags -http:///admin/configure -http:///admin/tools -http:///daily -http:///admin/shaare -http:///admin/export -http:///admin/import -http:///login -http:///picture-wall -http:///admin/plugins -http:///tags/cloud -http:///tags/list -``` - -#### Improve existing translation - -In Poedit, click on "Edit a Translation", and from Shaarli's directory open -`inc/languages//LC_MESSAGES/shaarli.po`. - -The existing list of translatable strings should have been loaded, then click on the "Update" button. - -You can start editing the translation. - -![poedit-screenshot](images/poedit-1.jpg) - -Save when you're done, then you can submit a pull request containing the updated `shaarli.po`. - -#### Add a new language - -Open Poedit and select "Create New Translation", then from Shaarli's directory open -`inc/languages//LC_MESSAGES/shaarli.po`. - -Then select the language you want to create. - -Click on `File > Save as...`, and save your file in `/inc/language//LC_MESSAGES/shaarli.po`. -`` here should be the language code respecting the [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-2) -format in lowercase (e.g. `de` for German). - -Then click on the "Update" button, and you can start to translate every available string. - -Save when you're done, then you can submit a pull request containing the new `shaarli.po`. - -### Theme translations - -Theme translation extensions are loaded automatically if they're present. - -As a theme developer, all you have to do is to add the `.po` and `.mo` compiled file like this: - - tpl//language//LC_MESSAGES/.po - tpl//language//LC_MESSAGES/.mo - -Where `` is the ISO 3166-1 alpha-2 language code. -Read the following section "Extend Shaarli's translation" to learn how to generate those files. - -### Extend Shaarli's translation - -If you're writing a custom theme, or a non official plugin, you might want to use the translation system, -but you won't be able to able to override Shaarli's translation. - -However, you can add your own translation domain which extends the main translation list. - -> Note that you can find a live example of translation extension in the `demo_plugin`. - -First, create your translation files tree directory: - -``` -/languages//LC_MESSAGES/ -``` - -Your `.po` files must be named like your domain. E.g. if your translation domain is `my_theme`, then your file will be -`my_theme.po`. - -Users have to register your extension in their configuration with the parameter -`translation.extensions.: `. - -Example: - -```php -if (! $conf->exists('translation.extensions.my_theme')) { - $conf->set('translation.extensions.my_theme', '/languages/'); - $conf->write(true); -} -``` - -> Note that the page needs to be reloaded after the registration. - -It is then recommended to create a custom translation function which will call the `t()` function with your domain. -For example : - -```php -function my_theme_t($text, $nText = '', $nb = 1) -{ - return t($text, $nText, $nb, 'my_theme'); // the last parameter is your translation domain. -} -``` - -All strings which can be translated should be processed through your function: - -```php -my_theme_t('Comment'); -my_theme_t('Comment', 'Comments', 2); -``` - -Or in templates: - -```php -{'Comment'|my_theme_t} -{function="my_theme_t('Comment', 'Comments', 2)"} -``` - -> Note than in template, you need to visit your page at least once to generate a cache file. - -When you're done, open Poedit and load translation strings from sources: - - 1. `File > New` - 2. Choose your language - 3. Save your `PO` file in `/languages//LC_MESSAGES/my_theme.po`. - 4. Go to `Catalog > Properties...` - 5. Fill the `Translation Properties` tab - 6. Add your source path in the `Sources Paths` tab - 7. In the `Sources Keywords` tab uncheck "Also use default keywords" and add the following lines: - -``` -my_theme_t -my_theme_t:1,2 -``` - -Click on the "Update" button and you're free to start your translations! diff --git a/doc/md/Troubleshooting.md b/doc/md/Troubleshooting.md index 01fd9840..3f75719d 100644 --- a/doc/md/Troubleshooting.md +++ b/doc/md/Troubleshooting.md @@ -1,5 +1,8 @@ # Troubleshooting +First of all, ensure that both the [web server](Server-configuration.md) and [Shaarli](Shaarli-configuration.md) are correctly configured. + + ## Login ### I forgot my password! @@ -8,22 +11,29 @@ Delete the file `data/config.json.php` and display the page again. You will be a ### I'm locked out - Login bruteforce protection -Login form is protected against brute force attacks: 4 failed logins will ban the IP address from login for 30 minutes. Banned IPs can still browse links. +Login form is protected against brute force attacks: 4 failed logins will ban the IP address from login for 30 minutes. Banned IPs can still browse Shaares. - To remove the current IP bans, delete the file `data/ipbans.php` - To list all login attempts, see `data/log.txt` (succesful/failed logins, bans/lifted bans) +-------------------------------------- + ## Browser issues ### Redirection issues (HTTP Referer) -Depending on its configuration and installed plugins, the browser may remove or alter (spoof) [HTTP referers](https://en.wikipedia.org/wiki/HTTP_referer), thus preventing Shaarli from properly redirecting between pages. Referer settings are available by browsing `about:config` and are documented [here](https://wiki.mozilla.org/Security/Referrer). `network.http.referer.spoofSource = true` in particular is known to break some functionality in Shaarli. +Shaarli relies on `HTTP_REFERER` for some functions (like redirects and clicking on tags). If you have disabled or altered/spoofed [HTTP referers](https://en.wikipedia.org/wiki/HTTP_referer) in your browser, some features of Shaarli may not work as expected (depending on configuration and installed plugins), notably redirections between pages. + +Firefox Referer settings are available by browsing `about:config` and are documented [here](https://wiki.mozilla.org/Security/Referrer). `network.http.referer.spoofSource = true` in particular is known to break some functionality in Shaarli. + ### Firefox, localhost and redirections `localhost` is not a proper Fully Qualified Domain Name (FQDN); if Firefox has been set up to spoof referers, or only accept requests from the same base domain/host, Shaarli redirections will not work properly. To solve this, assign a local domain to your host, e.g. `localhost.lan` in your [hosts file](https://en.wikipedia.org/wiki/Hosts_(file)) and browse Shaarli at http://localhost.lan/. +----------------------------------------- + ## Hosting problems ### Old PHP versions @@ -71,11 +81,108 @@ This can be caused by several things: - You may be using OperaTurbo or OperaMini, which use their own proxies which may change from time to time. - If you have another application on the same webserver where Shaarli is installed, these application may forcefully expire php sessions. + ### Old apache versions, Internal Server Error If you hosting provider only provides apache 2.2 and no support for `mod_version`, `.htaccess` files may cause 500 errors (Internal Server Error). See [this workaround](https://github.com/shaarli/Shaarli/issues/1196#issuecomment-412271085). -## Sessions do not seem to work correctly on your server + +### Sessions do not seem to work correctly on your server Follow the instructions in the error message. Make sure you are accessing shaarli via a direct IP address or a proper hostname. If you have **no dots** in the hostname (e.g. `localhost` or `http://my-webserver/shaarli/`), some browsers will not store cookies at all (this respects the [HTTP cookie specification](http://curl.haxx.se/rfc/cookie_spec.html)). +---------------------------------------------------------- + +## Upgrades + +### You must specify an integer as a key + +In `v0.8.1` we changed how Shaare keys are handled (from timestamps to incremental integers). Take a look at `data/updates.txt` content. + + +### `updates.txt` contains `updateMethodDatastoreIds` + +Try to delete it and refresh your page while being logged in. + +### `updates.txt` doesn't exist or doesn't contain `updateMethodDatastoreIds` + +1. Create `data/updates.txt` if it doesn't exist +2. Paste this string in the update file `;updateMethodRenameDashTags;` +3. Login to Shaarli +4. Delete the update file +5. Refresh + + + +-------------------------------------------------------- + +## Import/export + +### Importing shaarli data to Firefox + +- In Firefox, open the bookmark manager (`Bookmarks menu > Show all bookmarks` or `Ctrl+Shift+B`), select `Import and Backup > Import bookmarks in HTML format` +- Make sure the `Prepend note permalinks with this Shaarli instance's URL` box is checked when exporting, so that text-only/notes Shaares still point to the Shaarli instance you exported them from. +- Depending on the number of bookmarks, the import can take some time. + +You may be interested in these Firefox addons to manage bookmarks imported from Shaarli + +- [Bookmark Deduplicator](https://addons.mozilla.org/en-US/firefox/addon/bookmark-deduplicator/) - provides an easy way to deduplicate your bookmarks +- [TagSieve](https://addons.mozilla.org/en-US/firefox/addon/tagsieve/) - browse your bookmarks by their tags + +### Diigo + +If you export your bookmark from Diigo, make sure you use the Delicious export, not the Netscape export. (Their Netscape export is broken, and they don't seem to be interested in fixing it.) + +### Mister Wong + +See [this issue](https://github.com/sebsauvage/Shaarli/issues/146) for import tweaks. + +### SemanticScuttle + +To correctly import the tags from a [SemanticScuttle](http://semanticscuttle.sourceforge.net/) HTML export, edit the HTML file before importing and replace all occurences of `tags=` (lowercase) to `TAGS=` (uppercase). + +### Scuttle + +Shaarli cannot import data directly from [Scuttle](https://github.com/scronide/scuttle). + +However, you can use the third-party [scuttle-to-shaarli](https://github.com/q2apro/scuttle-to-shaarli) +tool to export the Scuttle database to the Netscape HTML format compatible with the Shaarli importer. + +### Refind.com + +You can use the third-party tool [Derefind](https://github.com/ShawnPConroy/Derefind) to convert refind.com bookmark exports to a format that can be imported into Shaarli. + + +------------------------------------------------------- + +## Other + +### The bookmarklet doesn't work + +Websites which enforce Content Security Policy (CSP), such as github.com, disallow usage of bookmarklets. Unfortunately, there is nothing Shaarli can do about it ([1](https://github.com/shaarli/Shaarli/issues/196), [2](https://bugzilla.mozilla.org/show_bug.cgi?id=866522), [3](https://code.google.com/p/chromium/issues/detail?id=233903). + +Under Opera, you can't drag'n drop the button: You have to right-click on it and add a bookmark to your personal toolbar. + + +### Changing the timestamp for a shaare + +- Look for `` in `tpl/editlink.tpl` (line 14) +- Replace `type="hidden"` with `type="text"` from this line +- A new date/time field becomes available in the edit/new Shaare dialog. +- You can set the timestamp manually by entering it in the format `YYYMMDD_HHMMS`. + + +------------------------------------------------------- + +## Support + +If the solutions above did not help, please: + +- Come and ask question on the [Gitter chat](https://gitter.im/shaarli/Shaarli) (also reachable via [IRC](https://irc.gitter.im/)) +- Search for [issues](https://github.com/shaarli/Shaarli/issues) and [Pull Requests](https://github.com/shaarli/Shaarli/pulls) + - if you find one that is related to the issue, feel free to comment and provide additional details (host/Shaarli setup...) + - check issues labeled [`feature`](https://github.com/shaarli/Shaarli/labels/feature), [`enhancement`](https://github.com/shaarli/Shaarli/labels/enhancement), and [`plugin`](https://github.com/shaarli/Shaarli/labels/plugin) if you would like a feature added to Shaarli. + - else, [open a new issue](https://github.com/shaarli/Shaarli/issues/new), and provide information about the problem: + - _what happens?_ - display glitches, invalid data, security flaws... + - _what is your configuration?_ - OS, server version, activated extensions, web browser... + - _is it reproducible?_ \ No newline at end of file diff --git a/doc/md/Unit-tests.md b/doc/md/Unit-tests.md deleted file mode 100644 index a9544656..00000000 --- a/doc/md/Unit-tests.md +++ /dev/null @@ -1,119 +0,0 @@ -The testing framework used is [PHPUnit](https://phpunit.de/); it can be installed with [Composer](https://getcomposer.org/), which is a dependency management tool. - -## Setup a testing environment - -### Install composer - -You can either use: - -- a system-wide version, e.g. installed through your distro's package manager (eg. `sudo apt install composer`) -- a local version, downloadable [here](https://getcomposer.org/download/). To update a local composer installation, run `php composer.phar self-update` - - -### Install Shaarli development dependencies - -```bash -$ cd /path/to/shaarli -$ composer install -``` - -### Install Xdebug - -Xdebug must be installed and enable for PHPUnit to generate coverage reports. See http://xdebug.org/docs/install. - -```bash -# for Debian-based distributions -$ aptitude install php-xdebug - -# for ArchLinux: -$ pacman -S xdebug -``` - -Then add the following line to `/etc/php//cli/php.ini`: - -```ini -zend_extension=xdebug.so -``` - -## Run unit tests - -Run `make test` and ensure tests return `OK`. If tests return failures, refer to PHPUnit messages and fix your code/tests accordingly. - -By default, PHPUnit will run all suitable tests found under the `tests` directory. Each test has 3 possible outcomes: - -- `.` - success -- `F` - failure: the test was run but its results are invalid - - the code does not behave as expected - - dependencies to external elements: globals, session, cache... -- `E` - error: something went wrong and the tested code has crashed - - typos in the code, or in the test code - - dependencies to missing external elements - -If Xdebug has been installed and activated, two coverage reports will be generated: - -- a summary in the console -- a detailed HTML report with metrics for tested code - - to open it in a web browser: `firefox coverage/index.html &` - -### Executing specific tests - -Add a [`@group`](https://phpunit.de/manual/current/en/appendixes.annotations.html#appendixes.annotations.group) annotation in a test class or method comment: - -```php -/** - * Netscape bookmark import - * @group WIP - */ -class BookmarkImportTest extends PHPUnit_Framework_TestCase -{ - [...] -} -``` - -To run all tests annotated with `@group WIP`: -```bash -$ vendor/bin/phpunit --group WIP tests/ -``` - -### Running tests inside Docker containers - -Test Dockerfiles are located under `tests/docker//Dockerfile`, -and can be used to build Docker images to run Shaarli test suites under common -Linux environments. - -Dockerfiles are provided for the following environments: - -- `alpine36` - [Alpine 3.6](https://www.alpinelinux.org/downloads/) -- `debian8` - [Debian 8 Jessie](https://www.debian.org/DebianJessie) (oldstable) -- `debian9` - [Debian 9 Stretch](https://wiki.debian.org/DebianStretch) (stable) -- `ubuntu16` - [Ubuntu 16.04 Xenial Xerus](http://releases.ubuntu.com/16.04/) (LTS) - -What's behind the curtains: - -- each image provides: - - a base Linux OS - - Shaarli PHP dependencies (OS packages) - - test PHP dependencies (OS packages) - - Composer -- the local workspace is mapped to the container's `/shaarli/` directory, -- the files are rsync'd so tests are run using a standard Linux user account - (running tests as `root` would bypass permission checks and may hide issues) -- the tests are run inside the container. - -To run tests inside a Docker container: - -```bash -# build the Debian 9 Docker image for unit tests -$ cd /path/to/shaarli -$ cd tests/docker/debian9 -$ docker build -t shaarli-test:debian9 . - -# install/update 3rd-party test dependencies -$ composer install --prefer-dist - -# run tests using the freshly built image -$ docker run -v $PWD:/shaarli shaarli-test:debian9 docker_test - -# run the full test campaign -$ docker run -v $PWD:/shaarli shaarli-test:debian9 docker_all_tests -``` diff --git a/doc/md/Upgrade-and-migration.md b/doc/md/Upgrade-and-migration.md index d5682a34..8b0db1f8 100644 --- a/doc/md/Upgrade-and-migration.md +++ b/doc/md/Upgrade-and-migration.md @@ -1,96 +1,85 @@ -## Preparation +# Upgrade and migration -### Note your current version +## Note your current version If anything goes wrong, it's important for us to know which version you're upgrading from. The current version is present in the `shaarli_version.php` file. -### Backup your data -Shaarli stores all user data under the `data` directory: +## Backup your data -- `data/config.json.php` (or `data/config.php` for older Shaarli versions) - main configuration file -- `data/datastore.php` - bookmarked links -- `data/ipbans.php` - banned IP addresses -- `data/updates.txt` - contains all automatic update to the configuration and datastore files already run +Shaarli stores all user data and [configuration](Shaarli-configuration.md) under the `data` directory. [Backup](Backup-and-restore.md) this repository _before_ upgrading Shaarli. You will need to restore it after the following upgrade steps. -See [Shaarli configuration](Shaarli-configuration) for more information about Shaarli resources. - -It is recommended to backup this repository _before_ starting updating/upgrading Shaarli: - -- users with SSH access: copy or archive the directory to a temporary location -- users with FTP access: download a local copy of your Shaarli installation using your favourite client - -### Migrating data from a previous installation - -As all user data is kept under `data`, this is the only directory you need to worry about when migrating to a new installation, which corresponds to the following steps: - -- backup the `data` directory -- install or update Shaarli: - - fresh installation - see [Download and Installation](Download-and-Installation) - - update - see the following sections -- check or restore the `data` directory - -## Recommended : Upgrading from release archives +```bash +sudo cp -r /var/www/shaarli.mydomain.org/data ~/shaarli-data-backup +``` -All tagged revisions can be downloaded as tarballs or ZIP archives from the [releases](https://github.com/shaarli/Shaarli/releases) page. +## Upgrading from ZIP archives -We recommend that you use the latest release tarball with the `-full` suffix. It contains the dependencies, please read [Download and Installation](Download-and-Installation) for `git` complete instructions. +If you installed Shaarli from a [release ZIP archive](Installation.md#from-release-zip): -Once downloaded, extract the archive locally and update your remote installation (e.g. via FTP) -be sure you keep the content of the `data` directory! +```bash +# Download the archive to the server, and extract it +cd ~ +wget https://github.com/shaarli/Shaarli/releases/download/v0.X.Y/shaarli-v0.X.Y-full.zip +unzip shaarli-v0.X.Y-full.zip + +# overwrite your Shaarli installation with the new release **All data will be lost, see _Backup your data_ above.** +sudo rsync -avP --delete Shaarli/ /var/www/shaarli.mydomain.org/ + +# restore file permissions as described on the installation page +sudo chown -R root:www-data /var/www/shaarli.mydomain.org +sudo chmod -R u=rwX /var/www/shaarli.mydomain.org +sudo chmod -R g+rX /var/www/shaarli.mydomain.org/{index.php,application/,plugins/,inc/} +sudo chmod -R g+rwX /var/www/shaarli.mydomain.org/{cache/,data/,pagecache/,tmp/} + +# restore backups of the data directory +sudo cp -r ~/shaarli-data-backup/* /var/www/shaarli.mydomain.org/data/ + +# If you use gettext mode for translations (not the default), reload your web server. +sudo systemctl restart apache2 +sudo systemctl restart nginx +``` -If you use translations in gettext mode - meaning you manually changed the default mode -, -reload your web server. +If you don't have shell access (eg. on shared hosting), backup the shaarli data directory, download the ZIP archive locally, extract it, upload it to the server using file transfer, and restore the data directory backup. -After upgrading, access your fresh Shaarli installation from a web browser; the configuration and data store will then be automatically updated, and new settings added to `data/config.json.php` (see [Shaarli configuration](Shaarli configuration) for more details). +Access your fresh Shaarli installation from a web browser; the configuration and data store will then be automatically updated, and new settings added to `data/config.json.php` (see [Shaarli configuration](Shaarli-configuration.md) for more details). -## Upgrading with Git -### Updating a community Shaarli +## Upgrading from Git -If you have installed Shaarli from the [community Git repository](Download#clone-with-git-recommended), simply [pull new changes](https://www.git-scm.com/docs/git-pull) from your local clone: +If you have installed Shaarli [from sources](Installation.md#from-sources): ```bash -$ cd /path/to/shaarli -$ git pull - -From github.com:shaarli/Shaarli - * branch master -> FETCH_HEAD -Updating ebd67c6..521f0e6 -Fast-forward - application/Url.php | 1 + - shaarli_version.php | 2 +- - tests/Url/UrlTest.php | 1 + - 3 files changed, 3 insertions(+), 1 deletion(-) -``` +# pull new changes from your local clone +cd /var/www/shaarli.mydomain.org/ +sudo git pull -Shaarli >= `v0.8.x`: install/update third-party PHP dependencies using [Composer](https://getcomposer.org/): +# update PHP dependencies (Shaarli >= v0.8) +sudo composer install --no-dev -```bash -$ composer install --no-dev +# update translations (Shaarli >= v0.9.2) +sudo make translate -Loading composer repositories with package information -Updating dependencies - - Installing shaarli/netscape-bookmark-parser (v1.0.1) - Downloading: 100% -``` +# If you use translations in gettext mode (not the default), reload your web server. +sudo systemctl reload apache +sudo systemctl reload nginx -Shaarli >= `v0.9.2` supports translations: +# update front-end dependencies (Shaarli >= v0.10.0) +sudo make build_frontend -```bash -$ make translate -``` +# restore file permissions as described on the installation page +sudo chown -R root:www-data /var/www/shaarli.mydomain.org +sudo chmod -R u=rwX /var/www/shaarli.mydomain.org +sudo chmod -R g+rX /var/www/shaarli.mydomain.org/{index.php,application/,plugins/,inc/} +sudo chmod -R g+rwX /var/www/shaarli.mydomain.org/{cache/,data/,pagecache/,tmp/} +``` -If you use translations in gettext mode, reload your web server. +Access your fresh Shaarli installation from a web browser; the configuration and data store will then be automatically updated, and new settings added to `data/config.json.php` (see [Shaarli configuration](Shaarli-configuration.md) for more details). -Shaarli >= `v0.10.0` manages its front-end dependencies with nodejs. You need to install -[yarn](https://yarnpkg.com/lang/en/docs/install/): +--------------------------------------------------------------- -```bash -$ make build_frontend -``` - -### Migrating and upgrading from Sebsauvage's repository +## Migrating and upgrading from Sebsauvage's repository If you have installed Shaarli from [Sebsauvage's original Git repository](https://github.com/sebsauvage/Shaarli), you can use [Git remotes](https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes) to update your working copy. @@ -104,7 +93,7 @@ The following guide assumes that: - no versioned file has been locally modified - no untracked files are present -#### Step 0: show repository information +### Step 0: show repository information ```bash $ cd /path/to/shaarli @@ -122,7 +111,7 @@ Your branch is up-to-date with 'origin/master'. nothing to commit, working directory clean ``` -#### Step 1: update Git remotes +### Step 1: update Git remotes ``` $ git remote rename origin sebsauvage @@ -146,7 +135,7 @@ From https://github.com/shaarli/Shaarli * [new tag] v0.7.0 -> v0.7.0 ``` -#### Step 2: use the stable community branch +### Step 2: use the stable community branch ```bash $ git checkout origin/stable -b stable @@ -177,8 +166,7 @@ $ make translate If you use translations in gettext mode, reload your web server. -Shaarli >= `v0.10.0` manages its front-end dependencies with nodejs. You need to install -[yarn](https://yarnpkg.com/lang/en/docs/install/): +Shaarli >= `v0.10.0` manages its front-end dependencies with nodejs. You need to install [yarn](https://yarnpkg.com/lang/en/docs/install/): ```bash $ make build_frontend @@ -204,30 +192,14 @@ Writing objects: 100% (3317/3317), done. Total 3317 (delta 2050), reused 3301 (delta 2034)to ``` -#### Step 3: configuration +### Step 3: configuration After migrating, access your fresh Shaarli installation from a web browser; the configuration will then be automatically updated, and new settings added to -`data/config.json.php` (see [Shaarli configuration](Shaarli-configuration) for more +`data/config.json.php` (see [Shaarli configuration](Shaarli-configuration.md) for more details). ## Troubleshooting -If the solutions provided here don't work, please open an issue specifying which version you're upgrading from and to. - -### You must specify an integer as a key - -In `v0.8.1` we changed how link keys are handled (from timestamps to incremental integers). -Take a look at `data/updates.txt` content. - -#### `updates.txt` contains `updateMethodDatastoreIds` - -Try to delete it and refresh your page while being logged in. - -#### `updates.txt` doesn't exist or doesn't contain `updateMethodDatastoreIds` +If the solutions provided here don't work, see [Troubleshooting](Troubleshooting.md) and/or open an issue specifying which version you're upgrading from and to. -1. Create `data/updates.txt` if it doesn't exist -2. Paste this string in the update file `;updateMethodRenameDashTags;` -3. Login to Shaarli -4. Delete the update file -5. Refresh diff --git a/doc/md/Usage.md b/doc/md/Usage.md new file mode 100644 index 00000000..0a1b9719 --- /dev/null +++ b/doc/md/Usage.md @@ -0,0 +1,109 @@ +## Features + +For any item posted to Shaarli (called a _Shaare_), you can customize the following aspects: + +- URL to link to +- Title +- Free-text description +- Tags +- Public/private status + + +### Adding/editing Shaares + +While logged in to your Shaarli, you can add, edit or delete Shaares: + +- Using the **+Shaare** button: enter the URL you want to share, click `Add link`, fill in the details of your Shaare, and `Save` +- Using the [Bookmarklet](https://en.wikipedia.org/wiki/Bookmarklet): drag the `✚Shaare link` button from the `Tools` page to your browser's bookmarks bar, click it to share the current page. +- Using [apps and browser addons](Community-and-related-software.md#mobile-apps) +- Using the [REST API](https://shaarli.github.io/api-documentation/) +- Any Shaare can edited by clicking its ![](images/edit_icon.png) `Edit` button. + + +### Tags + +Tags can be be used to organize and categorize your Shaares: + +- You can rename, merge and delete tags from the _Tools_ menu or the [tag cloud/list](#tag-cloud) +- Tags are auto-completed (from the list of existing tags) in all dialogs +- Tags can be combined with text in [search](#search) queries + + +### Public/private Shaares + +Additional filter buttons can be found at the top left of the Shaare list **only when logged in**: + +- **Only show private Shaares:** Private shares can be searched by clicking the `only show private links` toggle button top left of the Shaares list (only when logged in) + + +### Permalinks + +Permalinks are fixed, short links attached to each Shaare. Editing a Shaare will not change it's permalink, each permalink always points to the latest revision of a Shaare. + + +### Text-only (note) Shaares + +Shaarli can be used as a minimal blog, notepad, pastebin...: While adding or editing a Shaare, leave the URL field blank to create a text-only ("note") post. This allows you to post any kind of text content, such as blog articles, private or public notes, snippets... There is no character limit! You can access your post from its permalink. + + +### Search + +- **Plain text search:** Use `Search text` to search in all fields of all Shaares (Title, URL, Description...). Use double-quotes (example `"exact search"`) to search for the exact expression. +- **Tags search:** `Filter by tags` allow only displaying Shaares tagged with one or multiple tags (use space to separate tags). +- **Hidden tags:** tags starting with a dot `.` (example `.secret`) are private. They can only be seen and searched when logged in. +- **Exclude text/tags:** Use the `-` operator before a word or tag to exclude Shaares matching this word from search results (`NOT` operator). +- **Untagged links:** Shaares without tags can be searched by clicking the `untagged` toggle button top left of the Shaares list (only when logged in). + + +Both exclude patterns and exact searches can be combined with normal searches (example `"exact search" term otherterm -notthis "very exact" stuff -notagain`). Only AND (and NOT) search is currrently supported. + + +### Tag cloud + +The `Tag cloud` page diplays a "cloud" or list view of all tags in your Shaarli (most frequently used tags are displayed with a bigger font size) + + +- **Tags list:** click on `Most used` or `Alphabetical` to display tags as a list. You can also edit/delete tags for this page. +- Click on any tag to search all Shaares matching this tag. +- **Filtering the tag cloud/list:** Click on the counter next to a tag to show other tags of Shaares with this tag. Repeat this any number of times to further filter the tag cloud. Click `List all links with those tags` to display Shaares matching your current tag filter set. + + + +### RSS feeds + +RSS/ATOM feeds feeds are available (in ATOM with `/feed/atom` and RSS with `/feed/rss`) + +- **Filtering RSS feeds:** RSS feeds and picture wall can also be restricted to only return items matching a text/tag search. For example, search for `photography` (text or tags) in Shaarli, then click the `RSS Feed` button. A feed with only matching results is displayed. +- Add the `&nb` parameter in feed URLs to specify the number of Shaares you want in a feed (default if not specified: `50`). The keyword `all` is available if you want everything. +- Add the `&permalinks` parameter in feed URLs to point permalinks to the corresponding shaarly entry/link instead of the direct, Shaare URL attribute + +![](images/rss-filter-1.png) ![](images/rss-filter-2.png) + +```bash +# examples +https://shaarli.mydomain.org/feed/atom?permalinks +https://shaarli.mydomain.org/feed/atom?permalinks&nb=42 +https://shaarli.mydomain.org/feed/atom?permalinks&nb=all +https://shaarli.mydomain.org/feed/rss?searchtags=nature +https://shaarli.mydomain.org/links/picture-wall?searchterm=poney +``` + + +### Picture wall + +- The picture wall can be filtered by text or tags search in the same way as [RSS feeds](#rss-feeds) + + +### Import/export + +To **export Shaares as a HTML file**, under _Tools > Export_, choose: + +- `Export all` to export both public and private Shaares +- `Export public` to export public Shaares only +- `Export private` to export private Shaares only + +Restore by using the `Import` feature. + +- These exports contain the full data (URL, title, tags, date, description, public/private status of your Shaares) +- They can also be imported to your web browser bookmarks. + diff --git a/doc/md/Versioning-and-Branches.md b/doc/md/Versioning-and-Branches.md deleted file mode 100644 index 7097ca0a..00000000 --- a/doc/md/Versioning-and-Branches.md +++ /dev/null @@ -1,75 +0,0 @@ -**WORK IN PROGRESS** - -It's important to understand how Shaarli branches work, especially if you're maintaining a 3rd party tools for Shaarli (theme, plugin, etc.), to be sure stay compatible. - -## `master` branch - -The `master` branch is the development branch. Any new change MUST go through this branch using Pull Requests. - -Remarks: - -- This branch shouldn't be used for production as it isn't necessary stable. -- 3rd party aren't required to be compatible with the latest changes. -- Official plugins, themes and libraries (contained within Shaarli organization repos) must be compatible with the master branch. -- The version in this branch is always `dev`. - -## `v0.x` branch - -This `v0.x` branch, points to the latest `v0.x.y` release. - -Explanation: - -When a new version is released, it might contains a major bug which isn't detected right away. For example, a new PHP version is released, containing backward compatibility issue which doesn't work with Shaarli. - -In this case, the issue is fixed in the `master` branch, and the fix is backported the to the `v0.x` branch. Then a new release is made from the `v0.x` branch. - -This workflow allow us to fix any major bug detected, without having to release bleeding edge feature too soon. - -## `latest` branch - -This branch point the latest release. It recommended to use it to get the latest tested changes. - -## `stable` branch - -The `stable` branch doesn't contain any major bug, and is one major digit version behind the latest release. - -For example, the current latest release is `v0.8.3`, the stable branch is an alias to the latest `v0.7.x` release. When the `v0.9.0` version will be released, the stable will move to the latest `v0.8.x` release. - -Remarks: - -- Shaarli release pace isn't fast, and the stable branch might be a few months behind the latest release. - -## Releases - -Releases are always made from the latest `v0.x` branch. - -Note that for every release, we manually generate a tarball which contains all Shaarli dependencies, making Shaarli's installation only one step. - -## Advices on 3rd party git repos workflow - -### Versioning - -Any time a new Shaarli release is published, you should publish a new release of your repo if the changes affected you since the latest release (take a look at the [changelog](https://github.com/shaarli/Shaarli/releases) (*Draft* means not released yet) and the commit log (like [`tpl` folder](https://github.com/shaarli/Shaarli/commits/master/tpl/default) for themes)). You can either: - - - use the Shaarli version number, with your repo version. For example, if Shaarli `v0.8.3` is released, publish a `v0.8.3-1` release, where `v0.8.3` states Shaarli compatibility and `-1` is your own version digit for the current Shaarli version. - - use your own versioning scheme, and state Shaarli compatibility in the release description. - -Using this, any user will be able to pick the release matching his own Shaarli version. - -### Major bugfix backport releases - -To be able to support backported fixes, it recommended to use our workflow: - -```bash -# In master, fix the major bug -git commit -m "Katastrophe" -git push origin master -# Get your commit hash -git log --format="%H" -n 1 -# Create a new branch from your latest release, let's say v0.8.2-1 (the tag name) -git checkout -b katastrophe v0.8.2-1 -# Backport the fix commit to your brand new branch -git cherry-pick -git push origin katastrophe -# Then you just have to make a new release from the `katastrophe` branch tagged `v0.8.3-1` -``` diff --git a/doc/md/dev/Development.md b/doc/md/dev/Development.md new file mode 100644 index 00000000..5c085e03 --- /dev/null +++ b/doc/md/dev/Development.md @@ -0,0 +1,179 @@ +# Development + +Please read [Contributing to Shaarli](https://github.com/shaarli/Shaarli/tree/master/CONTRIBUTING.md) + +## Guidelines + + +- [Unit tests](Unit-tests) +- Javascript linting - Shaarli uses [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript). +Run `make eslint` to check JS style. +- [GnuPG signature](GnuPG-signature) for tags/releases + + +## Third-party libraries + +CSS: + +- Yahoo UI [CSS Reset](http://yuilibrary.com/yui/docs/cssreset/) - standardize cross-browser rendering + +Javascript: + +- [Awesomeplete](https://leaverou.github.io/awesomplete/) ([GitHub](https://github.com/LeaVerou/awesomplete)) - autocompletion in input forms +- [bLazy](http://dinbror.dk/blazy/) ([GitHub](https://github.com/dinbror/blazy)) - lazy loading for thumbnails +- [qr.js](http://neocotic.com/qr.js/) ([GitHub](https://github.com/neocotic/qr.js)) - QR code generation + +PHP (managed through [`composer.json`](https://github.com/shaarli/Shaarli/blob/master/composer.json)): + +- [RainTPL](https://github.com/rainphp/raintpl) - HTML templating for PHP +- [`shaarli/netscape-bookmark-parser`](https://packagist.org/packages/shaarli/netscape-bookmark-parser) - Import bookmarks from Netscape files +- [`erusev/parsedown`](https://packagist.org/packages/erusev/parsedown) - Parse MarkDown syntax for the MarkDown plugin +- [`slim/slim`](https://packagist.org/packages/slim/slim) - Handle routes and middleware for the REST API +- [`ArthurHoaro/web-thumbnailer`](https://github.com/ArthurHoaro/web-thumbnailer) - PHP library which will retrieve a thumbnail for any given URL +- [`pubsubhubbub/publisher`](https://github.com/pubsubhubbub/php-publisher) - A PubSubHubbub publisher module for PHP. +- [`gettext/gettext`](https://github.com/php-gettext/Gettext) - PHP library to collect and manipulate gettext (.po, .mo, .php, .json, etc) + + +## Security + +- The password is salted, hashed and stored in the data subdirectory, in a PHP file, and protected by htaccess. Even if the webserver does not support htaccess, the hash is not readable by URL. Even if the .php file is stolen, the password cannot deduced from the hash. The salt prevents rainbow-tables attacks. +- Directories are protected using `.htaccess` files +- Forms are protected against [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery): + - Forms which act on data (save,delete…) contain a token generated by the server. + - Any posted form which does not contain a valid token is rejected. + - Any token can only be used once. + - Tokens are attached to the session and cannot be reused in another session. +- Sessions automatically expire after 60 minutes. +- Sessions are protected against hijacking: the session ID cannot be used from a different IP address. +- Links are stored as an associative array which is serialized, compressed (with deflate), base64-encoded and saved as a comment in a `.php` file - even if the server does not support `.htaccess` files, the data file will still not be readable by URL. +- Bruteforce protection: Successful and failed login attempts are logged - IP bans are enforced after a configurable amount of failures. Logs can also be used consumed by [fail2ban](../Server-configuration.md#fail2ban) +- A pop-up notification is shown when a new release is available. + +## Link structure + +Every link available through the `LinkDB` object is represented as an array +containing the following fields: + + * `id` (integer): Unique identifier. + * `title` (string): Title of the link. + * `url` (string): URL of the link. Used for displayable links (without redirector, url encoding, etc.). + Can be absolute or relative for Notes. + * `real_url` (string): Real destination URL, can be redirected, encoded, etc. + * `shorturl` (string): Permalink small hash. + * `description` (string): Link text description. + * `private` (boolean): whether the link is private or not. + * `tags` (string): all link tags separated by a single space + * `thumbnail` (string|boolean): relative path of the thumbnail cache file, or false if there isn't any. + * `created` (DateTime): link creation date time. + * `updated` (DateTime): last modification date time. + +Small hashes are used to make a link to an entry in Shaarli. They are unique: the date of the item (eg. `20110923_150523`) is hashed with CRC32, then converted to base64 and some characters are replaced. They are always 6 characters longs and use only `A-Z a-z 0-9 - _` and `@`. + + +## Directory structure + +Here is the directory structure of Shaarli and the purpose of the different files: + +```bash + index.php # Main program + application/ # Shaarli classes + ├── LinkDB.php + + ... + + └── Utils.php + tests/ # Shaarli unitary & functional tests + ├── LinkDBTest.php + + ... + + ├── utils # utilities to ease testing + │ └── ReferenceLinkDB.php + └── UtilsTest.php + assets/ + ├── common/ # Assets shared by multiple themes + ├── ... + ├── default/ # Assets for the default template, before compilation + ├── fonts/ # Font files + ├── img/ # Images used by the default theme + ├── js/ # JavaScript files in ES6 syntax + ├── scss/ # SASS files + └── vintage/ # Assets for the vintage template, before compilation + └── ... + COPYING # Shaarli license + inc/ # static assets and 3rd party libraries + └── rain.tpl.class.php # RainTPL templating library + images/ # Images and icons used in Shaarli + data/ # data storage: bookmark database, configuration, logs, banlist... + ├── config.json.php # Shaarli configuration (login, password, timezone, title...) + ├── datastore.php # Your link database (compressed). + ├── ipban.php # IP address ban system data + ├── lastupdatecheck.txt # Update check timestamp file + └── log.txt # login/IPban log. + tpl/ # RainTPL templates for Shaarli. They are used to build the pages. + ├── default/ # Default Shaarli theme + ├── fonts/ # Font files + ├── img/ # Images + ├── js/ # JavaScript files compiled by Babel and compatible with all browsers + ├── css/ # CSS files compiled with SASS + └── vintage/ # Legacy Shaarli theme + └── ... + cache/ # thumbnails cache + # This directory is automatically created. You can erase it anytime you want. + tmp/ # Temporary directory for compiled RainTPL templates. + # This directory is automatically created. You can erase it anytime you want. + vendor/ # Third-party dependencies. This directory is created by Composer +``` + +Shaarli needs read access to: + +- the root index.php file +- the `application/`, `plugins/` and `inc/` directories (recursively) + +Shaarli needs read/write access to the `cache/`, `data/`, `pagecache/`, and `tmp/` directories + + +## Automation + +A [`Makefile`](https://github.com/shaarli/Shaarli/blob/master/Makefile) is available to perform project-related operations: + +- [Static analysis](#Static-analysis) - check that the code is compliant to PHP conventions +- [Unit tests](#Unit-tests) - ensure there are no regressions introduced by new commits +- Documentation - generate a local HTML copy of the markdown documentation + +### Continuous Integration + +[Travis CI](http://docs.travis-ci.com/) is a Continuous Integration build server, that runs a build: + +- each time a commit is merged to the mainline (`master` branch) +- each time a Pull Request is submitted or updated + +After all jobs have finished, Travis returns the results to GitHub: + +- a status icon represents the result for the `master` branch: [![](https://api.travis-ci.org/shaarli/Shaarli.svg)](https://travis-ci.org/shaarli/Shaarli) +- Pull Requests are updated with the Travis build result. + +See [`.travis.yml`](https://github.com/shaarli/Shaarli/blob/master/.travis.yml). + + +### Documentation + +[mkdocs](https://www.mkdocs.org/) is used to convert markdown documentation to HTML pages. The [public documentation](https://shaarli.readthedocs.io/en/master/) website is rendered and hosted by [readthedocs.org](https://readthedocs.org/). A copy of the documentation is also included in prebuilt [release archives](https://github.com/shaarli/Shaarli/releases) (`doc/html/` path in your Shaarli installation). To generate the HTML documentation locally, install a recent version of Python `setuptools` and run `make doc`. + + +## Static analysis + +Patches should try to stick to the [PHP Standard Recommendations](http://www.php-fig.org/psr/) (PSR), especially: + +- [PSR-1](http://www.php-fig.org/psr/psr-1/) - Basic Coding Standard +- [PSR-2](http://www.php-fig.org/psr/psr-2/) - Coding Style Guide + + +**Work in progress:** Static analysis is currently being discussed here: in [#95 - Fix coding style (static analysis)](https://github.com/shaarli/Shaarli/issues/95), [#130 - Continuous Integration tools & features](https://github.com/shaarli/Shaarli/issues/130) + +Static analysis tools can be installed with Composer, and used through Shaarli's [Makefile](https://github.com/shaarli/Shaarli/blob/master/Makefile). + +For an overview of the available features, see: + +- [Code quality: Makefile to run static code checkers](https://github.com/shaarli/Shaarli/pull/124) (#124) +- [Run PHPCS against different coding standards](https://github.com/shaarli/Shaarli/pull/276) (#276) diff --git a/doc/md/dev/GnuPG-signature.md b/doc/md/dev/GnuPG-signature.md new file mode 100644 index 00000000..25578001 --- /dev/null +++ b/doc/md/dev/GnuPG-signature.md @@ -0,0 +1,70 @@ +## Introduction +### PGP and GPG +[Gnu Privacy Guard](https://gnupg.org/) (GnuPG) is an Open Source implementation of the [Pretty Good Privacy](https://en.wikipedia.org/wiki/Pretty_Good_Privacy#OpenPGP) (OpenPGP) specification. Its main purposes are digital authentication, signature and encryption. It is often used by the [FLOSS](https://en.wikipedia.org/wiki/Free_and_open-source_software) community to verify: + +- Linux package signatures: Debian [SecureApt](https://wiki.debian.org/SecureApt), ArchLinux [Master Keys](https://www.archlinux.org/master-keys/) +- [Version control](https://en.wikipedia.org/wiki/Revision_control) releases & maintainer identity + +> You MUST understand that presence of data in the keyserver (pools) in no way connotes trust. Anyone can generate a key, with any name or email address, and upload it. All security and trust comes from evaluating security at the “object level”, via PGP [Web of trust](https://en.wikipedia.org/wiki/Web_of_trust) signatures. This keyserver makes it possible to retrieve keys, looking them up via various indices, but the collection of keys in this public pool is KNOWN to contain malicious and fraudulent keys. It is the common expectation of server operators that users understand this and use software which, like all known common OpenPGP implementations, evaluates trust accordingly. This expectation is so common that it is not normally explicitly stated. + +-- Phil Pennock (author of the [SKS](https://bitbucket.org/skskeyserver/sks-keyserver/wiki/Home) key server - http://sks.spodhuis.org/) + +Trust can be gained by having your key signed by other people (and signing their key back, too :) ), for instance during [key signing parties](https://en.wikipedia.org/wiki/Key_signing_party): [Keysigning party HOWTO](http://www.cryptnet.net/fdp/crypto/keysigning_party/en/keysigning_party.html), + + +## Generate a GPG key +- [Generating a GPG key for Git tagging](http://stackoverflow.com/a/16725717) (StackOverflow) +- [Generating a GPG key](https://help.github.com/articles/generating-a-gpg-key/) (GitHub) + +### gpg - provide identity information +```bash +$ gpg --gen-key + +gpg (GnuPG) 2.1.6; Copyright (C) 2015 Free Software Foundation, Inc. +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law. + +Note: Use "gpg2 --full-gen-key" for a full featured key generation dialog. + +GnuPG needs to construct a user ID to identify your key. + +Real name: Marvin the Paranoid Android +Email address: marvin@h2g2.net +You selected this USER-ID: + "Marvin the Paranoid Android " + +Change (N)ame, (E)mail, or (O)kay/(Q)uit? o +We need to generate a lot of random bytes. It is a good idea to perform +some other action (type on the keyboard, move the mouse, utilize the +disks) during the prime generation; this gives the random number +generator a better chance to gain enough entropy. +``` + +### gpg - entropy interlude +At this point, you will: +- be prompted for a secure password to protect your key (the input method will depend on your Desktop Environment and configuration) +- be asked to use your machine's input devices (mouse, keyboard, etc.) to generate random entropy; this step _may take some time_ + +### gpg - key creation confirmation +```bash +gpg: key A9D53A3E marked as ultimately trusted +public and secret key created and signed. + +gpg: checking the trustdb +gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model +gpg: depth: 0 valid: 2 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 2u +pub rsa2048/A9D53A3E 2015-07-31 + Key fingerprint = AF2A 5381 E54B 2FD2 14C4 A9A3 0E35 ACA4 A9D5 3A3E +uid [ultimate] Marvin the Paranoid Android +sub rsa2048/8C0EACF1 2015-07-31 +``` + +### gpg - submit your public key to a PGP server (Optional) +``` bash +$ gpg --keyserver pgp.mit.edu --send-keys A9D53A3E +gpg: sending key A9D53A3E to hkp server pgp.mit.edu +``` + +## Create and push a GPG-signed tag + +See [Release Shaarli](Release Shaarli). diff --git a/doc/md/dev/Plugin-system.md b/doc/md/dev/Plugin-system.md new file mode 100644 index 00000000..a87bd0cf --- /dev/null +++ b/doc/md/dev/Plugin-system.md @@ -0,0 +1,758 @@ +# Plugin system + +## Developer API + +### What can I do with plugins? + +The plugin system lets you: + +- insert content into specific places across templates. +- alter data before templates rendering. +- alter data before saving new links. + + +### How can I create a plugin for Shaarli? + +First, chose a plugin name, such as `demo_plugin`. + +Under `plugin` folder, create a folder named with your plugin name. Then create a .meta file and a .php file in that folder. + +You should have the following tree view: + +``` +| index.php +| plugins/ +|---| demo_plugin/ +| |---| demo_plugin.meta +| |---| demo_plugin.php +``` + + +### Plugin initialization + +At the beginning of Shaarli execution, all enabled plugins are loaded. At this point, the plugin system looks for an `init()` function in the .php to execute and run it if it exists. This function must be named this way, and takes the `ConfigManager` as parameter. + + _init($conf) + +This function can be used to create initial data, load default settings, etc. But also to set *plugin errors*. If the initialization function returns an array of strings, they will be understand as errors, and displayed in the header to logged in users. + +The plugin system also looks for a `description` variable in the .meta file, to be displayed in the plugin administration page. + + description="The plugin does this and that." + +### Understanding hooks + +A plugin is a set of functions. Each function will be triggered by the plugin system at certain point in Shaarli execution. + +These functions need to be named with this pattern: + +``` +hook__($data, $conf) +``` + +Parameters: + +- data: see [$data section](https://shaarli.readthedocs.io/en/master/Plugin-System/#plugins-data) +- conf: the `ConfigManager` instance. + +For example, if my plugin want to add data to the header, this function is needed: + + hook_demo_plugin_render_header + +If this function is declared, and the plugin enabled, it will be called every time Shaarli is rendering the header. + + +### Plugin's data + +#### Parameters + +Every hook function has a `$data` parameter. Its content differs for each hooks. + +**This parameter needs to be returned every time**, otherwise data is lost. + + return $data; + +#### Special data + +Special additional data are passed to every hook through the +`$data` parameter to give you access to additional context, and services. + +Complete list: + + * `_PAGE_` (string): if the current hook is used to render a template, its name is passed through this additional parameter. + * `_LOGGEDIN_` (bool): whether the user is logged in or not. + * `_BASE_PATH_` (string): if Shaarli instance is hosted under a subfolder, contains the subfolder path to `index.php` (e.g. `https://domain.tld/shaarli/` -> `/shaarli/`). + * `_BOOKMARK_SERVICE_` (`BookmarkServiceInterface`): bookmark service instance, for advanced usage. + +Example: + +```php +if ($data['_PAGE_'] === TemplatePage::LINKLIST && $data['LOGGEDIN'] === true) { + // Do something for logged in users when the link list is rendered +} +``` + +#### Filling templates placeholder + +Template placeholders are displayed in template in specific places. + +RainTPL displays every element contained in the placeholder's array. These element can be added by plugins. + +For example, let's add a value in the placeholder `top_placeholder` which is displayed at the top of my page: + +```php +$data['top_placeholder'][] = 'My content'; +# OR +array_push($data['top_placeholder'], 'My', 'content'); + +return $data; +``` + + +#### Data manipulation + +When a page is displayed, every variable send to the template engine is passed to plugins before that in `$data`. + +The data contained by this array can be altered before template rendering. + +For example, in linklist, it is possible to alter every title: + +```php +// mind the reference if you want $data to be altered +foreach ($data['links'] as &$value) { + // String reverse every title. + $value['title'] = strrev($value['title']); +} + +return $data; +``` + +### Metadata + +Every plugin needs a `.meta` file, which is in fact an `.ini` file (`KEY="VALUE"`), to be listed in plugin administration. + +Each file contain two keys: + +- `description`: plugin description +- `parameters`: user parameter names, separated by a `;`. +- `parameter.`: add a text description the specified parameter. + +> Note: In PHP, `parse_ini_file()` seems to want strings to be between by quotes `"` in the ini file. + + +### It's not working! + +Use `demo_plugin` as a functional example. It covers most of the plugin system features. + +If it's still not working, please [open an issue](https://github.com/shaarli/Shaarli/issues/new). + + +### Hooks + +| Hooks | Description | +| ------------- |:-------------:| +| [render_header](#render_header) | Allow plugin to add content in page headers. | +| [render_includes](#render_includes) | Allow plugin to include their own CSS files. | +| [render_footer](#render_footer) | Allow plugin to add content in page footer and include their own JS files. | +| [render_linklist](#render_linklist) | It allows to add content at the begining and end of the page, after every link displayed and to alter link data. | +| [render_editlink](#render_editlink) | Allow to add fields in the form, or display elements. | +| [render_tools](#render_tools) | Allow to add content at the end of the page. | +| [render_picwall](#render_picwall) | Allow to add content at the top and bottom of the page. | +| [render_tagcloud](#render_tagcloud) | Allow to add content at the top and bottom of the page, and after all tags. | +| [render_taglist](#render_taglist) | Allow to add content at the top and bottom of the page, and after all tags. | +| [render_daily](#render_daily) | Allow to add content at the top and bottom of the page, the bottom of each link and to alter data. | +| [render_feed](#render_feed) | Allow to do add tags in RSS and ATOM feeds. | +| [save_link](#save_link) | Allow to alter the link being saved in the datastore. | +| [delete_link](#delete_link) | Allow to do an action before a link is deleted from the datastore. | +| [save_plugin_parameters](#save_plugin_parameters) | Allow to manipulate plugin parameters before they're saved. | + + +#### render_header + +Triggered on every page - allows plugins to add content in page headers. + + +##### Data + +`$data` is an array containing: + + - [Special data](#special-data) + +##### Template placeholders + +Items can be displayed in templates by adding an entry in `$data['']` array. + +List of placeholders: + +- `buttons_toolbar`: after the list of buttons in the header. + +![buttons_toolbar_example](http://i.imgur.com/ssJUOrt.png) + +- `fields_toolbar`: after search fields in the header. + +> Note: This will only be called in linklist. + +![fields_toolbar_example](http://i.imgur.com/3GMifI2.png) + + +#### render_includes + +Triggered on every page - allows plugins to include their own CSS files. + +##### data + +`$data` is an array containing: + + - [Special data](#special-data) + +##### Template placeholders + +Items can be displayed in templates by adding an entry in `$data['']` array. + +List of placeholders: + +- `css_files`: called after loading default CSS. + +> Note: only add the path of the CSS file. E.g: `plugins/demo_plugin/custom_demo.css`. + + +#### render_footer + +Triggered on every page. + +Allow plugin to add content in page footer and include their own JS files. + +##### data + +`$data` is an array containing: + + - [Special data](#special-data) + +##### Template placeholders + +Items can be displayed in templates by adding an entry in `$data['']` array. + +List of placeholders: + +- `text`: called after the end of the footer text. +- `endofpage`: called at the end of the page. + +![text_example](http://i.imgur.com/L5S2YEH.png) + +- `js_files`: called at the end of the page, to include custom JS scripts. + +> Note: only add the path of the JS file. E.g: `plugins/demo_plugin/custom_demo.js`. + + +#### render_linklist + +Triggered when `linklist` is displayed (list of links, permalink, search, tag filtered, etc.). + +It allows to add content at the begining and end of the page, after every link displayed and to alter link data. + +##### data + +`$data` is an array containing: + + - All templates data, including links. + - [Special data](#special-data) + +##### template placeholders + +Items can be displayed in templates by adding an entry in `$data['']` array. + +List of placeholders: + +- `action_plugin`: next to the button "private only" at the top and bottom of the page. + +![action_plugin_example](http://i.imgur.com/Q12PWg0.png) + +- `link_plugin`: for every link, between permalink and link URL. + +![link_plugin_example](http://i.imgur.com/3oDPhWx.png) + +- `plugin_start_zone`: before displaying the template content. + +![plugin_start_zone_example](http://i.imgur.com/OVBkGy3.png) + +- `plugin_end_zone`: after displaying the template content. + +![plugin_end_zone_example](http://i.imgur.com/6IoRuop.png) + + +#### render_editlink + +Triggered when the link edition form is displayed. + +Allow to add fields in the form, or display elements. + +##### data + +`$data` is an array containing: + + - All templates data. + - [Special data](#special-data) + +##### template placeholders + +Items can be displayed in templates by adding an entry in `$data['']` array. + +List of placeholders: + +- `edit_link_plugin`: after tags field. + +![edit_link_plugin_example](http://i.imgur.com/5u17Ens.png) + + +#### render_tools + +Triggered when the "tools" page is displayed. + +Allow to add content at the end of the page. + +##### data + +`$data` is an array containing: + + - All templates data. + - [Special data](#special-data) + +##### template placeholders + +Items can be displayed in templates by adding an entry in `$data['']` array. + +List of placeholders: + +- `tools_plugin`: at the end of the page. + +![tools_plugin_example](http://i.imgur.com/Bqhu9oQ.png) + + +#### render_picwall + +Triggered when picwall is displayed. + +Allow to add content at the top and bottom of the page. + +##### data + +`$data` is an array containing: + + - All templates data. + - [Special data](#special-data) + +##### template placeholders + +Items can be displayed in templates by adding an entry in `$data['']` array. + +List of placeholders: + +- `plugin_start_zone`: before displaying the template content. +- `plugin_end_zone`: after displaying the template content. + +![plugin_start_end_zone_example](http://i.imgur.com/tVTQFER.png) + + +#### render_tagcloud + +Triggered when tagcloud is displayed. + +Allow to add content at the top and bottom of the page. + +##### data + +`$data` is an array containing: + + - All templates data. + - [Special data](#special-data) + +##### Template placeholders + +Items can be displayed in templates by adding an entry in `$data['']` array. + +List of placeholders: + +- `plugin_start_zone`: before displaying the template content. +- `plugin_end_zone`: after displaying the template content. + +For each tag, the following placeholder can be used: + +- `tag_plugin`: after each tag + +![plugin_start_end_zone_example](http://i.imgur.com/vHmyT3a.png) + + +#### render_taglist + +Triggered when taglist is displayed - allows to add content at the top and bottom of the page. + +##### data + +`$data` is an array containing: + + - All templates data. + - [Special data](#special-data) + +##### Template placeholders + +Items can be displayed in templates by adding an entry in `$data['']` array. + +List of placeholders: + +- `plugin_start_zone`: before displaying the template content. +- `plugin_end_zone`: after displaying the template content. + +For each tag, the following placeholder can be used: + +- `tag_plugin`: after each tag + +#### render_daily + +Triggered when tagcloud is displayed. + +Allow to add content at the top and bottom of the page, the bottom of each link and to alter data. + + +##### data + +`$data` is an array containing: + + - All templates data, including links. + - [Special data](#special-data) + +##### Template placeholders + +Items can be displayed in templates by adding an entry in `$data['']` array. + +List of placeholders: + +- `link_plugin`: used at bottom of each link. + +![link_plugin_example](http://i.imgur.com/hzhMfSZ.png) + +- `plugin_start_zone`: before displaying the template content. +- `plugin_end_zone`: after displaying the template content. + + +#### render_feed + +Triggered when the ATOM or RSS feed is displayed. + +Allow to add tags in the feed, either in the header or for each items. Items (links) can also be altered before being rendered. + +##### data + +`$data` is an array containing: + + - All templates data, including links. + - [Special data](#special-data) + +##### Template placeholders + +Tags can be added in feeds by adding an entry in `$data['']` array. + +List of placeholders: + +- `feed_plugins_header`: used as a header tag in the feed. + +For each links: + +- `feed_plugins`: additional tag for every link entry. + + +#### save_link + +Triggered when a link is save (new link or edit). + +Allow to alter the link being saved in the datastore. + +##### data + +`$data` is an array containing the link being saved: + +- id +- title +- url +- shorturl +- description +- private +- tags +- created +- updated + +Also [special data](#special-data). + + +#### delete_link + +Triggered when a link is deleted. + +Allow to execute any action before the link is actually removed from the datastore + +##### data + +`$data` is an array containing the link being deleted: + +- id +- title +- url +- shorturl +- description +- private +- tags +- created +- updated + +Also [special data](#special-data). + +#### save_plugin_parameters + +Triggered when the plugin parameters are saved from the plugin administration page. + +Plugins can perform an action every times their settings are updated. +For example it is used to update the CSS file of the `default_colors` plugins. + +##### data + +`$data` input contains the `$_POST` array. + +So if the plugin has a parameter called `MYPLUGIN_PARAMETER`, +the array will contain an entry with `MYPLUGIN_PARAMETER` as a key. + +Also [special data](#special-data). + +## Guide for template designers + +### Plugin administration + +Your theme must include a plugin administration page: `pluginsadmin.html`. + +> Note: repo's template link needs to be added when the PR is merged. + +Use the default one as an example. + +Aside from classic RainTPL loops, plugins order is handle by JavaScript. You can just include `plugin_admin.js`, only if: + +- you're using a table. +- you call orderUp() and orderUp() onclick on arrows. +- you add data-line and data-order to your rows. + +Otherwise, you can use your own JS as long as this field is send by the form: + + + +### Placeholder system + +In order to make plugins work with every custom themes, you need to add variable placeholder in your templates. + +It's a RainTPL loop like this: + + {loop="$plugin_variable"} + {$value} + {/loop} + +You should enable `demo_plugin` for testing purpose, since it uses every placeholder available. + +### List of placeholders + +**page.header.html** + +At the end of the menu: + + {loop="$plugins_header.buttons_toolbar"} + {$value} + {/loop} + +At the end of file, before clearing floating blocks: + + {if="!empty($plugin_errors) && $is_logged_in"} +
    + {loop="plugin_errors"} +
  • {$value}
  • + {/loop} +
+ {/if} + +**includes.html** + +At the end of the file: + +```html +{loop="$plugins_includes.css_files"} + +{/loop} +``` + +**page.footer.html** + +At the end of your footer notes: + +```html +{loop="$plugins_footer.text"} + {$value} +{/loop} +``` + +At the end of file: + +```html +{loop="$plugins_footer.js_files"} + +{/loop} +``` + +**linklist.html** + +After search fields: + +```html +{loop="$plugins_header.fields_toolbar"} + {$value} +{/loop} +``` + +Before displaying the link list (after paging): + +```html +{loop="$plugin_start_zone"} + {$value} +{/loop} +``` + +For every links (icons): + +```html +{loop="$value.link_plugin"} + {$value} +{/loop} +``` + +Before end paging: + +```html +{loop="$plugin_end_zone"} + {$value} +{/loop} +``` + +**linklist.paging.html** + +After the "private only" icon: + +```html +{loop="$action_plugin"} + {$value} +{/loop} +``` + +**editlink.html** + +After tags field: + +```html +{loop="$edit_link_plugin"} + {$value} +{/loop} +``` + +**tools.html** + +After the last tool: + +```html +{loop="$tools_plugin"} + {$value} +{/loop} +``` + +**picwall.html** + +Top: + +```html +
+ {loop="$plugin_start_zone"} + {$value} + {/loop} +
+``` + +Bottom: + +```html +
+ {loop="$plugin_end_zone"} + {$value} + {/loop} +
+``` + +**tagcloud.html** + +Top: + +```html +
+ {loop="$plugin_start_zone"} + {$value} + {/loop} +
+``` + +Bottom: + +```html +
+ {loop="$plugin_end_zone"} + {$value} + {/loop} +
+``` + +**daily.html** + +Top: + +```html +
+ {loop="$plugin_start_zone"} + {$value} + {/loop} +
+``` + +After every link: + +```html +
+ {loop="$link.link_plugin"} + {$value} + {/loop} +
+``` + +Bottom: + +```html +
+ {loop="$plugin_end_zone"} + {$value} + {/loop} +
+``` + +**feed.atom.xml** and **feed.rss.xml**: + +In headers tags section: +```xml +{loop="$feed_plugins_header"} + {$value} +{/loop} +``` + +After each entry: +```xml +{loop="$value.feed_plugins"} + {$value} +{/loop} +``` diff --git a/doc/md/dev/Release-Shaarli.md b/doc/md/dev/Release-Shaarli.md new file mode 100644 index 00000000..2c772406 --- /dev/null +++ b/doc/md/dev/Release-Shaarli.md @@ -0,0 +1,145 @@ +# Release Shaarli + +## Requirements + +This guide assumes that you have: + +- a GPG key matching your GitHub authentication credentials/email (the email address identified by the GPG key is the same as the one in your `~/.gitconfig`) +- a GitHub fork of Shaarli +- a local clone of your Shaarli fork, with the following remotes: + - `origin` pointing to your GitHub fork + - `upstream` pointing to the main Shaarli repository +- maintainer permissions on the main Shaarli repository, to: + - push the signed tag + - create a new release +- [Composer](https://getcomposer.org/) needs to be installed +- The [venv](https://docs.python.org/3/library/venv.html) Python 3 module needs to be installed for HTML documentation generation. + +## Release notes and `CHANGELOG.md` + +GitHub allows drafting the release notes for the upcoming release, from the [Releases](https://github.com/shaarli/Shaarli/releases) page. This way, the release note can be drafted while contributions are merged to `master`. See http://keepachangelog.com/en/0.3.0/ for changelog formatting. + +`CHANGELOG.md` should contain the same information as the release note draft for the upcoming version. Update it to: + +- add new entries (additions, fixes, etc.) +- mark the current version as released by setting its date and link +- add a new section for the future unreleased version + +```bash +## [v0.x.y](https://github.com/shaarli/Shaarli/releases/tag/v0.x.y) - UNRELEASES + +### Added + +### Changed + +### Fixed + +### Removed + +### Deprecated + +### Security + +``` + + +## Update the list of Git contributors + +```bash +$ make authors +$ git commit -s -m "Update AUTHORS" +``` + +## Create and merge a Pull Request + +Create a Pull Request to marge changes from your remote, into `master` in the community Shaarli repository, and have it merged. + + +## Create the release branch and update shaarli_version.php + +```bash +# fetch latest changes from master to your local copy +git checkout master +git pull upstream master + +# If releasing a new minor version, create a release branch +$ git checkout -b v0.x + +# Bump shaarli_version.php from dev to 0.x.0, **without the v** +$ vim shaarli_version.php +$ git add shaarli_version +$ git commit -s -m "Bump Shaarli version to v0.x.0" +$ git push upstream v0.x +``` + +## Create and push a signed tag + +Git [tags](http://git-scm.com/book/en/v2/Distributed-Git-Maintaining-a-Project#Tagging-Your-Releases) are used to identify specific revisions with a unique version number that follows [semantic versioning](https://semver.org/) + +```bash +# update your local copy +git checkout v0.5 +git pull upstream v0.5 + +# create a signed tag +git tag -s -m "Release v0.5.0" v0.5.0 + +# push the tag to upstream +git push --tags upstream +``` + +Here is how to verify a signed tag. [`v0.5.0`](https://github.com/shaarli/Shaarli/releases/tag/v0.5.0) is the first GPG-signed tag pushed on the Community Shaarli. Let's have a look at its signature! + +```bash +# update the list of available tags +git fetch upstream + +# get the SHA1 reference of the tag +git show-ref tags/v0.5.0 +# gives: f7762cf803f03f5caf4b8078359a63783d0090c1 refs/tags/v0.5.0 + +# verify the tag signature information +git verify-tag f7762cf803f03f5caf4b8078359a63783d0090c1 +# gpg: Signature made Thu 30 Jul 2015 11:46:34 CEST using RSA key ID 4100DF6F +# gpg: Good signature from "VirtualTam " [ultimate] +``` + +## Publish the GitHub release + +- In the `master` banch, update version badges in `README.md` to point to the newly released Shaarli version +- Update the previously drafted [release](https://github.com/shaarli/Shaarli/releases) (notes, tag) and publish it +- Profit! + + +## Generate full release zip archives + +Release archives will contain Shaarli code plus all required third-party libraries. They are useful for users who: + +- have no SSH access, no possibility to install PHP packages/server extensions, no possibility to run scripts (shared hosting) +- do not want to install build/dev dependencies on their server + + `git checkout` the appropriate branch, then: + +```bash +# checkout the appropriate branch +git checkout 0.x.y +# generate zip archives +make release_archive +``` + +This will create `shaarli-v0.x.y-full.tar`, `shaarli-v0.x.y-full.zip`. These archives need to be manually uploaded on the previously created GitHub [release](https://github.com/shaarli/Shaarli/releases). + + +### Update the `latest` branch + +```bash +# checkout the 'latest' branch +git checkout latest +# merge changes from your newly published release branch +git merge v0.x.y +# fix eventual conflicts with git mergetool... +# run tests +make test +# push the latest branch +git push upstream latest +``` diff --git a/doc/md/dev/Theming.md b/doc/md/dev/Theming.md new file mode 100644 index 00000000..5be1a481 --- /dev/null +++ b/doc/md/dev/Theming.md @@ -0,0 +1,85 @@ +# Theming + +## Foreword + +There are two ways of customizing how Shaarli looks: + +1. by using a custom CSS to override Shaarli's CSS +2. by using a full theme that provides its own RainTPL templates, CSS and Javascript resources + +## Custom CSS + +Shaarli's appearance can be modified by adding CSS rules to: + +- Shaarli < `v0.9.0`: `inc/user.css` +- Shaarli >= `v0.9.0`: `data/user.css` + +This file allows overriding rules defined in the template CSS files (only add changed rules), or define a whole new theme. + +**Note**: Do not edit `tpl/default/css/shaarli.css`! Your changes would be overridden when updating Shaarli. + +## Themes + +Installation: + +- find a theme you'd like to install +- copy or clone the theme folder under `tpl/` +- enable the theme: + - Shaarli < `v0.9.0`: edit `data/config.json.php` and set the value of `raintpl_tpl` to the new theme name: + `"raintpl_tpl": "tpl\/my-template\/"` + - Shaarli >= `v0.9.0`: select the theme through the _Tools_ page + +## Community CSS & themes + +### Custom CSS + +- [mrjovanovic/serious-theme-shaarli](https://github.com/mrjovanovic/serious-theme-shaarli) - A serious theme for Shaarli +- [shaarli/shaarli-themes](https://github.com/shaarli/shaarli-themes) + +### Themes + +- [AkibaTech/Shaarli Superhero Theme](https://github.com/AkibaTech/Shaarli---SuperHero-Theme) - A template/theme for Shaarli +- [alexisju/albinomouse-template](https://github.com/alexisju/albinomouse-template) - A full template for Shaarli +- [ArthurHoaro/shaarli-launch](https://github.com/ArthurHoaro/shaarli-launch) - Customizable Shaarli theme +- [dhoko/ShaarliTemplate](https://github.com/dhoko/ShaarliTemplate) - A template/theme for Shaarli +- [kalvn/shaarli-blocks](https://github.com/kalvn/shaarli-blocks) - A template/theme for Shaarli +- [kalvn/Shaarli-Material](https://github.com/kalvn/Shaarli-Material) - A theme (template) based on Google's Material Design for Shaarli, the superfast delicious clone +- [ManufacturaInd/shaarli-2004licious-theme](https://github.com/ManufacturaInd/shaarli-2004licious-theme) - A template/theme as a humble homage to the early looks of the del.icio.us site + +### Shaarli forks + +- [misterair/Limonade](https://github.com/misterair/limonade) - A fork of (legacy) Shaarli with a new template +- [vivienhaese/shaarlitheme](https://github.com/vivienhaese/shaarlitheme) - A Shaarli fork meant to be run in an openshift instance + +## Example installation: AlbinoMouse theme + +With the following configuration: + +- Apache 2 / PHP 5.6 +- user sites are enabled, e.g. `/home/user/public_html/somedir` is served as `http://localhost/~user/somedir` +- `http` is the name of the Apache user + +```bash +$ cd ~/public_html + +# clone repositories +$ git clone https://github.com/shaarli/Shaarli.git shaarli +$ pushd shaarli/tpl +$ git clone https://github.com/alexisju/albinomouse-template.git +$ popd + +# set access rights for Apache +$ chgrp -R http shaarli +$ chmod g+rwx shaarli shaarli/cache shaarli/data shaarli/pagecache shaarli/tmp +``` + +Get config written: +- go to the freshly installed site +- fill the install form +- log in to Shaarli + +Edit Shaarli's [configuration](Shaarli-configuration): +```bash +# the file should be owned by Apache, thus not writeable => sudo +$ sudo sed -i s=tpl=tpl/albinomouse-template=g shaarli/data/config.php +``` diff --git a/doc/md/dev/Translations.md b/doc/md/dev/Translations.md new file mode 100644 index 00000000..8f3b8f10 --- /dev/null +++ b/doc/md/dev/Translations.md @@ -0,0 +1,157 @@ +## Translations + +Shaarli supports [gettext](https://www.gnu.org/software/gettext/manual/gettext.html) translations +since `>= v0.9.2`. + +Note that only the `default` theme supports translations. + +### Contributing + +We encourage the community to contribute to Shaarli translations, either by improving existing translations or submitting a new language. + +Contributing to the translation does not require software development knowledge. + +Please submit a pull request with the `.po` file updated/created. Note that the compiled file (`.mo`) is not stored on the repository, and is generated during the release process. + + +### How to + +Install [Poedit](https://poedit.net/) (used to extract strings to translate from the PHP source code, and generate `.po` files). + +Due to the usage of a template engine, it's important to generate PHP cache files to extract every translatable string. You can either use [this script](https://gist.github.com/ArthurHoaro/5d0323f758ab2401ef444a53f54e9a07) (recommended) or visit every template page in your browser to generate cache files, while logged in. Here is a list : + +``` +http:/// +http:///login +http:///daily +http:///tags/cloud +http:///tags/list +http:///picture-wall +http:///?nonope +http:///admin/add-shaare +http:///admin/password +http:///admin/tags +http:///admin/configure +http:///admin/tools +http:///admin/shaare +http:///admin/export +http:///admin/import +http:///admin/plugins +``` + + +#### Improve existing translations + +- In Poedit, click on "Edit a Translation +- Open `inc/languages//LC_MESSAGES/shaarli.po` under Shaarli's directory +- The existing list of translatable strings should load +- Click on the "Update" button. +- Start editing translations. + +![poedit-screenshot](images/poedit-1.jpg) + +Save when you're done, then you can submit a pull request containing the updated `shaarli.po`. + + +#### Add a new language + +- In Poedit select "Create New Translation" +- Open `inc/languages//LC_MESSAGES/shaarli.po` under Shaarli's directory +- Select the language you want to create. +- Click on `File > Save as...`, save your file in `/inc/language//LC_MESSAGES/shaarli.po` (`` here should be the language code respecting the [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-2) format in lowercase - e.g. `de` for German) +- Click on the "Update" button +- Start editing translations. + +Save when you're done, then you can submit a pull request containing the new `shaarli.po`. + + +### Theme translations + +[Theme](Theming) translation extensions are loaded automatically if they're present. + +As a theme developer, all you have to do is to add the `.po` and `.mo` compiled file like this: + +``` +tpl//language//LC_MESSAGES/.po +tpl//language//LC_MESSAGES/.mo +``` + +Where `` is the ISO 3166-1 alpha-2 language code. + +Read the following section "Extend Shaarli's translation" to learn how to generate those files. + + +### Extend Shaarli's translation + +If you're writing a custom theme, or a non official plugin, you might want to use the translation system, +but you won't be able to able to override Shaarli's translation. + +However, you can add your own translation domain which extends the main translation list. + +> Note that you can find a live example of translation extension in the `demo_plugin`. + +First, create your translation files tree directory: + +``` +/languages//LC_MESSAGES/ +``` + +Your `.po` files must be named like your domain. E.g. if your translation domain is `my_theme`, then your file will be +`my_theme.po`. + +Users have to register your extension in their configuration with the parameter +`translation.extensions.: `. + +Example: + +```php +if (! $conf->exists('translation.extensions.my_theme')) { + $conf->set('translation.extensions.my_theme', '/languages/'); + $conf->write(true); +} +``` + +> Note that the page needs to be reloaded after the registration. + +It is then recommended to create a custom translation function which will call the `t()` function with your domain. +For example : + +```php +function my_theme_t($text, $nText = '', $nb = 1) +{ + return t($text, $nText, $nb, 'my_theme'); // the last parameter is your translation domain. +} +``` + +All strings which can be translated should be processed through your function: + +```php +my_theme_t('Comment'); +my_theme_t('Comment', 'Comments', 2); +``` + +Or in templates: + +```php +{'Comment'|my_theme_t} +{function="my_theme_t('Comment', 'Comments', 2)"} +``` + +> Note than in template, you need to visit your page at least once to generate a cache file. + +When you're done, open Poedit and load translation strings from sources: + + 1. `File > New` + 2. Choose your language + 3. Save your `PO` file in `/languages//LC_MESSAGES/my_theme.po`. + 4. Go to `Catalog > Properties...` + 5. Fill the `Translation Properties` tab + 6. Add your source path in the `Sources Paths` tab + 7. In the `Sources Keywords` tab uncheck "Also use default keywords" and add the following lines: + +``` +my_theme_t +my_theme_t:1,2 +``` + +Click on the "Update" button and you're free to start your translations! diff --git a/doc/md/dev/Unit-tests.md b/doc/md/dev/Unit-tests.md new file mode 100644 index 00000000..25af82d7 --- /dev/null +++ b/doc/md/dev/Unit-tests.md @@ -0,0 +1,138 @@ +# Unit tests + +Shaarli uses the [PHPUnit](https://phpunit.de/) test framework; it can be installed with [Composer](https://getcomposer.org/), which is a dependency management tool. + +## Install composer + +You can either use: + +- a system-wide version, e.g. installed through your distro's package manager +- a local version, downloadable [here](https://getcomposer.org/download/). + +```bash +# system-wide version +$ composer install +$ composer update + +# local version +$ php composer.phar self-update +$ php composer.phar install +$ php composer.phar update +``` + +## Install Shaarli dev dependencies + +```bash +$ cd /path/to/shaarli +$ composer update +``` + +## Install and enable Xdebug to generate PHPUnit coverage reports + + +[Xdebug](http://xdebug.org/docs/install) is a PHP extension which provides debugging and profiling capabilities. Install Xdebug: + +```bash +# for Debian-based distros: +sudo aptitude install php5-xdebug + +# for ArchLinux: +pacman -S xdebug + +# then add the following line to /etc/php/php.ini +zend_extension=xdebug.so +``` + +## Run unit tests + +Ensure tests pass successuflly: + +```bash +make test +# ... +# OK (36 tests, 65 assertions) +``` + +In case of failure the test suite will point you to actual errors and output a summary: + +```bash +make test +# ... +# FAILURES! +# Tests: 36, Assertions: 63, Errors: 1, Failures: 2. +``` + +By default, PHPUnit will run all suitable tests found under the `tests` directory. Each test has 3 possible outcomes: + +- `.` - success +- `F` - failure: the test was run but its results are invalid + - the code does not behave as expected + - dependencies to external elements: globals, session, cache... +- `E` - error: something went wrong and the tested code has crashed + - typos in the code, or in the test code + - dependencies to missing external elements + +If Xdebug has been installed and activated, two coverage reports will be generated: + +- a summary in the console +- a detailed HTML report with metrics for tested code + - to open it in a web browser: `firefox coverage/index.html &` + + +### Executing specific tests + +Add a [`@group`](https://phpunit.de/manual/current/en/appendixes.annotations.html#appendixes.annotations.group) annotation in a test class or method comment: + +```php +/** + * Netscape bookmark import + * @group WIP + */ +class BookmarkImportTest extends PHPUnit_Framework_TestCase +{ + [...] +} +``` + +To run all tests annotated with `@group WIP`: +```bash +$ vendor/bin/phpunit --group WIP tests/ +``` + +## Running tests inside Docker containers + +Unit tests can be run inside [Docker](../Docker.md) containers. + +Test Dockerfiles are located under `tests/docker//Dockerfile`, and can be used to build Docker images to run Shaarli test suites under commonLinux environments. Dockerfiles are provided for the following environments: + +- [`alpine36`](https://github.com/shaarli/Shaarli/blob/master/tests/docker/alpine36/Dockerfile) - [Alpine Linux 3.6](https://www.alpinelinux.org/downloads/) +- [`debian8`](https://github.com/shaarli/Shaarli/blob/master/tests/docker/debian8/Dockerfile) - [Debian 8 Jessie](https://www.debian.org/DebianJessie) (oldoldstable) +- [`debian9`](https://github.com/shaarli/Shaarli/blob/master/tests/docker/debian9/Dockerfile) - [Debian 9 Stretch](https://wiki.debian.org/DebianStretch) (oldstable) +- [`ubuntu16`](https://github.com/shaarli/Shaarli/blob/master/tests/docker/ubuntu16/Dockerfile) - [Ubuntu 16.04 Xenial Xerus](http://releases.ubuntu.com/16.04/) (old LTS) + +Each image provides: +- a base Linux OS +- Shaarli PHP dependencies (OS packages) +- test PHP dependencies (OS packages) +- Composer +- Tests that run inside the conatiner using a standard Linux user account (running tests as `root` would bypass permission checks and may hide issues) + +Build a test image: + +```bash +# build the Debian 9 Docker image +cd /path/to/shaarli/tests/docker/debian9 +docker build -t shaarli-test:debian9 . +``` + +Run unit tests in a container: + +```bash +cd /path/to/shaarli +# install/update 3rd-party test dependencies +composer install --prefer-dist +# run tests using the freshly built image +docker run -v $PWD:/shaarli shaarli-test:debian9 docker_test +# run the full test campaign +docker run -v $PWD:/shaarli shaarli-test:debian9 docker_all_tests +``` diff --git a/doc/md/dev/Versioning.md b/doc/md/dev/Versioning.md new file mode 100644 index 00000000..32c80a5c --- /dev/null +++ b/doc/md/dev/Versioning.md @@ -0,0 +1,63 @@ +# Versioning + +If you're maintaining a 3rd party tool for Shaarli (theme, plugin, etc.), It's important to understand how Shaarli branches work ensure your tool stays compatible. + + +## `master` branch + +The `master` branch is the development branch. Any new change MUST go through this branch using Pull Requests. + +Remarks: + +- This branch shouldn't be used for production as it isn't necessary stable. +- 3rd party aren't required to be compatible with the latest changes. +- Official plugins, themes and libraries (contained within Shaarli organization repos) must be compatible with the master branch. + + +## `v0.x` branch + +The `v0.x` branch points to the latest `v0.x.y` release. + +If a major bug affects the original `v0.x.0` release, we may [backport](https://en.wikipedia.org/wiki/Backporting) a fix for this bug from master, to the `v0.x` branch, and create a new bugfix release (eg. `v0.x.1`) from this branch. + +This allows users of the original release to upgrade to the fixed version, without having to upgrade to a completely new minor/major release. + + +## `latest` branch + +This branch point the latest release. It recommended to use it to get the latest tested changes. + + +## Releases + +For every release, we manually generate a .zip file which contains all Shaarli dependencies, making Shaarli's installation only one step. + + +## Advices on 3rd party git repos workflow + +### Versioning + +Any time a new Shaarli release is published, you should publish a new release of your repo if the changes affected you since the latest release (take a look at the [changelog](https://github.com/shaarli/Shaarli/releases) (*Draft* means not released yet) and the commit log (like [`tpl` folder](https://github.com/shaarli/Shaarli/commits/master/tpl/default) for themes)). You can either: + + - use the Shaarli version number, with your repo version. For example, if Shaarli `v0.8.3` is released, publish a `v0.8.3-1` release, where `v0.8.3` states Shaarli compatibility and `-1` is your own version digit for the current Shaarli version. + - use your own versioning scheme, and state Shaarli compatibility in the release description. + +Using this, any user will be able to pick the release matching his own Shaarli version. + +### Major bugfix backport releases + +To be able to support backported fixes, it recommended to use our workflow: + +```bash +# In master, fix the major bug +git commit -m "Katastrophe" +git push origin master +# Get your commit hash +git log --format="%H" -n 1 +# Create a new branch from your latest release, let's say v0.8.2-1 (the tag name) +git checkout -b katastrophe v0.8.2-1 +# Backport the fix commit to your brand new branch +git cherry-pick +git push origin katastrophe +# Then you just have to make a new release from the `katastrophe` branch tagged `v0.8.3-1` +``` diff --git a/doc/md/dev/images/poedit-1.jpg b/doc/md/dev/images/poedit-1.jpg new file mode 100644 index 00000000..673ae6d6 Binary files /dev/null and b/doc/md/dev/images/poedit-1.jpg differ diff --git a/doc/md/docker/docker-101.md b/doc/md/docker/docker-101.md deleted file mode 100644 index a9c00b85..00000000 --- a/doc/md/docker/docker-101.md +++ /dev/null @@ -1,140 +0,0 @@ -## Basics -Install [Docker](https://www.docker.com/), by following the instructions relevant -to your OS / distribution, and start the service. - -### Search an image on [DockerHub](https://hub.docker.com/) - -```bash -$ docker search debian - -NAME DESCRIPTION STARS OFFICIAL AUTOMATED -ubuntu Ubuntu is a Debian-based Linux operating s... 2065 [OK] -debian Debian is a Linux distribution that's comp... 603 [OK] -google/debian 47 [OK] -``` - -### Show available tags for a repository -```bash -$ curl https://index.docker.io/v1/repositories/debian/tags | python -m json.tool - -% Total % Received % Xferd Average Speed Time Time Time Current -Dload Upload Total Spent Left Speed -100 1283 0 1283 0 0 433 0 --:--:-- 0:00:02 --:--:-- 433 -``` - -Sample output: -```json -[ - { - "layer": "85a02782", - "name": "stretch" - }, - { - "layer": "59abecbc", - "name": "testing" - }, - { - "layer": "bf0fd686", - "name": "unstable" - }, - { - "layer": "60c52dbe", - "name": "wheezy" - }, - { - "layer": "c5b806fe", - "name": "wheezy-backports" - } -] - -``` - -### Pull an image from DockerHub -```bash -$ docker pull repository[:tag] - -$ docker pull debian:wheezy -wheezy: Pulling from debian -4c8cbfd2973e: Pull complete -60c52dbe9d91: Pull complete -Digest: sha256:c584131da2ac1948aa3e66468a4424b6aea2f33acba7cec0b631bdb56254c4fe -Status: Downloaded newer image for debian:wheezy -``` - -Docker re-uses layers already downloaded. In other words if you have images based on Alpine or some Ubuntu version for example, those can share disk space. - -### Start a container -A container is an instance created from an image, that can be run and that keeps running until its main process exits. Or until the user stops the container. - -The simplest way to start a container from image is ``docker run``. It also pulls the image for you if it is not locally available. For more advanced use, refer to ``docker create``. - -Stopped containers are not destroyed, unless you specify ``--rm``. To view all created, running and stopped containers, enter: -```bash -$ docker ps -a -``` - -Some containers may be designed or configured to be restarted, others are not. Also remember both network ports and volumes of a container are created on start, and not editable later. - -### Access a running container -A running container is accessible using ``docker exec``, or ``docker copy``. You can use ``exec`` to start a root shell in the Shaarli container: -```bash -$ docker exec -ti bash -``` -Note the names and ID's of containers are listed in ``docker ps``. You can even type only one or two letters of the ID, given they are unique. - -Access can also be through one or more network ports, or disk volumes. Both are specified on and fixed on ``docker create`` or ``run``. - -You can view the console output of the main container process too: -```bash -$ docker logs -f -``` - -### Docker disk use -Trying out different images can fill some gigabytes of disk quickly. Besides images, the docker volumes usually take up most disk space. - -If you care only about trying out docker and not about what is running or saved, the following commands should help you out quickly if you run low on disk space: - -```bash -$ docker rmi -f $(docker images -aq) # remove or mark all images for disposal -$ docker volume rm $(docker volume ls -q) # remove all volumes -``` - -### Systemd config -Systemd is the process manager of choice on Debian-based distributions. Once you have a ``docker`` service installed, you can use the following steps to set up Shaarli to run on system start. - -```bash -systemctl enable /etc/systemd/system/docker.shaarli.service -systemctl start docker.shaarli -systemctl status docker.* -journalctl -f # inspect system log if needed -``` - -You will need sudo or a root terminal to perform some or all of the steps above. Here are the contents for the service file: -``` -[Unit] -Description=Shaarli Bookmark Manager Container -After=docker.service -Requires=docker.service - - -[Service] -Restart=always - -# Put any environment you want in an included file, like $host- or $domainname in this example -EnvironmentFile=/etc/sysconfig/box-environment - -# It's just an example.. -ExecStart=/usr/bin/docker run \ - -p 28010:80 \ - --name ${hostname}-shaarli \ - --hostname shaarli.${domainname} \ - -v /srv/docker-volumes-local/shaarli-data:/var/www/shaarli/data:rw \ - -v /etc/localtime:/etc/localtime:ro \ - shaarli/shaarli:latest - -ExecStop=/usr/bin/docker rm -f ${hostname}-shaarli - - -[Install] -WantedBy=multi-user.target -``` diff --git a/doc/md/docker/resources.md b/doc/md/docker/resources.md deleted file mode 100644 index 082d4a46..00000000 --- a/doc/md/docker/resources.md +++ /dev/null @@ -1,19 +0,0 @@ -### Docker - -- [Interactive Docker training portal](https://www.katacoda.com/courses/docker/) on [Katakoda](https://www.katacoda.com/) -- [Where are Docker images stored?](http://blog.thoward37.me/articles/where-are-docker-images-stored/) -- [Dockerfile reference](https://docs.docker.com/reference/builder/) -- [Dockerfile best practices](https://docs.docker.com/articles/dockerfile_best-practices/) -- [Volumes](https://docs.docker.com/userguide/dockervolumes/) - -### DockerHub - -- [Repositories](https://docs.docker.com/userguide/dockerrepos/) -- [Teams and organizations](https://docs.docker.com/docker-hub/orgs/) -- [GitHub automated build](https://docs.docker.com/docker-hub/github/) - -### Service management - -- [Using supervisord](https://docs.docker.com/articles/using_supervisord/) -- [Nginx in the foreground](http://nginx.org/en/docs/ngx_core_module.html#daemon) -- [supervisord](http://supervisord.org/) diff --git a/doc/md/docker/reverse-proxy-configuration.md b/doc/md/docker/reverse-proxy-configuration.md deleted file mode 100644 index e53c9422..00000000 --- a/doc/md/docker/reverse-proxy-configuration.md +++ /dev/null @@ -1,123 +0,0 @@ -## Foreword - -This guide assumes that: - -- Shaarli runs in a Docker container -- The host's `10080` port is mapped to the container's `80` port -- Shaarli's Fully Qualified Domain Name (FQDN) is `shaarli.domain.tld` -- HTTP traffic is redirected to HTTPS - -## Apache - -- [Apache 2.4 documentation](https://httpd.apache.org/docs/2.4/) - - [mod_proxy](https://httpd.apache.org/docs/2.4/mod/mod_proxy.html) - - [Reverse Proxy Request Headers](https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#x-headers) - -The following HTTP headers are set when the `ProxyPass` directive is set: - -- `X-Forwarded-For` -- `X-Forwarded-Host` -- `X-Forwarded-Server` - -The original `SERVER_NAME` can be sent to the proxied host by setting the [`ProxyPreserveHost`](https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#ProxyPreserveHost) directive to `On`. - -```apache - - ServerName shaarli.domain.tld - Redirect permanent / https://shaarli.domain.tld - - - - ServerName shaarli.domain.tld - - SSLEngine on - SSLCertificateFile /path/to/cert - SSLCertificateKeyFile /path/to/certkey - - LogLevel warn - ErrorLog /var/log/apache2/shaarli-error.log - CustomLog /var/log/apache2/shaarli-access.log combined - - RequestHeader set X-Forwarded-Proto "https" - ProxyPreserveHost On - - ProxyPass / http://127.0.0.1:10080/ - ProxyPassReverse / http://127.0.0.1:10080/ - -``` - - -## HAProxy - -- [HAProxy documentation](https://cbonte.github.io/haproxy-dconv/) - -```conf -global - [...] - -defaults - [...] - -frontend http-in - bind :80 - redirect scheme https code 301 if !{ ssl_fc } - - bind :443 ssl crt /path/to/cert.pem - - default_backend shaarli - - -backend shaarli - mode http - option http-server-close - option forwardfor - reqadd X-Forwarded-Proto: https - - server shaarli1 127.0.0.1:10080 -``` - - -## Nginx - -- [Nginx documentation](https://nginx.org/en/docs/) - -```nginx -http { - [...] - - index index.html index.php; - - root /home/john/web; - access_log /var/log/nginx/access.log; - error_log /var/log/nginx/error.log; - - server { - listen 80; - server_name shaarli.domain.tld; - return 301 https://shaarli.domain.tld$request_uri; - } - - server { - listen 443 ssl http2; - server_name shaarli.domain.tld; - - ssl_certificate /path/to/cert - ssl_certificate_key /path/to/certkey - - location / { - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $host; - - proxy_pass http://localhost:10080/; - proxy_set_header Host $host; - proxy_connect_timeout 30s; - proxy_read_timeout 120s; - - access_log /var/log/nginx/shaarli.access.log; - error_log /var/log/nginx/shaarli.error.log; - } - } -} -``` diff --git a/doc/md/docker/shaarli-images.md b/doc/md/docker/shaarli-images.md deleted file mode 100644 index 14971d54..00000000 --- a/doc/md/docker/shaarli-images.md +++ /dev/null @@ -1,118 +0,0 @@ -A brief guide on getting starting using docker is given in [Docker 101](docker-101.md). -To learn more about user data and how to keep it across versions, please see [Upgrade and Migration](../Upgrade-and-migration.md). - -## Get and run a Shaarli image - -### DockerHub repository -The images can be found in the [`shaarli/shaarli`](https://hub.docker.com/r/shaarli/shaarli/) -repository. - -### Available image tags -- `latest`: latest branch -- `master`: master branch -- `stable`: stable branch - -The `latest`, `master` and `stable` images rely on: - -- [Alpine Linux](https://www.alpinelinux.org/) -- [PHP7-FPM](http://php-fpm.org/) -- [Nginx](http://nginx.org/) - -Additional Dockerfiles are provided for the `arm32v7` platform, relying on -[Linuxserver.io Alpine armhf -images](https://hub.docker.com/r/lsiobase/alpine.armhf/). These images must be -built using [`docker -build`](https://docs.docker.com/engine/reference/commandline/build/) on an -`arm32v7` machine or using an emulator such as -[qemu](https://resin.io/blog/building-arm-containers-on-any-x86-machine-even-dockerhub/). - -### Download from Docker Hub -```shell -$ docker pull shaarli/shaarli - -latest: Pulling from shaarli/shaarli -32716d9fcddb: Pull complete -84899d045435: Pull complete -4b6ad7444763: Pull complete -e0345ef7a3e0: Pull complete -5c1dd344094f: Pull complete -6422305a200b: Pull complete -7d63f861dbef: Pull complete -3eb97210645c: Pull complete -869319d746ff: Already exists -869319d746ff: Pulling fs layer -902b87aaaec9: Already exists -Digest: sha256:f836b4627b958b3f83f59c332f22f02fcd495ace3056f2be2c4912bd8704cc98 -Status: Downloaded newer image for shaarli/shaarli:latest -``` - -### Create and start a new container from the image -```shell -# map the host's :8000 port to the container's :80 port -$ docker create -p 8000:80 shaarli/shaarli -d40b7af693d678958adedfb88f87d6ea0237186c23de5c4102a55a8fcb499101 - -# launch the container in the background -$ docker start d40b7af693d678958adedfb88f87d6ea0237186c23de5c4102a55a8fcb499101 -d40b7af693d678958adedfb88f87d6ea0237186c23de5c4102a55a8fcb499101 - -# list active containers -$ docker ps -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -d40b7af693d6 shaarli/shaarli /usr/bin/supervisor 15 seconds ago Up 4 seconds 0.0.0.0:8000->80/tcp backstabbing_galileo -``` - -### Stop and destroy a container -```shell -$ docker stop backstabbing_galileo # those docker guys are really rude to physicists! -backstabbing_galileo - -# check the container is stopped -$ docker ps -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES - -# list ALL containers -$ docker ps -a -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -d40b7af693d6 shaarli/shaarli /usr/bin/supervisor 5 minutes ago Exited (0) 48 seconds ago backstabbing_galileo - -# destroy the container -$ docker rm backstabbing_galileo # let's put an end to these barbarian practices -backstabbing_galileo - -$ docker ps -a -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -``` - -### Automatic builds -Docker users can start a personal instance from an -[autobuild image](https://hub.docker.com/r/shaarli/shaarli/). -For example to start a temporary Shaarli at ``localhost:8000``, and keep session -data (config, storage): - -```shell -MY_SHAARLI_VOLUME=$(cd /path/to/shaarli/data/ && pwd -P) -docker run -ti --rm \ - -p 8000:80 \ - -v $MY_SHAARLI_VOLUME:/var/www/shaarli/data \ - shaarli/shaarli -``` - -### Volumes and data persistence -Data can be persisted by [using volumes](https://docs.docker.com/storage/volumes/). -Volumes allow to keep your data when renewing and/or updating container images: - -```shell -# Create data volumes -$ docker volume create shaarli-data -$ docker volume create shaarli-cache - -# Create and start a Shaarli container using these volumes to persist data -$ docker create \ - --name shaarli \ - -v shaarli-cache:/var/www/shaarli/cache \ - -v shaarli-data:/var/www/shaarli/data \ - -p 8000:80 \ - shaarli/shaarli:master -$ docker start shaarli -``` diff --git a/doc/md/guides/backup-restore-import-export.md b/doc/md/guides/backup-restore-import-export.md deleted file mode 100644 index bb790074..00000000 --- a/doc/md/guides/backup-restore-import-export.md +++ /dev/null @@ -1,64 +0,0 @@ -## Backup and restore the datastore file - -Backup the file `data/datastore.php` (by FTP or SSH). Restore by putting the file back in place. - -Example command: -```bash -rsync -avzP my.server.com:/var/www/shaarli/data/datastore.php datastore-$(date +%Y-%m-%d_%H%M).php -``` - -## Export links as... - -To export links as an HTML file, under _Tools > Export_, choose: - -- _Export all_ to export both public and private links -- _Export public_ to export public links only -- _Export private_ to export private links only - -Restore by using the `Import` feature. - -- This can be done using the [shaarchiver](https://github.com/nodiscc/shaarchiver) tool. - -Example command: -```bash -./export-bookmarks.py --url=https://my.server.com/shaarli --username=myusername --password=mysupersecretpassword --download-dir=./ --type=all -``` - -## Import links from... - -### Diigo - -If you export your bookmark from Diigo, make sure you use the Delicious export, not the Netscape export. (Their Netscape export is broken, and they don't seem to be interested in fixing it.) - -### Mister Wong - -See [this issue](https://github.com/sebsauvage/Shaarli/issues/146) for import tweaks. - -### SemanticScuttle - -To correctly import the tags from a [SemanticScuttle](http://semanticscuttle.sourceforge.net/) HTML export, edit the HTML file before importing and replace all occurences of `tags=` (lowercase) to `TAGS=` (uppercase). - -### Scuttle - -Shaarli cannot import data directly from [Scuttle](https://github.com/scronide/scuttle). - -However, you can use the third-party [scuttle-to-shaarli](https://github.com/q2apro/scuttle-to-shaarli) -tool to export the Scuttle database to the Netscape HTML format compatible with the Shaarli importer. - -### Refind - -You can use the third-party tool [Derefind](https://github.com/ShawnPConroy/Derefind) to convert refind.com bookmark exports to a format that can be imported into Shaarli. - -## Import Shaarli links to Firefox - -- Export your Shaarli links as described above. - - For compatibility reasons, check `Prepend note permalinks with this Shaarli instance's URL (useful to import bookmarks in a web browser)` -- In Firefox, open the bookmark manager (not the sidebar! `Bookmarks menu > Show all bookmarks` or `Ctrl+Shift+B`) -- Select `Import and Backup > Import bookmarks in HTML format` - -Your bookmarks will be imported in Firefox, ready to use, with tags and descriptions retained. "Self" (notes) shaares will still point to the Shaarli instance you exported them from, but the note text can be viewed directly in the bookmark properties inside your browser. Depending on the number of bookmarks, the import can take some time. - -You may be interested in these Firefox addons to manage links imported from Shaarli - -- [Bookmark Deduplicator](https://addons.mozilla.org/en-US/firefox/addon/bookmark-deduplicator/) - provides an easy way to deduplicate your bookmarks -- [TagSieve](https://addons.mozilla.org/en-US/firefox/addon/tagsieve/) - browse your bookmarks by their tags diff --git a/doc/md/guides/images/01-create-droplet-distro.jpg b/doc/md/guides/images/01-create-droplet-distro.jpg deleted file mode 100644 index 63682ba8..00000000 Binary files a/doc/md/guides/images/01-create-droplet-distro.jpg and /dev/null differ diff --git a/doc/md/guides/images/02-create-droplet-region.jpg b/doc/md/guides/images/02-create-droplet-region.jpg deleted file mode 100644 index 135a78be..00000000 Binary files a/doc/md/guides/images/02-create-droplet-region.jpg and /dev/null differ diff --git a/doc/md/guides/images/03-create-droplet-size.jpg b/doc/md/guides/images/03-create-droplet-size.jpg deleted file mode 100644 index aa5b2fd2..00000000 Binary files a/doc/md/guides/images/03-create-droplet-size.jpg and /dev/null differ diff --git a/doc/md/guides/images/04-finalize.jpg b/doc/md/guides/images/04-finalize.jpg deleted file mode 100644 index 68ec0dc5..00000000 Binary files a/doc/md/guides/images/04-finalize.jpg and /dev/null differ diff --git a/doc/md/guides/images/05-droplet.jpg b/doc/md/guides/images/05-droplet.jpg deleted file mode 100644 index 44e93a1e..00000000 Binary files a/doc/md/guides/images/05-droplet.jpg and /dev/null differ diff --git a/doc/md/guides/images/06-domain.jpg b/doc/md/guides/images/06-domain.jpg deleted file mode 100644 index 5827dd93..00000000 Binary files a/doc/md/guides/images/06-domain.jpg and /dev/null differ diff --git a/doc/md/guides/images/07-installation.jpg b/doc/md/guides/images/07-installation.jpg deleted file mode 100644 index 42cc9f10..00000000 Binary files a/doc/md/guides/images/07-installation.jpg and /dev/null differ diff --git a/doc/md/guides/install-shaarli-with-debian9-and-docker.md b/doc/md/guides/install-shaarli-with-debian9-and-docker.md deleted file mode 100644 index f1b26d47..00000000 --- a/doc/md/guides/install-shaarli-with-debian9-and-docker.md +++ /dev/null @@ -1,257 +0,0 @@ -_Last updated on 2018-07-01._ - -## Goals -- Getting a Virtual Private Server (VPS) -- Running Shaarli: - - as a Docker container, - - using the Træfik reverse proxy, - - securized with TLS certificates from Let's Encrypt. - - -The following components and tools will be used: - -- [Debian](https://www.debian.org/), a GNU/Linux distribution widely used in - server environments; -- [Docker](https://docs.docker.com/engine/docker-overview/), an open platform - for developing, shipping, and running applications; -- [Docker Compose](https://docs.docker.com/compose/), a tool for defining and - running multi-container Docker applications. - - -More information can be found in the [Resources](#resources) section at the -bottom of the guide. - -## Getting a Virtual Private Server -For this guide, I went for the smallest VPS available from DigitalOcean, -a Droplet with 1 CPU, 1 GiB RAM and 25 GiB SSD storage, which costs -$5/month ($0.007/hour): - -- [Droplets Overview](https://www.digitalocean.com/docs/droplets/overview/) -- [Pricing](https://www.digitalocean.com/pricing/) -- [How to Create a Droplet from the DigitalOcean Control Panel](https://www.digitalocean.com/docs/droplets/how-to/create/) -- [How to Add SSH Keys to Droplets](https://www.digitalocean.com/docs/droplets/how-to/add-ssh-keys/) -- [Initial Server Setup with Debian 8](https://www.digitalocean.com/community/tutorials/initial-server-setup-with-debian-8) (also applies to Debian 9) -- [An Introduction to Securing your Linux VPS](https://www.digitalocean.com/community/tutorials/an-introduction-to-securing-your-linux-vps) - -### Creating a Droplet -Select `Debian 9` as the Droplet distribution: - -Droplet distribution - -Choose a region that is geographically close to you: - -Droplet region - -Choose a Droplet size that corresponds to your usage and budget: - -Droplet size - -Finalize the Droplet creation: - -Droplet finalization - -Droplet information is displayed on the Control Panel: - -Droplet summary - -Once your VPS has been created, you will receive an e-mail with connection -instructions. - -## Obtaining a domain name -After creating your VPS, it will be reachable using its IP address; some hosting -providers also create a DNS record, e.g. `ns4853142.ip-01-47-127.eu`. - -A domain name (DNS record) is required to obtain a certificate and setup HTTPS -(HTTP with TLS encryption). - -Domain names can be obtained from registrars through hosting providers such as -[Gandi](https://www.gandi.net/en/domain). - -Once you have your own domain, you need to create a new DNS record that points -to your VPS' IP address: - -Domain configuration - -## Host setup -Now's the time to connect to your freshly created VPS! - -```shell -$ ssh root@188.166.85.8 - -Linux stretch-shaarli-02 4.9.0-6-amd64 #1 SMP Debian 4.9.88-1+deb9u1 (2018-05-07) x86_64 - -The programs included with the Debian GNU/Linux system are free software; -the exact distribution terms for each program are described in the -individual files in /usr/share/doc/*/copyright. - -Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent -permitted by applicable law. -Last login: Sun Jul 1 11:20:18 2018 from - -root@stretch-shaarli-02:~$ -``` - -### Updating the system -```shell -root@stretch-shaarli-02:~$ apt update && apt upgrade -y -``` - -### Setting up Docker -_The following instructions are from the -[Get Docker CE for Debian](https://docs.docker.com/install/linux/docker-ce/debian/) -guide._ - -Install package dependencies: - -```shell -root@stretch-shaarli-02:~$ apt install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common -``` - -Add Docker's package repository GPG key: - -```shell -root@stretch-shaarli-02:~$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - -``` - -Add Docker's package repository: - -```shell -root@stretch-shaarli-02:~$ add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian stretch stable" -``` - -Update package lists and install Docker: - -```shell -root@stretch-shaarli-02:~$ apt update && apt install -y docker-ce -``` - -Verify Docker is properly configured by running the `hello-world` image: - -```shell -root@stretch-shaarli-02:~$ docker run hello-world -``` - -### Setting up Docker Compose -_The following instructions are from the -[Install Docker Compose](https://docs.docker.com/compose/install/) -guide._ - -Download the current version from the release page: - -```shell -root@stretch-shaarli-02:~$ curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose -root@stretch-shaarli-02:~$ chmod +x /usr/local/bin/docker-compose -``` - -## Running Shaarli -Shaarli comes with a configuration file for Docker Compose, that will setup: - -- a local Docker network -- a Docker [volume](https://docs.docker.com/storage/volumes/) to store Shaarli data -- a Docker [volume](https://docs.docker.com/storage/volumes/) to store Træfik TLS configuration and certificates -- a [Shaarli](https://hub.docker.com/r/shaarli/shaarli/) instance -- a [Træfik](https://hub.docker.com/_/traefik/) instance - -[Træfik](https://docs.traefik.io/) is a modern HTTP reverse proxy, with native -support for Docker and [Let's Encrypt](https://letsencrypt.org/). - -### Compose configuration -Create a new directory to store the configuration: - -```shell -root@stretch-shaarli-02:~$ mkdir shaarli && cd shaarli -root@stretch-shaarli-02:~/shaarli$ -``` - -Download the current version of Shaarli's `docker-compose.yml`: - -```shell -root@stretch-shaarli-02:~/shaarli$ curl -L https://raw.githubusercontent.com/shaarli/Shaarli/master/docker-compose.yml -o docker-compose.yml -``` - -Create the `.env` file and fill in your VPS and domain information (replace -`` and `` with your actual information): - -```shell -root@stretch-shaarli-02:~/shaarli$ vim .env -``` - -```shell -SHAARLI_VIRTUAL_HOST= -SHAARLI_LETSENCRYPT_EMAIL= -``` - -### Pull the Docker images -```shell -root@stretch-shaarli-02:~/shaarli$ docker-compose pull -Pulling shaarli ... done -Pulling traefik ... done -``` - -### Run! -```shell -root@stretch-shaarli-02:~/shaarli$ docker-compose up -d -Creating network "shaarli_http-proxy" with the default driver -Creating volume "shaarli_traefik-acme" with default driver -Creating volume "shaarli_shaarli-data" with default driver -Creating shaarli_shaarli_1 ... done -Creating shaarli_traefik_1 ... done -``` - -## Conclusion -Congratulations! Your Shaarli instance should be up and running, and available -at `https://`. - -Shaarli installation page - -## Resources -### Related Shaarli documentation -- [Docker 101](../docker/docker-101.md) -- [Shaarli images](../docker/shaarli-images.md) - -### Hosting providers -- [DigitalOcean](https://www.digitalocean.com/) -- [Gandi](https://www.gandi.net/en) -- [OVH](https://www.ovh.co.uk/) -- [RackSpace](https://www.rackspace.com/) -- etc. - -### Domain Names and Registrars -- [Introduction to the Domain Name System (DNS)](https://opensource.com/article/17/4/introduction-domain-name-system-dns) -- [ICANN](https://www.icann.org/) -- [Domain name registrar](https://en.wikipedia.org/wiki/Domain_name_registrar) -- [OVH Domain Registration](https://www.ovh.co.uk/domains/) -- [Gandi Domain Registration](https://www.gandi.net/en/domain) - -### HTTPS and Security -- [Transport Layer Security](https://en.wikipedia.org/wiki/Transport_Layer_Security) -- [Let's Encrypt](https://letsencrypt.org/) - -### Docker -- [Docker Overview](https://docs.docker.com/engine/docker-overview/) -- [Docker Documentation](https://docs.docker.com/) -- [Get Docker CE for Debian](https://docs.docker.com/install/linux/docker-ce/debian/) -- [docker logs](https://docs.docker.com/engine/reference/commandline/logs/) -- [Volumes](https://docs.docker.com/storage/volumes/) -- [Install Docker Compose](https://docs.docker.com/compose/install/) -- [docker-compose logs](https://docs.docker.com/compose/reference/logs/) - -### Træfik -- [Getting Started](https://docs.traefik.io/) -- [Docker backend](https://docs.traefik.io/configuration/backends/docker/) -- [Let's Encrypt and Docker](https://docs.traefik.io/user-guide/docker-and-lets-encrypt/) -- [traefik](https://hub.docker.com/_/traefik/) Docker image diff --git a/doc/md/guides/various-hacks.md b/doc/md/guides/various-hacks.md deleted file mode 100644 index 0cef99df..00000000 --- a/doc/md/guides/various-hacks.md +++ /dev/null @@ -1,24 +0,0 @@ -### Decode datastore content - -To display the array representing the data saved in `data/datastore.php`, use the following snippet: - -```php -$data = "tZNdb9MwFIb... "; -$out = unserialize(gzinflate(base64_decode($data))); -echo "
"; // Pretty printing is love, pretty printing is life
-print_r($out);
-echo "
"; -exit; -``` -This will output the internal representation of the datastore, "unobfuscated" (if this can really be considered obfuscation). - -Alternatively, you can transform to JSON format (and pretty-print if you have `jq` installed): -``` -php -r 'print(json_encode(unserialize(gzinflate(base64_decode(preg_replace("!.*/\* (.+) \*/.*!", "$1", file_get_contents("data/datastore.php")))))));' | jq . -``` - -### See also - -- [Add a new custom field to shaares (example patch)](https://gist.github.com/nodiscc/8b0194921f059d7b9ad89a581ecd482c) -- [Copy an existing Shaarli installation over SSH, and serve it locally](https://gist.github.com/nodiscc/ed161c66e5b028b5299b0a3733d01c77) -- [Create multiple Shaarli instances, generate an HTML index of them](https://gist.github.com/nodiscc/52e711cda3bc47717c16065231cf6b20) diff --git a/doc/md/images/07-installation.jpg b/doc/md/images/07-installation.jpg new file mode 100644 index 00000000..42cc9f10 Binary files /dev/null and b/doc/md/images/07-installation.jpg differ diff --git a/doc/md/images/bookmarklet.png b/doc/md/images/bookmarklet.png deleted file mode 100644 index 0262578e..00000000 Binary files a/doc/md/images/bookmarklet.png and /dev/null differ diff --git a/doc/md/images/firefoxshare.png b/doc/md/images/firefoxshare.png deleted file mode 100644 index 8f8fdba4..00000000 Binary files a/doc/md/images/firefoxshare.png and /dev/null differ diff --git a/doc/md/images/install-shaarli.png b/doc/md/images/install-shaarli.png deleted file mode 100644 index d5d5baa7..00000000 Binary files a/doc/md/images/install-shaarli.png and /dev/null differ diff --git a/doc/md/images/poedit-1.jpg b/doc/md/images/poedit-1.jpg deleted file mode 100644 index 673ae6d6..00000000 Binary files a/doc/md/images/poedit-1.jpg and /dev/null differ diff --git a/doc/md/index.md b/doc/md/index.md index 1431f9e1..2c4995f8 100644 --- a/doc/md/index.md +++ b/doc/md/index.md @@ -2,21 +2,19 @@ The personal, minimalist, super-fast, database free, bookmarking service. -Do you want to share the links you discover? -Shaarli is a minimalist bookmark manager and link sharing service that you can install on your own server. -It is designed to be personal (single-user), fast and handy. - - +Do you want to share the links you discover? Shaarli is a minimalist bookmark manager and link sharing service that you can install on your own server. It is designed to be personal (single-user), fast and handy. Visit the pages in the sidebar to find information on how to setup, use, configure, tweak and troubleshoot Shaarli. - * [GitHub project page](https://github.com/shaarli/Shaarli) -* [Online documentation](https://shaarli.readthedocs.io/) -* [Latest releases](https://github.com/shaarli/Shaarli/releases) +* [Documentation](https://shaarli.readthedocs.io/) * [Changelog](https://github.com/shaarli/Shaarli/blob/master/CHANGELOG.md) +[![](https://i.imgur.com/8wEBRSG.png)](https://i.imgur.com/WWPfSj0.png) [![](https://i.imgur.com/93PpLLs.png)](https://i.imgur.com/V09kAQt.png) [![](https://i.imgur.com/rrsjWYy.png)](https://i.imgur.com/TZzGHMs.png) [![](https://i.imgur.com/8iRzHfe.png)](https://i.imgur.com/sfJJ6NT.png) [![](https://i.imgur.com/GjZGvIh.png)](https://i.imgur.com/QsedIuJ.png) [![](https://i.imgur.com/TFZ9PEq.png)](https://i.imgur.com/KdtF8Ll.png) [![](https://i.imgur.com/uICDOle.png)](https://i.imgur.com/27wYsbC.png) [![](https://i.imgur.com/tVvD3gH.png)](https://i.imgur.com/zGF4d6L.jpg) + + + ## Demo You can use this [public demo instance of Shaarli](https://demo.shaarli.org). @@ -25,101 +23,80 @@ It runs the latest development version of Shaarli and is updated/reset daily. Login: `demo`; Password: `demo` +## Getting started + +- [Configure your server](Server-configuration.md) +- [Install Shaarli](Installation.md) +- Or install Shaarli using [Docker](Docker.md) + + ## Features Shaarli can be used: -- to share, comment and save interesting links and news +- to share, comment and save interesting links - to bookmark useful/frequent links and share them between computers - as a minimal blog/microblog/writing platform -- as a read-it-later list -- to draft and save articles/posts/ideas -- to keep notes, documentation and code snippets -- as a shared clipboard/notepad/pastebin between machines -- as a todo list -- to store media playlists -- to keep extracts/comments from webpages that may disappear. -- to keep track of ongoing discussions -- to feed other blogs, aggregators, social networks... using RSS feeds +- as a read-it-later/todo list +- as a notepad to draft and save articles/posts/ideas +- as a knowledge base to keep notes, documentation and code snippets +- as a shared clipboard/notepad/pastebin between computers +- as playlist manager for online media +- to feed other blogs, aggregators, social networks... ### Edit, view and search your links -- Minimalist design -- FAST -- Customizable link titles and descriptions -- Tags to organize your links (features tag autocompletion, renaming, merging and deletion) -- Search by tag or using the full-text search -- Public and private links (visible only to logged-in users) -- Unique permalinks for easy reference -- Paginated link list (with image and video thumbnails) -- Tag cloud and list views -- Picture wall: image and video thumbnails view (with lazy loading) -- ATOM and RSS feeds (can also be filtered using tags or text search) -- Daily: newspaper-like daily digest (and daily RSS feed) -- URL cleanup: automatic removal of `?utm_source=...`, `fb=...` -- Extensible through [plugins](https://shaarli.readthedocs.io/en/master/Plugins/#plugin-usage) - -### Easy setup - -- Dead-simple installation: drop the files, open the page -- Links are stored in a file (no database required, easy backup: simply copy the datastore file) -- Import and export links as Netscape bookmarks compatible with most Web browsers - -### Accessibility - -- Bookmarklet and other tools to share links in one click -- Support for mobile browsers -- Degrades gracefully with Javascript disabled -- Easy page customization through HTML/CSS/RainTPL - -### Security - -- Discreet pop-up notification when a new release is available -- Bruteforce protection on the login form -- Protected against [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) and session cookie hijacking +- Editable URL, title, description, tags, private/public status for all your [Shaares](Usage.md) +- [Tags](Usage.md#tags) to organize your Shaares +- [Search](Usage.md#search) in all fields +- Unique [permalinks](Usage.md#permalinks) for easy reference +- Paginated Shaares list view (with image and video thumbnails) +- [Tag cloud/list](Usage#tag-cloud) views +- [Picture wall](Usage#picture-wall)/thumbnails view (with lazy loading) +- [ATOM and RSS feeds](Usage.md#rss-feeds) (can also be filtered using tags or text search) +- [Daily](Usage.md#daily): newspaper-like daily digest (and daily RSS feed) +- URL cleanup: automatic removal of `?utm_source=...`, `fb=...` tracking parameters +- Extensible through [plugins](Plugins.md) +- Easily extensible by any client using the [REST API](REST-API.md) exposed by Shaarli +- Bookmarklet and [other tools](Community-and-related-software.md) to share links in one click +- Responsive/support for mobile browsers, degrades gracefully with Javascript disabled - -### REST API - -- Easily extensible by any client using the REST API exposed by Shaarli ([API documentation](http://shaarli.github.io/api-documentation/)). +### Easy setup +- Dead-simple [installation](Installation.md): drop the files on your server, open the page +- Shaares are stored in a file (no database required, easy [backup](Backup-and-restore.md)) +- [Configurable](Shaarli-configuration.md) from dialog and configuration file +- Extensible through third-party [plugins and themes](Community-and-related-software.md) -## Screenshots +### Fast -[![](https://i.imgur.com/8wEBRSG.png)](https://i.imgur.com/WWPfSj0.png) [![](https://i.imgur.com/rrsjWYy.png)](https://i.imgur.com/TZzGHMs.png) [![](https://i.imgur.com/uICDOle.png)](https://i.imgur.com/27wYsbC.png) [![](https://i.imgur.com/KNvFGVB.png)](https://i.imgur.com/0f5faqw.png) [![](https://i.imgur.com/tVvD3gH.png)](https://i.imgur.com/zGF4d6L.jpg) [![](https://i.imgur.com/8iRzHfe.png)](https://i.imgur.com/sfJJ6NT.png) [![](https://i.imgur.com/GjZGvIh.png)](https://i.imgur.com/QsedIuJ.png) [![](https://i.imgur.com/TFZ9PEq.png)](https://i.imgur.com/KdtF8Ll.png) [![](https://i.imgur.com/IvlqXXK.png)](https://i.imgur.com/boaaibC.png) [![](https://i.imgur.com/nlETouG.png)](https://i.imgur.com/Ib9O7n3.png) +- Fast! Small datastore file, write-once/read-many, served most of the time from OS disk caches (no disk I/O) +- Stays fast with even tens of thousands shaares! +### Self-hosted +- Shaarli is an alternative to commercial services such as StumbleUpon, Delicio.us, Diigo... +- The data is yours, [import and export](Usage#import-export) it to HTML bookmarksformat compatible with most web browser, and from a variety of formats +- Shaarli does not send any telemetry/metrics/private information to developers +- Shaarli is Free and Open-Source software, inspect and change how the program works in the [source code](https://github.com/shaarli/Shaarli) +- Built-in [Security](dev/Development.md#security) features to help you protect your Shaarli instance ## About -### Shaarli community fork - -This friendly fork is maintained by the Shaarli community at - -This is a community fork of the original [Shaarli](https://github.com/sebsauvage/Shaarli/) project by [Sébastien Sauvage](http://sebsauvage.net/). - -The original project is currently unmaintained, and the developer [has informed us](https://github.com/sebsauvage/Shaarli/issues/191) that he would have no time to work on Shaarli in the near future. +This [community fork](https://github.com/shaarli/Shaarli) of the original [Shaarli](https://github.com/sebsauvage/Shaarli/) project by [Sébastien Sauvage](http://sebsauvage.net/) (now [unmaintained](https://github.com/sebsauvage/Shaarli/issues/191)) has carried on the work to provide [many patches](https://github.com/shaarli/Shaarli/compare/sebsauvage:master...master) for [bug fixes and enhancements](https://github.com/shaarli/Shaarli/issues?q=is%3Aclosed+) in this repository, and will keep maintaining the project for the foreseeable future, while keeping Shaarli simple and efficient. -The Shaarli community has carried on the work to provide [many -patches](https://github.com/shaarli/Shaarli/compare/sebsauvage:master...master) for -[bug fixes and enhancements](https://github.com/shaarli/Shaarli/issues?q=is%3Aclosed+) -in this repository, and will keep maintaining the project for the foreseeable -future, while keeping Shaarli simple and efficient. +The original Shaarli instance is still available [here](https://sebsauvage.net/links/) (+25000 shaares!) ### Contributing and getting help -Feedback is very appreciated! +Feedback is very appreciated! Feel free to propose solutions to existing problems, help us improve the documentation and translations, and submit pull requests :-) -- If you have any questions or ideas, please join the [chat](https://gitter.im/shaarli/Shaarli) (also reachable via [IRC](https://irc.gitter.im/)), post them in our [general discussion](https://github.com/shaarli/Shaarli/issues/308) or read the current [issues](https://github.com/shaarli/Shaarli/issues). -- Have a look at the open [issues](https://github.com/shaarli/Shaarli/issues) and [pull requests](https://github.com/shaarli/Shaarli/pulls) -- If you would like a feature added to Shaarli, check the issues labeled [`feature`](https://github.com/shaarli/Shaarli/labels/feature), [`enhancement`](https://github.com/shaarli/Shaarli/labels/enhancement), and [`plugin`](https://github.com/shaarli/Shaarli/labels/plugin). -- If you've found a bug, please create a [new issue](https://github.com/shaarli/Shaarli/issues/new). -- Feel free to propose solutions to existing problems, help us improve the documentation and translations, and submit pull requests :-) +See [Support](Troubleshooting.md#support) to get in touch with the Shaarli community. ### License -- cgit v1.2.3 From fe007f94e477c40e715269791c0014c18d91d9da Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sat, 16 May 2020 13:08:28 +0200 Subject: doc: docker.md: fix stray code block --- doc/md/Docker.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'doc') diff --git a/doc/md/Docker.md b/doc/md/Docker.md index bcd8cff2..e02d7fbd 100644 --- a/doc/md/Docker.md +++ b/doc/md/Docker.md @@ -82,10 +82,9 @@ A `docker-compose.yml` file can be used to run a persistent/autostarted shaarli Shaarli provides configuration file for Docker Compose, that will setup a Shaarli instance, a [Træfik](https://hub.docker.com/_/traefik/) instance with [Let's Encrypt](https://letsencrypt.org/) certificates, a Docker network, and volumes for Shaarli data and Træfik TLS configuration and certificates. -```bash Download docker-compose from the [release page](https://docs.docker.com/compose/install/): -```shell +```bash $ sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose $ sudo chmod +x /usr/local/bin/docker-compose # create a new directory to store the configuration: -- cgit v1.2.3 From a32e6665d0516f0ee1958be39ed2c8f0a0389e50 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Mon, 18 May 2020 21:04:55 +0200 Subject: formatting/emphasis --- doc/md/Server-configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index 5c45942c..1c14e1a6 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -16,7 +16,7 @@ Examples in this documentation are given for [Debian](https://www.debian.org/), Try to host the server in a region that is geographically close to your users. -A domain name ([DNS record](https://opensource.com/article/17/4/introduction-domain-name-system-dns)) pointing to the server's public IP address is required to obtain a SSL/TLS certificate and setup HTTPS to secure client traffic to your Shaarli instance. +A **domain name** ([DNS record](https://opensource.com/article/17/4/introduction-domain-name-system-dns)) pointing to the server's public IP address is required to obtain a SSL/TLS certificate and setup HTTPS to secure client traffic to your Shaarli instance. You can obtain a domain name from a [registrar](https://en.wikipedia.org/wiki/Domain_name_registrar) ([1](https://www.ovh.co.uk/domains), [2](https://www.gandi.net/en/domain)), or from free subdomain providers ([1](https://freedns.afraid.org/)). If you don't have a domain name, please set up a private domain name ([FQDN](ttps://en.wikipedia.org/wiki/Fully_qualified_domain_name) in your clients' [hosts files](https://en.wikipedia.org/wiki/Hosts_(file)) to access the server (direct access by IP address can result in unexpected behavior). -- cgit v1.2.3 From 6384447d1d9ff8f2f58a0c6a7e901ec95691bc87 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Mon, 18 May 2020 21:05:49 +0200 Subject: fix markdown syntax --- doc/md/Server-configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index 1c14e1a6..89225b4f 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -18,7 +18,7 @@ Try to host the server in a region that is geographically close to your users. A **domain name** ([DNS record](https://opensource.com/article/17/4/introduction-domain-name-system-dns)) pointing to the server's public IP address is required to obtain a SSL/TLS certificate and setup HTTPS to secure client traffic to your Shaarli instance. -You can obtain a domain name from a [registrar](https://en.wikipedia.org/wiki/Domain_name_registrar) ([1](https://www.ovh.co.uk/domains), [2](https://www.gandi.net/en/domain)), or from free subdomain providers ([1](https://freedns.afraid.org/)). If you don't have a domain name, please set up a private domain name ([FQDN](ttps://en.wikipedia.org/wiki/Fully_qualified_domain_name) in your clients' [hosts files](https://en.wikipedia.org/wiki/Hosts_(file)) to access the server (direct access by IP address can result in unexpected behavior). +You can obtain a domain name from a [registrar](https://en.wikipedia.org/wiki/Domain_name_registrar) ([1](https://www.ovh.co.uk/domains), [2](https://www.gandi.net/en/domain)), or from free subdomain providers ([1](https://freedns.afraid.org/)). If you don't have a domain name, please set up a private domain name ([FQDN](ttps://en.wikipedia.org/wiki/Fully_qualified_domain_name)) in your clients' [hosts files](https://en.wikipedia.org/wiki/Hosts_(file)) to access the server (direct access by IP address can result in unexpected behavior). ### PHP -- cgit v1.2.3 From 41b93897f3acdde949eaacb63e82651a2aaa0a92 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Mon, 18 May 2020 21:06:14 +0200 Subject: server-configuration: move firewall/NAT requirements to Network section --- doc/md/Server-configuration.md | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'doc') diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index 89225b4f..3e5139e2 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -20,6 +20,10 @@ A **domain name** ([DNS record](https://opensource.com/article/17/4/introduction You can obtain a domain name from a [registrar](https://en.wikipedia.org/wiki/Domain_name_registrar) ([1](https://www.ovh.co.uk/domains), [2](https://www.gandi.net/en/domain)), or from free subdomain providers ([1](https://freedns.afraid.org/)). If you don't have a domain name, please set up a private domain name ([FQDN](ttps://en.wikipedia.org/wiki/Fully_qualified_domain_name)) in your clients' [hosts files](https://en.wikipedia.org/wiki/Hosts_(file)) to access the server (direct access by IP address can result in unexpected behavior). +Setup a **firewall** (using `iptables`, [ufw](https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-debian-10), [fireHOL](https://firehol.org/) or any frontend of your choice) to deny all incoming traffic except `tcp/80` and `tcp/443`, which are needed to access the web server (and any other posrts you might need, like SSH). If the server is in a private network behind a NAT, ensure these **ports are forwarded** to the server. + +Shaarli makes outbound HTTP/HTTPS connections to websites you bookmark to fetch page information (title, thumbnails), the server must then have access to the Internet as well, and a working DNS resolver. + ### PHP -- cgit v1.2.3 From 30255b794ab3ddfaf2e813d173b445800102d748 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Mon, 18 May 2020 21:06:45 +0200 Subject: doc: php compatibility: add php 7.3 --- doc/md/Server-configuration.md | 1 + 1 file changed, 1 insertion(+) (limited to 'doc') diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index 3e5139e2..b4dfc53d 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -31,6 +31,7 @@ Supported PHP versions: Version | Status | Shaarli compatibility :---:|:---:|:---: +7.3 | Supported | Yes 7.2 | Supported | Yes 7.1 | Supported | Yes 7.0 | EOL: 2018-12-03 | Yes (up to Shaarli 0.10.x) -- cgit v1.2.3 From c84d1430472bac5c8f437f41b8e845b808acfdd2 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Mon, 18 May 2020 21:07:32 +0200 Subject: apache: fix let's encrypt configuration , copy it directly from reference file including options-ssl-apache.conf requires python3-certbot-apache which pulls a lot of dependencies --- doc/md/Server-configuration.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'doc') diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index b4dfc53d..70ae087a 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -77,7 +77,6 @@ sudo systemctl stop apache2 sudo systemctl stop nginx # generate initial certificates - Let's Encrypt ACME servers must be able to access your server! -# (DNS records must be correctly pointing to it, firewall/NAT on port 80/443 must be open) sudo certbot certonly --standalone --noninteractive --agree-tos --email "admin@shaarli.mydomain.org" -d shaarli.mydomain.org # this will generate a private key and certificate at /etc/letsencrypt/live/shaarli.mydomain.org/{privkey,fullchain}.pem @@ -150,7 +149,13 @@ sudo nano /etc/apache2/sites-available/shaarli.mydomain.org.conf SSLEngine on SSLCertificateFile /etc/letsencrypt/live/shaarli.mydomain.org/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/shaarli.mydomain.org/privkey.pem - Include /etc/letsencrypt/options-ssl-apache.conf + + # Let's Encrypt settings from https://github.com/certbot/certbot/blob/master/certbot-apache/certbot_apache/_internal/tls_configs/current-options-ssl-apache.conf + SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 + SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384 + SSLHonorCipherOrder off + SSLSessionTickets off + SSLOptions +StrictRequire # SSL/TLS configuration (for self-signed certificates) #SSLEngine on -- cgit v1.2.3 From 538fb324a8a8d57b7b06e30dfe2310137918f844 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Mon, 18 May 2020 21:08:36 +0200 Subject: doc: nginx: reorder --- doc/md/Server-configuration.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'doc') diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index 70ae087a..2bb403e5 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -215,9 +215,7 @@ See [How to install the Apache web server](https://www.digitalocean.com/communit ### Nginx -Guide on setting up the Nginx web server: [How to install the Nginx web server](https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-debian-10) - -You will also need to install the [PHP-FPM](http://php-fpm.org) interpreter as detailed [here](https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mariadb-php-lemp-stack-on-debian-10#step-3-%E2%80%94-installing-php-for-processing). Nginx and PHP-FPM must be running using the same user and group, here we assume the user/group to be `www-data:www-data` but this may vary depending on your Linux distribution. +This examples uses nginx and the [PHP-FPM](https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mariadb-php-lemp-stack-on-debian-10#step-3-%E2%80%94-installing-php-for-processing) PHP interpreter. Nginx and PHP-FPM must be running using the same user and group, here we assume the user/group to be `www-data:www-data`. ```bash @@ -311,6 +309,8 @@ sudo ln -s /etc/nginx/sites-available/shaarli.mydomain.org /etc/nginx/sites-enab sudo systemctl reload nginx ``` +See [How to install the Nginx web server](https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-debian-10) for a complete guide. + ## Reverse proxies -- cgit v1.2.3 From 778add2c9cc858bcc1aa8180620bd46590b84e15 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Mon, 18 May 2020 21:08:51 +0200 Subject: doc: nginx: add let's encrypt ssl configuration --- doc/md/Server-configuration.md | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'doc') diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index 2bb403e5..6e21de91 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -250,6 +250,14 @@ server { ssl_certificate /etc/ssl/shaarli.mydomain.org.crt; ssl_certificate_key /etc/ssl/private/shaarli.mydomain.org.key; + # Let's Encrypt SSL settings from https://github.com/certbot/certbot/blob/master/certbot-nginx/certbot_nginx/_internal/tls_configs/options-ssl-nginx.conf + ssl_session_cache shared:le_nginx_SSL:10m; + ssl_session_timeout 1440m; + ssl_session_tickets off; + ssl_protocols TLSv1.2 TLSv1.3; + ssl_prefer_server_ciphers off; + ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384"; + # increase the maximum file upload size if needed: by default nginx limits file upload to 1MB (413 Entity Too Large error) client_max_body_size 100m; -- cgit v1.2.3 From 881bd96f151f9eefdac6264e432e573a657fc82b Mon Sep 17 00:00:00 2001 From: nodiscc Date: Mon, 18 May 2020 21:09:14 +0200 Subject: doc: usage: active filters/clear search filters --- doc/md/Usage.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/md/Usage.md b/doc/md/Usage.md index 0a1b9719..683b41c4 100644 --- a/doc/md/Usage.md +++ b/doc/md/Usage.md @@ -54,9 +54,10 @@ Shaarli can be used as a minimal blog, notepad, pastebin...: While adding or edi - **Exclude text/tags:** Use the `-` operator before a word or tag to exclude Shaares matching this word from search results (`NOT` operator). - **Untagged links:** Shaares without tags can be searched by clicking the `untagged` toggle button top left of the Shaares list (only when logged in). - Both exclude patterns and exact searches can be combined with normal searches (example `"exact search" term otherterm -notthis "very exact" stuff -notagain`). Only AND (and NOT) search is currrently supported. +Active search terms are displayed on top of the link list. To remove terms/tags from the curent search, click the `x` next to any of them, or simply clear text/tag search fields. + ### Tag cloud -- cgit v1.2.3 From dfed9b2dd58cfb82a334f4c9433bfce84426cd34 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Thu, 21 May 2020 13:26:04 +0200 Subject: doc: troubleshooting: improve compatibility with PHP 5.6/FTP upload limits ref. https://github.com/shaarli/Shaarli/issues/1469 --- doc/md/Troubleshooting.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'doc') diff --git a/doc/md/Troubleshooting.md b/doc/md/Troubleshooting.md index 3f75719d..f0cf4e97 100644 --- a/doc/md/Troubleshooting.md +++ b/doc/md/Troubleshooting.md @@ -38,18 +38,21 @@ Shaarli redirections will not work properly. To solve this, assign a local domai ### Old PHP versions -On **free.fr**: free.fr now supports php 5.6.x([link](http://les.pages.perso.chez.free.fr/migrations/php5v6.io)) -and so support now the tag autocompletion but you have to do the following. - -At the root of your webspace create a `sessions` directory and a `.htaccess` file containing: +- On hosts (such as **free.fr**) which only support PHP 5.6, Shaarli [v0.10.4](https://github.com/shaarli/Shaarli/releases/tag/v0.10.4) is the maximum supported version. At the root of your webspace create a `sessions` directory and a `.htaccess` file containing: ```xml php56 1 + +Order allow,deny +Deny from all +Satisfy all + +Options -Indexes ``` -- If you have an error such as: `Parse error: syntax error, unexpected '=', expecting '(' in /links/index.php on line xxx`, it means that your host is using php4, not php5. Shaarli requires php 5.1. Try changing the file extension to `.php5` +- If you have an error such as: `Parse error: syntax error, unexpected '=', expecting '(' in /links/index.php on line xxx`, it means that your host is using PHP 4, not PHP 5. Shaarli requires PHP 5.1. Try changing the file extension to `.php5` - On **1and1** : If you add the link from the page (and not from the bookmarklet), Shaarli will no be able to get the title of the page. You will have to enter it manually. (Because they have disabled the ability to download a file through HTTP). - If you have the error `Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /…/index.php on line xxx`, it means that your host has disabled the ability to fetch a file by HTTP in the php config (Typically in 1and1 hosting). Bad host. Change host. Or comment the following lines: @@ -59,9 +62,11 @@ php56 1 //if (strpos($status,'200 OK')) $title=html_extract_title($data); ``` -- On hosts which forbid outgoing HTTP requests (such as free.fr), some thumbnails will not work. +- On hosts (such as **free.fr**) which forbid outgoing HTTP requests, some thumbnails will not work. +- On hosts (such as **free.fr**) which limit the number of FTP connections, setup your FTP client accordingly (else some files may be missing after upload). - On **lost-oasis**, RSS doesn't work correctly, because of this message at the begining of the RSS/ATOM feed : ``. To fix this, remove this message from `php-include/prepend.php` + ### Dates are not properly formatted Shaarli tries to sniff the language of the browser (using `HTTP_ACCEPT_LANGUAGE` headers) -- cgit v1.2.3 From 328c215a8ac28e8c6b542fad1120b26692c923c5 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Fri, 29 May 2020 22:24:44 +0200 Subject: doc: add note about importing browser bookmarks folder structure to shaarli tags ref. https://github.com/shaarli/Shaarli/issues/1449 --- doc/md/Usage.md | 1 + 1 file changed, 1 insertion(+) (limited to 'doc') diff --git a/doc/md/Usage.md b/doc/md/Usage.md index 683b41c4..6dadde0a 100644 --- a/doc/md/Usage.md +++ b/doc/md/Usage.md @@ -108,3 +108,4 @@ Restore by using the `Import` feature. - These exports contain the full data (URL, title, tags, date, description, public/private status of your Shaares) - They can also be imported to your web browser bookmarks. +To **import a HTML bookmarks file** exported from your browser, just use the `Import` feature. For each "folder" in the bookmarks you imported, a new tag will be created (for example a bookmark in `Movies > Sci-fi` folder will be tagged `Movies` `Sci-fi`). -- cgit v1.2.3 From 74c2ae408838fc075030ec6899accc0b9f270c91 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Mon, 1 Jun 2020 17:09:09 +0200 Subject: doc: Community-and-related-software: add shaarli-webhooks plugin --- doc/md/Community-and-related-software.md | 1 + 1 file changed, 1 insertion(+) (limited to 'doc') diff --git a/doc/md/Community-and-related-software.md b/doc/md/Community-and-related-software.md index eac9d074..8266e3f1 100644 --- a/doc/md/Community-and-related-software.md +++ b/doc/md/Community-and-related-software.md @@ -25,6 +25,7 @@ See [REST API](REST-API) for a list of official and community clients. - [shaarli-descriptor](https://github.com/immanuelfodor/shaarli-descriptor) by [@immanuelfodor](https://github.com/immanuelfodor) - Customize the default height/number of rows of the Description field when editing a Shaare. - [urlextern](https://github.com/trailjeep/shaarli-urlextern) by [@trailjeep](https://github.com/trailjeep) - Shaarli plugin to open external links in a new tab/window. - [favicons](https://github.com/trailjeep/shaarli-favicons) by [@trailjeep](https://github.com/trailjeep) - Shaarli plugin to add favicon/filetype icons to Shaares. +- [webhooks](https://gitlab.com/flow.gunso/shaarli-webhooks) by [@flow.gunso](https://gitlab.com/flow.gunso) - Shaarli plugin that enables user-defined callback URL, i.e. webhooks, for specific Shaarli events (link saving, deletion...) ### Third-party themes -- cgit v1.2.3 From dfe14f264bf97e412794e386183189cd7cbd765a Mon Sep 17 00:00:00 2001 From: nodiscc Date: Mon, 1 Jun 2020 20:10:38 +0200 Subject: doc: server configuration: php requirements: add php-simplexml ref. https://github.com/shaarli/Shaarli/pull/1476 --- doc/md/Server-configuration.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index 6e21de91..3c207acc 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -44,8 +44,9 @@ Required PHP extensions: Extension | Required? | Usage ---|:---:|--- -[`openssl`](http://php.net/manual/en/book.openssl.php) | All | OpenSSL, HTTPS +[`openssl`](http://php.net/manual/en/book.openssl.php) | requires | OpenSSL, HTTPS [`php-json`](http://php.net/manual/en/book.json.php) | required | configuration parsing +[`php-simplexml`](https://www.php.net/manual/en/book.simplexml.php) | required | REST API (Slim framework) [`php-mbstring`](http://php.net/manual/en/book.mbstring.php) | CentOS, Fedora, RHEL, Windows, some hosting providers | multibyte (Unicode) string support [`php-gd`](http://php.net/manual/en/book.image.php) | optional | required to use thumbnails [`php-intl`](http://php.net/manual/en/book.intl.php) | optional | localized text sorting (e.g. `e->è->f`) -- cgit v1.2.3 From f5afa87c38f9c0673d94e8ab8b0dd73bbf9decea Mon Sep 17 00:00:00 2001 From: Lucas Cimon Date: Tue, 2 Jun 2020 12:26:44 +0200 Subject: Added links to doc section "Articles and social media discussions" --- doc/md/Community-and-related-software.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'doc') diff --git a/doc/md/Community-and-related-software.md b/doc/md/Community-and-related-software.md index 8266e3f1..f3f7709e 100644 --- a/doc/md/Community-and-related-software.md +++ b/doc/md/Community-and-related-software.md @@ -92,8 +92,15 @@ See [awesome-selfhosted: bookmarks & link sharing](https://github.com/Kickball/a ### Articles and social media discussions - -- 2016-09-22 - Hacker News - https://news.ycombinator.com/item?id=12552176 +- 2020-04-05 - Hacker News - [Self-hosted instance of Shaarli - it is simple, fast and reliable](https://news.ycombinator.com/item?id=22780219) +- 2016-10-10 - Framasoft - [MyFrama : vos favoris partout, avec vous, rien qu’à vous !](https://framablog.org/2016/10/10/myframa-vos-favoris-et-framasofteries-partout-avec-vous-rien-qua-vous/) +- 2016-09-22 - Hacker News - [Shaarli – Personal, minimalist, database-free, bookmarking service (github.com)](https://news.ycombinator.com/item?id=12552176) - 2015-08-15 - Reddit - [Question about migrating from WordPress to Shaarli.](https://www.reddit.com/r/selfhosted/comments/3h3zwh/question_about_migrating_from_wordpress_to_shaarli/) -- 2015-06-22 - Hacker News - https://news.ycombinator.com/item?id=9755366 +- 2015-06-22 - Hacker News - [Shaarli: Self-hosted del.icio.us alternative (sebsauvage.net)](https://news.ycombinator.com/item?id=9755366) - 2015-05-12 - Reddit - [shaarli - Self hosted Bookmarking / Delicious (PHP, MySQL)](https://www.reddit.com/r/selfhosted/comments/35pkkc/shaarli_self_hosted_bookmarking_delicious_php/) +- 2014-10-15 - OpenSource.com - [Five open source alternatives to popular web apps](https://opensource.com/life/14/10/five-open-source-alternatives-popular-web-apps) + +It also appears in the following recommendation lists: +- [AlternativeTo](https://alternativeto.net/software/shaarli/) +- [FramaLibre](https://framalibre.org/content/shaarli) +- [Project Awesome: Selfhosted Bookmarks and Link Sharing](https://project-awesome.org/Kickball/awesome-selfhosted) -- cgit v1.2.3 From 56ae25f11f1425684ec5bbdbaab3a3d283aa4a8f Mon Sep 17 00:00:00 2001 From: owen bell <66233223+xfnw@users.noreply.github.com> Date: Tue, 2 Jun 2020 11:27:02 -0400 Subject: add shaarli-default-dark to the themes list --- doc/md/dev/Theming.md | 1 + 1 file changed, 1 insertion(+) (limited to 'doc') diff --git a/doc/md/dev/Theming.md b/doc/md/dev/Theming.md index 5be1a481..1ad30465 100644 --- a/doc/md/dev/Theming.md +++ b/doc/md/dev/Theming.md @@ -45,6 +45,7 @@ Installation: - [kalvn/shaarli-blocks](https://github.com/kalvn/shaarli-blocks) - A template/theme for Shaarli - [kalvn/Shaarli-Material](https://github.com/kalvn/Shaarli-Material) - A theme (template) based on Google's Material Design for Shaarli, the superfast delicious clone - [ManufacturaInd/shaarli-2004licious-theme](https://github.com/ManufacturaInd/shaarli-2004licious-theme) - A template/theme as a humble homage to the early looks of the del.icio.us site +- [xfnw/shaarli-default-dark](https://github.com/xfnw/shaarli-default-dark) - The default theme but nice and dark for your eyeballs ### Shaarli forks -- cgit v1.2.3 From 5cacf290f01076587e8d7ac82feef855e4a2d10f Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sat, 20 Jun 2020 18:34:06 +0200 Subject: doc: document dev.debug configuration etting ref. https://github.com/shaarli/Shaarli/pull/779 --- doc/md/Shaarli-configuration.md | 3 +++ 1 file changed, 3 insertions(+) (limited to 'doc') diff --git a/doc/md/Shaarli-configuration.md b/doc/md/Shaarli-configuration.md index e93ee245..14eec7b2 100644 --- a/doc/md/Shaarli-configuration.md +++ b/doc/md/Shaarli-configuration.md @@ -75,6 +75,9 @@ Some settings can be configured directly from a web browser by accesing the `Too "title": "My Shaarli", "header_link": "?" }, + "dev": { + "debug": false, + } "extras": { "show_atom": false, "hide_public_links": false, -- cgit v1.2.3 From b6c9a2db30e6d9173d163b30a38ad64aa95f6658 Mon Sep 17 00:00:00 2001 From: Lucas Cimon Date: Wed, 8 Jul 2020 09:48:26 +0200 Subject: Removing dead link in doc As it currently redirects to https://www.lgblog.fr --- doc/md/Community-and-related-software.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/md/Community-and-related-software.md b/doc/md/Community-and-related-software.md index f3f7709e..013ade6c 100644 --- a/doc/md/Community-and-related-software.md +++ b/doc/md/Community-and-related-software.md @@ -66,7 +66,7 @@ See [Theming](Theming) for a list of community-contributed themes, and an instal - [shaarchiver](https://github.com/nodiscc/shaarchiver) - Archive your Shaarli bookmarks and their content - [shaarli-river](https://github.com/mknexen/shaarli-river) - An aggregator for shaarlis with many features -- [Shaarlo](https://github.com/DMeloni/shaarlo) - An aggregator for shaarlis with many features (a very popular running instance among French shaarliers: [shaarli.fr](http://shaarli.fr/)) +- [Shaarlo](https://github.com/DMeloni/shaarlo) - An aggregator for shaarlis with many features - [Shaarlimages](https://github.com/BoboTiG/shaarlimages) - An image-oriented aggregator for Shaarlis - [mknexen/shaarli-api](https://github.com/mknexen/shaarli-api) - A REST API for Shaarli - [Self dead link](https://framagit.org/qwertygc/shaarli-dev-code/blob/master/self-dead-link.php) - Detect dead links on shaarli. This version use the database of shaarli. [Another version](https://framagit.org/qwertygc/shaarli-dev-code/blob/master/dead-link.php), can be used for other shaarli instances (but is more resource consuming). -- cgit v1.2.3 From e0fe33f90ba0bfedc50ba79982833e10c7e6c4a4 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sat, 15 Aug 2020 19:37:24 +0200 Subject: doc: server configuration: add note on required firewall/NAT for Let's Encrypt certificates --- doc/md/Server-configuration.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index 3c207acc..f14be7f3 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -77,7 +77,8 @@ sudo apt install certbot sudo systemctl stop apache2 sudo systemctl stop nginx -# generate initial certificates - Let's Encrypt ACME servers must be able to access your server! +# generate initial certificates +# Let's Encrypt ACME servers must be able to access your server! port forwarding and firewall must be properly configured sudo certbot certonly --standalone --noninteractive --agree-tos --email "admin@shaarli.mydomain.org" -d shaarli.mydomain.org # this will generate a private key and certificate at /etc/letsencrypt/live/shaarli.mydomain.org/{privkey,fullchain}.pem -- cgit v1.2.3 From 1aeefe108861e5e01c6a1067935b00d24e606dd5 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sat, 15 Aug 2020 19:38:18 +0200 Subject: doc: server configuration: formatting/add comment --- doc/md/Server-configuration.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'doc') diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index f14be7f3..4164980b 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -96,11 +96,10 @@ If you don't want to rely on a certificate authority, or the server can only be ## Examples -The following examples assume a Debian-based operating system is installed. On other distributions you may have to adapt details such as package installation procedures, configuration file locations, and webserver username/group (`www-data` or `httpd` are common values). - -In these examples we assume the document root for your web server/virtualhost is at `/var/www/shaarli.mydomain.org/`: +The following examples assume a Debian-based operating system is installed. On other distributions you may have to adapt details such as package installation procedures, configuration file locations, and webserver username/group (`www-data` or `httpd` are common values). In these examples we assume the document root for your web server/virtualhost is at `/var/www/shaarli.mydomain.org/`: ```bash +# create the document root sudo mkdir -p /var/www/shaarli.mydomain.org/ ``` -- cgit v1.2.3 From 6c4cae378e87b43a793cd91a87dc1952106107f7 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sat, 15 Aug 2020 19:39:28 +0200 Subject: doc: server configuration: remove apache logging options see https://github.com/nodiscc/xsrv/blob/master/roles/apache/templates/etc_apache2_conf-available_logging.conf.j2 for an example server-wide logging configuration --- doc/md/Server-configuration.md | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'doc') diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index 4164980b..2ee15ef6 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -122,12 +122,6 @@ sudo nano /etc/apache2/sites-available/shaarli.mydomain.org.conf ServerName shaarli.mydomain.org DocumentRoot /var/www/shaarli.mydomain.org/ - # Log level. Possible values include: debug, info, notice, warn, error, crit, alert, emerg. - LogLevel warn - # Log file locations - ErrorLog /var/log/apache2/error.log - CustomLog /var/log/apache2/access.log combined - # Redirect HTTP requests to HTTPS RewriteEngine on RewriteRule ^.well-known/acme-challenge/ - [L] @@ -140,12 +134,6 @@ sudo nano /etc/apache2/sites-available/shaarli.mydomain.org.conf ServerName shaarli.mydomain.org DocumentRoot /var/www/shaarli.mydomain.org/ - # Log level. Possible values include: debug, info, notice, warn, error, crit, alert, emerg. - LogLevel warn - # Log file locations - ErrorLog /var/log/apache2/error.log - CustomLog /var/log/apache2/access.log combined - # SSL/TLS configuration (for Let's Encrypt certificates) SSLEngine on SSLCertificateFile /etc/letsencrypt/live/shaarli.mydomain.org/fullchain.pem -- cgit v1.2.3 From 78f319fa6b9a2824bdc8becc88c365455b1a1aa6 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sat, 15 Aug 2020 19:40:59 +0200 Subject: doc: troubleshooting: add procedure to clear shaarli caches --- doc/md/Server-configuration.md | 1 + doc/md/Troubleshooting.md | 10 ++++++++++ 2 files changed, 11 insertions(+) (limited to 'doc') diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index 2ee15ef6..281abb0d 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -202,6 +202,7 @@ systemctl restart apache See [How to install the Apache web server](https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-debian-10) for a complete guide. + ### Nginx This examples uses nginx and the [PHP-FPM](https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mariadb-php-lemp-stack-on-debian-10#step-3-%E2%80%94-installing-php-for-processing) PHP interpreter. Nginx and PHP-FPM must be running using the same user and group, here we assume the user/group to be `www-data:www-data`. diff --git a/doc/md/Troubleshooting.md b/doc/md/Troubleshooting.md index f0cf4e97..e1ed5e00 100644 --- a/doc/md/Troubleshooting.md +++ b/doc/md/Troubleshooting.md @@ -176,6 +176,16 @@ Under Opera, you can't drag'n drop the button: You have to right-click on it and - A new date/time field becomes available in the edit/new Shaare dialog. - You can set the timestamp manually by entering it in the format `YYYMMDD_HHMMS`. +### Clearing Shaarli caches + +For debugging purposes: + +```bash +# clear raintpl cache and temporary files +find /var/www/links/cache/ /var/www/links/pagecache/ /var/www/links/tmp/ -type f -exec rm -v '{}' \; +# if you have a php accelerator such as php-apcu, restart the webserver +sudo systemctl restart apache2 +``` ------------------------------------------------------- -- cgit v1.2.3 From 46e019a1329389e9102b591139410574d8e9e7b6 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sat, 15 Aug 2020 19:43:22 +0200 Subject: doc: plugins: remove doc about deprecated $GLOBALS['config']['ENABLED_PLUGINS'] array --- doc/md/Plugins.md | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'doc') diff --git a/doc/md/Plugins.md b/doc/md/Plugins.md index 49a51f51..a9f5f1a8 100644 --- a/doc/md/Plugins.md +++ b/doc/md/Plugins.md @@ -37,23 +37,7 @@ This is important in case plugins depend on each other. Read plugins READMEs for ## Configuration file -Enabled plugins are stored in your [Configuration file](Shaarli-configuration), under the array: - -```php -$GLOBALS['config']['ENABLED_PLUGINS'] -``` - -You can edit them manually here. For example: - -```php -$GLOBALS['config']['ENABLED_PLUGINS'] = array( - 'qrcode', - 'archiveorg', - 'wallabag', - 'markdown', -); -``` - +Enabled plugins are stored in your [Configuration file](Shaarli-configuration). ## Usage -- cgit v1.2.3 From 45203c0bca53f49f2b99af271950718e03336bee Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sat, 15 Aug 2020 19:44:41 +0200 Subject: doc: Community-and-related-software.md: order plugins alphabetically --- doc/md/Community-and-related-software.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'doc') diff --git a/doc/md/Community-and-related-software.md b/doc/md/Community-and-related-software.md index 013ade6c..67eeff64 100644 --- a/doc/md/Community-and-related-software.md +++ b/doc/md/Community-and-related-software.md @@ -13,18 +13,18 @@ See [REST API](REST-API) for a list of official and community clients. ### Third party plugins - [autosave](https://github.com/kalvn/shaarli-plugin-autosave) by [@kalvn](https://github.com/kalvn): Automatically saves data when editing a Shaare to avoid any loss in case of crash or unexpected shutdown. -- [Code Coloration](https://github.com/ArthurHoaro/code-coloration) by [@ArthurHoaro](https://github.com/ArthurHoaro): client side code syntax highlighter. -- [Disqus](https://github.com/kalvn/shaarli-plugin-disqus) by [@kalvn](https://github.com/kalvn): Adds Disqus comment system to your Shaarli. +- [code Coloration](https://github.com/ArthurHoaro/code-coloration) by [@ArthurHoaro](https://github.com/ArthurHoaro): client side code syntax highlighter. +- [disqus](https://github.com/kalvn/shaarli-plugin-disqus) by [@kalvn](https://github.com/kalvn): Adds Disqus comment system to your Shaarli. +- [favicons](https://github.com/trailjeep/shaarli-favicons) by [@trailjeep](https://github.com/trailjeep) - Shaarli plugin to add favicon/filetype icons to Shaares. - [google analytics](https://github.com/ericjuden/Shaarli-Google-Analytics-Plugin) by [@ericjuden](http://github.com/ericjuden): Adds Google Analytics tracking support - [launch](https://github.com/ArthurHoaro/launch-plugin) - Launch Plugin is a plugin designed to enhance and customize Launch Theme for Shaarli. - [markdown-toolbar](https://github.com/immanuelfodor/shaarli-markdown-toolbar) by [@immanuelfodor](https://github.com/immanuelfodor) - Easily insert markdown syntax into the Description field when editing a Shaare. - [related](https://github.com/ilesinge/shaarli-related) by [@ilesinge](https://github.com/ilesinge) - Show related Shaares based on the number of identical tags. -- [social](https://github.com/alexisju/social) by [@alexisju](https://github.com/alexisju): share links to social networks. -- [shaarli2twitter](https://github.com/ArthurHoaro/shaarli2twitter) by [@ArthurHoaro](https://github.com/ArthurHoaro) - Automatically tweet your Shaares from Shaarli -- [shaarli2mastodon](https://github.com/kalvn/shaarli2mastodon) by [@kalvn](https://github.com/kalvn) - This Shaarli plugin allows you to automatically publish links you post on your Mastodon timeline. - [shaarli-descriptor](https://github.com/immanuelfodor/shaarli-descriptor) by [@immanuelfodor](https://github.com/immanuelfodor) - Customize the default height/number of rows of the Description field when editing a Shaare. +- [shaarli2mastodon](https://github.com/kalvn/shaarli2mastodon) by [@kalvn](https://github.com/kalvn) - This Shaarli plugin allows you to automatically publish links you post on your Mastodon timeline. +- [shaarli2twitter](https://github.com/ArthurHoaro/shaarli2twitter) by [@ArthurHoaro](https://github.com/ArthurHoaro) - Automatically tweet your Shaares from Shaarli +- [social](https://github.com/alexisju/social) by [@alexisju](https://github.com/alexisju): share links to social networks. - [urlextern](https://github.com/trailjeep/shaarli-urlextern) by [@trailjeep](https://github.com/trailjeep) - Shaarli plugin to open external links in a new tab/window. -- [favicons](https://github.com/trailjeep/shaarli-favicons) by [@trailjeep](https://github.com/trailjeep) - Shaarli plugin to add favicon/filetype icons to Shaares. - [webhooks](https://gitlab.com/flow.gunso/shaarli-webhooks) by [@flow.gunso](https://gitlab.com/flow.gunso) - Shaarli plugin that enables user-defined callback URL, i.e. webhooks, for specific Shaarli events (link saving, deletion...) -- cgit v1.2.3 From ecdae2237f85b93bb3db436cf405a88c945e2a7a Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sat, 15 Aug 2020 19:47:42 +0200 Subject: doc: server configuration: update apache configuration 2.2 -> 2.4 https://httpd.apache.org/docs/current/upgrading.html --- doc/md/Server-configuration.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'doc') diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index 281abb0d..c22b7d9c 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -160,8 +160,7 @@ sudo nano /etc/apache2/sites-available/shaarli.mydomain.org.conf # Required for .htaccess support AllowOverride All - Order allow,deny - Allow from all + Require all granted -- cgit v1.2.3 From 38d66e1a40c20678e34408a069a615928d2c244c Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sat, 15 Aug 2020 19:54:18 +0200 Subject: doc: server configuration: apache: add note about mod_md --- doc/md/Server-configuration.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index c22b7d9c..d32cc786 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -60,6 +60,8 @@ Some [plugins](Plugins.md) may require additional configuration. We recommend setting up [HTTPS](https://en.wikipedia.org/wiki/HTTPS) on your webserver for secure communication between clients and the server. +### Let's Encrypt + For public-facing web servers this can be done using free SSL/TLS certificates from [Let's Encrypt](https://en.wikipedia.org/wiki/Let's_Encrypt), a non-profit certificate authority provididing free certificates. - [How to secure Apache with Let's Encrypt](https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-debian-10) @@ -87,6 +89,10 @@ sudo systemctl start apache2 sudo systemctl start nginx ``` +On apache `2.4.43+`, you can also delegate LE certificate management to [mod_md](https://httpd.apache.org/docs/2.4/mod/mod_md.html) [[1](https://www.cyberciti.biz/faq/how-to-secure-apache-with-mod_md-lets-encrypt-on-ubuntu-20-04-lts/)] in which case you don't need certbot and manual SSL configuration in virtualhosts. + +### Self-signed + If you don't want to rely on a certificate authority, or the server can only be accessed from your own network, you can also generate self-signed certificates. Not that this will generate security warnings in web browsers/clients trying to access Shaarli: - [How To Create a Self-Signed SSL Certificate for Apache](https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-apache-on-debian-10) @@ -135,10 +141,10 @@ sudo nano /etc/apache2/sites-available/shaarli.mydomain.org.conf DocumentRoot /var/www/shaarli.mydomain.org/ # SSL/TLS configuration (for Let's Encrypt certificates) + # If certificates were acquired from certbot standalone SSLEngine on SSLCertificateFile /etc/letsencrypt/live/shaarli.mydomain.org/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/shaarli.mydomain.org/privkey.pem - # Let's Encrypt settings from https://github.com/certbot/certbot/blob/master/certbot-apache/certbot_apache/_internal/tls_configs/current-options-ssl-apache.conf SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384 -- cgit v1.2.3 From f3ab2616314834508c36b5e97406572ecd9af7a4 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sat, 15 Aug 2020 19:59:34 +0200 Subject: doc: apache: add example configuration for mod_md --- doc/md/Server-configuration.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'doc') diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index d32cc786..73e23886 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -128,20 +128,22 @@ sudo nano /etc/apache2/sites-available/shaarli.mydomain.org.conf ServerName shaarli.mydomain.org DocumentRoot /var/www/shaarli.mydomain.org/ - # Redirect HTTP requests to HTTPS + # Redirect HTTP requests to HTTPS, except Let's Encrypt ACME challenge requests RewriteEngine on RewriteRule ^.well-known/acme-challenge/ - [L] - # except for Let's Encrypt ACME challenge requests RewriteCond %{HTTP_HOST} =shaarli.mydomain.org RewriteRule ^ https://shaarli.mydomain.org%{REQUEST_URI} [END,NE,R=permanent] + # If you are using mod_md, use this instead + #MDCertificateAgreement accepted + #MDContactEmail admin@shaarli.mydomain.org + #MDPrivateKeys RSA 4096 ServerName shaarli.mydomain.org DocumentRoot /var/www/shaarli.mydomain.org/ - # SSL/TLS configuration (for Let's Encrypt certificates) - # If certificates were acquired from certbot standalone + # SSL/TLS configuration for Let's Encrypt certificates acquired with certbot standalone SSLEngine on SSLCertificateFile /etc/letsencrypt/live/shaarli.mydomain.org/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/shaarli.mydomain.org/privkey.pem @@ -152,6 +154,9 @@ sudo nano /etc/apache2/sites-available/shaarli.mydomain.org.conf SSLSessionTickets off SSLOptions +StrictRequire + # SSL/TLS configuration for Let's Encrypt certificates acquired with mod_md + #MDomain shaarli.mydomain.org + # SSL/TLS configuration (for self-signed certificates) #SSLEngine on #SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem -- cgit v1.2.3 From e21df1e7296cc7ed33e28989b86edebe7bc85b54 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sat, 15 Aug 2020 20:00:55 +0200 Subject: doc: fail2Ban: add note about restarting fail2ban --- doc/md/Server-configuration.md | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc') diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index 73e23886..c63e296e 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -402,6 +402,8 @@ maxretry = 3 bantime = -1 ``` +Then restart the service: `sudo systemctl restart fail2ban` + #### References - [Apache/PHP - error log per VirtualHost - StackOverflow](http://stackoverflow.com/q/176) -- cgit v1.2.3 From 02117f7ea35d719351a99cd4f1c339b2ad4ef266 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sat, 15 Aug 2020 20:03:43 +0200 Subject: doc: reverse proxy: update HTTP->HTTPS redirect configuration, remove logging options --- doc/md/Reverse-proxy.md | 17 +++++++++++------ doc/md/Server-configuration.md | 3 +-- 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'doc') diff --git a/doc/md/Reverse-proxy.md b/doc/md/Reverse-proxy.md index 2c1c601e..77e4a04d 100644 --- a/doc/md/Reverse-proxy.md +++ b/doc/md/Reverse-proxy.md @@ -17,8 +17,17 @@ See also [proxy-related](https://github.com/shaarli/Shaarli/issues?utf8=%E2%9C%9 ```apache ServerName shaarli.mydomain.org - # Redirect HTTP to HTTPS - Redirect permanent / https://shaarli.mydomain.org + DocumentRoot /var/www/shaarli.mydomain.org/ + + # Redirect HTTP requests to HTTPS, except Let's Encrypt ACME challenge requests + RewriteEngine on + RewriteRule ^.well-known/acme-challenge/ - [L] + RewriteCond %{HTTP_HOST} =shaarli.mydomain.org + RewriteRule ^ https://shaarli.mydomain.org%{REQUEST_URI} [END,NE,R=permanent] + # If you are using mod_md, use this instead + #MDCertificateAgreement accepted + #MDContactEmail admin@shaarli.mydomain.org + #MDPrivateKeys RSA 4096 @@ -28,10 +37,6 @@ See also [proxy-related](https://github.com/shaarli/Shaarli/issues?utf8=%E2%9C%9 SSLCertificateFile /path/to/certificate SSLCertificateKeyFile /path/to/private/key - LogLevel warn - ErrorLog /var/log/apache2/error.log - CustomLog /var/log/apache2/access.log combined - # let the proxied shaarli server/container know HTTPS URLs should be served RequestHeader set X-Forwarded-Proto "https" diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index c63e296e..c1cf4310 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -1,7 +1,5 @@ # Server configuration - - ## Requirements ### Operating system and web server @@ -24,6 +22,7 @@ Setup a **firewall** (using `iptables`, [ufw](https://www.digitalocean.com/commu Shaarli makes outbound HTTP/HTTPS connections to websites you bookmark to fetch page information (title, thumbnails), the server must then have access to the Internet as well, and a working DNS resolver. +-------------------------------------------------------------------------------- ### PHP -- cgit v1.2.3 From 48b19a7014ce7fac58ac77e171526cbb3a751318 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sat, 15 Aug 2020 20:05:32 +0200 Subject: doc: installation: bump version to 0.11.1 --- doc/md/Installation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'doc') diff --git a/doc/md/Installation.md b/doc/md/Installation.md index 1286a6b2..9f645a67 100644 --- a/doc/md/Installation.md +++ b/doc/md/Installation.md @@ -7,8 +7,8 @@ Once your server is [configured](Server-configuration.md), install Shaarli: To install Shaarli, simply place the files from the latest [release .zip archive](https://github.com/shaarli/Shaarli/releases) under your webserver's document root (directly at the document root, or in a subdirectory). Download the **shaarli-vX.X.X-full** archive to include dependencies. ```bash -wget https://github.com/shaarli/Shaarli/releases/download/v0.10.4/shaarli-v0.10.4-full.zip -unzip shaarli-v0.10.4-full.zip +wget https://github.com/shaarli/Shaarli/releases/download/v0.11.1/shaarli-v0.11.1-full.zip +unzip shaarli-v0.11.1-full.zip sudo rsync -avP Shaarli/ /var/www/shaarli.mydomain.org/ ``` -- cgit v1.2.3 From ff2b5f5bd857ee7edf496cae2b4ab526b0703345 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sat, 15 Aug 2020 20:10:46 +0200 Subject: doc: docker: update docker-compose to 1.26.2 --- doc/md/Docker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/md/Docker.md b/doc/md/Docker.md index e02d7fbd..3640ef26 100644 --- a/doc/md/Docker.md +++ b/doc/md/Docker.md @@ -85,7 +85,7 @@ Shaarli provides configuration file for Docker Compose, that will setup a Shaarl Download docker-compose from the [release page](https://docs.docker.com/compose/install/): ```bash -$ sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose +$ sudo curl -L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose $ sudo chmod +x /usr/local/bin/docker-compose # create a new directory to store the configuration: $ mkdir shaarli && cd shaarli -- cgit v1.2.3 From 78b5b44d8febc3eb262d13a9f29eafe9ccbe4247 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sat, 15 Aug 2020 20:11:04 +0200 Subject: doc: installation: simplify permissions setup --- doc/md/Installation.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'doc') diff --git a/doc/md/Installation.md b/doc/md/Installation.md index 9f645a67..11b5da85 100644 --- a/doc/md/Installation.md +++ b/doc/md/Installation.md @@ -50,22 +50,16 @@ $ rsync -avP /home/me/Shaarli/ /var/www/shaarli.mydomain.org/ Regardless of the installation method, appropriate [file permissions](dev/Development.md#directory-structure) must be set: ```bash -# by default, deny access to everything to the web server sudo chown -R root:www-data /var/www/shaarli.mydomain.org -sudo chmod -R u=rwX /var/www/shaarli.mydomain.org -# allow read-only access to these files/directories -sudo chmod -R g+rX /var/www/shaarli.mydomain.org/{index.php,application/,plugins/,inc/} -# allow read/write access to these directories +sudo chmod -R g+rX /var/www/shaarli.mydomain.org sudo chmod -R g+rwX /var/www/shaarli.mydomain.org/{cache/,data/,pagecache/,tmp/} ``` - ## Using Docker [See the documentation](Docker.md) - ## Finish Installation Once Shaarli is downloaded and files have been placed at the correct location, open this location your web browser. -- cgit v1.2.3 From 1a19c921a9a94f555c43fd932f9f57ddd5747889 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sat, 15 Aug 2020 20:12:39 +0200 Subject: doc: updagrde/migration: simplify permissions setup --- doc/md/Upgrade-and-migration.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'doc') diff --git a/doc/md/Upgrade-and-migration.md b/doc/md/Upgrade-and-migration.md index 8b0db1f8..bfef3e8c 100644 --- a/doc/md/Upgrade-and-migration.md +++ b/doc/md/Upgrade-and-migration.md @@ -29,8 +29,7 @@ sudo rsync -avP --delete Shaarli/ /var/www/shaarli.mydomain.org/ # restore file permissions as described on the installation page sudo chown -R root:www-data /var/www/shaarli.mydomain.org -sudo chmod -R u=rwX /var/www/shaarli.mydomain.org -sudo chmod -R g+rX /var/www/shaarli.mydomain.org/{index.php,application/,plugins/,inc/} +sudo chmod -R g+rX /var/www/shaarli.mydomain.org sudo chmod -R g+rwX /var/www/shaarli.mydomain.org/{cache/,data/,pagecache/,tmp/} # restore backups of the data directory @@ -70,8 +69,7 @@ sudo make build_frontend # restore file permissions as described on the installation page sudo chown -R root:www-data /var/www/shaarli.mydomain.org -sudo chmod -R u=rwX /var/www/shaarli.mydomain.org -sudo chmod -R g+rX /var/www/shaarli.mydomain.org/{index.php,application/,plugins/,inc/} +sudo chmod -R g+rX /var/www/shaarli.mydomain.org sudo chmod -R g+rwX /var/www/shaarli.mydomain.org/{cache/,data/,pagecache/,tmp/} ``` -- cgit v1.2.3 From 9417f1337eb518bd303017369fc66a074c1963bc Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sun, 16 Aug 2020 19:14:40 +0200 Subject: doc: server configuration: add asciicast of server configuration procedure (asciinema) --- doc/md/Server-configuration.md | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'doc') diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index c1cf4310..7da7995d 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -22,6 +22,13 @@ Setup a **firewall** (using `iptables`, [ufw](https://www.digitalocean.com/commu Shaarli makes outbound HTTP/HTTPS connections to websites you bookmark to fetch page information (title, thumbnails), the server must then have access to the Internet as well, and a working DNS resolver. + +### Screencast + +Here is a screencast of the installation procedure + +[![asciicast](https://asciinema.org/a/z3RXxcJIRgWk0jM2ws6EnUFgO.svg)](https://asciinema.org/a/z3RXxcJIRgWk0jM2ws6EnUFgO) + -------------------------------------------------------------------------------- ### PHP -- cgit v1.2.3 From d8847936d4fb3faa698bee1acabf99eb7f5268ed Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sun, 16 Aug 2020 19:15:11 +0200 Subject: doc: server configuration: add reminder to change the example domain name --- doc/md/Server-configuration.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'doc') diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index 7da7995d..bb488ef0 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -111,7 +111,7 @@ If you don't want to rely on a certificate authority, or the server can only be The following examples assume a Debian-based operating system is installed. On other distributions you may have to adapt details such as package installation procedures, configuration file locations, and webserver username/group (`www-data` or `httpd` are common values). In these examples we assume the document root for your web server/virtualhost is at `/var/www/shaarli.mydomain.org/`: ```bash -# create the document root +# create the document root (replace with your own domain name) sudo mkdir -p /var/www/shaarli.mydomain.org/ ``` @@ -125,7 +125,7 @@ You can install Shaarli at the root of your virtualhost, or in a subdirectory as sudo apt update sudo apt install apache2 libapache2-mod-php php-json php-mbstring php-gd php-intl php-curl php-gettext -# Edit the virtualhost configuration file with your favorite editor +# Edit the virtualhost configuration file with your favorite editor (replace the example domain name) sudo nano /etc/apache2/sites-available/shaarli.mydomain.org.conf ``` -- cgit v1.2.3 From 5eece37b0aaa8563d6fdde394b2e828bec61b6f5 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sun, 16 Aug 2020 19:15:56 +0200 Subject: doc: server configuration: fix apache site config file name --- doc/md/Server-configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index bb488ef0..89398b44 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -198,7 +198,7 @@ sudo nano /etc/apache2/sites-available/shaarli.mydomain.org.conf ```bash # Enable the virtualhost -sudo a2ensite shaarli +sudo a2ensite shaarli.mydomain.org # mod_ssl must be enabled to use TLS/SSL certificates # https://httpd.apache.org/docs/current/mod/mod_ssl.html -- cgit v1.2.3 From 19489e92d7dee3ec594432173071ddcddd79aa03 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sun, 16 Aug 2020 19:16:01 +0200 Subject: doc: server configuration: enable mod_headers --- doc/md/Server-configuration.md | 3 +++ 1 file changed, 3 insertions(+) (limited to 'doc') diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index 89398b44..8eeb10bd 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -208,6 +208,9 @@ sudo a2enmod ssl # https://httpd.apache.org/docs/current/mod/mod_rewrite.html sudo a2enmod rewrite +# mod_headers must be enabled to set custom headers from the server config +sudo a2enmod headers + # mod_version must only be enabled if you use Apache 2.2 or lower # https://httpd.apache.org/docs/current/mod/mod_version.html # sudo a2enmod version -- cgit v1.2.3 From 083b28021a34120778c203c85be6461a426cfa44 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sun, 16 Aug 2020 19:16:19 +0200 Subject: doc: server configuration: fix apache restart command --- doc/md/Server-configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index 8eeb10bd..3eeaad70 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -216,7 +216,7 @@ sudo a2enmod headers # sudo a2enmod version # restart the apache service -systemctl restart apache +sudo systemctl restart apache2 ``` See [How to install the Apache web server](https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-debian-10) for a complete guide. -- cgit v1.2.3 From f682f1b899641cde2617e6c2185d439b91d4338f Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sun, 16 Aug 2020 20:12:45 +0200 Subject: doc: serve configuration/reverse proxy: fix apache mod_md configuration, move reference links to their respective sections, shorten --- doc/md/Reverse-proxy.md | 35 +++++++++++++++---- doc/md/Server-configuration.md | 78 ++++++++++++++++++++---------------------- 2 files changed, 66 insertions(+), 47 deletions(-) (limited to 'doc') diff --git a/doc/md/Reverse-proxy.md b/doc/md/Reverse-proxy.md index 77e4a04d..1c55430f 100644 --- a/doc/md/Reverse-proxy.md +++ b/doc/md/Reverse-proxy.md @@ -19,23 +19,38 @@ See also [proxy-related](https://github.com/shaarli/Shaarli/issues?utf8=%E2%9C%9 ServerName shaarli.mydomain.org DocumentRoot /var/www/shaarli.mydomain.org/ + # For SSL/TLS certificates acquired with certbot or self-signed certificates # Redirect HTTP requests to HTTPS, except Let's Encrypt ACME challenge requests RewriteEngine on RewriteRule ^.well-known/acme-challenge/ - [L] RewriteCond %{HTTP_HOST} =shaarli.mydomain.org RewriteRule ^ https://shaarli.mydomain.org%{REQUEST_URI} [END,NE,R=permanent] - # If you are using mod_md, use this instead - #MDCertificateAgreement accepted - #MDContactEmail admin@shaarli.mydomain.org - #MDPrivateKeys RSA 4096 +# SSL/TLS configuration for Let's Encrypt certificates managed with mod_md +#MDomain shaarli.mydomain.org +#MDCertificateAgreement accepted +#MDContactEmail admin@shaarli.mydomain.org +#MDPrivateKeys RSA 4096 + ServerName shaarli.mydomain.org - SSLEngine on - SSLCertificateFile /path/to/certificate - SSLCertificateKeyFile /path/to/private/key + # SSL/TLS configuration for Let's Encrypt certificates acquired with certbot standalone + SSLEngine on + SSLCertificateFile /etc/letsencrypt/live/shaarli.mydomain.org/fullchain.pem + SSLCertificateKeyFile /etc/letsencrypt/live/shaarli.mydomain.org/privkey.pem + # Let's Encrypt settings from https://github.com/certbot/certbot/blob/master/certbot-apache/certbot_apache/_internal/tls_configs/current-options-ssl-apache.conf + SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 + SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384 + SSLHonorCipherOrder off + SSLSessionTickets off + SSLOptions +StrictRequire + + # SSL/TLS configuration for self-signed certificates + #SSLEngine on + #SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem + #SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key # let the proxied shaarli server/container know HTTPS URLs should be served RequestHeader set X-Forwarded-Proto "https" @@ -75,6 +90,7 @@ backend shaarli server shaarli1 127.0.0.1:10080 ``` +- [HAProxy documentation](https://cbonte.github.io/haproxy-dconv/) ## Nginx @@ -119,3 +135,8 @@ http { } ``` +## References + +- [`X-Forwarded-Proto`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto) +- [`X-Forwarded-Host`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Host) +- [`X-Forwarded-For`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For) diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index 3eeaad70..bad00ac5 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -4,12 +4,15 @@ ### Operating system and web server -Shaarli can be hosted on dedicated/virtual servers, or shared hosting. The smallest DigitalOcean VPS (Droplet with 1 CPU, 1 GiB RAM and 25 GiB SSD) costs about $5/month and will run any Shaarli installation without problems. +Shaarli can be hosted on dedicated/virtual servers, or shared hosting. You need write access to the Shaarli installation directory - you should have received instructions from your hosting provider on how to connect to the server using SSH (or FTP for shared hosts). Examples in this documentation are given for [Debian](https://www.debian.org/), a GNU/Linux distribution widely used in server environments. Please adapt them to your specific Linux distribution. +A $5/month VPS (1 CPU, 1 GiB RAM and 25 GiB SSD) will run any Shaarli installation without problems. Some hosting providers: [DigitalOcean](https://www.digitalocean.com/) ([1](https://www.digitalocean.com/docs/droplets/overview/), [2](https://www.digitalocean.com/pricing/), [3](https://www.digitalocean.com/docs/droplets/how-to/create/), [4](https://www.digitalocean.com/docs/droplets/how-to/add-ssh-keys/), [5](https://www.digitalocean.com/community/tutorials/initial-server-setup-with-debian-8), [6](https://www.digitalocean.com/community/tutorials/an-introduction-to-securing-your-linux-vps)), [Gandi](https://www.gandi.net/en), [OVH](https://www.ovh.co.uk/), [RackSpace](https://www.rackspace.com/), etc. + + ### Network and domain name Try to host the server in a region that is geographically close to your users. @@ -61,10 +64,16 @@ Extension | Required? | Usage Some [plugins](Plugins.md) may require additional configuration. +- [PHP: Supported versions](http://php.net/supported-versions.php) +- [PHP: Unsupported versions (EOL/End-of-life)](http://php.net/eol.php) +- [PHP 7 Changelog](http://php.net/ChangeLog-7.php) +- [PHP 5 Changelog](http://php.net/ChangeLog-5.php) +- [PHP: Bugs](https://bugs.php.net/) + ## SSL/TLS (HTTPS) -We recommend setting up [HTTPS](https://en.wikipedia.org/wiki/HTTPS) on your webserver for secure communication between clients and the server. +We recommend setting up [HTTPS](https://en.wikipedia.org/wiki/HTTPS) (SSL/[TLS](https://en.wikipedia.org/wiki/Transport_Layer_Security)) on your webserver for secure communication between clients and the server. ### Let's Encrypt @@ -103,6 +112,8 @@ If you don't want to rely on a certificate authority, or the server can only be - [How To Create a Self-Signed SSL Certificate for Apache](https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-apache-on-debian-10) - [How To Create a Self-Signed SSL Certificate for Nginx](https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-nginx-on-debian-10) +- [How to Create Self-Signed SSL Certificates with OpenSSL](http://www.xenocafe.com/tutorials/linux/centos/openssl/self_signed_certificates/index.php) +- [How do I create my own Certificate Authority?](https://workaround.org/certificate-authority) -------------------------------------------------------------------------------- @@ -134,17 +145,20 @@ sudo nano /etc/apache2/sites-available/shaarli.mydomain.org.conf ServerName shaarli.mydomain.org DocumentRoot /var/www/shaarli.mydomain.org/ + # For SSL/TLS certificates acquired with certbot or self-signed certificates # Redirect HTTP requests to HTTPS, except Let's Encrypt ACME challenge requests RewriteEngine on RewriteRule ^.well-known/acme-challenge/ - [L] RewriteCond %{HTTP_HOST} =shaarli.mydomain.org RewriteRule ^ https://shaarli.mydomain.org%{REQUEST_URI} [END,NE,R=permanent] - # If you are using mod_md, use this instead - #MDCertificateAgreement accepted - #MDContactEmail admin@shaarli.mydomain.org - #MDPrivateKeys RSA 4096 +# SSL/TLS configuration for Let's Encrypt certificates managed with mod_md +#MDomain shaarli.mydomain.org +#MDCertificateAgreement accepted +#MDContactEmail admin@shaarli.mydomain.org +#MDPrivateKeys RSA 4096 + ServerName shaarli.mydomain.org DocumentRoot /var/www/shaarli.mydomain.org/ @@ -160,10 +174,7 @@ sudo nano /etc/apache2/sites-available/shaarli.mydomain.org.conf SSLSessionTickets off SSLOptions +StrictRequire - # SSL/TLS configuration for Let's Encrypt certificates acquired with mod_md - #MDomain shaarli.mydomain.org - - # SSL/TLS configuration (for self-signed certificates) + # SSL/TLS configuration for self-signed certificates #SSLEngine on #SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem #SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key @@ -219,7 +230,13 @@ sudo a2enmod headers sudo systemctl restart apache2 ``` -See [How to install the Apache web server](https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-debian-10) for a complete guide. +- [How to install the Apache web server](https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-debian-10) +- [Apache/PHP - error log per VirtualHost - StackOverflow](http://stackoverflow.com/q/176) +- [Apache - PHP: php_value vs php_admin_value and the use of php_flag explained](https://ma.ttias.be/php-php_value-vs-php_admin_value-and-the-use-of-php_flag-explained/) +- [Server-side TLS (Apache) - Mozilla](https://wiki.mozilla.org/Security/Server_Side_TLS#Apache) +- [Apache 2.4 documentation](https://httpd.apache.org/docs/2.4/) +- [Apache mod_proxy](https://httpd.apache.org/docs/2.4/mod/mod_proxy.html) +- [Apache Reverse Proxy Request Headers](https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#x-headers) ### Nginx @@ -326,7 +343,14 @@ sudo ln -s /etc/nginx/sites-available/shaarli.mydomain.org /etc/nginx/sites-enab sudo systemctl reload nginx ``` -See [How to install the Nginx web server](https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-debian-10) for a complete guide. +- [How to install the Nginx web server](https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-debian-10) +- [Nginx Beginner's guide](http://nginx.org/en/docs/beginners_guide.html) +- [Nginx documentation](https://nginx.org/en/docs/) +- [Nginx ngx_http_fastcgi_module](http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html) +- [Nginx Pitfalls](http://wiki.nginx.org/Pitfalls) +- [Nginx PHP configuration examples - Karl Blessing](http://kbeezie.com/nginx-configuration-examples/) +- [Server-side TLS (Nginx) - Mozilla](https://wiki.mozilla.org/Security/Server_Side_TLS#Nginx) + ## Reverse proxies @@ -413,33 +437,7 @@ bantime = -1 Then restart the service: `sudo systemctl restart fail2ban` -#### References - -- [Apache/PHP - error log per VirtualHost - StackOverflow](http://stackoverflow.com/q/176) -- [Apache - PHP: php_value vs php_admin_value and the use of php_flag explained](https://ma.ttias.be/php-php_value-vs-php_admin_value-and-the-use-of-php_flag-explained/) -- [Server-side TLS (Apache) - Mozilla](https://wiki.mozilla.org/Security/Server_Side_TLS#Apache) -- [Nginx Beginner's guide](http://nginx.org/en/docs/beginners_guide.html) -- [Nginx ngx_http_fastcgi_module](http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html) -- [Nginx Pitfalls](http://wiki.nginx.org/Pitfalls) -- [Nginx PHP configuration examples - Karl Blessing](http://kbeezie.com/nginx-configuration-examples/) -- [Apache 2.4 documentation](https://httpd.apache.org/docs/2.4/) -- [Apache mod_proxy](https://httpd.apache.org/docs/2.4/mod/mod_proxy.html) -- [Apache Reverse Proxy Request Headers](https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#x-headers) -- [HAProxy documentation](https://cbonte.github.io/haproxy-dconv/) -- [Nginx documentation](https://nginx.org/en/docs/) -- [`X-Forwarded-Proto`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto) -- [`X-Forwarded-Host`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Host) -- [`X-Forwarded-For`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For) -- [Server-side TLS (Nginx) - Mozilla](https://wiki.mozilla.org/Security/Server_Side_TLS#Nginx) -- [How to Create Self-Signed SSL Certificates with OpenSSL](http://www.xenocafe.com/tutorials/linux/centos/openssl/self_signed_certificates/index.php) -- [How do I create my own Certificate Authority?](https://workaround.org/certificate-authority) -- [Travis configuration](https://github.com/shaarli/Shaarli/blob/master/.travis.yml) -- [PHP: Supported versions](http://php.net/supported-versions.php) -- [PHP: Unsupported versions (EOL/End-of-life)](http://php.net/eol.php) -- [PHP 7 Changelog](http://php.net/ChangeLog-7.php) -- [PHP 5 Changelog](http://php.net/ChangeLog-5.php) -- [PHP: Bugs](https://bugs.php.net/) -- [Transport Layer Security](https://en.wikipedia.org/wiki/Transport_Layer_Security) -- Hosting providers: [DigitalOcean](https://www.digitalocean.com/) ([1](https://www.digitalocean.com/docs/droplets/overview/), [2](https://www.digitalocean.com/pricing/), [3](https://www.digitalocean.com/docs/droplets/how-to/create/), [How to Add SSH Keys to Droplets](https://www.digitalocean.com/docs/droplets/how-to/add-ssh-keys/), [4](https://www.digitalocean.com/community/tutorials/initial-server-setup-with-debian-8), [5](https://www.digitalocean.com/community/tutorials/an-introduction-to-securing-your-linux-vps)), [Gandi](https://www.gandi.net/en), [OVH](https://www.ovh.co.uk/), [RackSpace](https://www.rackspace.com/), etc. +## What next? +[Shaarli installation](Installation.md) -- cgit v1.2.3 From 61f0c4b679f49953fa7147772354658a117a54e7 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Mon, 24 Aug 2020 21:32:44 +0200 Subject: doc: apache config: remove useless documentroot directive in HTTP-only virtualhost (only used for redirects) --- doc/md/Reverse-proxy.md | 1 - 1 file changed, 1 deletion(-) (limited to 'doc') diff --git a/doc/md/Reverse-proxy.md b/doc/md/Reverse-proxy.md index 1c55430f..b7e347d5 100644 --- a/doc/md/Reverse-proxy.md +++ b/doc/md/Reverse-proxy.md @@ -17,7 +17,6 @@ See also [proxy-related](https://github.com/shaarli/Shaarli/issues?utf8=%E2%9C%9 ```apache ServerName shaarli.mydomain.org - DocumentRoot /var/www/shaarli.mydomain.org/ # For SSL/TLS certificates acquired with certbot or self-signed certificates # Redirect HTTP requests to HTTPS, except Let's Encrypt ACME challenge requests -- cgit v1.2.3 From a5e9f2d6c927a3b7e58ac2a0747103634e4394a5 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Mon, 24 Aug 2020 21:33:53 +0200 Subject: doc: nginx config: document ipv4 and ipv6 listen directives --- doc/md/Server-configuration.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index bad00ac5..297d7c29 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -263,7 +263,10 @@ server { } server { - listen 443 ssl; + # ipv4 listening port/protocol + listen 443 ssl http2; + # ipv6 listening port/protocol + listen [::]:443 ssl http2; server_name shaarli.mydomain.org; root /var/www/shaarli.mydomain.org; -- cgit v1.2.3 From 68855686dbbc734003581524b45cb26240917dad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imm=C3=A1nuel!?= <21174107+immanuelfodor@users.noreply.github.com> Date: Sun, 30 Aug 2020 16:30:23 +0200 Subject: Add 2 plugins to the 3rd party plugin list Besides adding 2 new plugins, also reordered the list by ABC and fixed some discrepancies in the details to restore balance in the force --- doc/md/Community-and-related-software.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/md/Community-and-related-software.md b/doc/md/Community-and-related-software.md index 67eeff64..53a7555e 100644 --- a/doc/md/Community-and-related-software.md +++ b/doc/md/Community-and-related-software.md @@ -13,8 +13,10 @@ See [REST API](REST-API) for a list of official and community clients. ### Third party plugins - [autosave](https://github.com/kalvn/shaarli-plugin-autosave) by [@kalvn](https://github.com/kalvn): Automatically saves data when editing a Shaare to avoid any loss in case of crash or unexpected shutdown. -- [code Coloration](https://github.com/ArthurHoaro/code-coloration) by [@ArthurHoaro](https://github.com/ArthurHoaro): client side code syntax highlighter. +- [code-coloration](https://github.com/ArthurHoaro/code-coloration) by [@ArthurHoaro](https://github.com/ArthurHoaro): client side code syntax highlighter. +- [custom-css](https://github.com/immanuelfodor/shaarli-custom-css) by [@immanuelfodor](https://github.com/immanuelfodor) - Customize the look and feel of the UI with custom CSS rules - [disqus](https://github.com/kalvn/shaarli-plugin-disqus) by [@kalvn](https://github.com/kalvn): Adds Disqus comment system to your Shaarli. +- [emojione](https://github.com/immanuelfodor/emojione) by [@immanuelfodor](https://github.com/immanuelfodor) - Resurrected fork of the original emojione project - [favicons](https://github.com/trailjeep/shaarli-favicons) by [@trailjeep](https://github.com/trailjeep) - Shaarli plugin to add favicon/filetype icons to Shaares. - [google analytics](https://github.com/ericjuden/Shaarli-Google-Analytics-Plugin) by [@ericjuden](http://github.com/ericjuden): Adds Google Analytics tracking support - [launch](https://github.com/ArthurHoaro/launch-plugin) - Launch Plugin is a plugin designed to enhance and customize Launch Theme for Shaarli. -- cgit v1.2.3 From 97870f35121bed42ac126652d81bc43416b44356 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Thu, 3 Sep 2020 11:58:09 +0200 Subject: doc: Docker minor improvements --- doc/md/Docker.md | 59 ++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 19 deletions(-) (limited to 'doc') diff --git a/doc/md/Docker.md b/doc/md/Docker.md index 3640ef26..c152fe92 100644 --- a/doc/md/Docker.md +++ b/doc/md/Docker.md @@ -4,33 +4,45 @@ ## Install Docker -Install [Docker](https://www.docker.com/), by following the instructions relevant to your OS / distribution, and start the service. For example on [Debian](https://docs.docker.com/engine/install/debian/): +Install [Docker](https://docs.docker.com/engine/install/), by following the instructions relevant to your OS / distribution, and start the service. For example on [Debian](https://docs.docker.com/engine/install/debian/): ```bash # update your package lists -$ sudo apt update +sudo apt update # remove old versions -$ sudo apt-get remove docker docker-engine docker.io containerd runc +sudo apt-get remove docker docker-engine docker.io containerd runc # install requirements -$ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common +sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common # add docker's GPG signing key curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - # add the repository -$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" +sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" # install docker engine -$ sudo apt-get update -$ sudo apt-get install docker-ce docker-ce-cli containerd.io +sudo apt-get update +sudo apt-get install docker-ce docker-ce-cli containerd.io +# Start and enable Docker service +sudo systemctl enable docker && sudo systemctl start docker # verify that Docker is properly configured -root@stretch-shaarli-02:~$ docker run hello-world +sudo docker run hello-world ``` +In order to run Docker commands as a non-root user, you must add the `docker` group to this user: + +```bash +# Add docker group as secondary group +sudo usermod -aG docker your-user +# Reboot or logout +# Then verify that Docker is properly configured, as "your-user" +docker run hello-world +``` ## Get and run a Shaarli image -Shaarli images are available on [DockerHub](https://hub.docker.com/r/shaarli/shaarli/): +Shaarli images are available on [DockerHub](https://hub.docker.com/r/shaarli/shaarli/) `shaarli/shaarli`: -- `latest`: latest branch -- `master`: master branch +- `latest`: latest branch (last release) +- `stable`: stable branch (last release in previous major version) +- `master`: master branch (development branch) These images are built automatically on DockerHub and rely on: @@ -40,6 +52,8 @@ These images are built automatically on DockerHub and rely on: Additional Dockerfiles are provided for the `arm32v7` platform, relying on [Linuxserver.io Alpine armhf images](https://hub.docker.com/r/lsiobase/alpine.armhf/). These images must be built using [`docker build`](https://docs.docker.com/engine/reference/commandline/build/) on an `arm32v7` machine or using an emulator such as [qemu](https://resin.io/blog/building-arm-containers-on-any-x86-machine-even-dockerhub/). +Here is an example of how to run Shaarli latest image using Docker: + ```bash # download the 'latest' image from dockerhub docker pull shaarli/shaarli @@ -60,7 +74,7 @@ docker run --detach \ --rm \ --volume shaarli-data:/var/www/shaarli/data \ --volume shaarli-cache:/var/www/shaarli/cache \ - shaarli/shaarli + shaarli/shaarli:latest # verify that the container is running docker ps | grep myshaarli @@ -74,23 +88,30 @@ docker ps -a | grep myshaarli # verify th container has been destroyed ``` +After running `docker run` command, your Shaarli instance should be available on the host machine at [localhost:8000](http://localhost:8000). In order to access your instance through a reverse proxy, we recommend using our [Docker Compose](#docker-compose) build. + ## Docker Compose A [Compose file](https://docs.docker.com/compose/compose-file/) is a common format for defining and running multi-container Docker applications. A `docker-compose.yml` file can be used to run a persistent/autostarted shaarli service using [Docker Compose](https://docs.docker.com/compose/) or in a [Docker stack](https://docs.docker.com/engine/reference/commandline/stack_deploy/). -Shaarli provides configuration file for Docker Compose, that will setup a Shaarli instance, a [Træfik](https://hub.docker.com/_/traefik/) instance with [Let's Encrypt](https://letsencrypt.org/) certificates, a Docker network, and volumes for Shaarli data and Træfik TLS configuration and certificates. +Shaarli provides configuration file for Docker Compose, that will setup a Shaarli instance, a [Træfik](https://containo.us/traefik/) instance (reverse proxy) with [Let's Encrypt](https://letsencrypt.org/) certificates, a Docker network, and volumes for Shaarli data and Træfik TLS configuration and certificates. Download docker-compose from the [release page](https://docs.docker.com/compose/install/): ```bash $ sudo curl -L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose $ sudo chmod +x /usr/local/bin/docker-compose +``` + +To run Shaarli container and its reverse proxy, you can execute the following commands: + +```bash # create a new directory to store the configuration: $ mkdir shaarli && cd shaarli -# Download the current version of Shaarli's docker-compose.yml -$ curl -L https://raw.githubusercontent.com/shaarli/Shaarli/master/docker-compose.yml -o docker-compose.yml +# Download the latest version of Shaarli's docker-compose.yml +$ curl -L https://raw.githubusercontent.com/shaarli/Shaarli/latest/docker-compose.yml -o docker-compose.yml # Create the .env file and fill in your VPS and domain information # (replace and with your actual information) $ echo 'SHAARLI_VIRTUAL_HOST=shaarli.mydomain.org' > .env @@ -101,9 +122,9 @@ $ docker-compose pull $ docker-compose up -d ``` +After a few seconds, you should be able to access your Shaarli instance at [https://shaarli.mydomain.org](https://shaarli.mydomain.org) (replace your own domain name). - -### Running dockerized Shaarli as a systemd service +## Running dockerized Shaarli as a systemd service It is possible to start a dockerized Shaarli instance as a systemd service (systemd is the service management tool on several distributions). After installing Docker, use the following steps to run your shaarli container Shaarli to run on system start. @@ -154,9 +175,9 @@ journalctl -f ```bash # pull/update an image -$ docker pull shaarli:release +$ docker pull shaarli/shaarli:release # run a container from an image -$ docker run shaarli:latest +$ docker run shaarli/shaarli:latest # list available images $ docker images ls # list running containers -- cgit v1.2.3