Yossi
06/28/2022, 1:38 PM10.10.10.255
)
I am using the following docker-compose.yml (which I got and revised a bit by doing prefect server config > docker-compose.yml
networks:
prefect-server:
name: prefect-server
services:
apollo:
command: bash -c "./post-start.sh && npm run serve"
depends_on:
- graphql
- hasura
environment:
GRAPHQL_SERVICE_HOST: <http://graphql>
GRAPHQL_SERVICE_PORT: 4201
HASURA_API_URL: <http://hasura:3000/v1alpha1/graphql>
PREFECT_API_HEALTH_URL: <http://graphql:4201/health>
PREFECT_API_URL: <http://graphql:4201/graphql/>
PREFECT_SERVER__TELEMETRY__ENABLED: "true"
healthcheck:
interval: 10s
retries: 60
start_period: 1s
test: curl --fail --silent "<http://apollo:4200/.well-known/apollo/server-health>"
&> /dev/null || exit 1
timeout: 2s
image: prefecthq/apollo:core-1.2.2
networks:
prefect-server: null
ports:
- 0.0.0.0:4200:4200/tcp
restart: always
graphql:
command: bash -c "prefect-server database upgrade -y && python src/prefect_server/services/graphql/server.py"
depends_on:
- hasura
environment:
PREFECT_CORE_VERSION: 1.2.2
PREFECT_SERVER_DB_CMD: prefect-server database upgrade -y
PREFECT_SERVER__DATABASE__CONNECTION_URL: <postgresql://prefect>:test-password@postgres:5432/prefect_server
PREFECT_SERVER__HASURA__ADMIN_SECRET: hasura-secret-admin-secret
PREFECT_SERVER__HASURA__HOST: hasura
healthcheck:
interval: 20s
retries: 60
start_period: 1s
test: curl --fail --silent "<http://graphql:4201/health>" &> /dev/null || exit
1
timeout: 2s
image: prefecthq/server:core-1.2.2
networks:
prefect-server: null
ports:
- 0.0.0.0:4201:4201/tcp
restart: always
hasura:
command: graphql-engine serve
depends_on:
- postgres
environment:
HASURA_GRAPHQL_DATABASE_URL: <postgresql://prefect>:test-password@postgres:5432/prefect_server
HASURA_GRAPHQL_ENABLE_CONSOLE: "true"
HASURA_GRAPHQL_LOG_LEVEL: warn
HASURA_GRAPHQL_QUERY_PLAN_CACHE_SIZE: 100
HASURA_GRAPHQL_SERVER_PORT: '3000'
HASURA_GRAPHQL_V1_BOOLEAN_NULL_COLLAPSE: "true"
healthcheck:
interval: 10s
retries: 60
start_period: 1s
test: wget -O - <http://hasura>:$${HASURA_GRAPHQL_SERVER_PORT}/healthz &>/dev/null
|| exit 1
timeout: 2s
image: hasura/graphql-engine:v2.1.1
init: true
networks:
prefect-server: null
ports:
- 0.0.0.0:3000:3000/tcp
restart: always
postgres:
command:
- postgres
- -c
- max_connections=150
environment:
POSTGRES_DB: prefect_server
POSTGRES_PASSWORD: test-password
POSTGRES_USER: prefect
healthcheck:
interval: 10s
retries: 60
start_period: 2s
test: pg_isready -q -d $${POSTGRES_DB} -U $${POSTGRES_USER} || exit 1
timeout: 2s
image: postgres:11
networks:
prefect-server: null
ports:
- 0.0.0.0:5432:5432/tcp
restart: always
towel:
command: python src/prefect_server/services/towel/__main__.py
depends_on:
- graphql
environment:
PREFECT_SERVER__HASURA__ADMIN_SECRET: hasura-secret-admin-secret
PREFECT_SERVER__HASURA__HOST: hasura
image: prefecthq/server:core-1.2.2
networks:
prefect-server: null
restart: always
ui:
command: /intercept.sh
depends_on:
- apollo
environment:
PREFECT_SERVER__APOLLO_URL: <http://10.10.10.255:4200/graphql>
healthcheck:
interval: 30s
retries: 3
test: curl --fail --silent --head "<http://ui:8080/>" &> /dev/null || exit 1
timeout: 5s
image: prefecthq/ui:core-1.2.2
networks:
prefect-server: null
ports:
- 0.0.0.0:8080:8080/tcp
restart: always
version: '3.7'
The issue is that the UI when accessed from developer browser can't access the graphql endpoint. How can I tell the server to look for the API elsewhere? Currently it tries to access it on http://localhost:4200/graphql by default
I saw on this github thread some mentioning of VUE_APP_SERVER_URL
but I am not certain how to fit it in.docker exec -ti 76dda821912bash
nginx@76dda821912:/$ ls
bin boot dev docker-entrypoint.d docker-entrypoint.sh etc home intercept.sh lib lib64 media mnt opt proc root run sbin srv start_server.sh sys tmp usr var
nginx@76dda821912:/$ ls -a
. .. .dockerenv bin boot dev docker-entrypoint.d docker-entrypoint.sh etc home intercept.sh lib lib64 media mnt opt proc root run sbin srv start_server.sh sys tmp usr var
nginx@76dda821912:/$ cat start_server.sh
#!/usr/bin/env bash
# Set default prefect_ui_settings if
# env vars not present
if [[ -z ${PREFECT_SERVER__APOLLO_URL} ]]
then
echo "Missing the PREFECT_SERVER__APOLLO_URL environment variable. Using default"
PREFECT_SERVER__APOLLO_URL="<http://localhost:4200/graphql>"
fi
if [[ -z ${PREFECT_SERVER__BASE_URL} ]]
then
echo "Missing the PREFECT_SERVER__BASE_URL environment variable. Using default"
PREFECT_SERVER__BASE_URL="/"
fi
sed -i "s,PREFECT_SERVER__APOLLO_URL,$PREFECT_SERVER__APOLLO_URL," /var/www/settings.json
sed -i "s,PREFECT_SERVER__BASE_URL,$PREFECT_SERVER__BASE_URL," /var/www/settings.json
echo "๐พ๐พ๐พ UI running at localhost:8080 ๐พ๐พ๐พ"
nginx -g "daemon off;"
Kevin Kho
06/28/2022, 10:04 PM[server]
[server.ui]
apollo_url = "<http://YOUR_MACHINES_PUBLIC_IP:4200/graphql>"
before you start the server in the config.toml or under UI to point to the API[server]
endpoint = "YOUR_MACHINES_PUBLIC_IP:4200/graphql"
from local?Yossi
06/29/2022, 7:14 AMKevin Kho
06/29/2022, 7:25 AMYossi
06/29/2022, 7:26 AMdocker-compose up
I am not sure how to inject/change the .toml files. The only thing I have done is to change 127.0.0.1 to 0.0.0.0 and changing APOLLO_URL:
environment:
PREFECT_SERVER__APOLLO_URL: <http://YOUR_MACHINES_PUBLIC_IP:4200/graphql>
Kevin Kho
06/29/2022, 7:42 AMdocker-compose
yourself rather than using prefect server start
?