BLog

ImprintImpressum
PrivacyDatenschutz
DisclaimerHaftung
Downloads 

The new Obsigna BLog authored with ContentTools and backed by ContentCGI

In December 2012 I set up my BLog with WordPress, and while it is really true, that you can get your WP system up and running without major headaches, it comes also with a lot of things that most people did not ask for and usually do not need. In addition, several WordPress themes load web-fonts and the jQuery library from Google's CDN services. I don't want to be tracked, and I don't want my visitors to be tracked either. This attitude alone let me maintain a customized CDN-free albeit up to date WordPress for 6 years by the way of the SVN vendor branches method. Finally - the GDPR was lurking already - WordPress 4.9 introduced visual emoticons from yet another CDN. That was the straw to break the camel's back. So, I looked out for another system.

Back to the roots

BLog is the truncation of weBLog, which means it is a kind of a diary published on the web. For publishing a text with some pictures on the web, we don't need WordPress. We would need some writing tools which store our content into the directory where the web server can find it on visitor's requests. Ideally these writing tools would let us author our diary in WYSIWYG style, and it would be really nice if we could edit our text online. Do we need PHP? No. Do we need MySQL? No. Do we need WordPress for this? No, not either.

We need Anthony Blackshaw's ContentTools frontend for online authoring our content in a WYSIWYG manner, and my ContentCGI backend for storing the changes on the server.

Visitors of our BLog see static web pages only. The editing facility shall be accessed by a special URI which is access protected by HTTP Digest Authentication.

LoadModule auth_digest_module libexec/apache24/mod_auth_digest.so
LoadModule deflate_module libexec/apache24/mod_deflate.so
LoadModule ssl_module libexec/apache24/mod_ssl.so
LoadModule socache_shmcb_module libexec/apache24/mod_socache_shmcb.so
LoadModule proxy_module libexec/apache24/mod_proxy.so
LoadModule proxy_fcgi_module libexec/apache24/mod_proxy_fcgi.so

SetOutputFilter          DEFLATE
SetEnvIfNoCase           Request_URI "\.(?:gif|jpe?g|png)$" no-gzip

Listen                   443
SSLProtocol              All -SSLv2 -SSLv3
SSLCipherSuite           HIGH:!aNULL:!AES128:!SSLv2:!SSLv3
SSLHonorCipherOrder      on

SSLPassPhraseDialog      builtin
SSLSessionCache          "shmcb:/var/run/ssl_scache(512000)"
SSLSessionCacheTimeout   300

<VirtualHost *:80>
   ServerName            content.example.com:80
   RedirectPermanent     / https://content.example.com/
</VirtualHost>

<VirtualHost *:443>
   SetEnv CONTENT_TITLE  "CONTENT EXAMPLE"

   ServerName            content.example.com:443
   ServerAdmin           admin@example.com
   DocumentRoot          "/usr/local/www/ContentCGI/webdocs"

   <Directory "/usr/local/www/ContentCGI/webdocs">
      Require            all granted
   </Directory>

   <LocationMatch "^(/_|/.*/_).*$">
      ProxyPass          "unix:/tmp/ContentCGI.sock|fcgi://content.example.com"
      SSLOptions         +StdEnvVars
   </LocationMatch>

   <Location "/edit/">
      AuthType           Digest
      AuthDigestProvider file
      AuthUserFile       "etc/apache24/ContentEditors.passwd"
      AuthName           ContentEditors
      AuthDigestDomain   /
      Require            valid-user
      ProxyPass          "unix:/tmp/ContentCGI.sock|fcgi://content.example.com/edit/"
      SSLOptions         +StdEnvVars
   </Location>

   SSLEngine             on
   SSLCertificateFile    "etc/letsencrypt/live/example.com/fullchain.pem"
   SSLCertificateKeyFile "etc/letsencrypt/live/example.com/privkey.pem"
</VirtualHost>

ContentCGI is a FastCGI daemon which is to be invoked by the Apache web server in case of requests of said special URI's. It responds to edit, save, create, delete, revive and search requests. The search facility is backed by the Zettair search engine.

In order not to disturb users with links to my management utilities, I placed respective menu items into the favorites bar of my web browser.

The ContentTools and ContentCGI are both available on GitHub. ContentCGI runs out of the box on FreeBSD and macOS. It is extensible by the way of plugins. The ContentCGI package comes with the Hello Responder Delegate plugin, named hello-delegate. This one serves as a template for creating new plugins in order to add more functionality. The shell script delegate-cloner.sh may be used for cloning the hello plugin.

Those, who need a full featured CMS, would want to stay with WordPress, or Drupal etc. Currently, even a commentary facility is not implemented by ContentCGI (which is problematic anyway with the advent of the GDPR). Who needs a web diary only, may want to explore the new system (s. below).


Build, Install and Launch your Web Diary with ContentTools and ContentCGI on FreeBSD in about 5 minutes:

