Fixed a problem for me on a new test server too. Thanks @baris !
jongarrison
Posts
-
Looks like your connection to NodeBB was lost, please wait while we try to reconnect. on 1.4.4 -
Estimated Costs?@julian I've had a server under light load on a $5 Digital Ocean for over a year without a crash. The trick seems to be large amounts of swap.
-
Plugin Templates Not Loading - Hello new build system!Found the solution, It turns out that I had missed this blog post before upgrading to 1.4.x:
https://blog.nodebb.org/introducing-the-build-system-in-v1-4-3/
./nodebb build
-
Plugin Templates Not Loading - Hello new build system!Interesting, I had thought they were in /public/templates. Was that in older versions?
In any event, the server wasn't loading new templates coming in with an updated plugin.
I'm in the process of trying out a few things with the server now.
-
Plugin Templates Not Loading - Hello new build system!I recently deployed a new public Ubuntu server with Nodebb 1.4.3 and then upgraded to 1.4.4. For some reason, my plugin's template files are not being loaded into the nodebb/plugin/templates directory now.
Has anyone seen anything like this before?
Locally, when I do a "./nodebb dev" startup I see this in my logs:
6/3 16:14 [28897] - verbose: [plugins] /header.tpl replaced by ...
On my public server I don't see this even when doing the dev start.
To set up this new server, I followed the docs here: https://nodebb.readthedocs.io/en/latest/installing/os/ubuntu.html
Any ideas?
-
Solved - Installation Errors v1.4.3Never mind, it was a simple memory issue that was causing npm install to die.
Fixed with these instructions:
https://www.digitalocean.com/community/tutorials/additional-recommended-steps-for-new-ubuntu-14-04-servers#create-a-swap-file -
Solved - Installation Errors v1.4.3Hi guys,
I'm doing an install of nodebb v1.4.3 on a clean new Ubuntu 16.04 server and following the instructions from:
https://docs.nodebb.org/en/latest/installing/os/ubuntu.htmlThe instructions seem to be evolving nicely, but I ran into an error with he npm dependency installation:
$ sudo npm install --production npm WARN deprecated [email protected]: Please upgrade to 2.2.19 or higher npm WARN deprecated [email protected]: wrench.js is deprecated! You should check out fs-extra (https://github.com/jprichardson/node-fs-extra) for any operations you were using wrench for. Thanks for all the usage over the years. Killed ...] | extract:passport-local: sill gunzTarPerm extractEntry less/bootstrap-rtl/pager-rtl.less $ sudo ./nodebb setup NodeBB could not be started because it's dependencies have not been installed. Please ensure that you have executed "npm install --production" prior to running NodeBB. For more information, please see: https://docs.nodebb.org/en/latest/installing/os.html Could not start: MODULE_NOT_FOUND
Any advice?
Thanks!
-
Want a NodeBB REPL (command line interface)?I wanted to debug some code I had written in my plugin and did a quick search to see if I could create a Node.js REPL that would function in the context of my plugin. It turned out to be quite simple to do.
Just add this to your plugin's static:app.load method:
setTimeout(function() { console.log("About to start REPL"); var repl = require("repl"); var util = require('util'); var replServer = repl.start({ prompt: "swf-cms> ", breakEvalOnSigint: true, ignoreUndefined: true, useGlobal: true, useColors: true }); var context = replServer.context; context.require = require; context.module = module; context.context = util.inspect(replServer.context, {depth: 0}); }, 3000);
You'll want to wrap this in something to prevent it from running outside of dev mode. Also, load up the context object with anything that you want to be conveniently available in the REPL. FYI, I used the setTimeout to give Nodebb a chance to finish loading before it gives you the prompt.
Have fun.
-
Serious error! nodebb.org is in redirect loop (which prevents admin plugins pages from loading)@julian Yikes!
-
Serious error! nodebb.org is in redirect loop (which prevents admin plugins pages from loading)@julian Thanks.
Should something be changed in the acp so that a remote error doesn't prevent management of NodeBB installs everywhere?
-
Serious error! nodebb.org is in redirect loop (which prevents admin plugins pages from loading)I just upgraded to v1.2.1 and I cannot get to the admin plugins page. In my logs I am seeing a redirect loop with the nodebb.org server while it tries to get available plugin data. Unfortunately this error prevents me from even viewing the local installed plugins in the system:
Both:
https://packages.nodebb.org/api/v1/plugins?version=1.2.1
https://packages.nodebb.org/api/v1/plugins
are in a 301 redirect loopErrors from my server logs:
(node:24228) Warning: Possible EventEmitter memory leak detected. 11 pipe listeners added. Use emitter.setMaxListeners() to increase limit
(node:24228) Warning: Possible EventEmitter memory leak detected. 11 end listeners added. Use emitter.setMaxListeners() to increase limit
(node:24228) Warning: Possible EventEmitter memory leak detected. 11 pipe listeners added. Use emitter.setMaxListeners() to increase limit
(node:24228) Warning: Possible EventEmitter memory leak detected. 11 end listeners added. Use emitter.setMaxListeners() to increase limit
9/11 18:13 [24228] - error: Error parsing plugins : Exceeded maxRedirects. Probably stuck in a redirect loop https://packages.nodebb.org/api/v1/plugins?version=1.2.1
9/11 18:13 [24228] - error: Error parsing plugins : Exceeded maxRedirects. Probably stuck in a redirect loop https://packages.nodebb.org/api/v1/pluginsIs anyone else seeing this? Any ideas?
-
Replies to this postFantastic!
-
Using template values in footer.tpl?@baris Yeah, I can see how that would make sense. In custom routes, would developers then have to include both the header middleware and a footer middleware? That sounds reasonable and allows for easy customization.
Is this something that one you guys would want to take on? Or should I write some code and send a pull request?
Thanks!
-
Using template values in footer.tpl?From my spelunking around it appears that use of normal template values in footer.tpl is not possible (aside from {loggedIn}). Should the values available to footer.tpl be the same as the ones available to header.tpl? (Which includes values made available to config via the "filter:config.get" plugin hook).
Would this be the right place to inject the config values into the footer.tpl?
https://github.com/NodeBB/NodeBB/blob/master/src/middleware/header.js#L31-L34Any thoughts from the NodeBB team? I'd be happy to add some code and send a pull request, if you guys are open to a change here.
-
Use my oauth instead of NodeBB plugins@Jonathan-O'Donnell If that example doesn't make sense to you, you should consider hiring the NodeBB team to do what you need done.
-
Passing parameters into template helpers?@julian Agreed. But the goal is good and worthwhile, right?
-
Passing parameters into template helpers?I'm wrapping my head around the templates.js project and I've made some small changes which I think meets my two goals:
- Allow template helpers to receive parameter values outside of a loop.
- Allow template helpers to receive string literals as parameters.
Could somebody (@psychobunny @PitaJ) else review my changes? It seems like changes to templates.js can have some far ranging unintended consequences.
https://github.com/jongarrison/templates.js/commit/a6cda7f003d58e5de6f270aba42b00c8b924fe80
Thanks for any feedback!
-
Passing parameters into template helpers?@PitaJ Thank you! That was a very helpful tip.
That's a curious limitation of the template helpers. It makes sense that we would want to be able to run a template function on a singular value, right?
For other people that are running into questions about templates.js, here is the link to the project. I was looking around inside NodeBB for a while not realizing it was an external dependency:
GitHub - benchpressjs/benchpressjs: ultralight javascript templating framework
ultralight javascript templating framework. Contribute to benchpressjs/benchpressjs development by creating an account on GitHub.
GitHub (github.com)
-
Passing parameters into template helpers?Hi,
I've created a client and a server template helper that has been correctly registered for both server and client side use. I'm able to see logging messages showing the the methods are being called both on client and server template renders. However, I don't seem to be able to pass any parameters into the functions.Am I using the right syntax to embed my template helper?
In the template, I've tried a few ways to call the template helper without luck:
<img src="{function.someHelperFunction, someAvailableObject.subObject.value}"> <img src="{function.someHelperFunction, someAvailableObject}">
Server Side template helper:
templates.registerHelper('someHelperFunction', function(value) { winston.verbose("value: ", value); return "http://someurl.com/?zipper=" + value; });
Client Side template helper:
templates.registerHelper('someHelperFunction', function(value) { console.log("value: ", value); return "http://someurl.com/?zipper=" + value; });
In both cases "value" is undefined. Any ideas? What am I doing wrong?
FYI:
I'm running NodeBB 1.1.2, and I've used both of these threads as examples on creating template helpers:
https://community.nodebb.org/topic/3554/how-to-create-and-use-a-template-helper
https://community.nodebb.org/topic/6020/theme-conditional-target-xth-post/3 -
How can I add a section in the Admin Menu?I know this is an old topic, but I just ran into this today and wanted to add an admin nav section in the minimally invasive way possible. This technique worked for me and I'm wondering if anybody has any thoughts about this being a good or bad approach to quickly adding a custom admin navigation menu from a plugin. Any critiques appreciated!
plugin/static/js/admin/custommenu.js:
var adminInitialized = false; $(window).on('action:ajaxify.start', function(data) { if (!adminInitialized) { $('ul#main-menu').append('\ <li class="dropdown menu-item">\ <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Custom Menu</a>\ <ul class="dropdown-menu" role="menu">\ <li><a href="/admin/my-custom-route">Custom Route</a></li>\ </ul>\ </li>'); adminInitialized = true; } });
plugin.json:
"acpScripts": [ "static/js/admin/custommenu.js" ]