diff --git a/docs/docs_src/getting_started/basic_auth/fastapi/folder_structure.txt b/docs/docs_src/getting_started/basic_auth/fastapi/folder_structure.txt index c0c1fc5b..ce3a40b3 100644 --- a/docs/docs_src/getting_started/basic_auth/fastapi/folder_structure.txt +++ b/docs/docs_src/getting_started/basic_auth/fastapi/folder_structure.txt @@ -1,8 +1,4 @@ my_fastagency_app -├── deployment -│   └── firebase -│   ├── allowed_users.yaml -│   └── firebase_config.yaml ├── docker │   ├── content │   │   ├── nginx.conf.template diff --git a/docs/docs_src/getting_started/basic_auth/fastapi/my_fastagency_app/deployment/firebase/.gitignore b/docs/docs_src/getting_started/basic_auth/fastapi/my_fastagency_app/deployment/firebase/.gitignore deleted file mode 100644 index 89ccd39e..00000000 --- a/docs/docs_src/getting_started/basic_auth/fastapi/my_fastagency_app/deployment/firebase/.gitignore +++ /dev/null @@ -1 +0,0 @@ -serviceAccountKey.json diff --git a/docs/docs_src/getting_started/basic_auth/fastapi/my_fastagency_app/deployment/firebase/allowed_users.yaml b/docs/docs_src/getting_started/basic_auth/fastapi/my_fastagency_app/deployment/firebase/allowed_users.yaml deleted file mode 100644 index c667f6bb..00000000 --- a/docs/docs_src/getting_started/basic_auth/fastapi/my_fastagency_app/deployment/firebase/allowed_users.yaml +++ /dev/null @@ -1,3 +0,0 @@ -# list all allowed users -- someone@somewhere.com -# - someone.else@somewhere.com diff --git a/docs/docs_src/getting_started/basic_auth/fastapi/my_fastagency_app/deployment/firebase/firebase_config.yaml b/docs/docs_src/getting_started/basic_auth/fastapi/my_fastagency_app/deployment/firebase/firebase_config.yaml deleted file mode 100644 index 8ea66ad9..00000000 --- a/docs/docs_src/getting_started/basic_auth/fastapi/my_fastagency_app/deployment/firebase/firebase_config.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# You can find the guide for getting the config values here: -# https://support.google.com/firebase/answer/7015592?hl=en#web&zippy=%2Cin-this-article -api_key: "" -auth_domain: "" -project_id: "" -storage_bucket: "" -messaging_sender_id: "" -app_id: "" diff --git a/docs/docs_src/getting_started/basic_auth/fastapi/my_fastagency_app/docker/content/nginx.conf.template b/docs/docs_src/getting_started/basic_auth/fastapi/my_fastagency_app/docker/content/nginx.conf.template index 0ecb7679..52347c6e 100644 --- a/docs/docs_src/getting_started/basic_auth/fastapi/my_fastagency_app/docker/content/nginx.conf.template +++ b/docs/docs_src/getting_started/basic_auth/fastapi/my_fastagency_app/docker/content/nginx.conf.template @@ -20,7 +20,7 @@ map $fly_machine_id $sticky_action { # Main server block server { - listen $MESOP_PORT; + listen $SERVICE_PORT; server_name localhost; # Security headers diff --git a/docs/docs_src/getting_started/basic_auth/fastapi/my_fastagency_app/docker/content/run_fastagency.sh b/docs/docs_src/getting_started/basic_auth/fastapi/my_fastagency_app/docker/content/run_fastagency.sh index 77781096..548457f6 100755 --- a/docs/docs_src/getting_started/basic_auth/fastapi/my_fastagency_app/docker/content/run_fastagency.sh +++ b/docs/docs_src/getting_started/basic_auth/fastapi/my_fastagency_app/docker/content/run_fastagency.sh @@ -5,7 +5,9 @@ FASTAPI_PORT=${FASTAPI_PORT:-8008} + export MESOP_PORT=${MESOP_PORT:-8888} +export SERVICE_PORT=$MESOP_PORT # Default number of workers if not set WORKERS=${WORKERS:-1} @@ -18,24 +20,26 @@ echo "Fly machine ID: $FLY_MACHINE_ID" # Generate nginx config for ((i=1; i<$WORKERS+1; i++)) do - PORT=$((MESOP_PORT + i)) + PORT=$((SERVICE_PORT + i)) sed -i "5i\ server 127.0.0.1:$PORT;" nginx.conf.template done -envsubst '${MESOP_PORT},${FLY_MACHINE_ID}' < nginx.conf.template >/etc/nginx/conf.d/default.conf +envsubst '${SERVICE_PORT},${FLY_MACHINE_ID}' < nginx.conf.template >/etc/nginx/conf.d/default.conf echo "Nginx config:" cat /etc/nginx/conf.d/default.conf # Start nginx nginx -g "daemon off;" & + # Run uvicorn server uvicorn my_fastagency_app.deployment.main_1_fastapi:app --host 0.0.0.0 --port $FASTAPI_PORT > /dev/stdout 2>&1 & + # Run gunicorn server # Start multiple single-worker gunicorn instances on consecutive ports for ((i=1; i<$WORKERS+1; i++)) do - PORT=$((MESOP_PORT + i)) + PORT=$((SERVICE_PORT + i)) echo "Starting gunicorn on port $PORT" gunicorn --workers=1 my_fastagency_app.deployment.main_2_mesop:app --bind 0.0.0.0:$PORT > /dev/stdout 2>&1 & done diff --git a/docs/docs_src/getting_started/basic_auth/fastapi/my_fastagency_app/scripts/run_docker.sh b/docs/docs_src/getting_started/basic_auth/fastapi/my_fastagency_app/scripts/run_docker.sh index 6933bf73..a6beea9c 100755 --- a/docs/docs_src/getting_started/basic_auth/fastapi/my_fastagency_app/scripts/run_docker.sh +++ b/docs/docs_src/getting_started/basic_auth/fastapi/my_fastagency_app/scripts/run_docker.sh @@ -1,3 +1,3 @@ #!/bin/bash -docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8008:8008 -p 8888:8888 deploy_fastagency +docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8008:8008 -p 8888:8888 deploy_fastagency diff --git a/docs/docs_src/getting_started/basic_auth/mesop/folder_structure.txt b/docs/docs_src/getting_started/basic_auth/mesop/folder_structure.txt index 46225106..a8d5744c 100644 --- a/docs/docs_src/getting_started/basic_auth/mesop/folder_structure.txt +++ b/docs/docs_src/getting_started/basic_auth/mesop/folder_structure.txt @@ -1,8 +1,4 @@ my_fastagency_app -├── deployment -│   └── firebase -│   ├── allowed_users.yaml -│   └── firebase_config.yaml ├── docker │   ├── content │   │   ├── nginx.conf.template diff --git a/docs/docs_src/getting_started/basic_auth/mesop/my_fastagency_app/deployment/firebase/.gitignore b/docs/docs_src/getting_started/basic_auth/mesop/my_fastagency_app/deployment/firebase/.gitignore deleted file mode 100644 index 89ccd39e..00000000 --- a/docs/docs_src/getting_started/basic_auth/mesop/my_fastagency_app/deployment/firebase/.gitignore +++ /dev/null @@ -1 +0,0 @@ -serviceAccountKey.json diff --git a/docs/docs_src/getting_started/basic_auth/mesop/my_fastagency_app/deployment/firebase/allowed_users.yaml b/docs/docs_src/getting_started/basic_auth/mesop/my_fastagency_app/deployment/firebase/allowed_users.yaml deleted file mode 100644 index c667f6bb..00000000 --- a/docs/docs_src/getting_started/basic_auth/mesop/my_fastagency_app/deployment/firebase/allowed_users.yaml +++ /dev/null @@ -1,3 +0,0 @@ -# list all allowed users -- someone@somewhere.com -# - someone.else@somewhere.com diff --git a/docs/docs_src/getting_started/basic_auth/mesop/my_fastagency_app/deployment/firebase/firebase_config.yaml b/docs/docs_src/getting_started/basic_auth/mesop/my_fastagency_app/deployment/firebase/firebase_config.yaml deleted file mode 100644 index 8ea66ad9..00000000 --- a/docs/docs_src/getting_started/basic_auth/mesop/my_fastagency_app/deployment/firebase/firebase_config.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# You can find the guide for getting the config values here: -# https://support.google.com/firebase/answer/7015592?hl=en#web&zippy=%2Cin-this-article -api_key: "" -auth_domain: "" -project_id: "" -storage_bucket: "" -messaging_sender_id: "" -app_id: "" diff --git a/docs/docs_src/getting_started/basic_auth/mesop/my_fastagency_app/docker/content/nginx.conf.template b/docs/docs_src/getting_started/basic_auth/mesop/my_fastagency_app/docker/content/nginx.conf.template index 0ecb7679..52347c6e 100644 --- a/docs/docs_src/getting_started/basic_auth/mesop/my_fastagency_app/docker/content/nginx.conf.template +++ b/docs/docs_src/getting_started/basic_auth/mesop/my_fastagency_app/docker/content/nginx.conf.template @@ -20,7 +20,7 @@ map $fly_machine_id $sticky_action { # Main server block server { - listen $MESOP_PORT; + listen $SERVICE_PORT; server_name localhost; # Security headers diff --git a/docs/docs_src/getting_started/basic_auth/mesop/my_fastagency_app/docker/content/run_fastagency.sh b/docs/docs_src/getting_started/basic_auth/mesop/my_fastagency_app/docker/content/run_fastagency.sh index 5f546fc6..55aa17d3 100755 --- a/docs/docs_src/getting_started/basic_auth/mesop/my_fastagency_app/docker/content/run_fastagency.sh +++ b/docs/docs_src/getting_started/basic_auth/mesop/my_fastagency_app/docker/content/run_fastagency.sh @@ -3,7 +3,9 @@ # Accept env variable for PORT + export MESOP_PORT=${MESOP_PORT:-8888} +export SERVICE_PORT=$MESOP_PORT # Default number of workers if not set WORKERS=${WORKERS:-1} @@ -16,24 +18,26 @@ echo "Fly machine ID: $FLY_MACHINE_ID" # Generate nginx config for ((i=1; i<$WORKERS+1; i++)) do - PORT=$((MESOP_PORT + i)) + PORT=$((SERVICE_PORT + i)) sed -i "5i\ server 127.0.0.1:$PORT;" nginx.conf.template done -envsubst '${MESOP_PORT},${FLY_MACHINE_ID}' < nginx.conf.template >/etc/nginx/conf.d/default.conf +envsubst '${SERVICE_PORT},${FLY_MACHINE_ID}' < nginx.conf.template >/etc/nginx/conf.d/default.conf echo "Nginx config:" cat /etc/nginx/conf.d/default.conf # Start nginx nginx -g "daemon off;" & + # Run uvicorn server uvicorn my_fastagency_app.deployment.main_:app --host 0.0.0.0 --port $FASTAPI_PORT > /dev/stdout 2>&1 & + # Run gunicorn server # Start multiple single-worker gunicorn instances on consecutive ports for ((i=1; i<$WORKERS+1; i++)) do - PORT=$((MESOP_PORT + i)) + PORT=$((SERVICE_PORT + i)) echo "Starting gunicorn on port $PORT" gunicorn --workers=1 my_fastagency_app.deployment.main:app --bind 0.0.0.0:$PORT > /dev/stdout 2>&1 & done diff --git a/docs/docs_src/getting_started/basic_auth/mesop/my_fastagency_app/scripts/run_docker.sh b/docs/docs_src/getting_started/basic_auth/mesop/my_fastagency_app/scripts/run_docker.sh index 1c9df5e0..ab261872 100755 --- a/docs/docs_src/getting_started/basic_auth/mesop/my_fastagency_app/scripts/run_docker.sh +++ b/docs/docs_src/getting_started/basic_auth/mesop/my_fastagency_app/scripts/run_docker.sh @@ -1,3 +1,3 @@ #!/bin/bash -docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8888:8888 deploy_fastagency +docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8888:8888 deploy_fastagency diff --git a/docs/docs_src/getting_started/basic_auth/nats_n_fastapi/folder_structure.txt b/docs/docs_src/getting_started/basic_auth/nats_n_fastapi/folder_structure.txt index 26395887..bd5b9f02 100644 --- a/docs/docs_src/getting_started/basic_auth/nats_n_fastapi/folder_structure.txt +++ b/docs/docs_src/getting_started/basic_auth/nats_n_fastapi/folder_structure.txt @@ -1,8 +1,4 @@ my_fastagency_app -├── deployment -│   └── firebase -│   ├── allowed_users.yaml -│   └── firebase_config.yaml ├── docker │   ├── content │   │   ├── nginx.conf.template diff --git a/docs/docs_src/getting_started/basic_auth/nats_n_fastapi/my_fastagency_app/deployment/firebase/.gitignore b/docs/docs_src/getting_started/basic_auth/nats_n_fastapi/my_fastagency_app/deployment/firebase/.gitignore deleted file mode 100644 index 89ccd39e..00000000 --- a/docs/docs_src/getting_started/basic_auth/nats_n_fastapi/my_fastagency_app/deployment/firebase/.gitignore +++ /dev/null @@ -1 +0,0 @@ -serviceAccountKey.json diff --git a/docs/docs_src/getting_started/basic_auth/nats_n_fastapi/my_fastagency_app/deployment/firebase/allowed_users.yaml b/docs/docs_src/getting_started/basic_auth/nats_n_fastapi/my_fastagency_app/deployment/firebase/allowed_users.yaml deleted file mode 100644 index c667f6bb..00000000 --- a/docs/docs_src/getting_started/basic_auth/nats_n_fastapi/my_fastagency_app/deployment/firebase/allowed_users.yaml +++ /dev/null @@ -1,3 +0,0 @@ -# list all allowed users -- someone@somewhere.com -# - someone.else@somewhere.com diff --git a/docs/docs_src/getting_started/basic_auth/nats_n_fastapi/my_fastagency_app/deployment/firebase/firebase_config.yaml b/docs/docs_src/getting_started/basic_auth/nats_n_fastapi/my_fastagency_app/deployment/firebase/firebase_config.yaml deleted file mode 100644 index 8ea66ad9..00000000 --- a/docs/docs_src/getting_started/basic_auth/nats_n_fastapi/my_fastagency_app/deployment/firebase/firebase_config.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# You can find the guide for getting the config values here: -# https://support.google.com/firebase/answer/7015592?hl=en#web&zippy=%2Cin-this-article -api_key: "" -auth_domain: "" -project_id: "" -storage_bucket: "" -messaging_sender_id: "" -app_id: "" diff --git a/docs/docs_src/getting_started/basic_auth/nats_n_fastapi/my_fastagency_app/docker/content/nginx.conf.template b/docs/docs_src/getting_started/basic_auth/nats_n_fastapi/my_fastagency_app/docker/content/nginx.conf.template index 0ecb7679..52347c6e 100644 --- a/docs/docs_src/getting_started/basic_auth/nats_n_fastapi/my_fastagency_app/docker/content/nginx.conf.template +++ b/docs/docs_src/getting_started/basic_auth/nats_n_fastapi/my_fastagency_app/docker/content/nginx.conf.template @@ -20,7 +20,7 @@ map $fly_machine_id $sticky_action { # Main server block server { - listen $MESOP_PORT; + listen $SERVICE_PORT; server_name localhost; # Security headers diff --git a/docs/docs_src/getting_started/basic_auth/nats_n_fastapi/my_fastagency_app/docker/content/run_fastagency.sh b/docs/docs_src/getting_started/basic_auth/nats_n_fastapi/my_fastagency_app/docker/content/run_fastagency.sh index d1a56eba..1db12dbb 100755 --- a/docs/docs_src/getting_started/basic_auth/nats_n_fastapi/my_fastagency_app/docker/content/run_fastagency.sh +++ b/docs/docs_src/getting_started/basic_auth/nats_n_fastapi/my_fastagency_app/docker/content/run_fastagency.sh @@ -7,7 +7,9 @@ NATS_FASTAPI_PORT=${NATS_FASTAPI_PORT:-8000} FASTAPI_PORT=${FASTAPI_PORT:-8008} + export MESOP_PORT=${MESOP_PORT:-8888} +export SERVICE_PORT=$MESOP_PORT # Default number of workers if not set WORKERS=${WORKERS:-1} @@ -20,10 +22,10 @@ echo "Fly machine ID: $FLY_MACHINE_ID" # Generate nginx config for ((i=1; i<$WORKERS+1; i++)) do - PORT=$((MESOP_PORT + i)) + PORT=$((SERVICE_PORT + i)) sed -i "5i\ server 127.0.0.1:$PORT;" nginx.conf.template done -envsubst '${MESOP_PORT},${FLY_MACHINE_ID}' < nginx.conf.template >/etc/nginx/conf.d/default.conf +envsubst '${SERVICE_PORT},${FLY_MACHINE_ID}' < nginx.conf.template >/etc/nginx/conf.d/default.conf echo "Nginx config:" cat /etc/nginx/conf.d/default.conf @@ -33,14 +35,16 @@ nginx -g "daemon off;" & # Run nats uvicorn server uvicorn my_fastagency_app.deployment.main_1_nats:app --host 0.0.0.0 --port $NATS_FASTAPI_PORT > /dev/stdout 2>&1 & + # Run uvicorn server uvicorn my_fastagency_app.deployment.main_2_fastapi:app --host 0.0.0.0 --port $FASTAPI_PORT > /dev/stdout 2>&1 & + # Run gunicorn server # Start multiple single-worker gunicorn instances on consecutive ports for ((i=1; i<$WORKERS+1; i++)) do - PORT=$((MESOP_PORT + i)) + PORT=$((SERVICE_PORT + i)) echo "Starting gunicorn on port $PORT" gunicorn --workers=1 my_fastagency_app.deployment.main_3_mesop:app --bind 0.0.0.0:$PORT > /dev/stdout 2>&1 & done diff --git a/docs/docs_src/getting_started/no_auth/fastapi/folder_structure.txt b/docs/docs_src/getting_started/no_auth/fastapi/folder_structure.txt index c0c1fc5b..ce3a40b3 100644 --- a/docs/docs_src/getting_started/no_auth/fastapi/folder_structure.txt +++ b/docs/docs_src/getting_started/no_auth/fastapi/folder_structure.txt @@ -1,8 +1,4 @@ my_fastagency_app -├── deployment -│   └── firebase -│   ├── allowed_users.yaml -│   └── firebase_config.yaml ├── docker │   ├── content │   │   ├── nginx.conf.template diff --git a/docs/docs_src/getting_started/no_auth/fastapi/my_fastagency_app/deployment/firebase/.gitignore b/docs/docs_src/getting_started/no_auth/fastapi/my_fastagency_app/deployment/firebase/.gitignore deleted file mode 100644 index 89ccd39e..00000000 --- a/docs/docs_src/getting_started/no_auth/fastapi/my_fastagency_app/deployment/firebase/.gitignore +++ /dev/null @@ -1 +0,0 @@ -serviceAccountKey.json diff --git a/docs/docs_src/getting_started/no_auth/fastapi/my_fastagency_app/deployment/firebase/allowed_users.yaml b/docs/docs_src/getting_started/no_auth/fastapi/my_fastagency_app/deployment/firebase/allowed_users.yaml deleted file mode 100644 index c667f6bb..00000000 --- a/docs/docs_src/getting_started/no_auth/fastapi/my_fastagency_app/deployment/firebase/allowed_users.yaml +++ /dev/null @@ -1,3 +0,0 @@ -# list all allowed users -- someone@somewhere.com -# - someone.else@somewhere.com diff --git a/docs/docs_src/getting_started/no_auth/fastapi/my_fastagency_app/deployment/firebase/firebase_config.yaml b/docs/docs_src/getting_started/no_auth/fastapi/my_fastagency_app/deployment/firebase/firebase_config.yaml deleted file mode 100644 index 8ea66ad9..00000000 --- a/docs/docs_src/getting_started/no_auth/fastapi/my_fastagency_app/deployment/firebase/firebase_config.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# You can find the guide for getting the config values here: -# https://support.google.com/firebase/answer/7015592?hl=en#web&zippy=%2Cin-this-article -api_key: "" -auth_domain: "" -project_id: "" -storage_bucket: "" -messaging_sender_id: "" -app_id: "" diff --git a/docs/docs_src/getting_started/no_auth/fastapi/my_fastagency_app/docker/content/nginx.conf.template b/docs/docs_src/getting_started/no_auth/fastapi/my_fastagency_app/docker/content/nginx.conf.template index 0ecb7679..52347c6e 100644 --- a/docs/docs_src/getting_started/no_auth/fastapi/my_fastagency_app/docker/content/nginx.conf.template +++ b/docs/docs_src/getting_started/no_auth/fastapi/my_fastagency_app/docker/content/nginx.conf.template @@ -20,7 +20,7 @@ map $fly_machine_id $sticky_action { # Main server block server { - listen $MESOP_PORT; + listen $SERVICE_PORT; server_name localhost; # Security headers diff --git a/docs/docs_src/getting_started/no_auth/fastapi/my_fastagency_app/docker/content/run_fastagency.sh b/docs/docs_src/getting_started/no_auth/fastapi/my_fastagency_app/docker/content/run_fastagency.sh index 77781096..548457f6 100755 --- a/docs/docs_src/getting_started/no_auth/fastapi/my_fastagency_app/docker/content/run_fastagency.sh +++ b/docs/docs_src/getting_started/no_auth/fastapi/my_fastagency_app/docker/content/run_fastagency.sh @@ -5,7 +5,9 @@ FASTAPI_PORT=${FASTAPI_PORT:-8008} + export MESOP_PORT=${MESOP_PORT:-8888} +export SERVICE_PORT=$MESOP_PORT # Default number of workers if not set WORKERS=${WORKERS:-1} @@ -18,24 +20,26 @@ echo "Fly machine ID: $FLY_MACHINE_ID" # Generate nginx config for ((i=1; i<$WORKERS+1; i++)) do - PORT=$((MESOP_PORT + i)) + PORT=$((SERVICE_PORT + i)) sed -i "5i\ server 127.0.0.1:$PORT;" nginx.conf.template done -envsubst '${MESOP_PORT},${FLY_MACHINE_ID}' < nginx.conf.template >/etc/nginx/conf.d/default.conf +envsubst '${SERVICE_PORT},${FLY_MACHINE_ID}' < nginx.conf.template >/etc/nginx/conf.d/default.conf echo "Nginx config:" cat /etc/nginx/conf.d/default.conf # Start nginx nginx -g "daemon off;" & + # Run uvicorn server uvicorn my_fastagency_app.deployment.main_1_fastapi:app --host 0.0.0.0 --port $FASTAPI_PORT > /dev/stdout 2>&1 & + # Run gunicorn server # Start multiple single-worker gunicorn instances on consecutive ports for ((i=1; i<$WORKERS+1; i++)) do - PORT=$((MESOP_PORT + i)) + PORT=$((SERVICE_PORT + i)) echo "Starting gunicorn on port $PORT" gunicorn --workers=1 my_fastagency_app.deployment.main_2_mesop:app --bind 0.0.0.0:$PORT > /dev/stdout 2>&1 & done diff --git a/docs/docs_src/getting_started/no_auth/fastapi/my_fastagency_app/scripts/run_docker.sh b/docs/docs_src/getting_started/no_auth/fastapi/my_fastagency_app/scripts/run_docker.sh index 6933bf73..a6beea9c 100755 --- a/docs/docs_src/getting_started/no_auth/fastapi/my_fastagency_app/scripts/run_docker.sh +++ b/docs/docs_src/getting_started/no_auth/fastapi/my_fastagency_app/scripts/run_docker.sh @@ -1,3 +1,3 @@ #!/bin/bash -docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8008:8008 -p 8888:8888 deploy_fastagency +docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8008:8008 -p 8888:8888 deploy_fastagency diff --git a/docs/docs_src/getting_started/no_auth/mesop/folder_structure.txt b/docs/docs_src/getting_started/no_auth/mesop/folder_structure.txt index 46225106..a8d5744c 100644 --- a/docs/docs_src/getting_started/no_auth/mesop/folder_structure.txt +++ b/docs/docs_src/getting_started/no_auth/mesop/folder_structure.txt @@ -1,8 +1,4 @@ my_fastagency_app -├── deployment -│   └── firebase -│   ├── allowed_users.yaml -│   └── firebase_config.yaml ├── docker │   ├── content │   │   ├── nginx.conf.template diff --git a/docs/docs_src/getting_started/no_auth/mesop/my_fastagency_app/deployment/firebase/.gitignore b/docs/docs_src/getting_started/no_auth/mesop/my_fastagency_app/deployment/firebase/.gitignore deleted file mode 100644 index 89ccd39e..00000000 --- a/docs/docs_src/getting_started/no_auth/mesop/my_fastagency_app/deployment/firebase/.gitignore +++ /dev/null @@ -1 +0,0 @@ -serviceAccountKey.json diff --git a/docs/docs_src/getting_started/no_auth/mesop/my_fastagency_app/deployment/firebase/allowed_users.yaml b/docs/docs_src/getting_started/no_auth/mesop/my_fastagency_app/deployment/firebase/allowed_users.yaml deleted file mode 100644 index c667f6bb..00000000 --- a/docs/docs_src/getting_started/no_auth/mesop/my_fastagency_app/deployment/firebase/allowed_users.yaml +++ /dev/null @@ -1,3 +0,0 @@ -# list all allowed users -- someone@somewhere.com -# - someone.else@somewhere.com diff --git a/docs/docs_src/getting_started/no_auth/mesop/my_fastagency_app/deployment/firebase/firebase_config.yaml b/docs/docs_src/getting_started/no_auth/mesop/my_fastagency_app/deployment/firebase/firebase_config.yaml deleted file mode 100644 index 8ea66ad9..00000000 --- a/docs/docs_src/getting_started/no_auth/mesop/my_fastagency_app/deployment/firebase/firebase_config.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# You can find the guide for getting the config values here: -# https://support.google.com/firebase/answer/7015592?hl=en#web&zippy=%2Cin-this-article -api_key: "" -auth_domain: "" -project_id: "" -storage_bucket: "" -messaging_sender_id: "" -app_id: "" diff --git a/docs/docs_src/getting_started/no_auth/mesop/my_fastagency_app/docker/content/nginx.conf.template b/docs/docs_src/getting_started/no_auth/mesop/my_fastagency_app/docker/content/nginx.conf.template index 0ecb7679..52347c6e 100644 --- a/docs/docs_src/getting_started/no_auth/mesop/my_fastagency_app/docker/content/nginx.conf.template +++ b/docs/docs_src/getting_started/no_auth/mesop/my_fastagency_app/docker/content/nginx.conf.template @@ -20,7 +20,7 @@ map $fly_machine_id $sticky_action { # Main server block server { - listen $MESOP_PORT; + listen $SERVICE_PORT; server_name localhost; # Security headers diff --git a/docs/docs_src/getting_started/no_auth/mesop/my_fastagency_app/docker/content/run_fastagency.sh b/docs/docs_src/getting_started/no_auth/mesop/my_fastagency_app/docker/content/run_fastagency.sh index 5f546fc6..55aa17d3 100755 --- a/docs/docs_src/getting_started/no_auth/mesop/my_fastagency_app/docker/content/run_fastagency.sh +++ b/docs/docs_src/getting_started/no_auth/mesop/my_fastagency_app/docker/content/run_fastagency.sh @@ -3,7 +3,9 @@ # Accept env variable for PORT + export MESOP_PORT=${MESOP_PORT:-8888} +export SERVICE_PORT=$MESOP_PORT # Default number of workers if not set WORKERS=${WORKERS:-1} @@ -16,24 +18,26 @@ echo "Fly machine ID: $FLY_MACHINE_ID" # Generate nginx config for ((i=1; i<$WORKERS+1; i++)) do - PORT=$((MESOP_PORT + i)) + PORT=$((SERVICE_PORT + i)) sed -i "5i\ server 127.0.0.1:$PORT;" nginx.conf.template done -envsubst '${MESOP_PORT},${FLY_MACHINE_ID}' < nginx.conf.template >/etc/nginx/conf.d/default.conf +envsubst '${SERVICE_PORT},${FLY_MACHINE_ID}' < nginx.conf.template >/etc/nginx/conf.d/default.conf echo "Nginx config:" cat /etc/nginx/conf.d/default.conf # Start nginx nginx -g "daemon off;" & + # Run uvicorn server uvicorn my_fastagency_app.deployment.main_:app --host 0.0.0.0 --port $FASTAPI_PORT > /dev/stdout 2>&1 & + # Run gunicorn server # Start multiple single-worker gunicorn instances on consecutive ports for ((i=1; i<$WORKERS+1; i++)) do - PORT=$((MESOP_PORT + i)) + PORT=$((SERVICE_PORT + i)) echo "Starting gunicorn on port $PORT" gunicorn --workers=1 my_fastagency_app.deployment.main:app --bind 0.0.0.0:$PORT > /dev/stdout 2>&1 & done diff --git a/docs/docs_src/getting_started/no_auth/mesop/my_fastagency_app/scripts/run_docker.sh b/docs/docs_src/getting_started/no_auth/mesop/my_fastagency_app/scripts/run_docker.sh index 1c9df5e0..ab261872 100755 --- a/docs/docs_src/getting_started/no_auth/mesop/my_fastagency_app/scripts/run_docker.sh +++ b/docs/docs_src/getting_started/no_auth/mesop/my_fastagency_app/scripts/run_docker.sh @@ -1,3 +1,3 @@ #!/bin/bash -docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8888:8888 deploy_fastagency +docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8888:8888 deploy_fastagency diff --git a/docs/docs_src/getting_started/no_auth/nats_n_fastapi/folder_structure.txt b/docs/docs_src/getting_started/no_auth/nats_n_fastapi/folder_structure.txt index 26395887..bd5b9f02 100644 --- a/docs/docs_src/getting_started/no_auth/nats_n_fastapi/folder_structure.txt +++ b/docs/docs_src/getting_started/no_auth/nats_n_fastapi/folder_structure.txt @@ -1,8 +1,4 @@ my_fastagency_app -├── deployment -│   └── firebase -│   ├── allowed_users.yaml -│   └── firebase_config.yaml ├── docker │   ├── content │   │   ├── nginx.conf.template diff --git a/docs/docs_src/getting_started/no_auth/nats_n_fastapi/my_fastagency_app/deployment/firebase/.gitignore b/docs/docs_src/getting_started/no_auth/nats_n_fastapi/my_fastagency_app/deployment/firebase/.gitignore deleted file mode 100644 index 89ccd39e..00000000 --- a/docs/docs_src/getting_started/no_auth/nats_n_fastapi/my_fastagency_app/deployment/firebase/.gitignore +++ /dev/null @@ -1 +0,0 @@ -serviceAccountKey.json diff --git a/docs/docs_src/getting_started/no_auth/nats_n_fastapi/my_fastagency_app/deployment/firebase/allowed_users.yaml b/docs/docs_src/getting_started/no_auth/nats_n_fastapi/my_fastagency_app/deployment/firebase/allowed_users.yaml deleted file mode 100644 index c667f6bb..00000000 --- a/docs/docs_src/getting_started/no_auth/nats_n_fastapi/my_fastagency_app/deployment/firebase/allowed_users.yaml +++ /dev/null @@ -1,3 +0,0 @@ -# list all allowed users -- someone@somewhere.com -# - someone.else@somewhere.com diff --git a/docs/docs_src/getting_started/no_auth/nats_n_fastapi/my_fastagency_app/deployment/firebase/firebase_config.yaml b/docs/docs_src/getting_started/no_auth/nats_n_fastapi/my_fastagency_app/deployment/firebase/firebase_config.yaml deleted file mode 100644 index 8ea66ad9..00000000 --- a/docs/docs_src/getting_started/no_auth/nats_n_fastapi/my_fastagency_app/deployment/firebase/firebase_config.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# You can find the guide for getting the config values here: -# https://support.google.com/firebase/answer/7015592?hl=en#web&zippy=%2Cin-this-article -api_key: "" -auth_domain: "" -project_id: "" -storage_bucket: "" -messaging_sender_id: "" -app_id: "" diff --git a/docs/docs_src/getting_started/no_auth/nats_n_fastapi/my_fastagency_app/docker/content/nginx.conf.template b/docs/docs_src/getting_started/no_auth/nats_n_fastapi/my_fastagency_app/docker/content/nginx.conf.template index 0ecb7679..52347c6e 100644 --- a/docs/docs_src/getting_started/no_auth/nats_n_fastapi/my_fastagency_app/docker/content/nginx.conf.template +++ b/docs/docs_src/getting_started/no_auth/nats_n_fastapi/my_fastagency_app/docker/content/nginx.conf.template @@ -20,7 +20,7 @@ map $fly_machine_id $sticky_action { # Main server block server { - listen $MESOP_PORT; + listen $SERVICE_PORT; server_name localhost; # Security headers diff --git a/docs/docs_src/getting_started/no_auth/nats_n_fastapi/my_fastagency_app/docker/content/run_fastagency.sh b/docs/docs_src/getting_started/no_auth/nats_n_fastapi/my_fastagency_app/docker/content/run_fastagency.sh index d1a56eba..1db12dbb 100755 --- a/docs/docs_src/getting_started/no_auth/nats_n_fastapi/my_fastagency_app/docker/content/run_fastagency.sh +++ b/docs/docs_src/getting_started/no_auth/nats_n_fastapi/my_fastagency_app/docker/content/run_fastagency.sh @@ -7,7 +7,9 @@ NATS_FASTAPI_PORT=${NATS_FASTAPI_PORT:-8000} FASTAPI_PORT=${FASTAPI_PORT:-8008} + export MESOP_PORT=${MESOP_PORT:-8888} +export SERVICE_PORT=$MESOP_PORT # Default number of workers if not set WORKERS=${WORKERS:-1} @@ -20,10 +22,10 @@ echo "Fly machine ID: $FLY_MACHINE_ID" # Generate nginx config for ((i=1; i<$WORKERS+1; i++)) do - PORT=$((MESOP_PORT + i)) + PORT=$((SERVICE_PORT + i)) sed -i "5i\ server 127.0.0.1:$PORT;" nginx.conf.template done -envsubst '${MESOP_PORT},${FLY_MACHINE_ID}' < nginx.conf.template >/etc/nginx/conf.d/default.conf +envsubst '${SERVICE_PORT},${FLY_MACHINE_ID}' < nginx.conf.template >/etc/nginx/conf.d/default.conf echo "Nginx config:" cat /etc/nginx/conf.d/default.conf @@ -33,14 +35,16 @@ nginx -g "daemon off;" & # Run nats uvicorn server uvicorn my_fastagency_app.deployment.main_1_nats:app --host 0.0.0.0 --port $NATS_FASTAPI_PORT > /dev/stdout 2>&1 & + # Run uvicorn server uvicorn my_fastagency_app.deployment.main_2_fastapi:app --host 0.0.0.0 --port $FASTAPI_PORT > /dev/stdout 2>&1 & + # Run gunicorn server # Start multiple single-worker gunicorn instances on consecutive ports for ((i=1; i<$WORKERS+1; i++)) do - PORT=$((MESOP_PORT + i)) + PORT=$((SERVICE_PORT + i)) echo "Starting gunicorn on port $PORT" gunicorn --workers=1 my_fastagency_app.deployment.main_3_mesop:app --bind 0.0.0.0:$PORT > /dev/stdout 2>&1 & done diff --git a/tests/api/openapi/test_end2end.py b/tests/api/openapi/test_end2end.py index 9d705099..79d28d81 100644 --- a/tests/api/openapi/test_end2end.py +++ b/tests/api/openapi/test_end2end.py @@ -9,6 +9,7 @@ import pytest from autogen.agentchat import ConversableAgent from fastapi import Body, FastAPI, Query +from packaging.version import Version from pydantic import BaseModel, Field from fastagency.api.openapi import OpenAPI @@ -87,7 +88,7 @@ def openapi_schema(self, fastapi_app: FastAPI) -> dict[str, Any]: return fastapi_app.openapi() def test_openapi_schema( - self, openapi_schema: dict[str, Any], pydantic_version: float + self, openapi_schema: dict[str, Any], pydantic_version: Version ) -> None: expected = { "openapi": "3.1.0", @@ -352,7 +353,7 @@ def test_openapi_schema( }, } pydantic28_delta = '{"paths": {"/items/{item_id}": {"put": {"requestBody": {"content": {"application/json": {"schema": {"allOf": [{"$$ref": "#/components/schemas/Item"}], "title": "Item", "$delete": ["$$ref"]}}}}}}, "/items/": {"post": {"requestBody": {"content": {"application/json": {"schema": {"allOf": [{"$$ref": "#/components/schemas/Item"}], "title": "Item", "$delete": ["$$ref"]}}}}}}}}' - if pydantic_version < 2.9: + if pydantic_version < Version("2.9"): # print(f"pydantic28_delta = '{jsondiff.diff(expected, openapi_schema, dump=True)}'") expected = jsondiff.patch(json.dumps(expected), pydantic28_delta, load=True) # print(openapi_schema) @@ -368,7 +369,7 @@ def generated_code_path(self, openapi_schema: dict[str, Any]) -> Iterator[Path]: yield td def test_generated_code_main( - self, generated_code_path: Path, pydantic_version: float + self, generated_code_path: Path, pydantic_version: Version ) -> None: expected_pydantic_v28 = '''# generated by fastapi-codegen: # filename: openapi.json @@ -553,7 +554,9 @@ def delete_item_items__item_id__delete( pass ''' expected = ( - expected_pydantic_v28 if pydantic_version < 2.9 else expected_pydantic_v29 + expected_pydantic_v28 + if pydantic_version < Version("2.9") + else expected_pydantic_v29 ) suffix = generated_code_path.name expected = expected.replace("tmp61z6vu75", suffix) @@ -569,7 +572,7 @@ def delete_item_items__item_id__delete( assert main == expected def test_generated_code_models( - self, generated_code_path: Path, pydantic_version: float + self, generated_code_path: Path, pydantic_version: Version ) -> None: expected_pydantic_v28 = """# generated by fastapi-codegen: # filename: openapi.json @@ -681,7 +684,9 @@ class HTTPValidationError(BaseModel): """ expected = ( - expected_pydantic_v28 if pydantic_version < 2.9 else expected_pydantic_v29 + expected_pydantic_v28 + if pydantic_version < Version("2.9") + else expected_pydantic_v29 ) assert generated_code_path.exists() assert generated_code_path.is_dir() @@ -721,7 +726,7 @@ def test_register_for_llm( self, client: OpenAPI, azure_gpt35_turbo_16k_llm_config: dict[str, Any], - pydantic_version: float, + pydantic_version: Version, ) -> None: class JSONEncoder(json.JSONEncoder): def default(self, o: Any) -> Any: @@ -865,7 +870,7 @@ def default(self, o: Any) -> Any: tools = agent.llm_config["tools"] # print(tools) pydantic28_delta = '{"0": {"function": {"parameters": {"properties": {"body": {"title": "ItemsPostRequest"}}}}}, "2": {"function": {"parameters": {"properties": {"body": {"title": "ItemsItemIdPutRequest"}}}}}}' - if pydantic_version < 2.9: + if pydantic_version < Version("2.9"): # print(f"pydantic28_delta = '{jsondiff.diff(expected_tools, tools, dump=True)}'") expected_tools = jsondiff.patch( json.dumps(expected_tools, cls=JSONEncoder), pydantic28_delta, load=True diff --git a/tests/conftest.py b/tests/conftest.py index e3b17a28..7c8312be 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -19,6 +19,7 @@ import pytest import uvicorn from fastapi import FastAPI, Path +from packaging.version import Version from pydantic import BaseModel from pydantic import __version__ as version_of_pydantic @@ -263,8 +264,8 @@ def fastapi_openapi_url(request: pytest.FixtureRequest) -> Iterator[str]: @pytest.fixture -def pydantic_version() -> float: - return float(".".join(version_of_pydantic.split(".")[:2])) +def pydantic_version() -> Version: + return Version(version_of_pydantic) ################################################################################