[Consul] - consul docker installation
http://coding4ever.net/blog/2019/08/02/menyimpan-konfigurasi-terpusat-menggunakan-consul-key-value-store-bagian-number-1/
https://doc.networknt.com/tutorial/common/discovery/token/
sudo docker run -p 8500:8500 -p 8600:8600/udp --name=consul consul:latest agent -server -bootstrap -ui -client=0.0.0.0
agent join:
-----------
sudo docker run -d consul agent
sudo docker run -d consul agent --retry-join=172.17.0.2
change mode host
----------------
sudo docker run --net=host -e CONSUL_BIND_INTERFACE=wlp2s0 --name=consul consul:latest agent -server -bootstrap -ui -client=0.0.0.0
sudo docker run --net=host -e CONSUL_BIND_INTERFACE=wlp2s0 -e CONSUL_CLIENT_INTERFACE=wlp2s0 -d consul agent -ui -server -bootstrap-expect=1
ip: 192.168.43.154
docker run -d --name=consulagent1 --net=host consul agent --retry-join=192.168.43.154 -bind=192.168.43.154
//sudah jalan menggunakan network interface
-------------------------------------------
sudo docker run --net=host -e CONSUL_BIND_INTERFACE=wlp2s0 --name=consul consul:latest agent -server -bootstrap -ui -client=0.0.0.0
docker with token - sudah jalan denga acl token
--------------------------------
docker run -d -p 8400:8400 -p 8500:8500/tcp -p 8600:53/udp -e 'CONSUL_LOCAL_CONFIG={"acl_datacenter":"dc1","acl_default_policy":"deny","acl_down_policy":"extend-cache","acl_master_token":"the_one_ring","bootstrap_expect":1,"datacenter":"dc1","data_dir":"/usr/local/bin/consul.d/data","server":true}' consul agent -server -ui -bind=127.0.0.1 -client=0.0.0.0
with volumes:
-------------
docker run -d -p 8400:8400 -p 8500:8500/tcp -p 8600:53/udp -v consul_config:/consul/config -v consul_data:/consul/data -e 'CONSUL_LOCAL_CONFIG={"acl_datacenter":"dc1","acl_default_policy":"deny","acl_down_policy":"extend-cache","acl_master_token":"the_one_ring","bootstrap_expect":1,"datacenter":"dc1","data_dir":"/usr/local/bin/consul.d/data","server":true}' consul agent -server -ui -bind=127.0.0.1 -client=0.0.0.0
with volumes, name
-----------------
docker run -d -p 8400:8400 -p 8500:8500/tcp -p 8600:53/udp --name consul -v consul_config:/consul/config -v consul_data:/consul/data -e 'CONSUL_LOCAL_CONFIG={"acl_datacenter":"dc1","acl_default_policy":"deny","acl_down_policy":"extend-cache","acl_master_token":"the_one_ring","bootstrap_expect":1,"datacenter":"dc1","data_dir":"/usr/local/bin/consul.d/data","server":true}' consul:latest agent -server -ui -bind=127.0.0.1 -client=0.0.0.0
docker run -d \
-p 8400:8400 \
-p 8500:8500/tcp \
-p 8600:53/udp \
--name consul \
--restart always \
-v consul_config:/consul/config \
-v consul_data:/consul/data \
-e 'CONSUL_LOCAL_CONFIG={"acl_datacenter":"dc1","acl_default_policy":"deny","acl_down_policy":"extend-cache","acl_master_token":"the_one_ring","bootstrap_expect":1,"datacenter":"dc1","data_dir":"/usr/local/bin/consul.d/data","server":true}' \
consul:latest agent -server -ui \
-bind=127.0.0.1 \
-client=0.0.0.0
Create agent token
------------------
//read only key/value
---------------------
curl \
--request PUT \
--header "X-Consul-Token: the_one_ring" \
--data \
'{
"Name": "Agent Token",
"Type": "client",
"Rules": "node \"\" { policy = \"write\" } service \"\" { policy = \"write\"}"
}' http://127.0.0.1:8500/v1/acl/create
{"ID":"a4daa51f-9f76-60f5-b7cd-e715a03007f7"}
a9eccfd9-1cd7-25bf-7f93-a649f1feb5ee
//with write key/value
----------------------
curl \
--request PUT \
--header "X-Consul-Token: the_one_ring" \
--data \
'{
"Name": "Agent Token",
"Type": "client",
"Rules": "node \"\" { policy = \"write\" } service \"\" { policy = \"write\" } key \"\" { policy = \"read\" }"
}' http://127.0.0.1:8500/v1/acl/create
{"ID":"e675ef87-6ab7-9681-941e-9885acbc6361"}
key with filter value:
----------------------
curl \
--request PUT \
--header "X-Consul-Token: the_one_ring" \
--data \
'{
"Name": "Agent Token",
"Type": "client",
"Rules": "node \"\" { policy = \"write\" } service \"\" { policy = \"write\" } key \"config1\" { policy = \"read\" }"
}' http://127.0.0.1:8500/v1/acl/create
ID":"3d514fa4-ff0b-91a6-e544-d784758b7907
key with filter value database:
----------------------
curl \
--request PUT \
--header "X-Consul-Token: the_one_ring" \
--data \
'{
"Name": "Agent Token",
"Type": "client",
"Rules": "node \"\" { policy = \"write\" } service \"\" { policy = \"write\" } key \"database\" { policy = \"read\" }"
}' http://127.0.0.1:8500/v1/acl/create
{"ID":"75bde197-45eb-c9d2-d309-11e23bd282b7"}
key with filter value database:
----------------------
curl \
--request PUT \
--header "X-Consul-Token: the_one_ring" \
--data \
'{
"Name": "Agent Token",
"Type": "client",
"Rules": "node \"\" { policy = \"write\" } service \"\" { policy = \"write\" } key \"database/spdb\" { policy = \"read\" }"
}' http://127.0.0.1:8500/v1/acl/create
{"ID":"1d1cc16a-71ad-4f26-e89c-24f345580c36"}
tes postman:
------------
http://127.0.0.1:8500/v1/kv/config1?raw=true&token=e675ef87-6ab7-9681-941e-9885acbc6361 --> ok
Subscribe to:
Post Comments (Atom)
Pemrograman Running text P10 RGB dengan Arduino Nano
Pemrograman Running text P10 RGB dengan Arduino Nano PIN CONNECTION P10 RGB DENGAN ARDUINO NANO/UNO Source code arduino p10 RGB #include &q...
-
#include <MD_Parola.h> #include <MD_MAX72xx.h> #include <SPI.h> #include <Wire.h> // DS3231cl...
-
[Arduino] - Jam digital dan running text dengan LED Max7219 #include <MD_Parola.h> #include <MD_MAX72xx.h> #include <SPI.h...
-
Pemrograman Running text P10 RGB dengan Arduino Nano PIN CONNECTION P10 RGB DENGAN ARDUINO NANO/UNO Source code arduino p10 RGB #include &q...
No comments:
Post a Comment