diff --git a/scripts/deploy_langflow_gcp.sh b/scripts/deploy_langflow_gcp.sh index 2c3dc0420..fbf87099a 100644 --- a/scripts/deploy_langflow_gcp.sh +++ b/scripts/deploy_langflow_gcp.sh @@ -26,16 +26,16 @@ if [[ -z "$subnet_exists" ]]; then gcloud compute networks subnets create $SUBNET_NAME --network=$VPC_NAME --region=$REGION --range=$SUBNET_RANGE fi -# Create a firewall rule to allow TCP port 8080 for all instances in the VPC -firewall_8080_exists=$(gcloud compute firewall-rules list --filter="name=allow-tcp-8080" --format="value(name)") -if [[ -z "$firewall_8080_exists" ]]; then - gcloud compute firewall-rules create allow-tcp-8080 --network $VPC_NAME --allow tcp:8080 --source-ranges 0.0.0.0/0 --direction INGRESS +# Create a firewall rule to allow TCP port 7860 for all instances in the VPC +firewall_7860_exists=$(gcloud compute firewall-rules list --filter="name=allow-tcp-7860" --format="value(name)") +if [[ -z "$firewall_7860_exists" ]]; then + gcloud compute firewall-rules create allow-tcp-7860 --network $VPC_NAME --allow tcp:7860 --source-ranges 0.0.0.0/0 --direction INGRESS fi # Create a firewall rule to allow IAP traffic firewall_iap_exists=$(gcloud compute firewall-rules list --filter="name=allow-iap" --format="value(name)") if [[ -z "$firewall_iap_exists" ]]; then - gcloud compute firewall-rules create allow-iap --network $VPC_NAME --allow tcp:80,tcp:443 --source-ranges 35.235.240.0/20 --direction INGRESS + gcloud compute firewall-rules create allow-iap --network $VPC_NAME --allow tcp:80,tcp:443,tcp:22,:tcp:3389 --source-ranges 35.235.240.0/20 --direction INGRESS fi # Define the startup script as a multiline Bash here-doc @@ -49,24 +49,7 @@ apt -y upgrade # Install Python 3 pip, Langflow, and Nginx apt -y install python3-pip pip install langflow -apt-get -y install nginx - -# Configure Nginx for Langflow -touch /etc/nginx/sites-available/langflow-app -echo "server { - listen 0.0.0.0:8080; - - location / { - proxy_pass http://127.0.0.1:7860; - proxy_set_header Host "\$host"; - proxy_set_header X-Real-IP "\$remote_addr"; - proxy_set_header X-Forwarded-For "\$proxy_add_x_forwarded_for"; - } -}" >> /etc/nginx/sites-available/langflow-app -ln -s /etc/nginx/sites-available/langflow-app /etc/nginx/sites-enabled/ -sudo nginx -t -sudo systemctl restart nginx -langflow +langflow --host 0.0.0.0 --port 7860 EOF ) diff --git a/scripts/deploy_langflow_gcp_spot.sh b/scripts/deploy_langflow_gcp_spot.sh index f43b54c21..9291ddcc3 100644 --- a/scripts/deploy_langflow_gcp_spot.sh +++ b/scripts/deploy_langflow_gcp_spot.sh @@ -26,7 +26,7 @@ if [[ -z "$subnet_exists" ]]; then gcloud compute networks subnets create $SUBNET_NAME --network=$VPC_NAME --region=$REGION --range=$SUBNET_RANGE fi -# Create a firewall rule to allow TCP port 8080 for all instances in the VPC +# Create a firewall rule to allow TCP port 7860 for all instances in the VPC firewall_7860_exists=$(gcloud compute firewall-rules list --filter="name=allow-tcp-7860" --format="value(name)") if [[ -z "$firewall_7860_exists" ]]; then gcloud compute firewall-rules create allow-tcp-7860 --network $VPC_NAME --allow tcp:7860 --source-ranges 0.0.0.0/0 --direction INGRESS @@ -35,7 +35,7 @@ fi # Create a firewall rule to allow IAP traffic firewall_iap_exists=$(gcloud compute firewall-rules list --filter="name=allow-iap" --format="value(name)") if [[ -z "$firewall_iap_exists" ]]; then - gcloud compute firewall-rules create allow-iap --network $VPC_NAME --allow tcp:80,tcp:443 --source-ranges 35.235.240.0/20 --direction INGRESS + gcloud compute firewall-rules create allow-iap --network $VPC_NAME --allow tcp:80,tcp:443,tcp:22,:tcp:3389 --source-ranges 35.235.240.0/20 --direction INGRESS fi # Define the startup script as a multiline Bash here-doc @@ -49,23 +49,6 @@ apt -y upgrade # Install Python 3 pip, Langflow, and Nginx apt -y install python3-pip pip install langflow -# apt-get -y install nginx - -# # Configure Nginx for Langflow -# touch /etc/nginx/sites-available/langflow-app -# echo "server { -# listen 0.0.0.0:8080; - -# location / { -# proxy_pass http://127.0.0.1:7860; -# proxy_set_header Host "\$host"; -# proxy_set_header X-Real-IP "\$remote_addr"; -# proxy_set_header X-Forwarded-For "\$proxy_add_x_forwarded_for"; -# } -# }" >> /etc/nginx/sites-available/langflow-app -# ln -s /etc/nginx/sites-available/langflow-app /etc/nginx/sites-enabled/ -# sudo nginx -t -# sudo systemctl restart nginx langflow --host 0.0.0.0 --port 7860 EOF ) diff --git a/scripts/walkthroughtutorial.md b/scripts/walkthroughtutorial.md index fa6e3c11d..83ea3086a 100644 --- a/scripts/walkthroughtutorial.md +++ b/scripts/walkthroughtutorial.md @@ -37,7 +37,7 @@ The script will: 1. Check if the required resources (VPC, subnet, firewall rules, and Cloud Router) exist and create them if needed 2. Create a startup script to install Python, Langflow, and Nginx 3. Create a Compute Engine VM instance with the specified configuration and startup script -4. Configure Nginx to serve Langflow on TCP port 8080 +4. Run Langflow to serve content on TCP port 7860 > The process may take approximately 30 minutes to complete. Rest assured that progress is being made, and you'll be able to proceed once the process is finished. @@ -47,13 +47,13 @@ In the next step, you'll learn how to connect to the Langflow VM. ## Connect to the Langflow VM To connect to your new Langflow VM, follow these steps: -1. Navigate to the [VM instances](https://console.cloud.google.com/compute/instances) page and click on the external IP for your VM. Make sure to use HTTP and set the port to 8080 +1. Navigate to the [VM instances](https://console.cloud.google.com/compute/instances) page and click on the external IP for your VM. Make sure to use HTTP and set the port to 7860
**or** 3. Run the following command to display the URL for your Langflow environment: ```bash export LANGFLOW_IP=$(gcloud compute instances list --filter="NAME=langflow-dev" --format="value(EXTERNAL_IP)") -echo http://$LANGFLOW_IP:8080 +echo http://$LANGFLOW_IP:7860 ``` 4. Click on the Langflow URL in cloudshell to be greeted by the Langflow Dev environment @@ -76,7 +76,7 @@ However, if you decide to remove them after completing the walkthrough, you can > These commands will delete the firewall rules and network configurations created during the walkthrough. Make sure to run them only if you no longer need these settings. ``` -gcloud compute firewall-rules delete allow-tcp-8080 --quiet +gcloud compute firewall-rules delete allow-tcp-7860 --quiet gcloud compute firewall-rules delete allow-iap --quiet diff --git a/scripts/walkthroughtutorial_spot.md b/scripts/walkthroughtutorial_spot.md index a08d95770..3792bc1ca 100644 --- a/scripts/walkthroughtutorial_spot.md +++ b/scripts/walkthroughtutorial_spot.md @@ -37,7 +37,7 @@ The script will: 1. Check if the required resources (VPC, subnet, firewall rules, and Cloud Router) exist and create them if needed 2. Create a startup script to install Python, Langflow, and Nginx 3. Create a Compute Engine VM instance with the specified configuration and startup script -4. Configure Nginx to serve Langflow on TCP port 8080 +4. Run Langflow to serve content on TCP port 7860 > The process may take approximately 30 minutes to complete. Rest assured that progress is being made, and you'll be able to proceed once the process is finished. @@ -46,13 +46,13 @@ In the next step, you'll learn how to connect to the Langflow VM. ## Connect to the Langflow VM To connect to your new Langflow VM, follow these steps: -1. Navigate to the [VM instances](https://console.cloud.google.com/compute/instances) page and click on the external IP for your VM. Make sure to use HTTP and set the port to 8080 +1. Navigate to the [VM instances](https://console.cloud.google.com/compute/instances) page and click on the external IP for your VM. Make sure to use HTTP and set the port to 7860
**or** 3. Run the following command to display the URL for your Langflow environment: ```bash export LANGFLOW_IP=$(gcloud compute instances list --filter="NAME=langflow-dev" --format="value(EXTERNAL_IP)") -echo http://$LANGFLOW_IP:8080 +echo http://$LANGFLOW_IP:7860 ``` 4. Click on the Langflow URL in cloudshell to be greeted by the Langflow Dev environment @@ -73,7 +73,7 @@ However, if you decide to remove them after completing the walkthrough, you can > These commands will delete the firewall rules and network configurations created during the walkthrough. Make sure to run them only if you no longer need these settings. ``` -gcloud compute firewall-rules delete allow-tcp-8080 --quiet +gcloud compute firewall-rules delete allow-tcp-7860 --quiet gcloud compute firewall-rules delete allow-iap --quiet