{"id":2390,"date":"2015-01-27T17:20:45","date_gmt":"2015-01-27T17:20:45","guid":{"rendered":"http:\/\/wiki.davelevy.info\/?p=2390"},"modified":"2021-05-04T23:48:41","modified_gmt":"2021-05-04T23:48:41","slug":"pump-io-and-microblogging","status":"publish","type":"post","link":"https:\/\/davelevy.info\/wiki\/pump-io-and-microblogging\/","title":{"rendered":"pump.io and microblogging"},"content":{"rendered":"<p>I returned to pump.io in Oct 2016 and again in May 2017 when I rebuilt the page deprecating aged content . The page had remained unchanged since I had to stop my 2015 experiments. <!--more-->In 2015 I&#8217;d got the server software working but had not made a usable solution for either micro blogging, nor for messaging. I hope that the pre-reqs remain\u00a0 node.js, npm, a database server and &#8216;gm&#8217;. I assume that node.js <em>forever<\/em> remains desirable.<\/p>\n<h3>2016<\/h3>\n<p>Here are some links<\/p>\n<ul>\n<li>http:\/\/pump.io\/<\/li>\n<li><a href=\"https:\/\/docs.npmjs.com\/cli\/update\">How to update a node.js package?<\/a><\/li>\n<\/ul>\n<p>I decided to install on a brand new U16 image and there have been some npm install problems. I have worked out how to run mongodb in a docker container.<\/p>\n<p>On my 1st U16 build I was getting errors on the npm installs but after loads of <code>sudo ( apt-get update ; apt-get upgrade )<\/code>, the npm calls work, although with warnings in the case of <code>forever<\/code>. Now onto mongodb.<\/p>\n<h4>mongodb<\/h4>\n<p>This <a href=\"https:\/\/docs.mongodb.com\/manual\/tutorial\/install-mongodb-on-ubuntu\/\">page describes how to install<\/a> and start mongodb. Use <code>apt-get<\/code> to install, I <a href=\"https:\/\/docs.mongodb.com\/v3.2\/reference\/configuration-options\/\">amended the .conf file to invoke smallFiles<\/a>, implemented the recommended service file\u00a0<a title=\"this is a syntactically correct systemd service file, it must be renamed and placed in the \/lib\/systemd\/system\" href=\"https:\/\/davelevy.info\/wiki\/wp-content\/uploads\/2015\/01\/mongod_service.txt\">mongod.service<\/a> and used the <code>service<\/code> command to start and stop as tests.<\/p>\n<p>In May 2017, a moved the smallfiles command from the conf file to the command line in the services file.<\/p>\n<p>It is recommended to run mongod in a non-root user, and that is what the systemd service file mandates and the post install triggers set up the mongo users. The first time mongod is run it performs a db initialisation, if this is done as root, you will need to remove all the files from the database sub-directory before it will run as a non root user because the daemon cannot manipulate the files previously created as root. Doh! I need to check about smallFiles as the alternate way to do this is from the command line.<\/p>\n<p>mongodb file systems require support for <code>fsync<\/code>. It will not work with vbox shared folders. There are also performance reasons for not using NFS. There <a href=\"http:\/\/stackoverflow.com\/questions\/35400740\/how-to-set-docker-mongo-data-volume\">may be some problems in using data volumes<\/a> in Docker. I used <a href=\"https:\/\/docs.docker.com\/engine\/tutorials\/dockervolumes\/\">this page<\/a> to guide me in building the volume structures\/regime.<\/p>\n<p>I built an image, using the instructions here, I pushed it <a href=\"https:\/\/hub.docker.com\/r\/dfl1955\/mongod\/\">to my repo<\/a> and start the image first time using the following code,<\/p>\n<pre>$ docker run -p 27017:27017 --name mongodb-1 -d dfl1955\/mongodb --smallfiles\r\n<\/pre>\n<h4>npm &amp; pump.io<\/h4>\n<p>Install via <code>apt-get install nodejs npm<\/code> using apt-get, for ubuntu symbolically link \/usr\/bin\/nodejs to \/usr\/bin\/node.<\/p>\n<p><code>$ ln \/usr\/bin\/nodejs \/usr\/bin\/node<\/code><\/p>\n<p>Install graphicksmagaick using apt-get, I originally did this using npm.<\/p>\n<p>I have used the manual install route, so mkdir or<\/p>\n<pre>$ cd \/opt\/local\/\r\n$ git clone https:\/\/github.com\/e14n\/pump.io.git\r\n$ cd pump.io \r\n$ npm install -g\r\n$ npm test -g\r\n<\/pre>\n<p>and then<\/p>\n<pre>$ npm install -g databank-mongodb\r\n<\/pre>\n<p>make the jason config file, include the &#8220;serverUser&#8221; parameter and then make the user, this lives by default in \/etc\/pumpio.conf.json, then if you use the dafault loging location, you need to make \/var\/log\/pump but first you need the user<\/p>\n<pre>$ useradd pump\r\n<\/pre>\n<p>then<\/p>\n<pre>sudo mkdir \/var\/log\/pump\r\nsudo chown pump:pump pump\r\n<\/pre>\n<p>Because of vbox, I installed and started samba &amp; mongod obviously.<\/p>\n<p>I made the <a href=\"https:\/\/davelevy.info\/wiki\/wp-content\/uploads\/2015\/01\/pumpio.txt\">pumpio<\/a> config file<\/p>\n<pre>{\r\n    \"driver\":  \"mongodb\",\r\n    \"params\":  {\"hostname\": \"localhost\"},\r\n    \"hostname\": \"davevbu16c\",\r\n    \"secret\":  \"ruislip\",\r\n    \"noweb\":  false,\r\n    \"site\":  \"Awesome Sauce\",\r\n    \"owner\":  \"Dave Levy\",\r\n    \"ownerURL\":  \"http:\/\/davelevy.info\/\",\r\n    \"port\":  80,\r\n    \"address\":  \"0.0.0.0\",\r\n    \"nologger\":  false,\r\n    \"logfile\": \"\/var\/log\/pump\/pumpio.log\",\r\n    \"serverUser\":  \"pump\",\r\n# don't want uploaddir anymore\r\n    \"uploaddir\": \"\/var\/local\/pump.io\/uploads\",\r\n    \"debugClient\": false,\r\n    \"firehose\": \"ofirehose.example\"\r\n}\r\n<\/pre>\n<p>Using the default port caused errors, so I transformed the listener port to 80.<\/p>\n<h3>2015<\/h3>\n<p>I have decided to give <a title=\"the project home page\" href=\"http:\/\/pump.io\/\">pump.io<\/a> a whirl given the constraints of using other&#8217;s micro blogging services products. I last used this when it was laconica. The database server must have a databank client interface which they say means mongodb, couchdb or redis. They recommend mongo as the best default, should be fun.<\/p>\n<p>&nbsp;<\/p>\n<h4><\/h4>\n<p>On Ubuntu, one needs to make a link command to provide the alias of node to \/usr\/bin\/nodejs. See more <a title=\"\/usr\/bin\/env: node: No such file or directory\" href=\"http:\/\/stackoverflow.com\/questions\/26320901\/cannot-install-nodejs-usr-bin-env-node-no-such-file-or-directory\">from Stackoverflow<\/a>.<\/p>\n<p>Installing <em>forever<\/em>, this is another node.js package and needs to be installed using npm. See also <a href=\"https:\/\/www.exratione.com\/2011\/07\/running-a-nodejs-server-as-a-service-using-forever\/\">this article at exratione.com<\/a>, and <a title=\"the forever site at Github\" href=\"https:\/\/github.com\/foreverjs\/forever\">this article at Github<\/a>. forever is needed to set some of the environment, and the use of the -a &amp; -l flags are significant, or more accurately, the -l flag takes an argument, which is the first string after the flag. i.e. -l -a ${filename} doesn&#8217;t work. This <a title=\"Bad options not handled at Forever's GIT ste\" href=\"https:\/\/github.com\/foreverjs\/forever\/issues\/490\">has been bugged here&#8230;<\/a><\/p>\n<p><a href=\"https:\/\/github.com\/foreverjs\/forever\">https:\/\/github.com\/foreverjs\/forever<\/a><\/p>\n<p>Important commands include, forever start application and forever &#8211;help. NB Global installations using npm make links in \/usr\/local\/bin<\/p>\n<p>My notes on packages and parameters have been moved to a comment, dated 2nd May 2017.<\/p>\n<p>I have written a start\/stop script. Wonder if anyone else will find it useful. (Probably not, its LSB compliant.)<\/p>\n<p>To solve the problems related to pump.io itself I need to set the logging on. This will need prettyprint, see <a href=\"http:\/\/www.skorks.com\/2013\/04\/the-best-way-to-pretty-print-json-on-the-command-line\/\">this <\/a>and <a title=\"at stackoverflow\" href=\"http:\/\/stackoverflow.com\/questions\/352098\/how-can-i-pretty-print-json\">this<\/a>. Looks like python will be helpful.<\/p>\n<p>This might be best encapsulated using Docker.<\/p>\n<p>&nbsp;<\/p>\n<p>Some more links to help with mongo,<\/p>\n<ol>\n<li><a href=\"http:\/\/docs.mongodb.org\/manual\/reference\/configuration-options\/#systemLog.component.storage.verbosity\">http:\/\/docs.mongodb.org\/manual\/reference\/configuration-options\/#systemLog.component.storage.verbosity<\/a><\/li>\n<li><a href=\"http:\/\/stackoverflow.com\/questions\/17708897\/how-to-get-pump-io-oauth-consumer-key\">http:\/\/stackoverflow.com\/questions\/17708897\/how-to-get-pump-io-oauth-consumer-key<\/a><\/li>\n<li><a href=\"http:\/\/stackoverflow.com\/questions\/14181047\/how-to-set-permernent-dbpath-for-mongodb\">http:\/\/stackoverflow.com\/questions\/14181047\/how-to-set-permernent-dbpath-for-mongodb<\/a><\/li>\n<li><a href=\"http:\/\/stackoverflow.com\/questions\/10805782\/how-to-run-mongo-db-as-service-using-non-default-dbpath\">http:\/\/stackoverflow.com\/questions\/10805782\/how-to-run-mongo-db-as-service-using-non-default-dbpath<\/a><\/li>\n<li><a href=\"https:\/\/web.archive.org\/web\/20150317222413\/http:\/\/info.mongodb.com\/rs\/mongodb\/images\/10gen-MongoDB_Operations_Best_Practices.pdf\">http:\/\/info.mongodb.com\/rs\/mongodb\/images\/10gen-MongoDB_Operations_Best_Practices.pdf<\/a><\/li>\n<li><a href=\"https:\/\/web.archive.org\/web\/20150930052443\/http:\/\/docs.mongodb.org:80\/manual\/reference\/command\/copydb\/\">http:\/\/docs.mongodb.org\/manual\/reference\/command\/copydb\/<\/a><\/li>\n<\/ol>\n<p>Maybe I need a separate snip for mongo.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I returned to pump.io in Oct 2016 and again in May 2017 when I rebuilt the page deprecating aged content . The page had remained unchanged since I had to stop my 2015 experiments.<\/p>\n","protected":false},"author":1,"featured_media":2409,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","_share_on_mastodon":"0"},"categories":[3],"tags":[1184,322,331,293,330,856,791,911],"class_list":["post-2390","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology","tag-deprecated","tag-javascript","tag-laconica","tag-messaging","tag-microblogging","tag-mongodb","tag-pump-io","tag-technology"],"share_on_mastodon":{"url":"","error":""},"jetpack_featured_media_url":"https:\/\/davelevy.info\/wiki\/wp-content\/uploads\/2015\/01\/pump_iow650.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/posts\/2390","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/comments?post=2390"}],"version-history":[{"count":4,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/posts\/2390\/revisions"}],"predecessor-version":[{"id":5256,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/posts\/2390\/revisions\/5256"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/media\/2409"}],"wp:attachment":[{"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/media?parent=2390"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/categories?post=2390"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/tags?post=2390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}