@wjsc/remote-config-client
Advanced tools
Comparing version 0.0.8 to 0.0.9
{ | ||
"name": "@wjsc/remote-config-client", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
121
README.md
# remote-config-grpc | ||
Externalized config server with built-in encryption for microservices architecture | ||
Externalized config server with built-in encryption for microservices architecture: https://microservices.io/patterns/externalized-configuration.html | ||
@@ -8,6 +8,6 @@ ## General | ||
- Architecture: | ||
- Storage engine: redis, mongodb or filesystem | ||
- remote-config Server connected to storage engine | ||
- remote-config Client for nodejs: https://www.npmjs.com/package/@wjsc/remote-config-client | ||
- remote-config Client for Command line interface(CLI) | ||
- Storage engine: redis, mongodb, dynamodb or filesystem | ||
- remote-config-server: https://hub.docker.com/r/imageswjsc/remote-config-server | ||
- remote-config-client for nodejs: https://www.npmjs.com/package/@wjsc/remote-config-client | ||
- remote-config-client for Command line interface(CLI) | ||
@@ -29,6 +29,38 @@ - The remote-config server stores remote-configs with this structure: | ||
### 2. Build remote config server and connect to redis storage | ||
### 2. Generate private & public keys for a specific namespace for full TLS/SSL authentication | ||
- You can ignore this step if no authentication is required | ||
#### 2.1. Install certstrap | ||
``` | ||
cd ./server | ||
docker build -t remote-config-server:1.0 . | ||
wget https://github.com/square/certstrap/releases/download/v1.1.1/certstrap-v1.1.1-linux-amd64 | ||
mv certstrap-v1.1.1-linux-amd64 certstrap | ||
chmod +x certstrap | ||
``` | ||
#### 2.2. Generating a root certificate authority | ||
``` | ||
certstrap init --organization "ca" --common-name "ca" | ||
``` | ||
#### 2.3. Generating a server certificate & Sign server certificate | ||
``` | ||
certstrap request-cert --common-name "server" --domain "localhost" | ||
certstrap sign --CA ca "server" | ||
``` | ||
#### 2.4. Create client certificate & Sign client certificate | ||
``` | ||
certstrap request-cert --common-name "client" | ||
certstrap sign --CA ca "client" | ||
``` | ||
#### 2.5. Move files to folders | ||
``` | ||
cp ./out/ca.crt ./server/certs | ||
cp ./out/server* ./server/certs | ||
cp ./out/ca.crt ./client/cli/certs | ||
cp ./out/client* ./client/cli/certs | ||
``` | ||
### 3. Run remote-config server and connect to redis storage | ||
- If no authentication is required, remove CA_CERT_PATH, KEY_PATH & CERT_PATH from command | ||
``` | ||
docker run -p3000:3000 \ | ||
@@ -45,6 +77,6 @@ -e STORAGE=redis \ | ||
--name remote-config-server-redis \ | ||
-d remote-config-server:1.0 | ||
-d imageswjsc/remote-config-server | ||
``` | ||
### 3. Install CLI client dependencies | ||
### 4. Install CLI client dependencies | ||
``` | ||
@@ -55,8 +87,3 @@ cd ./client/cli | ||
### 4. Generate private & public keys for a specific namespace for full TLS/SSL authentication | ||
- Server private key & certificate | ||
- Client private key & certificate | ||
- Certificate authority certificate | ||
### 5. Test saving & retrieving a remote-config with encryption | ||
@@ -66,6 +93,7 @@ ``` | ||
node set_config.js -r certs/client.key -l certs/client.crt -a certs/ca.crt -n ns1 -k key1 -v value1 -h 127.0.0.1:3000 | ||
node set_config.js -r certs/client.key -l certs/client.crt -a certs/ca.crt -n ns1 -k key1 -h localhost:3000 | ||
// The CLI will prompt for value | ||
// output: { namespace: 'ns1', key: 'key1', value: 'value1' } | ||
node get_config.js -r certs/client.key -l certs/client.crt -a certs/ca.crt -n ns1 -k key1 -h 127.0.0.1:3000 | ||
node get_config.js -r certs/client.key -l certs/client.crt -a certs/ca.crt -n ns1 -k key1 -h localhost:3000 | ||
// output: { namespace: 'ns1', key: 'key1', value: 'value1' } | ||
@@ -78,6 +106,7 @@ ``` | ||
node set_config.js -r certs/client.key -l certs/client.crt -a certs/ca.crt -n ns2 -k key2 -v value2 -h 127.0.0.1:3000 -x | ||
node set_config.js -r certs/client.key -l certs/client.crt -a certs/ca.crt -n ns2 -k key2 -h localhost:3000 -x | ||
// The CLI will prompt for value | ||
// output: { namespace: 'ns2', key: 'key2', value: 'value2' } | ||
node get_config.js -r certs/client.key -l certs/client.crt -a certs/ca.crt -n ns2 -k key2 -h 127.0.0.1:3000 -x | ||
node get_config.js -r certs/client.key -l certs/client.crt -a certs/ca.crt -n ns2 -k key2 -h localhost:3000 -x | ||
// output: { namespace: 'ns2', key: 'key2', value: 'value2' } | ||
@@ -95,5 +124,6 @@ ``` | ||
Options: | ||
-x, --share Do not decrypt value | ||
-r, --private <path> Private key path | ||
-p, --passphrase <path> Passphrase | ||
-x, --share Do not encrypt value | ||
-r, --private <path> Client private key path | ||
-l, --clientcert <path> Client Certificate path | ||
-a, --cacert <path> CA Certificate path | ||
-n, --namespace <namespace> Config namespace | ||
@@ -113,6 +143,7 @@ -k, --key <key> Config key | ||
-x, --share Do not encrypt value | ||
-u, --public <path> Public key path | ||
-r, --private <path> Client private key path | ||
-l, --clientcert <path> Client Certificate path | ||
-a, --cacert <path> CA Certificate path | ||
-n, --namespace <namespace> Config namespace | ||
-k, --key <key> Config key | ||
-v, --value <value> Config value | ||
-h, --host <value> Remote config server ip:port | ||
@@ -123,6 +154,4 @@ --help display help for command | ||
### Build remote config server and connect to filesystem as storage engine | ||
### Run remote-config-server and connect to filesystem as storage engine | ||
``` | ||
cd ./server | ||
docker build -t remote-config-server:1.0 . | ||
docker run -p3000:3000 \ | ||
@@ -138,11 +167,9 @@ -e STORAGE=filesystem \ | ||
-e CERT_PATH=/home/node/certs/server.crt \ | ||
-d remote-config-server:1.0 | ||
-d imageswjsc/remote-config-server | ||
``` | ||
### Build remote config server and connect to mongodb as storage engine | ||
### Run remote-config-server and connect to mongodb as storage engine | ||
``` | ||
docker run --name remote-config-db-mongodb -p27017:27017 -d mongo | ||
cd ./server | ||
docker build -t remote-config-server:1.0 . | ||
docker run -p3000:3000 \ | ||
@@ -161,7 +188,27 @@ -e STORAGE=mongodb \ | ||
--name remote-config-server-mongodb \ | ||
-d remote-config-server:1.0 | ||
-d imageswjsc/remote-config-server | ||
``` | ||
### Enviromental variables supoorted | ||
### Run remote-config-server and connect to dynamodb as storage engine | ||
``` | ||
docker run --name remote-config-db-dynamodb -p8000:8000 -d amazon/dynamodb-local | ||
docker run -p3000:3000 \ | ||
-e STORAGE=dynamodb \ | ||
-e AWS_REGION=us-east-1 \ | ||
-e DYNAMODB_ENDPOINT=http://localhost:8000 \ | ||
-e DATABASE_TABLENAME=remote-config-storage \ | ||
-e DYNAMODB_CAPACITY_READ=5 \ | ||
-e DYNAMODB_CAPACITY_WRITE=5 \ | ||
-e HOST=0.0.0.0 \ | ||
-e PORT=3000 \ | ||
-v $PWD/certs:/home/node/certs/ \ | ||
-e CA_CERT_PATH=/home/node/certs/ca.crt \ | ||
-e KEY_PATH=/home/node/certs/server.key \ | ||
-e CERT_PATH=/home/node/certs/server.crt \ | ||
--name remote-config-server-dynamodb \ | ||
-d imageswjsc/remote-config-server | ||
``` | ||
### Environment variables supported | ||
``` | ||
STORAGE: Storage engine. Redis OR mongodb OR filesystem | ||
@@ -177,4 +224,12 @@ DATABASE_HOST: Database connection endpoint | ||
CERT_PATH: Optional. Server certificate path for SSL/TLS authentication. This file must be mounted. | ||
IGNORE_CLIENT_CERT: Ignore client certificate, only authenticate server. | ||
AWS_REGION: Optional. Region for dynamodb. | ||
AWS_ENDPOINT: Optional. Endpoint for dynamodb service | ||
AWS_ACCESS_KEY_ID: Optional. Only for dynamodb. | ||
AWS_SECRET_ACCESS_KEY: Optional. Only for dynamodb. | ||
DATABASE_TABLENAME: Optional. Only for dynamodb. | ||
DYNAMODB_CAPACITY_READ: Optional. Only for dynamodb. | ||
DYNAMODB_CAPACITY_WRITE: Optional. Only for dynamodb. | ||
/// If CA_CERT_PATH, KEY_PATH & CERT_PATH are not defined, the server can run in insecure mode | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12962
224