Skip to content

Commit

Permalink
Refactor create-clients.sh approach
Browse files Browse the repository at this point in the history
Use a docker run command instead of a compose service
  • Loading branch information
focusaurus committed Sep 19, 2018
1 parent 543f698 commit ee010f0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
20 changes: 15 additions & 5 deletions bin/create-clients.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,23 @@

__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

docker-compose run --rm \
docker_image="oryd/hydra:v1.0.0-beta.9-alpine"
network="auth.reaction.localhost"
hydra_host="hydra.${network}"
hydra_admin_port="4445"
hydra_admin_url="http://${hydra_host}:${hydra_admin_port}"
docker run --rm \
--interactive \
--volume "${__dir}/wait-for.sh:/usr/local/bin/wait-for.sh" \
hydra-clients <<'EOF'
set -e
--network "${network}" \
--env "HYDRA_HOST=${hydra_host}" \
--env "HYDRA_ADMIN_PORT=${hydra_admin_port}" \
--env "HYDRA_ADMIN_URL=${hydra_admin_url}" \
--env "HYDRA_CLIENT_SECRET" \
--network "${network}" \
--entrypoint sh \
"${docker_image}" <<'EOF'
/usr/local/bin/wait-for.sh "${HYDRA_HOST}:${HYDRA_ADMIN_PORT}"
# Want to check stderr on failure of the next command so +e
set +e
hydra clients create --skip-tls-verify \
--id reaction-next-starterkit \
--secret "${HYDRA_CLIENT_SECRET-CHANGEME}" \
Expand Down
16 changes: 0 additions & 16 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,6 @@ services:
- DATABASE_URL=postgres://hydra:changeme@postgres:5432/hydra?sslmode=disable
restart: on-failure

hydra-clients:
image: oryd/hydra:v1.0.0-beta.9-alpine
entrypoint: /bin/sh
depends_on:
- hydra
environment:
HYDRA_HOST: hydra.auth.reaction.localhost
HYDRA_ADMIN_PORT: 4445
HYDRA_ADMIN_URL: http://hydra.auth.reaction.localhost:4445
HYDRA_CLIENT_SECRET:
restart: never
networks:
default:
auth:

hydra:
image: oryd/hydra:v1.0.0-beta.9-alpine
command: serve all --dangerous-force-http
Expand Down Expand Up @@ -76,7 +61,6 @@ services:
volumes:
- postgres-data:/var/lib/postgresql/data


# Uncomment the following section to use mysql instead.
# mysqld:
# image: mysql:5.7
Expand Down

0 comments on commit ee010f0

Please sign in to comment.