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

clever-compose

v1.0.1

Published

Simple CLI used to create docker-compose files for your project based on user created templates.

Downloads

9

Readme

Clever Compose

Simple CLI used to create docker-compose files for your project based on user created templates.

Contents

Background

We like docker and docker-compose. We like them a lot. We like them so much, that we're developing this project. But why this idea? It's simple. We create a lot of compose files to run our apps in proper way, and deploy them on the server. At some point, we were starting to see, that there is no tool to help us create docker-compose.yml without digging into documentation, and save some repetitive services to create next compose files quicker, without running into problems and errors. So here we are in this repository.

Clever-compose helps you create docker-compose.yml by asking you some questions and options to choose, and at the end the CLI will create a file for you, based on yours answers! Pretty helpful right? But we didn't stop there. You can also export repeatable services from your docker-compose.yml files save them as a templates in CLI, and use them later. BUT WE DIDN'T STOP THERE! You can write some use special variables in exported templates, and next time - when you will be creating compose file and importing your templates - CLI will ask you for values for these variables and exports services with values typed in CLI.

Requirements

Node Package Manager (NPM) - To install follow instructions here

Instalation

In terminal write npm i -g clever-compose

Usage

  • If you want to create docker-compose based on prepared questions and options, just type:
> clever-compose
  • If you want to export service from docker-compose which then can be imported in cli use:
> clever-compose -e <docker-compose_path>

Development

Instalation

  • Clone project
  • npm install

Commands

Run npm run <script>

Scripts:

  • build - builds project
  • build:watch - builds project which reloads on save
  • lint - check for style problems
  • lint:watch - run linting which reloads on save
  • fix - fix simple code style problems with eslint
  • dev - run application
  • dev:watch - run development server which reloads on save
  • test:unit - run unit tests
  • test:watch - run tests which reloads on save

Features

  1. Simple questions and options help you crate docker-compose.yml with low effort:
  1. Export service, and import it later:
  1. Use variables in template, to fill them with values in CLI:

Templates

  1. Let's assume, that you have docker-compose.yml file which looks like this:
version: '3'
services:
  my_app_postgres:
    container_name: my.app.postgress
    image: postgres:latest
    env_file:
     - env
    expose:
     - "5432"

  my_app_django:
    container_name: my.app.django
    build: ./django
    ports:
      - "3000:3000"
    env_file:
     - env
    volumes:
     - ./django:/app
    depends_on:
     - my_app_postgres

  my_app_redis:
    container_name: my.app.redis
    restart: unless-stopped
    image: redis:latest
    expose:
    - "6379"
  1. Go to directory with this file and type command:
> clever-compose -e ./docker-compose.yml
  1. Clever-compose will ask you a question:
? Select services to extract
( ) my_app_postgres
( ) my_app_django
( ) my_app_redis
  1. Select services (fe. my_app_postgres) to export. CLI will export them to dir: $HOME/clever-compose/templates

  2. Go to there, and edit my_app_postgres.yml with something like this:

my_app_postgres:
    container_name: my.app.postgress
    image: postgres:latest
    env_file:
     - ${env_file}
    expose:
     - "${expose_port}"
  1. Next time, when you will be creating docker-compose (with 3-4 services) and you will try to import this template as one of the services, CLI will ask you to provide values for env_file and expose_port.

Thanks to that you don't need to copy, paste and replace some text about this service made from postgres db. You need to fill only values, that you specified.