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

duraark-microservice-base

v0.2.5

Published

Base docker image and initial Sails.js setup a REST microservice.

Downloads

15

Readme

microservice-base

This is the documentation for 'microservice-base' source. Most likely you are reading this because you are using the generator-duraark scaffolding tool. If not I recommend to check out the project before returning to this page. generator-duraark allows you to scaffold microservices development and deploy environments via a CLI tool.

The microservice-base gives you a sane starting point for developing NodeJS based microservices with SailsJS.

The repository includes:

  • SailsJS for API-layer
  • Mocha test suite integration for SailsJS (based on http://stackoverflow.com/questions/21798840/how-use-mocha-test-framework-with-node-js-and-sails-js)
  • Full Docker support for deployment (see the 'devops' folder)
  • Setup for local testing with and production with PM2 and nodemon.

Installation

  1. Checkout this repository and delete the '.git' folder to be able to add the files to your own revision control system.
  2. Install SailsJS via 'sudo npm -g install sails'

After that you can add you own API logic via the SailsJS CLI (if you are not familiar with SailsJS have a look at the short introduction video).

Local development

For local development nodemon is used as process manager. To start developing locally change into the '_devops' folder and run the script 'serve-dev.sh' there (it is important to change into the _devops directory before, as the scripts are working relativ to this folder!). The SailsJS server is started on port 1337. We are currently not using the more sophisticated PM2 as process manager due to an issue where the service is constantly restarted when using PM2's '--watch' option.

Docker deployment

The 'devops' folder also contains helper scripts for deploying your service via Docker. Two steps are necessary to configure the deployment:

  1. Change the name of your service in ./devops/service-info.txt to your liking
  2. Have a look at the ./Dockerfile. Per default it installs NodeJS and SailsJS and starts the SailsJS server on port 1337.

To deploy the service do the following:

  1. Build the docker container via './devops/docker-build-image.sh'. The docker image will be available as 'local/your-service-name' afterwards.
  2. Start the docker container via './devops/docker-start-container.sh $PORT'.

When the container is started successfully the service is available on $PORT. If no $PORT is given as parameter SailsJS's default port 1337 is assumed.

Debugging the Docker container

The script './devops/docker-run-container.sh' starts the built docker container and gives you an interactive shell for debugging. You can also give the script a custom command as parameter. In this case the container will execute this command when the container starts (the default is '/bin/bash').