add etcd config file and Run etcd server example. (#24)
diff --git a/README.md b/README.md
index f326caf..1682232 100644
--- a/README.md
+++ b/README.md
@@ -12,14 +12,33 @@
docker build -t apisix:0.8-alpine --build-arg APISIX_VERSION=0.8 -f alpine/Dockerfile alpine
```
+## Run etcd server
+
+```
+docker run -it --name etcd-server \
+-v ./example/etcd_conf/etcd.conf.yml:/opt/bitnami/etcd/conf/etcd.conf.yml \
+-p 2379:2379 \
+-p 2380:2380 \
+--env ALLOW_NONE_AUTHENTICATION=yes bitnami/etcd:3.3.13-r80
+```
+
+> windows systems use absolute paths to hang in the configuration file
+>
+> eg:`-v /e/github/docker-apisix/example/etcd_conf/etcd.conf.yml:/opt/bitnami/etcd/conf/etcd.conf.yml`
## Run APISIX with etcd
+
You need etcd docker to work with APISIX. You can refer to
[the docker-compose example](example/README.md).
Or you can run APISIX with Docker directly(Docker name is test-api-gateway):
```
-docker run --name test-api-gateway -v ./example/apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml -v./example/apisix_log:/usr/local/apisix/logs -p 8080:9080 -p 8083:9443 -d iresty/apisix
+docker run --name test-api-gateway \
+-v ./example/apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml \
+-v ./example/apisix_log:/usr/local/apisix/logs \
+-p 8080:9080 \
+-p 8083:9443 \
+-d iresty/apisix
```
NOTE: macOS not supports `host` network mode, so Linux is recommended.
diff --git a/example/apisix_conf/config.yaml b/example/apisix_conf/config.yaml
index 13a5200..9cfdbb2 100644
--- a/example/apisix_conf/config.yaml
+++ b/example/apisix_conf/config.yaml
@@ -1,5 +1,6 @@
apisix:
node_listen: 9080 # APISIX listening port
+ node_ssl_listen: 9443
enable_heartbeat: true
enable_admin: true
enable_debug: false
diff --git a/example/etcd_conf/etcd.conf.yml b/example/etcd_conf/etcd.conf.yml
new file mode 100644
index 0000000..03f1abf
--- /dev/null
+++ b/example/etcd_conf/etcd.conf.yml
@@ -0,0 +1,140 @@
+# This is the configuration file for the etcd server.
+
+# Human-readable name for this member.
+name: 'default'
+
+# Path to the data directory.
+data-dir:
+
+# Path to the dedicated wal directory.
+wal-dir:
+
+# Number of committed transactions to trigger a snapshot to disk.
+snapshot-count: 10000
+
+# Time (in milliseconds) of a heartbeat interval.
+heartbeat-interval: 100
+
+# Time (in milliseconds) for an election to timeout.
+election-timeout: 1000
+
+# Raise alarms when backend size exceeds the given quota. 0 means use the
+# default quota.
+quota-backend-bytes: 0
+
+# List of comma separated URLs to listen on for peer traffic.
+listen-peer-urls: http://localhost:2380
+
+# List of comma separated URLs to listen on for client traffic.
+listen-client-urls: http://localhost:2379
+
+# Maximum number of snapshot files to retain (0 is unlimited).
+max-snapshots: 5
+
+# Maximum number of wal files to retain (0 is unlimited).
+max-wals: 5
+
+# Comma-separated white list of origins for CORS (cross-origin resource sharing).
+cors:
+
+# List of this member's peer URLs to advertise to the rest of the cluster.
+# The URLs needed to be a comma-separated list.
+initial-advertise-peer-urls: http://localhost:2380
+
+# List of this member's client URLs to advertise to the public.
+# The URLs needed to be a comma-separated list.
+advertise-client-urls: http://localhost:2379
+
+# Discovery URL used to bootstrap the cluster.
+discovery:
+
+# Valid values include 'exit', 'proxy'
+discovery-fallback: 'proxy'
+
+# HTTP proxy to use for traffic to discovery service.
+discovery-proxy:
+
+# DNS domain used to bootstrap initial cluster.
+discovery-srv:
+
+# Initial cluster configuration for bootstrapping.
+initial-cluster:
+
+# Initial cluster token for the etcd cluster during bootstrap.
+initial-cluster-token: 'etcd-cluster'
+
+# Initial cluster state ('new' or 'existing').
+initial-cluster-state: 'new'
+
+# Reject reconfiguration requests that would cause quorum loss.
+strict-reconfig-check: false
+
+# Accept etcd V2 client requests
+enable-v2: true
+
+# Enable runtime profiling data via HTTP server
+enable-pprof: true
+
+# Valid values include 'on', 'readonly', 'off'
+proxy: 'off'
+
+# Time (in milliseconds) an endpoint will be held in a failed state.
+proxy-failure-wait: 5000
+
+# Time (in milliseconds) of the endpoints refresh interval.
+proxy-refresh-interval: 30000
+
+# Time (in milliseconds) for a dial to timeout.
+proxy-dial-timeout: 1000
+
+# Time (in milliseconds) for a write to timeout.
+proxy-write-timeout: 5000
+
+# Time (in milliseconds) for a read to timeout.
+proxy-read-timeout: 0
+
+client-transport-security:
+ # Path to the client server TLS cert file.
+ cert-file:
+
+ # Path to the client server TLS key file.
+ key-file:
+
+ # Enable client cert authentication.
+ client-cert-auth: false
+
+ # Path to the client server TLS trusted CA cert file.
+ trusted-ca-file:
+
+ # Client TLS using generated certificates
+ auto-tls: false
+
+peer-transport-security:
+ # Path to the peer server TLS cert file.
+ cert-file:
+
+ # Path to the peer server TLS key file.
+ key-file:
+
+ # Enable peer client cert authentication.
+ client-cert-auth: false
+
+ # Path to the peer server TLS trusted CA cert file.
+ trusted-ca-file:
+
+ # Peer TLS using generated certificates.
+ auto-tls: false
+
+# Enable debug-level logging for etcd.
+debug: false
+
+logger: zap
+
+# Specify 'stdout' or 'stderr' to skip journald logging even when running under systemd.
+log-outputs: [stderr]
+
+# Force to create a new one member cluster.
+force-new-cluster: false
+
+auto-compaction-mode: periodic
+auto-compaction-retention: "1"