• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

Running a plugin on one node

Scheduled Pinned Locked Moved Technical Support
9 Posts 3 Posters 2.5k Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • BriB Offline
    BriB Offline
    Bri Community Rep
    wrote on last edited by
    #1

    Hey guys, was wondering if there was a way to have nodebb run a plugin on the main instance? For plugins like nodebb-plugin-camo, if local camo is selected, it will try to spin up a camo instance for each node in a cluster setup (cluster of size 3 -> 3 camo nodes)

    yariplusY 1 Reply Last reply
    0
  • barisB Offline
    barisB Offline
    <baris> NodeBB
    wrote on last edited by
    #2
    if (nconf.get('isPrimary') === 'true') {
       // do stuff only on the primary node
    }
    

    If you have nodebb running on multiple machines you can also add jobsDisabled: true to config.json on some of the machines and check for it in your code.

    As in

    if (nconf.get('isPrimary') === 'true' && !nconf.get('jobsDisabled')) {
       // do stuff on the primary node and only if jobs not disabled
    }
    
    1 Reply Last reply
    1
  • yariplusY Offline
    yariplusY Offline
    yariplus Community Rep
    replied to Bri on last edited by
    #3

    @Bri Hi. I have not thoroughly tested camo in a clustered environment yet, but currently in a 3 cluster setup, when it tries to spin up 3 nodes, 2 of them should silently fail, because they cannot all bind to the camo port.

    I'll add baris's code to the next update so that it only tries to spawn once.

    1 Reply Last reply
    0
  • BriB Offline
    BriB Offline
    Bri Community Rep
    wrote on last edited by
    #4

    I thought so too, but when I spin up on my local (on the old version), I see 6 new node processes.

    Just tried it out (with a tiny fix), looking good! I just noticed that I don't seem to get any log output from Camo

    1 Reply Last reply
    0
  • yariplusY Offline
    yariplusY Offline
    yariplus Community Rep
    wrote on last edited by
    #5

    As far as I know, it only sends a message when it's spawned and killed. You're getting nothing at all?

    1 Reply Last reply
    0
  • BriB Offline
    BriB Offline
    Bri Community Rep
    wrote on last edited by
    #6

    nothing 😞

    NodeBB v1.0.3 Copyright (C) 2013-2014 NodeBB Inc.
    This program comes with ABSOLUTELY NO WARRANTY.
    This is free software, and you are welcome to redistribute it under certain conditions.
    For the full license, please visit: http://www.gnu.org/copyleft/gpl.html
    
    Clustering enabled: Spinning up 3 process(es).
    
    27/4 18:10 [67457] - info: Time: Wed Apr 27 2016 18:10:06 GMT-0700 (PDT)
    27/4 18:10 [67457] - info: Initializing NodeBB v1.0.3
    27/4 18:10 [67459] - info: [database] Checking database indices.
    27/4 18:10 [67457] - info: [database] Checking database indices.
    27/4 18:10 [67458] - info: [database] Checking database indices.
    27/4 18:10 [67458] - warn: [socket.io] Clustering detected, you are advised to configure Redis as a websocket store.
    27/4 18:10 [67457] - warn: [socket.io] Clustering detected, you are advised to configure Redis as a websocket store.
    27/4 18:10 [67459] - warn: [socket.io] Clustering detected, you are advised to configure Redis as a websocket store.
    
    27/4 18:10 [67457] - warn: [plugins/load] The following plugins may not be compatible with your version of NodeBB. This may cause unintended behaviour or crashing. In the event of an unresponsive NodeBB caused by this plugin, run `./nodebb reset -p PLUGINNAME` to disable it.
      * nodebb-plugin-import
      * nodebb-plugin-spoilers
    
    27/4 18:10 [67457] - info: NodeBB Ready
    27/4 18:10 [67457] - info: Enabling 'trust proxy'
    27/4 18:10 [67457] - info: NodeBB is now listening on: 0.0.0.0:4567
    27/4 18:10 [67458] - info: NodeBB Ready
    27/4 18:10 [67459] - info: NodeBB Ready
    27/4 18:10 [67458] - info: Enabling 'trust proxy'
    27/4 18:10 [67459] - info: Enabling 'trust proxy'
    27/4 18:10 [67458] - info: NodeBB is now listening on: 0.0.0.0:4568
    27/4 18:10 [67459] - info: NodeBB is now listening on: 0.0.0.0:4569
    
    1 Reply Last reply
    0
  • yariplusY Offline
    yariplusY Offline
    yariplus Community Rep
    wrote on last edited by
    #7

    Dang, no idea why that would happen. Is everything else working?

    1 Reply Last reply
    0
  • BriB Offline
    BriB Offline
    Bri Community Rep
    wrote on last edited by
    #8

    Yeah, incoming PR. So weird.

    1 Reply Last reply
    0
  • BriB Offline
    BriB Offline
    Bri Community Rep
    wrote on last edited by
    #9

    Thanks for this @yariplus! So I'm trying to run a three-node cluster on 1GB of ram... needless to say things are a bit... crowded in terms of memory haha.

    1 Reply Last reply
    0

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development