Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Documentation] Deploy guide for langflow on AWS #1052

Open
ysekiy opened this issue Oct 14, 2023 · 23 comments
Open

[Documentation] Deploy guide for langflow on AWS #1052

ysekiy opened this issue Oct 14, 2023 · 23 comments

Comments

@ysekiy
Copy link
Contributor

ysekiy commented Oct 14, 2023

Hello all,

Thanks for this awesome work.

I'd like to use this on AWS. I think it would be good option for scalability & operation to use AWS Amplify + AWS Lambda + Amazon RDS.

Are there anyone working on this?
Happy to help or contribute regarding this if not.

Thanks

@yamonkjd
Copy link
Contributor

Since I learned about Langflow, I have researched it and actually deployed it to EC2, but since Langflow is frequently updated and there are frequent conflicts between components, I think it is worth trying if the project is at least up to version 1.x. Currently, distribution through Chainlit or Langflow embedd seems to be effective.

@ogabrielluiz
Copy link
Contributor

Hey
We have a Docker swarm setup on the works with terraform to deploy on AWS. Maybe we could use your help.

You can checkout the Docker compose in the deploy folder.
There's a branch called terraform that has the terraform setup we are building.

Would Amplify work better for this? With Redis caching setup using lambda could be useful too.

@satyagofylo
Copy link

any update on this @ysekiy were you able to create langflow in AWS + Lamda + amplify? , i am looking for a similar one it would be very helpful

@ysekiy
Copy link
Contributor Author

ysekiy commented Nov 2, 2023

I'm working on it with my colleague. We may be able to post any updates this month.

@kazuki306
Copy link
Contributor

Hello.
We have created a procedure for deploying langflow on AWS.
It will be built using Fargate and Aurora MySQL. All resources will be deployed by AWS CDK.
We initially thought of using Lambda and Amplify, but in consideration of future program revisions, we implemented ECS on Fargate by launching it from a Dockerfile using the AWS CDK.
Also, since we select Aurora MySQL as the database, we modified some code associated with DATABASE_URL specification.
The source of the program is here and the deployment procedure is in /langflow/scripts/aws/README.md.
Is it possible to create a branch like aws-cdk for this procedure?

@kmotohas
Copy link

kmotohas commented Dec 1, 2023

Hi @kazuki306

Thank you for creating the deployment guide! The steps are nicely simple. I have a couple of requests.

I would like an architecture diagram in the section of "Langflow on AWS" that shows what kind of architecture makes up the configuration.
Also, in the bottom of "How to set up your environment and deploy langflow", I would like a screenshot of the Web UI that is displayed when accessing the URL.
https://github.com/kazuki306/langflow/blob/aws-cdk-dev2/scripts/aws/README.md

@ogabrielluiz
Copy link
Contributor

Hey, @kazuki306 !

This is looking great!

Would you be willing to make a PR with this?

Have you checked out the setup inside the langflow/deploy folder?

@kazuki306
Copy link
Contributor

Hi @ogabrielluiz !

Thanks for your comment! We would like to submit a PR.

Have you checked out the setup inside the langflow/deploy folder?

We have deploy instructions and CDK source code in /langflow/sceripts/aws folder.
Should we put them in /langflow/deploy folder?

We have changed the code under /langflow/src/ , so we would appreciate it if you could prepare a new branch (e.g. aws-cdk) like the terraform branch.

@ogabrielluiz
Copy link
Contributor

Hi!

I've created the branch for you.

The scripts folder is good for this.

Thanks for the help!

@satyagofylo
Copy link

hi @kazuki306 thanks for sharing the deployment

i tried to deploy the same using the tutorial, however i was not successful

once i tried cdk deploy command

cdk deploy

✨ Synthesis time: 17.93s

