Coder Social home page Coder Social logo

hedzr / consul-tags Goto Github PK

View Code? Open in Web Editor NEW
12.0 4.0 1.0 214 KB

A CLI tool to Update, add, remove the service tags at consul store.

License: MIT License

Shell 14.08% Go 65.76% Dockerfile 3.55% Makefile 16.61%
consul devops tags modify update consul-service consul-tags cmdr golang

consul-tags's Introduction

Consul Service Tags Modifier

Go GitHub tag (latest SemVer) go.dev license Docker Automated build Docker Pulls

consul-tags can add, remove tag(s) of a consul service (one or all its instances).

Here is a first release for key functionality.

News

v0.7.3

  • upgrade deps

v0.7.1

  • fixed and re-enable docker build

v0.7.0

  • move to go1.17+
  • upgrade to the newest consul api
  • upgrade hedzr/cmdr to v1.11.6+
  • a slightly smaller binary file

v0.6.1

  • upgrade to the newest consul api
  • upgrade hedzr/cmdr to v1.8.0+

v0.5.9

  • fixed release files

v0.5.7

  • update the CI scripts
  • re-enable the docker image on Docker Hub

v0.5.5

  • update all codes with newest deps: cmdr, log, logex, errors.v2, ...

v0.5.1

  • new release has been testing and released soon.
  • it has been rewrote and optimized.

v0.5.0 is a pre-release

  • rewrote by cmdr
  • pre-released for v0.5.1 (final)

Install

Binary

Download binary from Release page.

Docker Hub (paused since v0.5.x)

docker pull hedzr/consul-tags
docker run -it --rm hedzr/consul-tags --addr 192.168.0.71:8500 ms --name test-redis tags ls

Replace 192.168.0.71 with your consul center ip or name.

DON'T use 127.0.0.1 with dockerize release.

latest: master branch and based on golang:alpine

Go Build

clone the repo and build:

cd $GOPATH/github.com/hedzr/consul-tags
go mod download
go build -o consul-tags ./cli/main.go 

mixin:

go get -u github.com/hedzr/consul-tags

Usage

# run consul demo instance for testing
./build.sh consul run &

# use the local consul demo instance as default addrress, see also `--addr` in `consul-tags ms --help`
export CT_APP_MS_ADDR=localhost:8500

# list services
consul-tags ms ls

# list tags
consul-tags ms --name test-redis tags ls
consul-tags ms tags ls --name test-redis

# modify tags
consul-tags ms tags modify --name test-redis tags --add a,c,e
consul-tags ms tags mod --name test-redis --add a --add c --add e
consul-tags ms tags mod --name test-redis --rm a,c,e
consul-tags ms tags mod --name test-redis --rm a --rm c --rm e
# by id
consul-tags ms tags ls --id test-redis-1

# toggle master/slave
consul-tags ms tags toggle --name test-redis --addr 10.7.13.1:6379 --set role=master --reset role=slave
consul-tags ms tags tog --name test-mq --addr 10.7.16.3:5672 --set role=leader,type=ram --reset role=peer,type=disk

# get commands and sub-commands help
consul-tags ms -h
# get help: -h or --help
consul-tags -h

Default consul address is consul.ops.local:8500, can be overridden with environment variable CT_APP_MS_ADDR (host:port), too. Such as:

export CT_APP_MS_ADDR=localhost:8500
consul-tags ms tags ls --name=consul
# or
CT_APP_MS_ADDR=localhost:8500 consul-tags --help
# or
consul-tags ms tags ls --name=consul --addr 127.0.0.1:8500

COMMANDS

     kv              K/V pair Operations, ...
     ms, service, m  Microservice Operations, ...
     help, h         Shows a list of commands or help for one command

GLOBAL OPTIONS

   --help, -h                          show help (default: false)
   --version, -v                       print the version (default: false)

Shell completion

consul-tags gen sh --zsh
consul-tags gen sh --bash

Thanks

my plan is building a suite of devops. consul operations is part of it.

and some repositories are good:

Third-party repos

License

MIT/APache 2.0

consul-tags's People

Contributors

dependabot[bot] avatar hedzr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

wmenjoy

consul-tags's Issues

consul node list, meta crud?

nodemeta crud in v0.3.2 does not work properly, our modifications will be reset by next node sync-ing loop, it is consul features.
to persist the changes of a node, we must commit to its agent instead of catalog.

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.