Nuthatch Web Publishing App

created May 31, 2018

Yet another web publishing app.

This one will be written in Lua, like Sora, but Nuthatch will function similar to Scaup and Veery.

It will store content in the CouchDB NoSQL database, and it will rely on Elasticsearch for searching.

Pages will cached in Memcached. I never recompiled the Nginx web server to include the Redis module. A few years ago, the Memcached module was included in the default install of Nginx. I'm only using key=value for caching, which is about all that Memcached can do.

Steps

DNS

May 31, 2018: Within my Digital Ocean account, I modified my Soupmode server's DNS. I added a CNAME record for nuthatch.soupmode.com.

CouchDB

May 31, 2018: I created a test development database for Nuthatch.

May 31, 2018: I created an author called "NutHatch".

May 31, 2018: Installed the Lua module for CouchDB. luarocks install luchia. The module requires lualogging which got installed automatically when installing luchia. The luchia module also required lua-cjson, which I already had installed.

https://luarocks.org/modules/thehunmonkgroup/luchia

https://github.com/thehunmonkgroup/luchia

Compatible with Lua 5.1, 5.2, 5.3

100% unit test coverage

Manual:

http://thehunmonkgroup.github.io/luchia/doc/topics/INTRODUCTION.md.html

My old post about using CouchDB, including curl commands.

Elasticsearch

May 31, 2018: I executed the script connect-elasticsearch-to-couchdb.sh which is self-explanatory.

Files

As of May 31, 2018:

Nuthatch /
  couchdb /
    createdb.sh
    dumpdb.sh
    createauthor.sh
    updateauthor.sh
    get-post.lua
    get-post-markup.lua
    get-stream.lua
  elasticsearch /
    connect-elasticsearch-to-couchdb.sh
    search.lua
    search-examples.txt

To-Dos

in couchdb directory, need to create create-views.lua and update-views.lua.

need to exploit the dsl capabilities in elasticsearch for advance searches. requires sending json in a post request to conduct a search.

Jun 20, 2018

Created an Nginx config file. Enabled the beginnings of the API code work through http.

http://nuthatch.soupmode.com/api/v1

http://nuthatch.soupmode.com/api/v1/posts/info


https://github.com/jrsawvel/Sora

https://github.com/jrsawvel/Veery-API-Perl

https://github.com/jrsawvel/Veery-API-Perl/blob/master/docs/veery-api.md

https://github.com/jrsawvel/Veery-API-Perl/blob/master/lib/App/Utils.pm

https://github.com/jrsawvel/Veery-API-Perl/blob/master/lib/App/Stream.pm

http://nuthatch.soupmode.com/api/v1/posts

http://veeryclientperl.soupmode.com/

http://veeryclientnodejs.soupmode.com/

June 29, 2018

-g in curl disables globbing and permits the uri to use brackets.

original url =

<a href="http://127.0.0.1:5984/veerydvlp1/_design/views/_view/tag_search?descending=true&amp;limit=16&amp;skip=0&amp;startkey=">http://127.0.0.1:5984/veerydvlp1/_design/views/_view/tag_search?descending=true&amp;limit=16&amp;skip=0&amp;startkey=</a>["wiki", {}]&amp;endkey=["wiki"]

but parts need encoded, apparently.

curl -g 'http://127.0.0.1:5984/veerydvlp1/_design/views/_view/tag_search?descending=true&amp;limit=16&amp;skip=0&amp;startkey=[%22wiki%22,%20%7B%7D]&amp;endkey=[%22wiki%22]'

https://www.w3schools.com/tags/ref_urlencode.asp

need a lua version of this:

https://metacpan.org/pod/release/MITHUN/URI-Encode-v1.1.1/lib/URI/Encode.pm

July 10, 2018

Search string: "My Web Apps as of August 2015"

Surrounding the string with double quotes makes the search an exact match on the string. Otherwise, posts that contain one or more of the words in the string will be returned too with the most relevant results displayed first.

curl 'http://127.0.0.1:9200/veerydvlp1/veerydvlp1/_search?size=15&amp;q=%2Btype%3Apost+%2Bpost_status%3Apublic+%2Bmarkup%3A%22My+Web+Apps+as+of+August+2015%22&amp;from=0'