Tag: Nextcloud

  • Nextcloud CLI updater

    I use Nextcloud extensively to run my little micro-business, and updating has often been a hassle, with regular timeouts and “Gad gateway” messages.

    Then I discovered the Nextcloud CLI updater.

    You can update Nextcloud (and apps) directly from the command line on your server.

    Just move to the Nextcloud installation directory, execute the PHP script updater/updater.phar as the web-server user, and follow the instructions.

    $ sudo -u www-data php updater/updater.phar
    Nextcloud Updater - version: v32.0.1-41-g157dc25 dirty
    
    Current version is 33.0.0.
    
    Update to Nextcloud 33.0.1 available. (channel: "stable")
    Following file will be downloaded automatically: https://github.com/nextcloud-releases/server/releases/download/v33.0.1/nextcloud-33.0.1.zip
    Open changelog ↗
    
    Steps that will be executed:
    [ ] Check for expected files
    [ ] Check for write permissions
    [ ] Create backup
    [ ] Downloading
    [ ] Verify integrity
    [ ] Extracting
    [ ] Enable maintenance mode
    [ ] Replace entry points
    [ ] Delete old files
    [ ] Move new files in place
    [ ] Done
    
    Start update? [y/N] y
    
    Info: Pressing Ctrl-C will finish the currently running step and then stops the updater.
    
    [✔] Check for expected files
    [✔] Check for write permissions
    [✔] Create backup
    [✔] Downloading
    [✔] Verify integrity
    [✔] Extracting
    [✔] Enable maintenance mode
    [✔] Replace entry points
    [✔] Delete old files
    [✔] Move new files in place
    [✔] Done
    
    Update of code successful.
    
    Should the "occ upgrade" command be executed? [Y/n] y
    
    Setting log level to debug
    Repair step: ... <many lines>
    Repair info: ...
    
    Starting code integrity check...
    Finished code integrity check
    Update successful
    Maintenance mode is kept active
    Resetting log level
    
    "occ upgrade" finished
    
    Keep maintenance mode active? [y/N] 
    Maintenance mode disabled
    
    Maintenance mode is disabled

    I’ll never use the web interface again.

    Fediverse Reactions
  • Nextcloud markdown editor ­— CLI

    I use the rich text editor in Nextcloud a lot, and it can be opened through a sub-menu of the context menu in the GNOME file manager.

    You can only open one file at a time, and requires a few clicks and moving the mouse around.

    Now, if we could have a simple command to open the Nextcloud editor, for one or more file?

    Having a look at the GNOME Files extension, it wasn’t that complicated.

    (more…)
  • Changing owner of a calendar in Nextcloud

    I needed to change the owner of a shared Nextcloud calendar, preferable without causing too many problems for the other user of the calendar (my wife).

    Exporting and importing into a new calendar would do that, I feared.

    (more…)
  • A WordPress-Nextcloud writing workflow

    I spend a large part of my time working on my website, which is an essential part of my business. The site is about the history of Venice, considered very widely, and a lot of studying and drafting goes into it.

    My main website is self-hosted WordPress, but WordPress is not sufficient for what I do.

    The preparatory work going into writing for the website, requires space for literature, sources, images, maps, notes, brainstorming drafts and much more.

    If I tried to do that in WordPress, it would be an unwieldy mess of uploaded gigabytes of PDFs and other files, which I would have to keep locally too.

    A private Nextcloud instance is a much better solution.

    With Nextcloud, I have a web-interface to the files with a set of remote apps and functions available, but I also have all the files locally. The synching is fast enough to allow me to switch between remote and local apps without any real problems.

    The basic writing-publishing process

    As I do my History Walks in Venice, I sometimes get questions I haven’t got before, or see things I hadn’t noticed before.

    That will send me back to my books to find an answer. More often than not, I’ll stumble over something else in the process, which might be worth my time later. Consequently, I often have many articles in the pipeline at any one time.

    The process is more or less this:

    1. Reading notes, odd ideas and what not goes into Nextcloud Notes, either as plain text or Markdown formatted. There’s a handy Nextcloud Notes app for the phone, there’s the normal Nextcloud web interface, and the files are mirrored on my computers. I therefore have easy access to these files anywhere, and can edit them with just about anything.
    2. Once a theme for an article or newsletter coagulates, I move the note to the Drafts folder in Nextcloud, and start finding images, making maps, compiling lists, translating sources or whatever is needed to back up the article. Any writing here also happens in Markdown format. I use whatever program I feel like to edit these files. Common choices are the rich-text editor in Nextcloud, Emacs or Apostrophe, but it is a simple text file which can be edited with any editor.
    3. I don’t always know exactly where a text will go on the website, as I have several custom post-types: posts, articles, newsletters, translations, and so on. Often the text will therefore enter as a custom ‘Scratchpad’ post-type, where I can do all the preparations for publishing, such as uploading images, tagging names and places, entering the bibliography, adding footnotes and such.
    4. When I’m done, I move the ‘Scratchpad’ post to the section of the site where it belongs, and schedule it for publishing. If it’s a newsletter, there’s a separate procedure to send that to the subscribers.
    5. Once the article is published on the website, I add links to it from older existing articles, where relevant. For this, I use two custom plugins. One tracks the internal linking structure of the site, so I can easily see which posts link to which, and another which implements a unified search function across all post-types.
    6. The last thing to do is sharing the article on social media. I do this manually, as most walled garden social media has made automated procedures even more cumbersome.
    7. The last last thing, is to move the article draft folder to the folder for published posts, with the date of publishing added to the folder name. If, for some reason, I need to return to the article later, I can easily find everything I used there.

    WordPress and Markdown

    In the early phases, I write in Markdown, but when the text enters WordPress it becomes HTML.

    This is automatic. I very rarely need to do anything.

    When writing in Markdown, I only use the basics: headers, links, bold, cursive, lists, and quotes. I never add images to the Markdown files, and I usually also stay clear of tables.

    To move a Markdown text into WordPress, I simply copy the Markdown formatted text to the clipboard, and paste it into the Gutenberg on WordPress. The Gutenberg block editor will automatically convert Markdown formatting into Gutenberg blocks, and it does a decent job.

    I don’t mind the Gutenberg block editor. It is great for all the visual aspects of how an article is presented, but it doesn’t suit me well for the earlier phases of writing.

    Markdown is perfect for that.

    If I need a distraction-free environment, I can do that easily with the Nextcloud editor or Apostrophe. If I need to do complicated search and replace, or very repetitive operations, or sometimes just anything but churning out words, I use Emacs.

    Writing aids

    English is not my native language, so it is easy to make mistakes.

    Initially, I used the integrated writing aids of the WordPress plugin Yoast SEO. They are, however, rather limited, and they forced me to do more of my workflow in WordPress than I cared for.

    Searching for something else, I discovered LanguageTool, which I find more useful. It offers me many more corrections, and it works in more contexts.

    It works in almost anything browser-based, so it’s there in the Gutenberg editor, and in the rich text editor of Nextcloud. I can also use it in LibreOffice and Thunderbird, with the necessary extensions.

    Why self-hosted?

    It has always been my preference to run my own services. I simply don’t trust big foreign corporations with all my data.

    The problem isn’t as much the confidentiality of the material, which is very low, but the amount of time I have invested in collecting, organising and writing everything.

    It would be very disruptive for my work to get kicked out of my digital office and library by some AI algorithm which mistakes a Renaissance painting by Titian of a nude girl for child pornography,

    In principle, any such provider could shut me down for anything, even a copy of a painting. If that sounds ridiculous, be assured that more ridiculous stuff has happened, and that you’ll have no recourse.

    I would have to keep copies of everything offline somewhere anyway, so what’s the point.

    One last point, in these times of AI — which is an illogical abbreviation for Automated Plagiarism — I don’t want everything I do to be used to train the AI models of big corporations.

  • Nextcloud on Synology NAS

    Nextcloud on Synology NAS

    My four years old Synology DS216 couldn’t run Nextcloud, but the new DS720+ can, and happily so.

    The basics are straightforward. Download the ZIP file from nextcloud.org, unzip it under the web shared folder, and configure it in the Web Station app, and run the Nextcloud installer.

    I only had two problems.

    Memcache

    Nextcloud prefers having a memory cache configured, and apparently the apcu module isn’t available in the Synology PHP package. It is not in the list of modules in the Web Station interface.

    It is there, though.

    To activate it, create the file /usr/local/etc/php74/cli/conf.d/nextcloud.ini with this content:

    extension = apcu.so
    
    [apc]
    apc.shm_size = 512M
    apc.enable_cli = 1

    and then enable the memcache normally in the Nextcloud config.php.

    That’ll make the warning go away.

    Cron-jobs

    I kept getting complaints about Nextcloud cron jobs non being run, and I fixed that my creating a normal system crontab for Nextcloud.

    Create the file /etc/cron.d/nextcloud with content:

    PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin
    
    0,10,20,30,40,50 * * * * http php74 /volume1/web/nextcloud/cron.php

    Adjust the path to you nextcloud installation directory.

    The cron daemon should pick up the new file automatically. If it doesn’t reload the cron daemon with systemctl reload crond.

    You could probably do the same just as easily using the DSM Task Scheduler.