fedwiki / wiki

Federated Wiki - node server as npm package
https://npmjs.org/package/wiki
Other
341 stars 74 forks source link

Installing federated wiki on cPanel node.js #114

Closed coevolving closed 5 years ago

coevolving commented 6 years ago

My hosting provider (Planethoster) offers node.js under cPanel. I'm still a newbie on Node, so some guidance on getting federated wiki running would be appreciated (and could enlarge the community as cPanel hosting is more popular than Node.js hosting).

To create a new subdomain, the choices in cPanel 74.0.9 for Node.js versions include 10.11.0, 6.14.3, 8.11.3 and 9.11.2. I've selected the latest version.

image

Selecting the "Create" button leads to some additional instructions from cPanel. 20181021_130632_wiki-coevolving

Enter to the virtual environment. To enter to virtual environment, run the command: source /home/coXXXXXX/nodevenv/wiki.coevolving.com/10/bin/activate

I logged in via SSH, and ran that activate command. Restarting node.js and browsing to wiki.coevolving.com , I can see:

Hello World from Node.js v10.11.0

Following https://github.com/fedwiki/wiki ...

$ npm install -g wiki
npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
/home/coXXXXXX/nodevenv/wiki.coevolving.com/10/lib/bin/wiki -> /home/coXXXXXX/nodevenv/wiki.coevolving.com/10/lib/lib/node_modules/wiki/index.js
/home/coXXXXXX/nodevenv/wiki.coevolving.com/10/lib/bin/wiki-migrate -> /home/coXXXXXX/nodevenv/wiki.coevolving.com/10/lib/lib/node_modules/wiki/scripts/wiki-migrate.js
+ wiki@0.15.0
added 269 packages from 253 contributors in 10.122s

$ wiki
-bash: wiki: command not found

$ ls
app.js  cgi-bin  node_modules  package-lock.json  public  tmp

So that doesn't seem to be the way to start up the wiki server. This leaves me with some questions:

  1. Should I be worried about the move of coffee-script to coffeescript?
  2. It looks like the wiki server isn't running. Is there something else I should specify in the SSH terminal? Or via the browser to cPanel, do I need to specify:
    • (a) Application URL (beyond wiki.coevolving.com) ?
    • (b) Application startup file (other than app.js) ?
    • (c) Since "Detected configuration files" says "package.json file is required", should I have done something before running "npm install" ? (The button to "Run NPM Install" is greyed out, so I did that via SSH).

I had previously been running federated wiki on Openshift. Since node.js is (supposedly) offered on cPanel, this would be a better path for me. (I have a lot of other PHP-based packages on my provider).

paul90 commented 6 years ago

Looking at the output from the install the wiki command is at /home/coXXXXXX/nodevenv/wiki.coevolving.com/10/lib/bin/wiki.

That said the screen image mentions both a app startup and package.json. So, I suspect it wants to find the application code your home directory, the Planethoster support page for Node.js says they have put a basic app there, it mentions using FTP. Which suggest it is not expecting you to use NPM to install the app files (other than its dependencies).

I would imagine that like Openshift we would need a minimal wrapper, replicating the wiki package function, that you can FTP up to the server.

coevolving commented 6 years ago

Thanks @paul90 for telling me that I was on the wrong path.

Watching the video "How to Setup a Node js App - PlanetHoster World" | Aug. 2016 at https://www.youtube.com/watch?v=vLdjEYWVHps shows an alternate interface to the standard cPanel, on which node.js can be set up. This doesn't change the description above, because once we're into SSH, we're about at the same place. I can get to "Hello World from Node.js v10.11.0".

In the video, I discovered that there may be some configuration work to be done, because there's Passenger underneath. The video goes on a lot farther than I need (I think), because it's targeting to install the app in a subdirectory, whereas I'm targeting a subdomain.

I've found a helpful parallel in "Comment installer Ghost sur un serveur mutualisé (Planethoster)" | Sofiane Benabdallah | February 19, 2018 at http://sofianebenabdallah.org/ghost-serveur-mutualise/ . (It looks like there may just be a search-and-replace of the port number for "passenger".

