Skip to content

Commit

Permalink
scripts: dont hardcode docker ip
Browse files Browse the repository at this point in the history
  • Loading branch information
cfal committed Aug 7, 2023
1 parent f69e715 commit 5877e4b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 8 additions & 0 deletions scripts/core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,20 @@ if [ ! -f "${config_path}" ]; then
exit 1
fi

docker_ip=$(docker network inspect bridge -f '{{range .IPAM.Config}}{{.Gateway}}{{end}}')
if [ -z "${docker_ip}" ]; then
echo "Could not fetch docker ip."
exit 1
fi

echo "Starting core container"
exec docker run \
-it --rm \
--add-host=host.docker.internal:host-gateway \
-p 127.0.0.1:6688:6688 \
-p 127.0.0.1:6690:6690 \
-p "${docker_ip}:6688:6688" \
-p "${docker_ip}:6690:6690" \
-e "CL_CONFIG=$(cat "${config_path}")" \
-e 'CL_DATABASE_URL=postgresql://postgres:postgres@host.docker.internal:35432/cosmos_test?sslmode=disable' \
-e 'CL_DATABASE_ALLOW_SIMPLE_PASSWORDS=true' \
Expand Down
9 changes: 8 additions & 1 deletion scripts/postgres.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ set -euo pipefail

bash "$(dirname -- "$0")/postgres-down.sh"

docker_ip=$(docker network inspect bridge -f '{{range .IPAM.Config}}{{.Gateway}}{{end}}')
if [ -z "${docker_ip}" ]; then
echo "Could not fetch docker ip."
exit 1
fi

echo "Starting postgres container"
docker run \
-p 172.17.0.1:35432:5432 \
-p "127.0.0.1:35432:5432" \
-p "${docker_ip}:35432:5432" \
-d \
--name "${container_name}" \
-e POSTGRES_USER=postgres \
Expand Down

0 comments on commit 5877e4b

Please sign in to comment.