Download the PHP package gamegos/consul-imex without Composer

On this page you can find all versions of the php package gamegos/consul-imex. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package consul-imex

Consul Imex (Import/Export) Tool

Consul-Imex is a simple import/export tool for Consul key/value storage over Consul HTTP API.

Installation

You can install Consul Imex in several ways:

Install as an executable phar file

Download the phar file from https://github.com/gamegos/consul-imex/releases/download/1.0.0-rc1/consul-imex.phar, then assign execute permission for it.

Example:

wget -O /usr/local/bin/consul-imex https://github.com/gamegos/consul-imex/releases/download/1.0.0-rc1/consul-imex.phar
chmod +x /usr/local/bin/consul-imex

Install as a docker image

docker pull sozpinar/consul-imex

Install as a Composer dependency

composer require gamegos/consul-imex

Install as a PHP project

Install via composer:

composer create-project gamegos/consul-imex

Or clone/download and install manually:

git clone https://github.com/gamegos/consul-imex.git
cd consul-imex
composer install

Usage

Run as an executable phar file:

consul-imex <command> [options] [arguments]

Run as a docker container:

See Notices for Docker Usage for detailed information of docker usage.

docker run -t -v `pwd`:/consul-imex sozpinar/consul-imex <command> [options] [arguments]

Run as a composer vendor binary:

composer exec -- consul-imex <command> [options] [arguments]

Run as a PHP script:

php scripts/consul-imex.php <command> [options] [arguments]

Export

Usage:

consul-imex export [options] <file>

Arguments:

Options:

Import

Usage:

consul-imex import [options] <file>

Arguments:

Options:

Copy

Usage:

consul-imex copy [options] <source> <target>

Arguments:

Options:

Examples

Export

$ consul-imex export -u http://localhost:8500 -p /old/prefix my-data.json
93 keys are fetched.

Export using token key:

$ consul-imex export -c 4874874a-2a3s-7892-123e-597a4e1v87e1 -u http://localhost:8500 -p /old/prefix my-data.json
93 keys are fetched.

Import

$ consul-imex import -u http://localhost:8500 -p /new/prefix my-data.json
93 keys are stored. (25 new directories are created.)

Import using token key:

$ consul-imex import -c 4874874a-2a3s-7892-123e-597a4e1v87e1 -u http://localhost:8500 -p /new/prefix my-data.json
93 keys are stored. (25 new directories are created.)

Copy

Copy keys from /old/prefix to /new/prefix:

$ consul-imex copy -s http://localhost:8500 /old/prefix /new/prefix
93 keys are fetched.
93 keys are stored. (25 new directories are created.)
Operation completed.

Copy keys from /old/prefix to /new/prefix using token:

$ consul-imex copy -s http://localhost:8500 -c 4874874a-2a3s-7892-123e-597a4e1v87e1 /old/prefix /new/prefix
93 keys are fetched.
93 keys are stored. (25 new directories are created.)
Operation completed.

Copy keys under /my/prefix to another server:

$ consul-imex copy -s http://localhost:8500 -t http://anotherhost:8500 /my/prefix /my/prefix
93 keys are fetched.
93 keys are stored. (25 new directories are created.)
Operation completed.

Copy keys under /my/prefix to another server using token:

$ consul-imex copy -s http://localhost:8500 -c 4874874a-2a3s-7892-123e-597a4e1v87e1 -t http://anotherhost:8500 --target-server-token 6242c15a-9w4x-2318-61a2-8as8c47317 /my/prefix /my/prefix
93 keys are fetched.
93 keys are stored. (25 new directories are created.)
Operation completed.

Copy all keys to another server:

$ consul-imex copy -s http://localhost:8500 -t http://anotherhost:8500
492 keys are fetched.
492 keys are stored. (108 new directories are created.)
Operation completed.

Notices for Docker Usage

Input/Output File Location

To use import and export commands with docker, the input/output files must be accessible by the container. The default working directory of the image is /consul-imex and input/output files are placed under this directory by default.

Examples for export command:

Example 1: Mount a host directory to the container for export operation, then the container will create my-data.json file in the host directory.

$ docker run -it -v `pwd`:/consul-imex sozpinar/consul-imex export -u 192.168.1.20:8500 -p /foo/bar my-data.json
93 keys are fetched.

Example 2: Copy the output file to your working directory after export operation.

$ docker run -it sozpinar/consul-imex export -u 192.168.1.20:8500 -p /foo/bar my-data.json
93 keys are fetched.
$ docker cp `docker ps -ql`:/consul-imex/my-data.json .

Examples for import command:

Example 1: Mount a host directory to the container for import operation, then the container will read my-data.json file from the host directory.

$ docker run -it -v `pwd`:/consul-imex sozpinar/consul-imex import -u 192.168.1.20:8500 -p /new/prefix my-data.json
93 keys are stored. (25 new directories are created.)

Example 2: Mount a file to the container and use it for import operation. This method does not require the input file to be placed in the default working directory.

$ docker run -it -v `pwd`/my-data.json:/my-data.json sozpinar/consul-imex import -u 192.168.1.20:8500 -p /new/prefix -v /my-data.json
93 keys are stored. (25 new directories are created.)

Network Configuration

If your Consul service is in a private network or does not have a public URL, you may have to set up a custom network configuration for the docker container.

Example

docker run -it --net=host sozpinar/consul-imex copy -s http://localhost:8500 -t http://anotherhost:8500

If the default docker network type is bridge then the running container does not recognize 'localhost'. So we simply add --net=host argument to make the container to use the network of the host machine.

Known Issues

Directories with values

Consul key/value storage allows a directory to have a value like an ordinary key. If a directory has a value, Consul Imex will ignore the value or the sub-keys; this depends how the keys are ordered.


All versions of consul-imex with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.9
symfony/console Version ^3.0
guzzlehttp/guzzle Version ^6.3
ext-json Version ~1.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package gamegos/consul-imex contains the following files

Loading the files please wait ....