Coder Social home page Coder Social logo

cliw's People

Contributors

dependabot[bot] avatar jenni avatar kgalli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cliw's Issues

Support `YAML` for main configuration

The main configuration is basically an enriched docker-compose format. Currently it is pretty annoying to go to docker hub to see a docker-compose config sample which has to be ported to JSON before it can be used.

Additionally, the industry seems to have settled to YAML for this kind of configuration.

Add support to specify which docker image version to run

It is often necessary to run a different version of a particular docker image in development to test a Pull Request or similar. To deal with this you have to update the docker-compose / cliw config every time you need this change. Furthermore, it is very easy to get confused which version is running write now. Not to mention that when you need to run several different versions in a kind of testing environment it is unnecessarily complicated to automate the change of the configuration. I recommend adding a feature like cliw service:origin to be able to overwrite the version.

"buildOrigin": {
  "registry": {
    "image": "kgalli/api-service:<This PART IS CHANGABLE VIA CONFIG>"
  }
}

service:origin:set always uses development environment

Currently the service:origin:set does not support environments. Hence if a service is set to SOURCE it will be build from source for all environments.

Expected:

  • the command supports the -e environment option and persists accordingly
  • service started in specific environment rely on what is configured for that environment

Fix running tests locally

The tests work fine after the first run. However, consecutive executions of npm test will raise this error:

  2) lists services run-types

  exec
(node:19506) [EEXIST] Error Plugin: orchestrator: EEXIST: file already exists, mkdir '/Users/jlijo/.config/orchestrator'
module: @oclif/[email protected]
task: toCached
plugin: orchestrator
root: /Users/jlijo/Documents/opensource/orchestrator
See more details with DEBUG=*

Running the tests for first time are creating a folder in this path /Users/jlijo/.config/orchestrator.

Removing the orchestrator folder after each test as a workaround.

Change `--dryRun` switch to `--dry-run`

As --dry-run (kebab-case) is more widely used for CLIs then camel-case.

Example for Up command.

import {flags} from '@oclif/command'

import {dryRunFlag, environmentFlag, servicesFlag} from '../flags'
import DockerComposeCommand from '../wrapper/docker-compose'

export default class Up extends DockerComposeCommand {
  static description = 'build, (re)create, start, and attach to containers'

  static flags = {
    services: servicesFlag,
    environment: environmentFlag,
    'dry-run': dryRunFlag,
    help: flags.help({char: 'h'}),
  }

  async run() {
    const {flags} = this.parse(Up)
    const services = flags.services
    const environment = flags.environment
    const dryRun = flags['dry-run']

    try {
      this
        .dockerCompose(dryRun)
        .up({}, services, environment)
    } catch (e) {
      this.error(`${e.message}\nSee more help with --help`, e)
    }
  }
}

Add `service:setup` command

Currently docker network has to be created manually before a service:[command] e.g. service:start can be executed.

The error:

ERROR: Network cliw_development declared as external, but could not be found. Please create the network manually using `docker network create cliw_development`

Idea is to provide a command which will create necessary docker networks (one for each environment) and optionally also clones defined internal service repositories of those are missing.

Do not allow to set service origin for non-existing service

Let's assume I have a main config that does not have the service with the name "non-existing-service" defined.

When running:

cliw service:origin:set non-existing-service source

Expected
I expect it to fail with the error message that this service is not defined.

Actual
Instead, it updates the service-build-origins.json with this service.

Add tty recognition so docker commands are constructed accordingly

Determine if a command like cliw db:create is run in a tty. If not do not add the -t flag to docker-compose command. Same for -i flag. Only add it when needed.

# https://nodejs.org/api/tty.html
# The preferred method of determining whether Node.js is being run within 
# a TTY context is to check that the value of the process.stdout.isTTY property is true:

$ node -p -e "Boolean(process.stdout.isTTY)"
true
$ node -p -e "Boolean(process.stdout.isTTY)" | cat
false

Add `config` command to manage `projectsConfig`

Currently using the init command the default project is created. Under the hood cliw already supports multiple projects and uses the default project to determine what to do (which projects config to pick) when a command is called.

The missing part is to actually provide a way through the interface that the user can set multiple projects and the default project.

Consider db sub command support for SSL connection settings

As of now the db sub command utilizes docker postgres image and uses "normal" connection setting without the option to specify something like :

psql "service=myservice sslmode=require"
# or
psql [options] -d "dbname=postgres sslmode=require" [other options]
# or 
psql [options] "dbname=postgres sslmode=require"

conninfo string

Consider having a service:list command

It would be useful to have a command like:

cliw service:list

to know all available services that can be started/stopped within the active project.

I know about the cliw service:status, but I think it will not list services that never started.

Add `service:network` (create/list) command(s) to create and list configured networks

Running cliw service:start the first time will end up in and error similar to this:

ERROR: Network demo-network_development declared as external, but could not be found.
Please create the network manually using `docker network create demo-network_development`
and try again.

Even though the error message is really descriptive I think we are better off adding a subcommand that sets up all necessary docker networks.

Move the `config` command to set `runtype` to `service:config`

To set the runtype for a particular service the config:set command is used. Due to the fact that runtype is specific to the service command which wraps docker-compose it should not be supported by the hight level config command.

The idea is to move the command under service:config or more to be more specific under service:runtype.

Add `--project` flag to execute commands on specific projects

As a developer who might work on different projects at the same time I could be interested in being able to run commands on specific projects, so that I don't have to switch cliw contexts when I want to do so.

i.e:
cliw start -p zalenium -s api

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.