Since there's a package.json at https://github.com/paul90/wiki-openshift-quickstart , does this provide a good starting point for installing on a cPanel site?

coevolving commented 6 years ago

Using https://github.com/paul90/wiki-openshift-quickstart as starting point, git doesn't work when I SSH into the cPanel hosting. After doing the initial setup via the browser as shown above, here's the progress so far.

After the subdomain is set up, node.js seems to be running.

It works!
NodeJS 10.11.0

Into SSH ..

[~]$ cd wiki.coevolving.com
[wiki.coevolving.com]$ ls
app.js  public  tmp
[wiki.coevolving.com]$ nano app.js

In the browser, the current "Application startup file" is app.js. Here's what we see inside.

var http = require('http');
var server = http.createServer(function(req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    var message = 'It works!\n',
        version = 'NodeJS ' + process.versions.node + '\n',
        response = [message, version].join('\n');
    res.end(response);
});
server.listen();

Since git doesn't work, let's follow the Ghost example, and pull down a zip file.

[wiki.coevolving.com]$ curl -L https://github.com/paul90/wiki-openshift-quickstart/archive/master.zip -o wiki-quickstart.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   137    0   137    0     0    290      0 --:--:-- --:--:-- --:--:--   290
  0     0    0 29680    0     0  44528      0 --:--:-- --:--:-- --:--:-- 44528
[wiki.coevolving.com]$ ls
app.js  public  tmp  wiki-quickstart.zip

[wiki.coevolving.com]$ unzip -uo wiki-quickstart.zip -d .
Archive:  wiki-quickstart.zip
a8ae8baeec996586651344d1960a6b21c08a4f64
   creating: ./wiki-openshift-quickstart-master/
 extracting: ./wiki-openshift-quickstart-master/.gitignore  
   creating: ./wiki-openshift-quickstart-master/.openshift/
   creating: ./wiki-openshift-quickstart-master/.openshift/action_hooks/
  inflating: ./wiki-openshift-quickstart-master/.openshift/action_hooks/README.md  
  inflating: ./wiki-openshift-quickstart-master/.openshift/action_hooks/build  
  inflating: ./wiki-openshift-quickstart-master/.openshift/action_hooks/deploy  
  inflating: ./wiki-openshift-quickstart-master/.openshift/action_hooks/post_deploy  
  inflating: ./wiki-openshift-quickstart-master/.openshift/action_hooks/post_start_nodejs  
    linking: ./wiki-openshift-quickstart-master/.openshift/action_hooks/post_start_nodejs-0.6  -> post_start_nodejs 
  inflating: ./wiki-openshift-quickstart-master/.openshift/action_hooks/post_stop_nodejs  
    linking: ./wiki-openshift-quickstart-master/.openshift/action_hooks/post_stop_nodejs-0.6  -> post_stop_nodejs 
  inflating: ./wiki-openshift-quickstart-master/.openshift/action_hooks/pre_build  
  inflating: ./wiki-openshift-quickstart-master/.openshift/action_hooks/pre_start_nodejs  
    linking: ./wiki-openshift-quickstart-master/.openshift/action_hooks/pre_start_nodejs-0.6  -> pre_start_nodejs 
  inflating: ./wiki-openshift-quickstart-master/.openshift/action_hooks/pre_stop_nodejs  
    linking: ./wiki-openshift-quickstart-master/.openshift/action_hooks/pre_stop_nodejs-0.6  -> pre_stop_nodejs 
   creating: ./wiki-openshift-quickstart-master/.openshift/cron/
  inflating: ./wiki-openshift-quickstart-master/.openshift/cron/README.cron  
   creating: ./wiki-openshift-quickstart-master/.openshift/cron/daily/
 extracting: ./wiki-openshift-quickstart-master/.openshift/cron/daily/.gitignore  
   creating: ./wiki-openshift-quickstart-master/.openshift/cron/hourly/
 extracting: ./wiki-openshift-quickstart-master/.openshift/cron/hourly/.gitignore  
   creating: ./wiki-openshift-quickstart-master/.openshift/cron/minutely/
 extracting: ./wiki-openshift-quickstart-master/.openshift/cron/minutely/.gitignore  
   creating: ./wiki-openshift-quickstart-master/.openshift/cron/monthly/
 extracting: ./wiki-openshift-quickstart-master/.openshift/cron/monthly/.gitignore  
   creating: ./wiki-openshift-quickstart-master/.openshift/cron/weekly/
  inflating: ./wiki-openshift-quickstart-master/.openshift/cron/weekly/README  
 extracting: ./wiki-openshift-quickstart-master/.openshift/cron/weekly/chrono.dat  
 extracting: ./wiki-openshift-quickstart-master/.openshift/cron/weekly/chronograph  
  inflating: ./wiki-openshift-quickstart-master/.openshift/cron/weekly/jobs.allow  
  inflating: ./wiki-openshift-quickstart-master/.openshift/cron/weekly/jobs.deny  
   creating: ./wiki-openshift-quickstart-master/.openshift/lib/
  inflating: ./wiki-openshift-quickstart-master/.openshift/lib/setup_custom_nodejs_env  
  inflating: ./wiki-openshift-quickstart-master/.openshift/lib/utils  
   creating: ./wiki-openshift-quickstart-master/.openshift/markers/
 extracting: ./wiki-openshift-quickstart-master/.openshift/markers/.gitkeep  
  inflating: ./wiki-openshift-quickstart-master/.openshift/markers/NODEJS_VERSION  
  inflating: ./wiki-openshift-quickstart-master/.openshift/markers/README.md  
  inflating: ./wiki-openshift-quickstart-master/CHANGES.md  
  inflating: ./wiki-openshift-quickstart-master/LICENSE  
  inflating: ./wiki-openshift-quickstart-master/OPENSHIFT.md  
  inflating: ./wiki-openshift-quickstart-master/README.md  
  inflating: ./wiki-openshift-quickstart-master/cli.coffee  
  inflating: ./wiki-openshift-quickstart-master/farm.coffee  
   creating: ./wiki-openshift-quickstart-master/node_modules/
 extracting: ./wiki-openshift-quickstart-master/node_modules/.gitkeep  
  inflating: ./wiki-openshift-quickstart-master/node_modules/read.me  
  inflating: ./wiki-openshift-quickstart-master/package.json  
   creating: ./wiki-openshift-quickstart-master/scripts/
  inflating: ./wiki-openshift-quickstart-master/scripts/wiki-migrate.js  
  inflating: ./wiki-openshift-quickstart-master/server.js  