current credentials could not be used to assume 'arn:aws:iam::692536198005:role/cdk-hnb659fds-deploy-role-692536198005-us-west-2', but are for the right account. Proceeding anyway.
current credentials could not be used to assume 'arn:aws:iam::692536198005:role/cdk-hnb659fds-deploy-role-692536198005-us-west-2', but are for the right account. Proceeding anyway.
current credentials could not be used to assume 'arn:aws:iam::692536198005:role/cdk-hnb659fds-deploy-role-692536198005-us-west-2', but are for the right account. Proceeding anyway.
current credentials could not be used to assume 'arn:aws:iam::692536198005:role/cdk-hnb659fds-deploy-role-692536198005-us-west-2', but are for the right account. Proceeding anyway.
current credentials could not be used to assume 'arn:aws:iam::692536198005:role/cdk-hnb659fds-deploy-role-692536198005-us-west-2', but are for the right account. Proceeding anyway.
LangflowAppStack: start: Building e77031893275c08bcaa0a774aa8b611727afd045b3b5d8e1e6f0f04063d9d386:current_account-current_region
LangflowAppStack: success: Built e77031893275c08bcaa0a774aa8b611727afd045b3b5d8e1e6f0f04063d9d386:current_account-current_region
LangflowAppStack: start: Building 2787cf9e14cb283f5bd620e092b3693febd0ead397441b7fe0deffdf2b93ddd0:current_account-current_region
LangflowAppStack: success: Built 2787cf9e14cb283f5bd620e092b3693febd0ead397441b7fe0deffdf2b93ddd0:current_account-current_region
LangflowAppStack: start: Publishing e77031893275c08bcaa0a774aa8b611727afd045b3b5d8e1e6f0f04063d9d386:current_account-current_region
LangflowAppStack: start: Building 94b83655403dac8fe335f8604b61c01d32209e0547652d8a1026bc2049365427:current_account-current_region
LangflowAppStack: success: Built 94b83655403dac8fe335f8604b61c01d32209e0547652d8a1026bc2049365427:current_account-current_region
LangflowAppStack: start: Publishing 2787cf9e14cb283f5bd620e092b3693febd0ead397441b7fe0deffdf2b93ddd0:current_account-current_region
LangflowAppStack: start: Building 91dded8d95bb1c65225d536db769102658af3236db20060f8104ba7fff8957c0:current_account-current_region
LangflowAppStack: start: Publishing 94b83655403dac8fe335f8604b61c01d32209e0547652d8a1026bc2049365427:current_account-current_region
current credentials could not be used to assume 'arn:aws:iam::692536198005:role/cdk-hnb659fds-file-publishing-role-692536198005-us-west-2', but are for the right account. Proceeding anyway.
current credentials could not be used to assume 'arn:aws:iam::692536198005:role/cdk-hnb659fds-file-publishing-role-692536198005-us-west-2', but are for the right account. Proceeding anyway.
current credentials could not be used to assume 'arn:aws:iam::692536198005:role/cdk-hnb659fds-file-publishing-role-692536198005-us-west-2', but are for the right account. Proceeding anyway.
LangflowAppStack: success: Published e77031893275c08bcaa0a774aa8b611727afd045b3b5d8e1e6f0f04063d9d386:current_account-current_region
LangflowAppStack: success: Published 94b83655403dac8fe335f8604b61c01d32209e0547652d8a1026bc2049365427:current_account-current_region
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
LangflowAppStack: fail: docker build --build-arg BACKEND_URL=http://backend.ecs-deploy.com:7860/ --tag cdkasset-91dded8d95bb1c65225d536db769102658af3236db20060f8104ba7fff8957c0 --file cdk.Dockerfile --platform linux/amd64 . exited with error code 1: ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
LangflowAppStack: success: Published 2787cf9e14cb283f5bd620e092b3693febd0ead397441b7fe0deffdf2b93ddd0:current_account-current_region