This tutorial assumes, that you got a clean FreeBSD server connected to the internet up and running, and that it got domain names, let's say content.dom, blog.content.dom and www.content.dom, which resolve to your server. The server must be able to respond on the HTTPS port 443. You should also have chosen already a nice site name, in oder not to waste hours for think about the name in the course of the installation - let's say your site name would be Nice Content.

When following the instructions below, you need to replace
- Nice Content - content.dom - blog.content.dom - www.content.dom -
by the actual names, of course.

  1. Login as User root, and install the requisites by the way of the FreeBSD package+ports system:
    pkg install -y py27-certbot
    pkg install -y apache24
    pkg install -y subversion
    pkg install -y libobjc2
    pkg install -y utf8proc
    pkg install -y iconv
    pkg install -y poppler-utils
    pkg install -y clone
    For image processing we would employ GraphicsMagic. The default options drag-in a lot of unfortunate stuff from the GNU Compiler Collection and from X11. Therefore, add the few really needed dependencies of GraphicsMagic from the FreeBSD package repository, and build+install graphic/GraphicsMagick from the ports with a custom option-set.
    pkg install -y webp
    pkg install -y libwmf-nox11
    
    cd /usr/ports/graphics/GraphicsMagick
    make config
    Disable Jasper, OpenMP, X11
    Enable SSE
    make install clean
  2. Get SSL certificates for your domains from letsencrypt.org with the official certbot application:
    certbot certonly --standalone --email admin@content.dom \
    -d content.dom \
    -d blog.content.dom \
    -d www.content.dom
  3. Prepare the installation directory and get the ContentCGI, ContentTools and Zettair sources from GitHub:
    mkdir -p ~/install
    
    cd ~/install
    svn checkout https://github.com/cyclaero/ContentCGI.git/trunk ContentCGI
    svn checkout https://github.com/GetmeUK/ContentTools.git/trunk ContentCGI/ContentTools
    svn checkout https://github.com/cyclaero/zettair.git/trunk/devel/src ContentCGI/plugins/search-delegate/zettair-spider
    
    cd ~/install/ContentCGI
  4. Execute the build and installation script:
    ./bsdinstall.sh install clean
  5. Copy the virtual host configuration file into the Apache Includes directory. It is wise to name the virtual host config file using the desired domain name:
    cp -p apache-vhost.conf /usr/local/etc/apache24/Includes/blog.content.dom.conf
  6. Use the sed command to set the site's title, and to substitute the virtual host dummy domains example.com and content.example.com to the desired site title and domain names, e.g.:
    "Nice Content" - content.dom - blog.content.dom:
    sed -i "" -e "s/CONTENT EXAMPLE/Nice Content/"         /usr/local/etc/apache24/Includes/blog.content.dom.conf
    sed -i "" -e "s/content.example.com/blog.content.dom/" /usr/local/etc/apache24/Includes/blog.content.dom.conf
    sed -i "" -e "s/example.com/content.dom/"              /usr/local/etc/apache24/Includes/blog.content.dom.conf
  7. Create the password digest file of the HTTP Digest authentication for editing the content. Inform your real name, because the system will use this name in the signature of the articles:
    htdigest -c /usr/local/etc/apache24/ContentEditors.passwd ContentEditors "Your Real Name"
  8. We may add more users with the same command but without the -c flag:
    htdigest /usr/local/etc/apache24/ContentEditors.passwd ContentEditors "Author II Real Name"
  9. Use the shell script generate-webdocs.sh for populating the site's directory with an initial set of yet empty web documents, derived from the model files of the content-delegate plugin:
    plugins/content-delegate/generate-webdocs.sh "Nice Content" /usr/local/www/ContentCGI/webdocs
    chown -R www:www /usr/local/www/ContentCGI
    chmod -R o-rwx /usr/local/www/ContentCGI
  10. Check the Apache configuration, the output of the following command should be Syntax OK:
    httpd -t
  11. Enable Apache and ContentCGI in /etc/rc.conf by adding the following lines - make sure the CGI daemon runs as the non-privileged user www:
    clear_tmp_enable="YES"
    apache24_enable="YES"
    ContentCGI_flags="-u www:www -w /usr/local/www/ContentCGI/webdocs"
    ContentCGI_enable="YES"
  12. Start Apache and the ContentCGI Daemon:
    service apache24 start
    service ContentCGI start
  13. Prepare the working directory for the Zettair search engine:
    mkdir -p /var/db/zettair
    chown -R www:www /var/db/zettair
    chmod -R o-rwx /var/db/zettair
  14. Add to /etc/crontab the following lines:
    #
    # call the Zettair spider every minute - it will re-index the articles, if a respective token is present in /var/db/zettair
    *       *       *       *       *       www     /usr/local/bin/spider /usr/local/www/ContentCGI/webdocs/articles > /dev/null 2>&1
  15. Point your browser to your domain and explore the new system.

Copyright © Dr. Rolf Jansen - 2018-06-20 20:59:36

PROMOTION