Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
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
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. App Packaging & Development
  3. Fastify does not work on custom apps.

Fastify does not work on custom apps.

Scheduled Pinned Locked Moved App Packaging & Development
4 Posts 3 Posters 537 Views 3 Watching
  • 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.
    • P Offline
      P Offline
      pedrocm
      wrote on last edited by
      #1

      I tried to deploy a custom app that a made in fastify (nodejs) build with ESBuild to keep everything in a single file. But an application build with fastify does not complete the health check.

      const fastify = require('fastify')();
      
      fastify.get('/', async (request, reply) => {
        return 'Hello, World!';
      });
      
      const start = async () => {
        try {
          await fastify.listen(3000);
          console.log('Server is running on port 3000');
        } catch (err) {
          console.error(err);
          process.exit(1);
        }
      };
      
      start();
      

      Does any one already deploy a backend api app made with Fastify to cloudron?

      1 Reply Last reply
      0
      • nebulonN Away
        nebulonN Away
        nebulon
        Staff
        wrote on last edited by
        #2

        I am no fastify expert, but the Cloudron healthcheck (defaulting to /) expects a 2hundred something (so like 200, 201, ...) http status code to let is succeed.

        Do you see your route handler being hit every 10seconds for a start and does that route handler reply with a 200 if you just return a string from the function?

        1 Reply Last reply
        0
        • girishG Offline
          girishG Offline
          girish
          Staff
          wrote on last edited by
          #3

          In the CloudronManifest.json be sure to have httpPort to 3000.

          Also, does await fastify.listen(3000); listen on 0.0.0.0 or just localhost ? It should listen on 0.0.0.0 / :: to be able to reachable from outside the container.

          1 Reply Last reply
          0
          • girishG Offline
            girishG Offline
            girish
            Staff
            wrote on last edited by
            #4

            You can check if listen({ host: '0.0.0.0', port: 3000 }) makes it better.

            1 Reply Last reply
            0
            • girishG girish moved this topic from Support on
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Bookmarks
              • Search