diff --git a/.github/scripts/setup-keycloak.sh b/.github/scripts/setup-keycloak.sh index 7d2c4e3d52..ba49562256 100755 --- a/.github/scripts/setup-keycloak.sh +++ b/.github/scripts/setup-keycloak.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash export KC_VERSION=26.2.5 curl -LO https://github.com/keycloak/keycloak/releases/download/"${KC_VERSION}"/keycloak-"${KC_VERSION}".zip diff --git a/data_migrations/controlplane/1747776337_rbac_groups/migrate.sh b/data_migrations/controlplane/1747776337_rbac_groups/migrate.sh index af5c064413..b4c5518b2f 100755 --- a/data_migrations/controlplane/1747776337_rbac_groups/migrate.sh +++ b/data_migrations/controlplane/1747776337_rbac_groups/migrate.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # https://stackoverflow.com/a/14203146 for i in "$@"; do diff --git a/demo/bump-deps.sh b/demo/bump-deps.sh index 436fd45ee2..9ee8ac88ec 100755 --- a/demo/bump-deps.sh +++ b/demo/bump-deps.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash GIT_REV=$(git show-ref main --heads -s) diff --git a/demo/compose.sh b/demo/compose.sh index 404b5408ce..2cdfa961c0 100755 --- a/demo/compose.sh +++ b/demo/compose.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash cd "../cli" diff --git a/demo/deploy.sh b/demo/deploy.sh index 9dbc7c1bad..2b3dd32e72 100755 --- a/demo/deploy.sh +++ b/demo/deploy.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e fly deploy -a product-api --dockerfile ./docker/products.Dockerfile diff --git a/demo/update_token.sh b/demo/update_token.sh index 9a65eadf9f..d335f6f895 100755 --- a/demo/update_token.sh +++ b/demo/update_token.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -eu fly secrets set -a product-api GRAPH_API_TOKEN="$GRAPH_API_TOKEN" diff --git a/docker/clickhouse/init-db.sh b/docker/clickhouse/init-db.sh index adde88640e..15f106b2df 100755 --- a/docker/clickhouse/init-db.sh +++ b/docker/clickhouse/init-db.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e clickhouse client -n <<-EOSQL diff --git a/docker/nats/build-push.sh b/docker/nats/build-push.sh index 144b9ec995..d9bcf025d9 100755 --- a/docker/nats/build-push.sh +++ b/docker/nats/build-push.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Exit on any error set -e diff --git a/examples/full-cosmo-docker/destroy.sh b/examples/full-cosmo-docker/destroy.sh index 3ef03f693e..4859da65ff 100755 --- a/examples/full-cosmo-docker/destroy.sh +++ b/examples/full-cosmo-docker/destroy.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e -cd ../.. && make full-demo-down \ No newline at end of file +cd ../.. && make full-demo-down diff --git a/examples/full-cosmo-docker/start.sh b/examples/full-cosmo-docker/start.sh index 864cae0548..dd4dfc2e56 100755 --- a/examples/full-cosmo-docker/start.sh +++ b/examples/full-cosmo-docker/start.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e -cd ../.. && make full-demo-up \ No newline at end of file +cd ../.. && make full-demo-up diff --git a/examples/full-cosmo-helm/create_demo.sh b/examples/full-cosmo-helm/create_demo.sh index 314dc299b2..c89e9550f5 100755 --- a/examples/full-cosmo-helm/create_demo.sh +++ b/examples/full-cosmo-helm/create_demo.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # Install WunderGraph CLI diff --git a/examples/full-cosmo-helm/delete_demo.sh b/examples/full-cosmo-helm/delete_demo.sh index 4b442ba13f..68e51973fd 100755 --- a/examples/full-cosmo-helm/delete_demo.sh +++ b/examples/full-cosmo-helm/delete_demo.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e . ../../scripts/configurations/kubernetes.sh diff --git a/examples/router-simple/start.sh b/examples/router-simple/start.sh index 564cb06994..f61b92015e 100755 --- a/examples/router-simple/start.sh +++ b/examples/router-simple/start.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # Install WunderGraph CLI diff --git a/helm/cosmo/README.md b/helm/cosmo/README.md index 5862d25dec..8f7f3b155a 100644 --- a/helm/cosmo/README.md +++ b/helm/cosmo/README.md @@ -46,7 +46,7 @@ This is the official Helm Chart for WunderGraph Cosmo - The Full Lifecycle Graph | clickhouse.commonAnnotations."kapp.k14s.io/change-group" | string | `"cosmo.apps.clickhouse.wundergraph.com/deployment"` | | | clickhouse.image.registry | string | `"docker.io"` | | | clickhouse.image.repository | string | `"bitnamilegacy/clickhouse"` | | -| clickhouse.initdbScripts."db-init.sh" | string | `"#!/bin/bash\nset -e\nclickhouse-client --user $CLICKHOUSE_ADMIN_USER --password $CLICKHOUSE_ADMIN_PASSWORD -n <<-EOSQL\n CREATE DATABASE IF NOT EXISTS cosmo;\nEOSQL\n"` | | +| clickhouse.initdbScripts."db-init.sh" | string | `"#!/usr/bin/env bash\nset -e\nclickhouse-client --user $CLICKHOUSE_ADMIN_USER --password $CLICKHOUSE_ADMIN_PASSWORD -n <<-EOSQL\n CREATE DATABASE IF NOT EXISTS cosmo;\nEOSQL\n"` | | | clickhouse.persistence.annotations."kapp.k14s.io/owned-for-deletion" | string | `""` | | | clickhouse.persistence.size | string | `"2Gi"` | | | clickhouse.replicaCount | int | `1` | | diff --git a/helm/cosmo/values.yaml b/helm/cosmo/values.yaml index e823d46a38..084ac9937d 100644 --- a/helm/cosmo/values.yaml +++ b/helm/cosmo/values.yaml @@ -428,7 +428,7 @@ clickhouse: password: 'changeme' initdbScripts: db-init.sh: | - #!/bin/bash + #!/usr/bin/env bash set -e clickhouse-client --user $CLICKHOUSE_ADMIN_USER --password $CLICKHOUSE_ADMIN_PASSWORD -n <<-EOSQL CREATE DATABASE IF NOT EXISTS cosmo; diff --git a/keycloak/theme/build.sh b/keycloak/theme/build.sh index 7eeeeac849..99ac88b1fb 100755 --- a/keycloak/theme/build.sh +++ b/keycloak/theme/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/router-tests/bump-deps.sh b/router-tests/bump-deps.sh index 40bb73ee8c..402d6d2871 100755 --- a/router-tests/bump-deps.sh +++ b/router-tests/bump-deps.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash GIT_REV=$(git rev-parse --short HEAD) diff --git a/router-tests/testdata/tls/makecert.sh b/router-tests/testdata/tls/makecert.sh index 8935bce65f..84b1778fb0 100755 --- a/router-tests/testdata/tls/makecert.sh +++ b/router-tests/testdata/tls/makecert.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # useful to test mTLS with self-signed certificates openssl req -newkey rsa:2048 \ diff --git a/router-tests/update-config-no-edg.sh b/router-tests/update-config-no-edg.sh index b017145b6b..b40535f03b 100755 --- a/router-tests/update-config-no-edg.sh +++ b/router-tests/update-config-no-edg.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # js composition diff --git a/router-tests/update-config.sh b/router-tests/update-config.sh index c7136e7274..b64ca1f1e5 100755 --- a/router-tests/update-config.sh +++ b/router-tests/update-config.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # js composition diff --git a/router/__schemas/compose.sh b/router/__schemas/compose.sh index 43864547ae..14d4485f53 100755 --- a/router/__schemas/compose.sh +++ b/router/__schemas/compose.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # export COSMO_API_KEY=cosmo_669b576aaadc10ee1ae81d9193425705 # export COSMO_API_URL=http://localhost:3001 diff --git a/router/__schemas/full-plugin-project.sh b/router/__schemas/full-plugin-project.sh index 3ec52eeb20..ddd46ab84e 100755 --- a/router/__schemas/full-plugin-project.sh +++ b/router/__schemas/full-plugin-project.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash rm -rf cosmo diff --git a/router/__schemas/plugin.sh b/router/__schemas/plugin.sh index c4698d4d05..0647210b5c 100755 --- a/router/__schemas/plugin.sh +++ b/router/__schemas/plugin.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash rm -rf ../plugins diff --git a/scripts/bench-create.sh b/scripts/bench-create.sh index 6745218ad3..de92aaeeea 100755 --- a/scripts/bench-create.sh +++ b/scripts/bench-create.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # Create and publish a demo federated graph based on the subgraphs in the demo folder diff --git a/scripts/bench-delete.sh b/scripts/bench-delete.sh index 71fdfe0373..d745d013da 100755 --- a/scripts/bench-delete.sh +++ b/scripts/bench-delete.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # Delete the demo diff --git a/scripts/bench-router.sh b/scripts/bench-router.sh index d0ccd40c4a..85e19574df 100755 --- a/scripts/bench-router.sh +++ b/scripts/bench-router.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash cd "../router" diff --git a/scripts/bench-update.sh b/scripts/bench-update.sh index 680775df1c..f7fbf2558a 100755 --- a/scripts/bench-update.sh +++ b/scripts/bench-update.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e cd "../cli" diff --git a/scripts/configurations/kubernetes.sh b/scripts/configurations/kubernetes.sh index 1ee05f5a85..e4c472b632 100755 --- a/scripts/configurations/kubernetes.sh +++ b/scripts/configurations/kubernetes.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e export COSMO_API_KEY=cosmo_669b576aaadc10ee1ae81d9193425705 diff --git a/scripts/configurations/local.sh b/scripts/configurations/local.sh index 50649227a8..f9ddbc46da 100755 --- a/scripts/configurations/local.sh +++ b/scripts/configurations/local.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e export COSMO_API_KEY=cosmo_669b576aaadc10ee1ae81d9193425705 diff --git a/scripts/create-cli-demo.sh b/scripts/create-cli-demo.sh index 4729a249c4..2ca10c9da3 100755 --- a/scripts/create-cli-demo.sh +++ b/scripts/create-cli-demo.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # Create demo using the published CLI @@ -6,7 +6,14 @@ set -e . ./scripts/configurations/local.sh -npm install -g wgc@latest +# Check if wgc is available, install locally if not +if ! command -v wgc &> /dev/null; then + echo "wgc not found, installing locally..." + export NPM_CONFIG_PREFIX="${NPM_CONFIG_PREFIX:-$HOME/.npm-global}" + export PATH="$NPM_CONFIG_PREFIX/bin:$PATH" + mkdir -p "$NPM_CONFIG_PREFIX" + npm install -g --prefix "$NPM_CONFIG_PREFIX" wgc@latest +fi wgc federated-graph create mygraph --namespace default --label-matcher team=A,team=B --routing-url http://localhost:3002/graphql diff --git a/scripts/create-cloud-demo.sh b/scripts/create-cloud-demo.sh index 67ba9957c9..ee368ace17 100755 --- a/scripts/create-cloud-demo.sh +++ b/scripts/create-cloud-demo.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # Create and publish a demo federated graph based on the subgraphs in the demo folder diff --git a/scripts/create-docker-demo.sh b/scripts/create-docker-demo.sh index 9991d4b7b2..66502dea7f 100755 --- a/scripts/create-docker-demo.sh +++ b/scripts/create-docker-demo.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # Create and publish a demo federated graph based on the subgraphs in the demo folder diff --git a/scripts/create-full-local-demo.sh b/scripts/create-full-local-demo.sh index 7a89734a83..de1a3d832b 100755 --- a/scripts/create-full-local-demo.sh +++ b/scripts/create-full-local-demo.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e ################################################################################################################### diff --git a/scripts/create-kubernetes-demo.sh b/scripts/create-kubernetes-demo.sh index 60c2c4ce0b..e2032a05e1 100755 --- a/scripts/create-kubernetes-demo.sh +++ b/scripts/create-kubernetes-demo.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # Create and publish a demo federated graph based on the subgraphs in the demo folder diff --git a/scripts/create-local-demo.sh b/scripts/create-local-demo.sh index ebc77b89dc..7b2261fcbf 100755 --- a/scripts/create-local-demo.sh +++ b/scripts/create-local-demo.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # Create and publish a demo federated graph based on the subgraphs in the demo folder diff --git a/scripts/delete-docker-demo.sh b/scripts/delete-docker-demo.sh index e7161e2a94..97d9160276 100755 --- a/scripts/delete-docker-demo.sh +++ b/scripts/delete-docker-demo.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # Delete the demo diff --git a/scripts/delete-full-local-demo.sh b/scripts/delete-full-local-demo.sh index 66125c4ba0..e1c1684625 100755 --- a/scripts/delete-full-local-demo.sh +++ b/scripts/delete-full-local-demo.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e ################################################################################################################### diff --git a/scripts/delete-kubernetes-demo.sh b/scripts/delete-kubernetes-demo.sh index 2d07cdec02..6897354471 100755 --- a/scripts/delete-kubernetes-demo.sh +++ b/scripts/delete-kubernetes-demo.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # Create and publish a demo federated graph based on the subgraphs in the demo folder diff --git a/scripts/delete-local-demo.sh b/scripts/delete-local-demo.sh index 821eeb87bb..59cb016713 100755 --- a/scripts/delete-local-demo.sh +++ b/scripts/delete-local-demo.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # Delete the demo diff --git a/scripts/demo-router.sh b/scripts/demo-router.sh index 2e3f02feca..e33594b364 100755 --- a/scripts/demo-router.sh +++ b/scripts/demo-router.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash cd "../router" diff --git a/scripts/setup-fulldemo.sh b/scripts/setup-fulldemo.sh index f30eac9411..cdf50397e5 100755 --- a/scripts/setup-fulldemo.sh +++ b/scripts/setup-fulldemo.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash echo "" echo "Setting up keycloak and seeding the database ..." @@ -22,6 +22,12 @@ make create-cli-demo echo "Demo project created successfully." +# Ensure wgc is available in PATH +if ! command -v wgc &> /dev/null; then + export NPM_CONFIG_PREFIX="${NPM_CONFIG_PREFIX:-$HOME/.npm-global}" + export PATH="$NPM_CONFIG_PREFIX/bin:$PATH" +fi + token=$(wgc router token create mytoken --graph-name mygraph --namespace default -r) echo '' @@ -46,4 +52,4 @@ echo "" echo "Login: foo@wundergraph.com" echo "Password: wunder@123" echo "" -echo "To see the playground of the router, navigate to http://localhost:3002" \ No newline at end of file +echo "To see the playground of the router, navigate to http://localhost:3002" diff --git a/scripts/update-demo.sh b/scripts/update-demo.sh index 89ff38d3ae..ff688f8193 100755 --- a/scripts/update-demo.sh +++ b/scripts/update-demo.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e SUBGRAPHS="employees family hobbies products availability mood employeeupdated" diff --git a/studio/entrypoint.sh b/studio/entrypoint.sh index b53aa546b8..58a9779839 100755 --- a/studio/entrypoint.sh +++ b/studio/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Variables envFilename='.env.production'