finishing deferred symbolic links:
  ./wiki-openshift-quickstart-master/.openshift/action_hooks/post_start_nodejs-0.6 -> post_start_nodejs
  ./wiki-openshift-quickstart-master/.openshift/action_hooks/post_stop_nodejs-0.6 -> post_stop_nodejs
  ./wiki-openshift-quickstart-master/.openshift/action_hooks/pre_start_nodejs-0.6 -> pre_start_nodejs
  ./wiki-openshift-quickstart-master/.openshift/action_hooks/pre_stop_nodejs-0.6 -> pre_stop_nodejs

[wiki.coevolving.com]$ ls
app.js  public  tmp  wiki-openshift-quickstart-master  wiki-quickstart.zip

Let's move the content from the wiki-openshift-quickstart-master subdirectory into the main (wiki.coevolving.com) directory:

[wiki.coevolving.com]$ mv -v wiki-openshift-quickstart-master/* .
'wiki-openshift-quickstart-master/CHANGES.md' -> './CHANGES.md'
'wiki-openshift-quickstart-master/LICENSE' -> './LICENSE'
'wiki-openshift-quickstart-master/OPENSHIFT.md' -> './OPENSHIFT.md'
'wiki-openshift-quickstart-master/README.md' -> './README.md'
'wiki-openshift-quickstart-master/cli.coffee' -> './cli.coffee'
'wiki-openshift-quickstart-master/farm.coffee' -> './farm.coffee'
'wiki-openshift-quickstart-master/node_modules' -> './node_modules'
'wiki-openshift-quickstart-master/package.json' -> './package.json'
'wiki-openshift-quickstart-master/scripts' -> './scripts'
'wiki-openshift-quickstart-master/server.js' -> './server.js'

[wiki.coevolving.com]$ ls
CHANGES.md  OPENSHIFT.md  app.js      farm.coffee   package.json  scripts    tmp                               wiki-quickstart.zip
LICENSE     README.md     cli.coffee  node_modules  public        server.js  wiki-openshift-quickstart-master

I'm not really sure when the "activate" should be done, but let's try it now.

[wiki.coevolving.com]$ /home/coevtmfb/nodevenv/wiki.coevolving.com/10/bin/activate
'activate' script should be sourced, not run directly

On cPanel, I can restart the app, but it doesn't seem to do anything different.

image

At http://sofianebenabdallah.org/ghost-serveur-mutualise/ , it looks like the triggering file is not app.js, but index.js ... that is renamed as app.js.

So, at this point.

(1) I'm not sure if having having the wiki-openshift-quickstart files in the right locations gets us any further ahead;

(2) cPanel doesn't seem to pick up that there's a package.json now in the immediate directory (and the and "Run NPM Install" button is still greyed out; and

(3) Since app.js isn't connected to the wiki, I'm still getting "It works! NodeJS 10.11.0" as response to surfing to the site.

paul90 commented 6 years ago

If I remember correctly, that old openshift quickstart uses a load of openshift environment variables to configure itself, and also uses a quite old version of wiki.

The ideas it uses, of being a special version of the wiki package, is I believe the correct approach. Might be better to use this repo, wiki, as the starting point. I will have a look in the morning.

coevolving commented 6 years ago

Good, @paul90 , I'll use this wiki repo as the starting point.

[~]$ cd wiki.coevolving.com
[wiki.coevolving.com]$ ls
app.js  public  tmp

[wiki.coevolving.com]$ curl -L https://github.com/fedwiki/wiki/archive/master.zip -o wiki-master.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   117    0   117    0     0    308      0 --:--:-- --:--:-- --:--:--   307
  0     0    0 14273    0     0  22883      0 --:--:-- --:--:-- --:--:-- 22883
[wiki.coevolving.com]$ ls
app.js  public  tmp  wiki-master.zip

[wiki.coevolving.com]$ unzip -uo wiki-master.zip -d .
Archive:  wiki-master.zip
de2803049abc87da8cb32e98761995bcee123f4f
   creating: ./wiki-master/
 extracting: ./wiki-master/.gitignore  
  inflating: ./wiki-master/AUTHORS.txt  
  inflating: ./wiki-master/Gruntfile.js  
  inflating: ./wiki-master/LICENSE.txt  
  inflating: ./wiki-master/ReadMe.md  
  inflating: ./wiki-master/cli.coffee  
  inflating: ./wiki-master/contributing.md  
  inflating: ./wiki-master/db-page-stores.md  
  inflating: ./wiki-master/farm.coffee  
  inflating: ./wiki-master/index.js  
  inflating: ./wiki-master/package.json  
   creating: ./wiki-master/scripts/
  inflating: ./wiki-master/scripts/wiki-migrate.js  
  inflating: ./wiki-master/security.md  

[wiki.coevolving.com]$ ls
app.js  public  tmp  wiki-master  wiki-master.zip

[wiki.coevolving.com]$ mv -v wiki-master/* .
'wiki-master/AUTHORS.txt' -> './AUTHORS.txt'
'wiki-master/Gruntfile.js' -> './Gruntfile.js'
'wiki-master/LICENSE.txt' -> './LICENSE.txt'
'wiki-master/ReadMe.md' -> './ReadMe.md'
'wiki-master/cli.coffee' -> './cli.coffee'
'wiki-master/contributing.md' -> './contributing.md'
'wiki-master/db-page-stores.md' -> './db-page-stores.md'
'wiki-master/farm.coffee' -> './farm.coffee'
'wiki-master/index.js' -> './index.js'
'wiki-master/package.json' -> './package.json'
'wiki-master/scripts' -> './scripts'
'wiki-master/security.md' -> './security.md'

[wiki.coevolving.com]$ ls
AUTHORS.txt   LICENSE.txt  app.js      contributing.md    farm.coffee  package.json  scripts      tmp          wiki-master.zip
Gruntfile.js  ReadMe.md    cli.coffee  db-page-stores.md  index.js     public        security.md  wiki-master

[wiki.coevolving.com]$ source /home/coevtmfb/nodevenv/wiki.coevolving.com/10/bin/activate

[wiki.coevolving.com (10)] [wiki.coevolving.com]$ npm install
npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated nsp@2.8.1: The Node Security Platform service is shutting down 9/30 - https://blog.npmjs.org/post/175511531085/the-node-security-platform-service-is-shutting
npm WARN deprecated hoek@2.16.3: The major version is no longer supported. Please update to 4.x or newer
npm notice created a lockfile as package-lock.json. You should commit this file.
added 268 packages from 253 contributors and audited 927 packages in 12.099s
found 7 vulnerabilities (2 low, 4 moderate, 1 high)
  run `npm audit fix` to fix them, or `npm audit` for details

[wiki.coevolving.com (10)] [wiki.coevolving.com]$ npm audit
npm ERR! code EAUDITNOLOCK
npm ERR! audit Neither npm-shrinkwrap.json nor package-lock.json found: Cannot audit a project without a lockfile
npm ERR! audit Try creating one first with: npm i --package-lock-only

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/coXXXXXX/.npm/_logs/2018-10-22T22_52_58_656Z-debug.log

That's a big step forward. I can run npm install !

However, are there changes from index.js that should be in app.js?

index.js

#!/usr/bin/env node
// **index.js**
require('coffee-script');
require('coffee-script/register')

module.exports = require('./cli');

app.js

var http = require('http');
var server = http.createServer(function(req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    var message = 'It works!\n',
        version = 'NodeJS ' + process.versions.node + '\n',
        response = [message, version].join('\n');
    res.end(response);
});
server.listen();

Following the Ghost installation at http://sofianebenabdallah.org/ghost-serveur-mutualise/ ,

[wiki.coevolving.com (10)] [wiki.coevolving.com]$ mv app.js app_old.js
[wiki.coevolving.com (10)] [wiki.coevolving.com]$ mv index.js app.js

... and then restarting the app provides great progress, because we now have the wiki page (although the formatting isn't there).

image

We're a lot closer!

paul90 commented 6 years ago

That is really strange - is there anything in the server error logs?

coevolving commented 6 years ago

@paul90 Here's the debug log mentioned from the npm install.

2018-10-22T22_52_58_656Z-debug.log

Is there someplace else that I should be looking for logs?

coevolving commented 6 years ago

Where are pages stored? I'm going to eventually have to restore pages that I had written on Openshift installation.

[wiki.coevolving.com]$ ls
AUTHORS.txt   ReadMe.md   cli.coffee         farm.coffee   scripts      wiki-master
Gruntfile.js  app.js      contributing.md    package.json  security.md  wiki-master.zip
LICENSE.txt   app_old.js  db-page-stores.md  public        tmp

[wiki.coevolving.com]$ cd ..
[ ~]$ cd .npm

[.npm]$ ls
JSONStream                  http-signature           serve-static
_cacache                    iconv-lite               set-immediate-shim
_locks                      imurmurhash              setprototypeof
_logs                       index-v5                 sigmund
abbrev                      individual               signal-exit
accepts                     inflight                 sntp
ajv                         inherits                 source-map
align-text                  ini                      split
amdefine                    ipaddr.js                sshpk
anonymous-cli-metrics.json  is-buffer                statuses
array-flatten               is-object                stream-combiner
asn1                        is-typedarray            string-template
assert-plus                 isarray                  string_decoder
async                       isstream                 stringstream
asynckit                    js-beautify              through
aws-sign2                   jsbn                     tough-cookie
aws4                        json-schema              tunnel-agent
balanced-match              json-schema-traverse     tweetnacl
basic-auth                  json-stable-stringify    type-is
bcrypt-pbkdf                json-stringify-safe      uglify-js
bluebird                    jsonfile                 uglify-to-browserify
body-parser                 jsonify                  uid2
boom                        jsonparse                underscore
brace-expansion             jsprim                   unpipe
browser-split               keygrip                  util-deprecate
bytes                       kind-of                  utils-merge
camelcase                   lazy-cache               uuid
camelize                    lodash                   vary
caseless                    longest                  verror
center-align                lru-cache                virtual-dom
client-sessions             map-stream               whatwg-fetch
cliui                       media-typer              wiki
co                          merge-descriptors        wiki-client
coffee-script               method-override          wiki-plugin-activity
coffee-trace                methods                  wiki-plugin-audio
combined-stream             mime                     wiki-plugin-bars
commander                   mime-db                  wiki-plugin-bytebeat
concat-map                  mime-types               wiki-plugin-calculator
config-chain                min-document             wiki-plugin-calendar
content-disposition         minimatch                wiki-plugin-changes
content-type                minimist                 wiki-plugin-chart
cookie                      mkdirp                   wiki-plugin-code
cookie-parser               morgan                   wiki-plugin-data
cookie-signature            ms                       wiki-plugin-factory
cookies                     negotiator               wiki-plugin-favicon
core-util-is                next-tick                wiki-plugin-federatedwiki
cryptiles                   nopt                     wiki-plugin-flagmatic
dashdash                    oauth                    wiki-plugin-force
debug                       oauth-sign               wiki-plugin-future
decamelize                  on-finished              wiki-plugin-grep
delayed-stream              on-headers               wiki-plugin-html
depd                        once                     wiki-plugin-image
destroy                     optimist                 wiki-plugin-line
dom-walk                    parseurl                 wiki-plugin-map
duplexer                    passport                 wiki-plugin-markdown
ecc-jsbn                    passport-github          wiki-plugin-mathjax
editorconfig                passport-google-oauth20  wiki-plugin-metabolism
ee-first                    passport-oauth1          wiki-plugin-method
encodeurl                   passport-oauth2          wiki-plugin-pagefold
error                       passport-strategy        wiki-plugin-paragraph
errorhandler                passport-twitter         wiki-plugin-plugmatic
es6-promise                 path-is-absolute         wiki-plugin-pushpin
escape-html                 path-to-regexp           wiki-plugin-radar
etag                        pause                    wiki-plugin-recycler
ev-store                    pause-stream             wiki-plugin-reduce
event-stream                performance-now          wiki-plugin-reference
express                     persona-pass             wiki-plugin-report
express-hbs                 pkginfo                  wiki-plugin-rollup
extend                      process                  wiki-plugin-roster
extsprintf                  process-nextick-args     wiki-plugin-scatter
fast-deep-equal             proto-list               wiki-plugin-search
finalhandler                proxy-addr               wiki-plugin-transport
flates                      pseudomap                wiki-plugin-video
forever-agent               punycode                 wiki-security-friends
form-data                   qs                       wiki-security-passportjs
forwarded                   range-parser             wiki-server
fresh                       raw-body                 window-size
from                        readable-stream          wordwrap
fs.realpath                 readdirp                 wrappy
getpass                     registry.npmjs.org       write-file-atomic
glob                        repeat-string            x-is-array
global                      request                  x-is-string
graceful-fs                 right-align              xml2js
handlebars                  safe-buffer              xmlbuilder
har-schema                  sanitize-caja            xmldom
har-validator               sax                      xtend
hawk                        seedrandom               xtraverse
hoek                        semver                   yargs
http-errors                 send
coevolving commented 6 years ago

I'm not sure why ... but on cPanel, the button that said "Run NPM Install" is no longer greyed out.

image

I pressed the "Run NPM Install" button, and now the familiar "Welcome Visitors" page appears.

The directory for the pages I've now located in the root directory of my master cPanel account.

[wiki.coevolving.com]$ ls
AUTHORS.txt   LICENSE.txt  app.js      cli.coffee       db-page-stores.md  node_modules  public   security.md  wiki-master
Gruntfile.js  ReadMe.md    app_old.js  contributing.md  farm.coffee        package.json  scripts  tmp          wiki-master.zip

[wiki.coevolving.com]$ ls ../.wiki
pages  status

This means, that despite the fact that I can have multiple addon domains on my (Planethoster) account, the fact that the .wiki directory is in the master account means that I can only install ONE federated instance wiki on that server.

Now, I'm looking for how to configure the login, so I can "own" this federated wiki instance.

paul90 commented 6 years ago

As you have noticed, using the default configuration and putting the wiki in .wiki is really not a good idea.

The best way to solve this is to use a configuration file, to alter the default location the wiki data is stored we could create a config.json with...

{
 "data": "~/wiki.coevolving.com/wiki"
}

Login has change a bit since last time, Persona is no more, so it is either a cheep and cheerful friends security adapter, or configuring OAuth in the PassportJS security adapter.

coevolving commented 6 years ago

Sorry to be pedantic @paul90 , but I'm not sure if what I'm doing is correct.

... alter the default location the wiki data is stored we could create a config.json with...

{ "data": "~/wiki.coevolving.com/wiki" }

I've created a config.json. Did I put this in the right place? I didn't create that new wiki directory, so I may need to do that.

[ wiki.coevolving.com]$ ls
AUTHORS.txt   LICENSE.txt  app.js      cli.coffee   contributing.md    farm.coffee   package.json  scripts      tmp          wiki-master.zip
Gruntfile.js  ReadMe.md    app_old.js  config.json  db-page-stores.md  node_modules  public        security.md  wiki-master 

Launching npm install and restarting the app didn't seem to have the effect.

... a cheep and cheerful friends security adapter ....

When https://github.com/fedwiki/wiki-security-friends reads ...

Launch the wiki server with three additional arguments, security_type, cookieSecret and session_duration.

Do I place that in the app.js (which was the renamed index.js)?

paul90 commented 6 years ago

The location that the script is being run from is one of the possible locations, so it should be the correct place.

Maybe the data parameter needs the full file path, rather than one with ~, it would actually make sense.

You can add the security parameters, so it would be something like...

{
  "data": "....",
  "security_type": "friends",
  "cookieSecret": "some long random string (not this!!!!)",
  "session_duration": "14"
}

If the configuration is getting picked up correctly when you click on the padlock you will login and claim the site, and a random string used as a name will be added into the status/owner.json file. Simply edit that file to replace the name with the one you want to use, and make a note of the value of the secret so you can log back in when your session expires.

WardCunningham commented 6 years ago

Jason Green has expressed interest in running federated wiki via cPanel. Here is the twitter conversation along with a reference to this issue. Jason was an early federated wiki "happening" participant. https://twitter.com/jasongreen/status/1047534364349943808

WardCunningham commented 6 years ago

I wonder if it would be an administrative insecurity if we included a plugin that answered many "where to find file X" questions regarding a running server? Could we actually provide accurate answers? There is the problem that you need it most when the server isn't working.

coevolving commented 6 years ago

My aim is have a documented installation of federated wiki on cPanel written up within a week. I'll leave a breadcrumb here, so that we can share experiences.

My installation has been working, but I haven't fully tested it. I restored a site originally developed on OpenShift in 2016. In two years, the development on fed wiki has continued to progress, so I need to catch up!

(Sorry for the slow response. I've been in Portland at PLoP and PUARL, flying back to Toronto on Oct. 29). Ward and I actually got to meet in person! https://twitter.com/daviding/status/1056069966875611136

paul90 commented 6 years ago

If I remember correctly, when you installed the software you had to edit the code to change the port being listened on to passenger. I wonder if setting it via the configuration file would work, using the port parameter.

coevolving commented 5 years ago

Just to close the loop, I completed instructions for "A federated wiki site on cPanel" | Jan. 1, 2019 at http://coevolving.com/blogs/index.php/archive/a-federated-wiki-site-on-cpanel/ .

WardCunningham commented 5 years ago

Thanks for this.