{"id":1710,"date":"2019-01-01T21:31:44","date_gmt":"2019-01-02T02:31:44","guid":{"rendered":"http:\/\/coevolving.com\/blogs\/?p=1710"},"modified":"2019-06-03T10:23:57","modified_gmt":"2019-06-03T15:23:57","slug":"a-federated-wiki-site-on-cpanel","status":"publish","type":"post","link":"https:\/\/coevolving.com\/blogs\/a-federated-wiki-site-on-cpanel\/","title":{"rendered":"A federated wiki site on cPanel"},"content":{"rendered":"<p>Since <a href=\"https:\/\/www.planethoster.com\/goph-coevolving-innovations-inc\">my cPanel shared hosting provider<\/a> supports <a href=\"https:\/\/my.planethoster.com\/knowledgebase\/article\/408\/world-icons-languages-nodejs\">node.js hosting<\/a>, installing a\u00a0<a href=\"http:\/\/wiki.coevolving.com\/view\/welcome-visitors\">federated wiki<\/a>\u00a0site beside the usual Softaculous packages is an option. The app requires node.js, and there is a <a href=\"http:\/\/wiki.coevolving.com\/view\/welcome-visitors\/view\/share-cards-openly\">variety of ways to deploy<\/a> that.<\/p>\n<p>In 2014, I had installed a federated wiki site on Openshift, but then didn&#8217;t maintain it as other priorities surfaced.\u00a0 The site is now available at\u00a0<a href=\"http:\/\/wiki.coevolving.com\">http:\/\/wiki.coevolving.com<\/a>, and the prior content has been restored.<\/p>\n<p>The installation isn&#8217;t a one-button procedure.\u00a0 However, an administator comfortable with opening an SSH terminal onto your shared hosting account should be able to follow the steps below.\u00a0 (If you have problems, the federated wiki community hangs out in <a href=\"https:\/\/riot.im\/app\/#\/room\/#fedwiki:matrix.org\">a room on matrix.org<\/a>).<\/p>\n<h3>A. Creating a Subdomain<\/h3>\n<p>(1) Through your browser, from cPanel &#8230; Domains &#8230; , create a <a href=\"https:\/\/documentation.cpanel.net\/display\/76Docs\/Subdomains\">Subdomain<\/a>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1717 size-medium\" src=\"http:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/11\/cPanel_Domains_Subdomains-1-475x124.png\" alt=\"\" width=\"475\" height=\"124\" data-wp-pid=\"1716\" srcset=\"https:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/11\/cPanel_Domains_Subdomains-1-475x124.png 475w, https:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/11\/cPanel_Domains_Subdomains-1.png 607w\" sizes=\"auto, (max-width: 475px) 100vw, 475px\" \/><\/p>\n<ul>\n<li>As an example, I can create a Subdomain <em>wiki<\/em> in the Domain <em>coevolving.com<\/em>, that will actually be stored in my Home (Document Root) as a <em>wiki.coevolving.com<\/em> directory.<\/li>\n<\/ul>\n<p><a href=\"http:\/\/coevolving.com\/blogs\/index.php\/archive\/a-federated-wiki-site-on-cpanel\/subdomain_createasubdomain\/\" rel=\"attachment wp-att-1714\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1714\" src=\"http:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/11\/Subdomain_CreateASubdomain-475x327.png\" alt=\"Subdomain_CreateASubdomain\" width=\"475\" height=\"327\" data-wp-pid=\"1714\" srcset=\"https:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/11\/Subdomain_CreateASubdomain-475x327.png 475w, https:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/11\/Subdomain_CreateASubdomain.png 663w\" sizes=\"auto, (max-width: 475px) 100vw, 475px\" \/><\/a><\/p>\n<h3>B. Installing Federated Wiki<\/h3>\n<p>(2) From cPanel &#8230; Software &#8230; Setup Node.js App.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1718\" src=\"http:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/11\/Software_SetupNodejsApp.png\" alt=\"\" width=\"429\" height=\"159\" data-wp-pid=\"1718\" \/><\/p>\n<ul>\n<li>In the Web Applications list, <em>Create Application<\/em>.\u00a0 As an example, set:\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><em>Node.js version:<\/em> 10.11.0<\/li>\n<li><em>Application mode:<\/em>\u00a0Production<\/li>\n<li><em>Application root:<\/em>\u00a0wiki.coevolving.com<\/li>\n<li><em>Application URL:\u00a0wiki.coevolving.com<\/em><\/li>\n<li><em>Application startup:<\/em>\u00a0app.js<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>(If you leave the\u00a0<em>Application startup<\/em> field blank, <em>app.js<\/em> automatically fills in as the default)<\/li>\n<\/ul>\n<p><a href=\"http:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/11\/NodeJs_CreateApplication.png\" rel=\"lightbox[1710]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1719\" src=\"http:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/11\/NodeJs_CreateApplication-475x411.png\" alt=\"NodeJs_CreateApplication\" width=\"475\" height=\"411\" data-wp-pid=\"1719\" srcset=\"https:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/11\/NodeJs_CreateApplication-475x411.png 475w, https:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/11\/NodeJs_CreateApplication.png 633w\" sizes=\"auto, (max-width: 475px) 100vw, 475px\" \/><\/a><\/p>\n<ul>\n<li>At this point, the node.js environment is not yet activated, as the <em>package.json<\/em> has not yet been downloaded, and the <em>Run NPM Install<\/em> button is greyed out.<\/li>\n<\/ul>\n<p><a href=\"http:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/11\/cPanel_WebApplications_EnterToTheVirtualEnvironment.png\" rel=\"lightbox[1710]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1720\" src=\"http:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/11\/cPanel_WebApplications_EnterToTheVirtualEnvironment-475x410.png\" alt=\"WebApplications_EnterToTheVirtualEnvironment\" width=\"475\" height=\"410\" data-wp-pid=\"1720\" srcset=\"https:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/11\/cPanel_WebApplications_EnterToTheVirtualEnvironment-475x410.png 475w, https:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/11\/cPanel_WebApplications_EnterToTheVirtualEnvironment-768x663.png 768w, https:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/11\/cPanel_WebApplications_EnterToTheVirtualEnvironment-720x621.png 720w, https:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/11\/cPanel_WebApplications_EnterToTheVirtualEnvironment-800x690.png 800w, https:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/11\/cPanel_WebApplications_EnterToTheVirtualEnvironment.png 927w\" sizes=\"auto, (max-width: 475px) 100vw, 475px\" \/><\/a><br \/>\n(3) Open a terminal to your account.\u00a0 Through a browser you could navigate to <a href=\"https:\/\/documentation.cpanel.net\/display\/76Docs\/Terminal+in+cPanel\">cPanel &#8230; Advanced &#8230; Terminal<\/a> ; the more technically proficient will already know how to log in via SSH.<\/p>\n<p><a href=\"https:\/\/documentation.cpanel.net\/display\/76Docs\/Terminal+in+cPanel\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1715\" src=\"http:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/11\/cPanel_Advanced_Terminal.png\" alt=\"cPanel_Advanced_Terminal\" width=\"136\" height=\"101\" data-wp-pid=\"1715\" \/><\/a><\/p>\n<p>(4) Download the current version of the federated wiki code, unzip it, and place it into a directory so that it can be installed with <a href=\"https:\/\/www.npmjs.com\/get-npm\">npm<\/a>.<\/p>\n<ul>\n<li>Change into the directory.\u00a0 Transfer the current version of the fedwiki repository from the Github site to your host (<em>curl <\/em>option<em>-L<\/em> will redo the request if the location has changed;\u00a0<em>-o<\/em> specifies the output file name).<\/li>\n<\/ul>\n<blockquote>\n<pre>cd wiki.coevolving.com \r\ncurl -L https:\/\/github.com\/fedwiki\/wiki\/archive\/master.zip -o wiki-master.zip<\/pre>\n<\/blockquote>\n<ul>\n<li>List the file to ensure it&#8217;s downloaded (<em>ls -lh<\/em> gives a long, human-readable list).\u00a0 Unzip it into a directory (<em>unzip <\/em>options<em> -uo<\/em> extracts newer versions of files already in the current directory and creates any files not already there;<em>\u00a0-d .<\/em> specifies the target directory as the current directory) .<\/li>\n<\/ul>\n<blockquote>\n<pre>ls -lh wiki-master.zip \r\nunzip -uo wiki-master.zip -d .<\/pre>\n<\/blockquote>\n<ul>\n<li>List the directory to ensure that the <em>wiki-master<\/em> directory was created properly (and the <em>package.json<\/em> is in place).\u00a0 Copy the contents from that now-unpacked directory up one level into the current direction (cp \u00a0<em>-r<\/em> recurses directories, <em>-f<\/em> forces overwrites; <em>-p<\/em> preserves datestamps; <em>-v<\/em> gives verbose information;).<\/li>\n<\/ul>\n<blockquote>\n<pre>ls\r\ncp -rfpv wiki-master\/* .<\/pre>\n<\/blockquote>\n<p>(5) If you had previously backed up a federated wiki, the content could now be restored.\u00a0 Upload the file, and unpack the archive.<\/p>\n<blockquote>\n<pre>tar -xvpf archive_wiki.tar.gz<\/pre>\n<\/blockquote>\n<ul>\n<li>&#8230; with\u00a0\u00a0<em>tar\u00a0<\/em>options\u00a0-x (extract); -v (verbose); -p, (preserve-permissions) ; -f\u00a0 (file-archive).<\/li>\n<\/ul>\n<p>(6) Personalizing the federated wiki requires (i) specifying where the data will be stored; (ii) setting up security; and (iii) setting up the site owner name.\u00a0 For a single (or small number) of users, the <a href=\"https:\/\/github.com\/fedwiki\/wiki-security-friends\">friends plugin<\/a> can invoked with the <a href=\"https:\/\/github.com\/fedwiki\/wiki\/issues\/114#issuecomment-432364412\">editing of config.json<\/a>.<\/p>\n<ul>\n<li>If a directory where the content will be stored hasn&#8217;t already been defined, create one, e.g. <em>wiki<\/em>.<\/li>\n<\/ul>\n<blockquote>\n<pre>mkdir wiki\r\n<\/pre>\n<\/blockquote>\n<ul>\n<li>Configure to use friends security, by editing a sample config.json &#8230;<\/li>\n<\/ul>\n<blockquote>\n<pre>cp config.json config-old.json\r\nnano config.json<\/pre>\n<\/blockquote>\n<ul>\n<li>&#8230; with an initial config.json template that looks like &#8230;<\/li>\n<\/ul>\n<blockquote>\n<pre>{\r\n\"data\": \"....\",\r\n\"security_type\": \"friends\",\r\n\"cookieSecret\": \"some long random string (not this!!!!)\",\r\n\"session_duration\": \"14\"\r\n}<\/pre>\n<\/blockquote>\n<ul>\n<li>&#8230; and can be modified to become &#8230;<\/li>\n<\/ul>\n<blockquote>\n<pre>{\r\n\"data\": \"\/home\/coXXXXXX\/wiki.coevolving.com\/wiki\",\r\n\"security_type\": \"friends\",\r\n\"cookieSecret\": \"my_cookieSecret_of_choice\",\r\n\"session_duration\": \"14\"\r\n}<\/pre>\n<\/blockquote>\n<ul>\n<li>As a precaution, make a backup the new <em>config.json<\/em>:<\/li>\n<\/ul>\n<blockquote>\n<pre>cp config.json \"$(date '+%Y-%m-%d')_config.json\"<\/pre>\n<\/blockquote>\n<ul>\n<li>Configure the site with your own user name, by editing a sample <em>owner.json<\/em> &#8230;<\/li>\n<\/ul>\n<blockquote>\n<pre>cp wiki\/status\/owner.json \/wiki\/status\/owner-old.json\r\nnano wiki\/status\/owner.json<\/pre>\n<\/blockquote>\n<ul>\n<li>&#8230; with an initial <em>owner.json<\/em> template that looks like &#8230;<\/li>\n<\/ul>\n<blockquote>\n<pre>{\r\n\"name\": \"Koheni\",\r\n\"friend\": {\r\n\"secret\": \"some long string that you use to reclaim write access\"\r\n}\r\n}<\/pre>\n<\/blockquote>\n<p>&#8230; and can be modified to become &#8230;<\/p>\n<blockquote>\n<pre>{\r\n\"name\": \"daviding\",\r\n\"friend\": {\r\n\"secret\": \"my_write_access_secret\"\r\n}\r\n}<\/pre>\n<\/blockquote>\n<ul>\n<li>As another precaution, backup the new owner.json<\/li>\n<\/ul>\n<blockquote>\n<pre>cp wiki\/status\/owner.json \"$(date '+%Y-%m-%d')_owner.json\"<\/pre>\n<\/blockquote>\n<p>(7) For the <em>cPanel Web Application<\/em>, the <em>Application startup file<\/em> is presumed to be <em>app.js<\/em>.\u00a0 The downloaded package from Github assumed index.js, so let&#8217;s give the environment the filename it expects.<\/p>\n<blockquote>\n<pre>ls *.js\r\nmv app.js app_old.js\r\ncp index.js app.js<\/pre>\n<\/blockquote>\n<p>(8) With the federated wiki files now in the right position, the cPanel instruction to &#8220;Enter into the virtual environment&#8221; can be carried out.<\/p>\n<blockquote>\n<pre>source \/home\/coXXXXXX\/nodevenv\/wiki.coevolving.com\/10\/bin\/activate<\/pre>\n<\/blockquote>\n<ul>\n<li>The <em>source<\/em> command is added to the command specified on the cPanel page, otherwise you&#8217;ll get the message &#8220;&#8216;activate&#8217; script should be sourced, not run directly&#8221;.<\/li>\n<\/ul>\n<p>(9) Returning to cPanel in the browser, reloading the page should now detected the <em>package.json<\/em> configuration file, and <em>Run NPM Install<\/em> button should be available.<\/p>\n<p><a href=\"http:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/12\/20181205_152744_cPanel_node.js_RunNPMInstall.png\" rel=\"lightbox[1710]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1725\" src=\"http:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/12\/20181205_152744_cPanel_node.js_RunNPMInstall-475x485.png\" alt=\"Run NPM Install button is available\" width=\"475\" height=\"485\" data-wp-pid=\"1725\" srcset=\"https:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/12\/20181205_152744_cPanel_node.js_RunNPMInstall-475x485.png 475w, https:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/12\/20181205_152744_cPanel_node.js_RunNPMInstall-768x784.png 768w, https:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/12\/20181205_152744_cPanel_node.js_RunNPMInstall-720x735.png 720w, https:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/12\/20181205_152744_cPanel_node.js_RunNPMInstall-800x817.png 800w, https:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/12\/20181205_152744_cPanel_node.js_RunNPMInstall.png 819w\" sizes=\"auto, (max-width: 475px) 100vw, 475px\" \/><\/a><\/p>\n<ul>\n<li>Select the <em>Run NPM Install<\/em>\u00a0button.\u00a0 (Running <em>npm install<\/em> from the terminal doesn&#8217;t seem to give the same results, as loading the <em>Welcome Visitors<\/em> page in a browser will not be properly formatted).<\/li>\n<\/ul>\n<h3>C. Claiming the Wiki Site<\/h3>\n<p>(10) In your browser, navigate to your wiki page (e.g. wiki.coevolving.com).\u00a0 At the bottom of the page, if you hover over the padlock, you should see a popup to &#8220;Reclaim this Wiki&#8221;<\/p>\n<p><a href=\"http:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/12\/20181205_160427_ReclaimThisWiki.jpg\" rel=\"lightbox[1710]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1726\" src=\"http:\/\/coevolving.com\/blogs\/wp-content\/uploads\/2018\/12\/20181205_160427_ReclaimThisWiki.jpg\" alt=\"Reclaim this Wiki\" width=\"404\" height=\"59\" data-wp-pid=\"1726\" \/><\/a><\/p>\n<ul>\n<li>Selecting the padlock should surface a panel, saying:<\/li>\n<\/ul>\n<blockquote><p>Welcome back &lt;&lt;yourname&gt;&gt;. Please enter your reclaim code to reconnect with your wiki.<\/p><\/blockquote>\n<ul>\n<li>With the &#8220;secret&#8221; you had entered in owner.json, the padlock icon should show as open.<\/li>\n<\/ul>\n<p>(11) Your federated wiki should now be available for collecting pages across the federation, and co-editing.<\/p>\n<h3>D. Maintaining the Wiki Site<\/h3>\n<p>(12) Periodically, it might be prudent to prepare an offline archive of your federated wiki site.\u00a0 On a terminal, pack a directory into a single file (<em>tar<\/em> with options -c (<i>c<\/i>reate); -v (verbose); -p (preserve-permissions); -z (compress to g<em>z<\/em>ip); -f (filename)).<\/p>\n<blockquote>\n<pre>ls wiki\r\ntar -cvpzf \"$(date '+%Y-%m-%d'_wiki).tar.gz\" wiki<\/pre>\n<\/blockquote>\n<ul>\n<li>Download a copy of that tar.gz file to your computer for safekeeping.\u00a0 That backed up wiki directory will include the <em>owner.json<\/em>.<\/li>\n<li>Download a copy of <em>config.json<\/em>.<\/li>\n<\/ul>\n<p>My federated wiki site is at <a href=\"http:\/\/wiki.coevolving.com\">http:\/\/wiki.coevolving.com<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Federated wiki is deployed on a node.js server, an environment which has become available on some cPanel shared hosting providers.  Here are some instructions written while restoring a wiki site originally installed in 2014-2015 on a cloud provider.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[14,10],"tags":[506,410],"class_list":["post-1710","post","type-post","status-publish","format-standard","hentry","category-technologies","category-web-tools","tag-cpanel","tag-federated-wiki"],"_links":{"self":[{"href":"https:\/\/coevolving.com\/blogs\/wp-json\/wp\/v2\/posts\/1710","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coevolving.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coevolving.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coevolving.com\/blogs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/coevolving.com\/blogs\/wp-json\/wp\/v2\/comments?post=1710"}],"version-history":[{"count":14,"href":"https:\/\/coevolving.com\/blogs\/wp-json\/wp\/v2\/posts\/1710\/revisions"}],"predecessor-version":[{"id":1852,"href":"https:\/\/coevolving.com\/blogs\/wp-json\/wp\/v2\/posts\/1710\/revisions\/1852"}],"wp:attachment":[{"href":"https:\/\/coevolving.com\/blogs\/wp-json\/wp\/v2\/media?parent=1710"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coevolving.com\/blogs\/wp-json\/wp\/v2\/categories?post=1710"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coevolving.com\/blogs\/wp-json\/wp\/v2\/tags?post=1710"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}