From 1cafacfedd41ebd7bbf442a24a81b33cc24b1838 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Sun, 1 Jul 2018 12:27:55 +0200 Subject: Docs: rename 'How-to' section to 'Guides' Signed-off-by: VirtualTam --- doc/md/Backup,-restore,-import-and-export.md | 64 --------------------------- doc/md/Various-hacks.md | 33 -------------- doc/md/guides/backup-restore-import-export.md | 64 +++++++++++++++++++++++++++ doc/md/guides/various-hacks.md | 33 ++++++++++++++ 4 files changed, 97 insertions(+), 97 deletions(-) delete mode 100644 doc/md/Backup,-restore,-import-and-export.md delete mode 100644 doc/md/Various-hacks.md create mode 100644 doc/md/guides/backup-restore-import-export.md create mode 100644 doc/md/guides/various-hacks.md (limited to 'doc') diff --git a/doc/md/Backup,-restore,-import-and-export.md b/doc/md/Backup,-restore,-import-and-export.md deleted file mode 100644 index bb790074..00000000 --- a/doc/md/Backup,-restore,-import-and-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/Various-hacks.md b/doc/md/Various-hacks.md deleted file mode 100644 index 0074ae9f..00000000 --- a/doc/md/Various-hacks.md +++ /dev/null @@ -1,33 +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 . -``` - -### 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 link dialog. -- You can set the timestamp manually by entering it in the format `YYYMMDD_HHMMS`. - - -### See also - -- [Add a new custom field to shaares (example patch)](https://gist.github.com/nodiscc/8b0194921f059d7b9ad89a581ecd482c) -- [Download CSS styles for shaarlis listed in an opml file](https://gist.github.com/nodiscc/dede231c92cab22c3ad2cc24d5035012) -- [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/guides/backup-restore-import-export.md b/doc/md/guides/backup-restore-import-export.md new file mode 100644 index 00000000..bb790074 --- /dev/null +++ b/doc/md/guides/backup-restore-import-export.md @@ -0,0 +1,64 @@ +## 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/various-hacks.md b/doc/md/guides/various-hacks.md new file mode 100644 index 00000000..0074ae9f --- /dev/null +++ b/doc/md/guides/various-hacks.md @@ -0,0 +1,33 @@ +### 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 . +``` + +### 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 link dialog. +- You can set the timestamp manually by entering it in the format `YYYMMDD_HHMMS`. + + +### See also + +- [Add a new custom field to shaares (example patch)](https://gist.github.com/nodiscc/8b0194921f059d7b9ad89a581ecd482c) +- [Download CSS styles for shaarlis listed in an opml file](https://gist.github.com/nodiscc/dede231c92cab22c3ad2cc24d5035012) +- [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) -- cgit v1.2.3 From a0c34a49765ecc2559ac51b62966b9785ff3a5a3 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Sun, 1 Jul 2018 16:02:35 +0200 Subject: Docs: Add an installation guide for Debian 9 + Docker Signed-off-by: VirtualTam --- doc/md/guides/images/01-create-droplet-distro.jpg | Bin 0 -> 20909 bytes doc/md/guides/images/02-create-droplet-region.jpg | Bin 0 -> 21603 bytes doc/md/guides/images/03-create-droplet-size.jpg | Bin 0 -> 20860 bytes doc/md/guides/images/04-finalize.jpg | Bin 0 -> 28233 bytes doc/md/guides/images/05-droplet.jpg | Bin 0 -> 11977 bytes doc/md/guides/images/06-domain.jpg | Bin 0 -> 4499 bytes doc/md/guides/images/07-installation.jpg | Bin 0 -> 42832 bytes .../install-shaarli-with-debian9-and-docker.md | 257 +++++++++++++++++++++ 8 files changed, 257 insertions(+) create mode 100644 doc/md/guides/images/01-create-droplet-distro.jpg create mode 100644 doc/md/guides/images/02-create-droplet-region.jpg create mode 100644 doc/md/guides/images/03-create-droplet-size.jpg create mode 100644 doc/md/guides/images/04-finalize.jpg create mode 100644 doc/md/guides/images/05-droplet.jpg create mode 100644 doc/md/guides/images/06-domain.jpg create mode 100644 doc/md/guides/images/07-installation.jpg create mode 100644 doc/md/guides/install-shaarli-with-debian9-and-docker.md (limited to 'doc') diff --git a/doc/md/guides/images/01-create-droplet-distro.jpg b/doc/md/guides/images/01-create-droplet-distro.jpg new file mode 100644 index 00000000..63682ba8 Binary files /dev/null and b/doc/md/guides/images/01-create-droplet-distro.jpg differ diff --git a/doc/md/guides/images/02-create-droplet-region.jpg b/doc/md/guides/images/02-create-droplet-region.jpg new file mode 100644 index 00000000..135a78be Binary files /dev/null and b/doc/md/guides/images/02-create-droplet-region.jpg differ diff --git a/doc/md/guides/images/03-create-droplet-size.jpg b/doc/md/guides/images/03-create-droplet-size.jpg new file mode 100644 index 00000000..aa5b2fd2 Binary files /dev/null and b/doc/md/guides/images/03-create-droplet-size.jpg differ diff --git a/doc/md/guides/images/04-finalize.jpg b/doc/md/guides/images/04-finalize.jpg new file mode 100644 index 00000000..68ec0dc5 Binary files /dev/null and b/doc/md/guides/images/04-finalize.jpg differ diff --git a/doc/md/guides/images/05-droplet.jpg b/doc/md/guides/images/05-droplet.jpg new file mode 100644 index 00000000..44e93a1e Binary files /dev/null and b/doc/md/guides/images/05-droplet.jpg differ diff --git a/doc/md/guides/images/06-domain.jpg b/doc/md/guides/images/06-domain.jpg new file mode 100644 index 00000000..5827dd93 Binary files /dev/null and b/doc/md/guides/images/06-domain.jpg differ diff --git a/doc/md/guides/images/07-installation.jpg b/doc/md/guides/images/07-installation.jpg new file mode 100644 index 00000000..42cc9f10 Binary files /dev/null and b/doc/md/guides/images/07-installation.jpg 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 new file mode 100644 index 00000000..f1b26d47 --- /dev/null +++ b/doc/md/guides/install-shaarli-with-debian9-and-docker.md @@ -0,0 +1,257 @@ +_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 -- cgit v1.2.3