mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 09:22:43 +03:00
Co-authored-by: Shahidh K Muhammed <muhammedshahid.k@gmail.com>
This commit is contained in:
parent
181902cc6c
commit
c2829c662b
@ -11,11 +11,11 @@ log() {
|
|||||||
DEFAULT_MIGRATIONS_DIR="/hasura-migrations"
|
DEFAULT_MIGRATIONS_DIR="/hasura-migrations"
|
||||||
TEMP_MIGRATIONS_DIR="/tmp/hasura-migrations"
|
TEMP_MIGRATIONS_DIR="/tmp/hasura-migrations"
|
||||||
|
|
||||||
# check server port and set default as 8080
|
# Use 9691 port for running temporary instance.
|
||||||
if [ -z ${HASURA_GRAPHQL_SERVER_PORT+x} ]; then
|
# In case 9691 is occupied (according to docker networking), then this will fail.
|
||||||
log "port env var is not set, defaulting to 8080"
|
# TODO: Find a proper random port or read from env variable.
|
||||||
HASURA_GRAPHQL_SERVER_PORT=8080
|
HASURA_GRAPHQL_MIGRATIONS_SERVER_PORT=9691
|
||||||
fi
|
|
||||||
if [ -z ${HASURA_GRAPHQL_MIGRATIONS_SERVER_TIMEOUT+x} ]; then
|
if [ -z ${HASURA_GRAPHQL_MIGRATIONS_SERVER_TIMEOUT+x} ]; then
|
||||||
log "server timeout is not set defaulting to 30 seconds"
|
log "server timeout is not set defaulting to 30 seconds"
|
||||||
HASURA_GRAPHQL_MIGRATIONS_SERVER_TIMEOUT=30
|
HASURA_GRAPHQL_MIGRATIONS_SERVER_TIMEOUT=30
|
||||||
@ -33,15 +33,15 @@ wait_for_port() {
|
|||||||
log "failed waiting for $PORT" && exit 1
|
log "failed waiting for $PORT" && exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
log "starting graphql engine temporarily on port $HASURA_GRAPHQL_SERVER_PORT"
|
log "starting graphql engine temporarily on port $HASURA_GRAPHQL_MIGRATIONS_SERVER_PORT"
|
||||||
|
|
||||||
# start graphql engine with metadata api enabled
|
# start graphql engine with metadata api enabled
|
||||||
graphql-engine serve --enabled-apis="metadata" &
|
graphql-engine serve --server-port=${HASURA_GRAPHQL_MIGRATIONS_SERVER_PORT} --enabled-apis="metadata" &
|
||||||
# store the pid to kill it later
|
# store the pid to kill it later
|
||||||
PID=$!
|
PID=$!
|
||||||
|
|
||||||
# wait for port to be ready
|
# wait for port to be ready
|
||||||
wait_for_port $HASURA_GRAPHQL_SERVER_PORT
|
wait_for_port $HASURA_GRAPHQL_MIGRATIONS_SERVER_PORT
|
||||||
|
|
||||||
# check if migration directory is set, default otherwise
|
# check if migration directory is set, default otherwise
|
||||||
log "checking for migrations directory"
|
log "checking for migrations directory"
|
||||||
@ -56,7 +56,7 @@ if [ -d "$HASURA_GRAPHQL_MIGRATIONS_DIR" ]; then
|
|||||||
mkdir -p "$TEMP_MIGRATIONS_DIR"
|
mkdir -p "$TEMP_MIGRATIONS_DIR"
|
||||||
cp -a "$HASURA_GRAPHQL_MIGRATIONS_DIR/." "$TEMP_MIGRATIONS_DIR/migrations/"
|
cp -a "$HASURA_GRAPHQL_MIGRATIONS_DIR/." "$TEMP_MIGRATIONS_DIR/migrations/"
|
||||||
cd "$TEMP_MIGRATIONS_DIR"
|
cd "$TEMP_MIGRATIONS_DIR"
|
||||||
echo "endpoint: http://localhost:$HASURA_GRAPHQL_SERVER_PORT" > config.yaml
|
echo "endpoint: http://localhost:$HASURA_GRAPHQL_MIGRATIONS_SERVER_PORT" > config.yaml
|
||||||
echo "show_update_notification: false" >> config.yaml
|
echo "show_update_notification: false" >> config.yaml
|
||||||
hasura-cli migrate apply
|
hasura-cli migrate apply
|
||||||
# check if metadata.[yaml|json] exist and apply
|
# check if metadata.[yaml|json] exist and apply
|
||||||
|
Loading…
Reference in New Issue
Block a user