ITS-Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Nodebb Healthcheck

    Scheduled Pinned Locked Moved IT-Stuff
    1 Posts 1 Posters 580 Views 1 Watching
    Loading More Posts
    • 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.
    • A Offline
      admin
      last edited by

      Hi,

      first we need the check in nodebb/.docker/config

      vi healtcheck.js

      const http = require('http');
      const options = {
          host: '127.0.0.1',
          port: 4567,
          timeout: 2000
      };
      
      const healthCheck = http.request(options, (res) => {
          console.log(`HEALTHCHECK STATUS: ${res.statusCode}`);
          if (res.statusCode == 200) {
              process.exit(0);
          }
          else {
              process.exit(1);
          }
      });
      
      healthCheck.on('error', function (err) {
          console.error('ERROR');
          process.exit(1);
      });
      
      healthCheck.end();
      

      Then we can add the check in our yml File

          healthcheck:
            test: ["CMD", "node", "/opt/config/healthcheck.js"]
            interval: 5s
            timeout: 3s
            retries: 5
            start_period: 15s
      

      To check if everything is Working we can watch docker ps, it should be healthy there or use docker inspeckt

      docker inspect --format='{{json .State.Health}}' <container-id>
      

      Greetings

      1 Reply Last reply Reply Quote 0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • First post
        Last post
      Powered by NodeBB | Contributors