From 5b7a664e9d12ac1a66c1fc98a0043e634c627bc0 Mon Sep 17 00:00:00 2001 From: Nandor Kracser Date: Sat, 3 Aug 2019 15:02:54 +0200 Subject: [PATCH] add docker-compose for local testing --- docker-compose.yaml | 39 ++++++++++++++++++++++++++++++++++++++ examples/config-dev.yaml | 30 +++++++++++++++++++++++++++++ storage/sql/config_test.go | 2 +- 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 docker-compose.yaml diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 00000000..bf2b2a75 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,39 @@ +# This docker-compose file provides quick setups for testing different storage backend options. +version: "3.8" +services: + mysql: + # For using percona-xtradb you need to make strict mode permissive with: + # docker-compose exec mysql mysql -uroot -proot -e "SET GLOBAL pxc_strict_mode=PERMISSIVE;" + # See: https://www.percona.com/doc/percona-xtradb-cluster/5.7/features/pxc-strict-mode.html + # image: percona/percona-xtradb-cluster:5.7 + # image: mariadb:10.5 + # image: mysql:5.6 + # image: mysql:8.0 + image: mysql:5.7 + environment: + MYSQL_DATABASE: dex + MYSQL_USER: mysql + MYSQL_PASSWORD: mysql + MYSQL_ROOT_PASSWORD: root + ports: + - "127.0.0.1:3306:3306" + + postgres: + image: postgres:10.8 + environment: + POSTGRES_DB: dex + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + ports: + - "127.0.0.1:5432:5432" + + etcd: + image: gcr.io/etcd-development/etcd:v3.2.9 + environment: + ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379 + ETCD_ADVERTISE_CLIENT_URLS: http://0.0.0.0:2379 + ports: + - "127.0.0.1:2379:2379" + + # For testing the Kubernetes storage backend we suggest https://kind.sigs.k8s.io/: + # kind create cluster diff --git a/examples/config-dev.yaml b/examples/config-dev.yaml index b9833fdf..f7b011ba 100644 --- a/examples/config-dev.yaml +++ b/examples/config-dev.yaml @@ -12,6 +12,36 @@ storage: config: file: examples/dex.db + # type: mysql + # config: + # host: localhost + # port: 3306 + # database: dex + # user: mysql + # password: mysql + # ssl: + # mode: "false" + + # type: postgres + # config: + # host: localhost + # port: 5432 + # database: dex + # user: postgres + # password: postgres + # ssl: + # mode: disable + + # type: etcd + # config: + # endpoints: + # - http://localhost:2379 + # namespace: dex/ + + # type: kubernetes + # config: + # kubeConfigFile: $HOME/.kube/config + # Configuration for the HTTP endpoints. web: http: 0.0.0.0:5556 diff --git a/storage/sql/config_test.go b/storage/sql/config_test.go index b3694cc3..4df32cf4 100644 --- a/storage/sql/config_test.go +++ b/storage/sql/config_test.go @@ -270,7 +270,7 @@ func TestMySQL(t *testing.T) { NetworkDB: NetworkDB{ Database: getenv("DEX_MYSQL_DATABASE", "mysql"), User: getenv("DEX_MYSQL_USER", "mysql"), - Password: getenv("DEX_MYSQL_PASSWORD", ""), + Password: getenv("DEX_MYSQL_PASSWORD", "mysql"), Host: host, Port: uint16(port), ConnectionTimeout: 5,