❌ Deployment failed: Error: Failed to publish asset 2787cf9e14cb283f5bd620e092b3693febd0ead397441b7fe0deffdf2b93ddd0:current_account-current_region
at Deployments.publishSingleAsset (/usr/local/lib/node_modules/aws-cdk/lib/index.js:470:11458)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.publishAsset (/usr/local/lib/node_modules/aws-cdk/lib/index.js:470:177912)
at async /usr/local/lib/node_modules/aws-cdk/lib/index.js:470:163339

Failed to publish asset 2787cf9e14cb283f5bd620e092b3693febd0ead397441b7fe0deffdf2b93ddd0:current_account-current_region`

also when i tried to reuse the command again i got no disk space limit error

Can you please guide me and tell if i am doing any thing wrong in the process

@aspirina765
Copy link

aspirina765 commented Dec 26, 2023

Hello,

First of all, thanks for this awesome work.

I've encountered an issue with the web application after deploying it on AWS using the dev branch (which I believe is the default one). The deployment process seemed fine, and the tasks and ECS services are showing normal operation in CloudWatch, including CPU usage.

However, I'm experiencing a persistent problem where the web page continuously reloads and loses all session data. This issue persists despite attempting to scale the tasks up or down. Notably, this behavior was not observed during a deployment on Railway, where the application functioned as expected without any such reloading issues.

I am available for providing any additional data or assistance needed for further clarification and contribution to resolving this issue.

Best Regards,

@aspirina765
Copy link

I think I got it, its the aws-cdk branch the one for aws usage.

My bad.

@satyagofylo
Copy link

satyagofylo commented Dec 26, 2023

hi @aspirina765

I followed all the steps mentioned in the scripts/aws read me branch and i tried to deploy aws-cdk branch how ever while creating the resource i saw the following error am i doing anything wrong here ? precisely it started happening after 55/78 steps

cc @ogabrielluiz @kazuki306
Screenshot 2023-12-27 at 1 10 42 AM

@kazuki306
Copy link
Contributor

Hi all.
I am sorry for the delay in getting back to you.

We have reviewed our architecture to fix some issues.
We have changed to deploy the built frontend to S3 and the backend to a container (ECS) to be distributed via CloudFront. It allows access to applications using HTTPS.
The related PR is here(#1491). See /langflow/scripts/aws/README.md for detailed architecture and deployment instructions.

@kazuki306
Copy link
Contributor

kazuki306 commented Mar 4, 2024

Hi @ogabrielluiz
By the way, the Amazon Bedrock components are not displayed since v0.6.6 (#1483), is it possible to display this components as Default instead of CustomComponent?

@coder-pikachu
Copy link

Hello,
Any update on this? I am planning to showcase this to some customers. Is the CDK process stable to try now?

@ogabrielluiz
Copy link
Contributor

@ysekiy did an awesome work on it but I haven't caught up to it yet.

I think it requires some testing. Could you help us out on that?

@ysekiy
Copy link
Contributor Author

ysekiy commented Apr 15, 2024

@ogabrielluiz Sure, I'd be happy to assist with testing. Could you please provide more details?

@ogabrielluiz
Copy link
Contributor

The dev branch is a bit different than the main now and we need to make sure the 1.0 alpha still works in the AWS CDK setup.

@ysekiy
Copy link
Contributor Author

ysekiy commented Apr 17, 2024

got it. I'm working on it.

@ysekiy
Copy link
Contributor Author

ysekiy commented Apr 18, 2024

deploy check

summary

  • Deployment of v1.0.0a23 failed
  • [blocker 1] I assume cdk-ecr-deployment should be ^3.0.1.
  • [blocker 2] cdk deploy cannot be completed because the /health endpoint becomes unreachable.

environment

step3: it works. ok.

git clone https://github.com/aws-samples/cloud9-setup-for-prototyping
cd cloud9-setup-for-prototyping
./bin/bootstrap

step4-1: failed (modified to checkout v1.0.0a23)

# ↓modified ver.
git clone https://github.com/langflow-ai/langflow.git -b v1.0.0a23
# original↓
# git clone https://github.com/langflow-ai/langflow.git
cd langflow/scripts/aws
cp .env.example .env
npm ci
cdk bootstrap
cdk deploy

error

Admin:~/environment/langflow/scripts/aws ((v1.0.0a23)) $ cdk deploy

✨  Synthesis time: 7.8s

LangflowAppStack: deploying... [1/1]
LangflowAppStack: creating CloudFormation changeset...
11:33:12 PM | CREATE_FAILED        | AWS::Lambda::Function                           | CustomCDKECRDeploy...3666512MiB2
8EAD8E4
Resource handler returned message: "The runtime parameter of go1.x is no longer supported for creating or updating AWS
Lambda functions. We recommend you use the new runtime (provided.al2023) while creating or updating functions. (Service
: Lambda, Status Code: 400, Request ID: 6fed4837-7bc6-45d6-9ec4-6a1a406aa1fd)" (RequestToken: 43563eec-6c13-7e67-ccc4-9
5a562c9ba76, HandlerErrorCode: InvalidRequest)


 ❌  LangflowAppStack failed: Error: The stack named LangflowAppStack failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Resource handler returned message: "The runtime parameter of go1.x is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (provided.al2023) while creating or updating functions. (Service: Lambda, Status Code: 400, Request ID: 6fed4837-7bc6-45d6-9ec4-6a1a406aa1fd)" (RequestToken: 43563eec-6c13-7e67-ccc4-95a562c9ba76, HandlerErrorCode: InvalidRequest)
    at FullCloudFormationDeployment.monitorDeployment (/home/ec2-user/.nvm/versions/node/v20.12.2/lib/node_modules/cdk/node_modules/aws-cdk/lib/index.js:433:10615)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.deployStack2 [as deployStack] (/home/ec2-user/.nvm/versions/node/v20.12.2/lib/node_modules/cdk/node_modules/aws-cdk/lib/index.js:436:200503)
    at async /home/ec2-user/.nvm/versions/node/v20.12.2/lib/node_modules/cdk/node_modules/aws-cdk/lib/index.js:436:181341

 ❌ Deployment failed: Error: The stack named LangflowAppStack failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Resource handler returned message: "The runtime parameter of go1.x is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (provided.al2023) while creating or updating functions. (Service: Lambda, Status Code: 400, Request ID: 6fed4837-7bc6-45d6-9ec4-6a1a406aa1fd)" (RequestToken: 43563eec-6c13-7e67-ccc4-95a562c9ba76, HandlerErrorCode: InvalidRequest)
    at FullCloudFormationDeployment.monitorDeployment (/home/ec2-user/.nvm/versions/node/v20.12.2/lib/node_modules/cdk/node_modules/aws-cdk/lib/index.js:433:10615)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.deployStack2 [as deployStack] (/home/ec2-user/.nvm/versions/node/v20.12.2/lib/node_modules/cdk/node_modules/aws-cdk/lib/index.js:436:200503)
    at async /home/ec2-user/.nvm/versions/node/v20.12.2/lib/node_modules/cdk/node_modules/aws-cdk/lib/index.js:436:181341

The stack named LangflowAppStack failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Resource handler returned message: "The runtime parameter of go1.x is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (provided.al2023) while creating or updating functions. (Service: Lambda, Status Code: 400, Request ID: 6fed4837-7bc6-45d6-9ec4-6a1a406aa1fd)" (RequestToken: 43563eec-6c13-7e67-ccc4-95a562c9ba76, HandlerErrorCode: InvalidRequest)

@ysekiy
Copy link
Contributor Author

ysekiy commented Apr 18, 2024

After modifying the cdk-ecr-deployment version, I couldn't complete cdk deploy. CDK doesn't show an error, but it never ends.

Screenshot 2024-04-18 at 10 56 03

@ysekiy
Copy link
Contributor Author

ysekiy commented Apr 18, 2024

I'm trying to run version 1.0.0a23 locally to detect root cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants