Giter VIP home page Giter VIP logo

Comments (1)

msigwart avatar msigwart commented on May 24, 2024

Came across the same issue for the distroless images and solved it by creating a modified Docker image with a built-in node-based health check for Soketi:

  1. Create a health check script for Node.
// healthcheck.js
#!/usr/bin/env node

const http = require('node:http');

const options = {
    hostname: 'localhost',
    port: process.env.SOKETI_PORT || 6001,
    path: '/',
    method: 'GET'
};

http.request(options, res => {
    let body = '';

    res.on('data', chunk => {
        body += chunk;
    });

    res.on('end', () => {
        if (body === 'OK') {
            process.stdout.write('We are healthy!');
            process.exit(0);
        } else {
            process.stdout.write('Uh oh, we are not healthy!');
            process.exit(1);
        }
    });
})
    .on('error', () => {
        process.stdout.write('Uh oh, we are not healthy!');
        process.exit(1);
    })
    .end();
  1. Create a Dockerfile based off the distroless Soketi image:
# Dockerfile
FROM quay.io/soketi/soketi:1.6-16-distroless
COPY docker/healthcheck.js /app/
  1. Build the Docker image:
docker build -t soketi-with-healthcheck .
  1. After building and running the Docker image, you can perform the healthcheck by running:
docker exec -i -t soketi-with-healthcheck /nodejs/bin/node healthcheck.js

Or if you're deploying the Docker container in AWS ECS for example, define the healthcheck in your container task definition like this:

          HealthCheck:
            Command: [ "CMD", "/nodejs/bin/node", "healthcheck.js" ]
            Interval: 5
            Retries: 3
            Timeout: 2

from soketi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.