npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

http-deployer

v1.9.0

Published

Simple deploy HTTP handler

Downloads

9

Readme

Simple HTTP Deploy tool

It will update package version in docker-compose and run commands:

docker-compose -f custom.docker-compose.yml up -d

Previous docker compose file will be saved as {previousDockerComposePath}_{previousImageVersion}

Configuration

Configuration by environment variables:

  • DEPLOYER_PORT - port that Express listen
  • DEPLOYER_CONFIG_PATH - path to JSON file with projects config

JSON config file should contain array, each element have to implement ConfigInterface

Requesting

Request

POST /

Content-Type: application/json

{
  "name": "image-name",
  "tag": "docker-registry.private.com/image-name:1.0.0"
}

Response

Content-Type: application/json

| Http Code | JSON Code | Message | What to do? | |----------- |----------- |------------------------------------------------ |------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | 200 | 0 | Successful | Drink beer | | 403 | -1 | Forbidden | Try to pass valid | | 422 | 101 | Missing name or tag in body | Put JSON body with name and tag fields | | 422 | 102 | {name} deploy does not exist | Configure {name} deploy on server | | 501 | 201 | Compose file does not exist | Fix path to docker-compose file in global configuration | | 501 | 202 | Can not find image name in docker-compose file | Make sure that image specified in docker-compose file. Image name should be placed between " and have 3-digit version after : (example: "image-name:1.0.0) | | 501 | 203 | Invalid {type} time: {invalidTimeFormat} | Make sure that time rules in configuration if specified in format HH:MM:SS | | 500 | 301 | BeforeDeploy Error | Error in some BeforeDeploy script. See deploy logs for details and improve script | | 500 | 302 | DockerDeploy Error | Error while executing docker-compose up -d. See deploy logs for details | | 500 | 303 | AfterDeploy Error | Error in some AfterDeploy script. See deploy logs for details and improve script | | 503 | 403 | Update not available | Try run update considering time specified in time rules |

Notice: message can be changed in minor version. You should not parse it and depend your CI process on it.

Example:

{
  "code": 0,
  "message": "Successful"
}

Request

GET /status/:projectName

Response

Content-Type: application/json

| Http Code | JSON Code | Message | What to do? | |---------- |------------ |--------------------------- |-------------------------------------------------------- | | 200 | 0 | Successful | Order Pizza | | 501 | 201 | Compose file does not exist | Fix path to docker-compose file in global configuration | | 503 | any number | Docker Error | Check executing docker-compose ps on server |

Notice: message can be changed in minor version. You should not parse it and depend your CI process on it.

Example:

{
  "code": 0,
  "message": "Successful",
  "containers": [
    {
      "name": "app-1",
      "state": "Up"
    },
    {
      "name": "app-2",
      "state": "Restarting"
    }
  ]
}

Author

Alexander Letnikow

License

MIT