reflex/tests/integration/init-test/in_docker_test_script.sh
Masen Furer 438b31f270
[ENG-4005] Proxy backend requests on '/' to the frontend (#3300)
* Proxy backend requests on '/' to the frontend

If the optional extra `proxy` is installed, then the backend can handle all
requests by proxy unrecognized routes to the frontend nextjs server.

* Update lock file

* pre-commit fu

* AppHarness: set config frontend_port and backend_port

* integration: frontend port and backend port should return the same content

with proxying enabled by default in dev mode, both frontend and backend ports
on / should return the same content.

* Retry up to 100 times when proxying to frontend

* Reduce retry attempts to 25

Fix log level passing to subprocess

* scripts/wait_for_listening_port: primarily check HTTP responses

if the port is up or not, we don't really care... the HTTP request needs to
work and not return errors

* aiohttp is an optional dep

* adapt integration.sh for --backend-only (counter integration test)

* woops

* windows WTF?

* scratching my head 🎄

* double WTF windows

* Fix remaining integration tests
2025-01-03 15:50:38 -08:00

38 lines
908 B
Bash
Executable File

#!/usr/bin/env bash
set -euxo pipefail
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
export TELEMETRY_ENABLED=false
function do_export () {
template=$1
mkdir ~/"$template"
cd ~/"$template"
rm -rf ~/.local/share/reflex ~/"$template"/.web
reflex init --template "$template"
reflex export
(
cd "$SCRIPTPATH/../../.."
scripts/integration.sh ~/"$template" dev
pkill -9 -f 'next-server|python3' || true
sleep 10
REDIS_URL=redis://localhost scripts/integration.sh ~/"$template" prod
pkill -9 -f 'next-server|python3' || true
sleep 10
)
}
echo "Preparing test project dir"
python3 -m venv ~/venv
source ~/venv/bin/activate
pip install -U pip
echo "Installing reflex from local repo code"
pip install '/reflex-repo[proxy]'
redis-server &
echo "Running reflex init in test project dir"
do_export blank