Commit graph

4,410 commits

Author SHA1 Message Date
Gabriel Luiz Freitas Almeida
6afaede719 feat(.gitignore): add .gitignore file to ignore Terraform related files and directories 2023-08-21 13:47:11 -03:00
Gabriel Luiz Freitas Almeida
f4760a38a3 🚀 feat(build-push.sh): add script to build and push Docker images
🚀 feat(build.sh): add script to build Docker images
2023-08-21 13:47:02 -03:00
Gabriel Luiz Freitas Almeida
15f6200477 🔧 chore(locustfile.py): remove hardcoded flow ID and replace it with the value from the FLOW_ID environment variable for flexibility and security 2023-08-21 13:46:35 -03:00
Gabriel Luiz Freitas Almeida
517a48f885 First implementation of terraform setup 2023-08-21 13:45:41 -03:00
Gabriel Luiz Freitas Almeida
fe65b63400 🔧 chore(deploy): update docker-compose version to 3.8 for better compatibility and features
🐳 chore(deploy): update traefik image version to v3.0 for improved functionality and compatibility
🔧 chore(deploy): remove unnecessary port mappings for backend, queue, pgadmin, redis, prometheus, and grafana services
2023-08-21 08:19:12 -03:00
Gabriel Luiz Freitas Almeida
d0911b3fd2 feat(.env.example): add example environment variables for domain, stack name, Traefik network, and Traefik tags to provide a template for configuring the deployment environment 2023-08-20 23:41:21 -03:00
Gabriel Luiz Freitas Almeida
6ffb994e53 📦 chore(docker-compose.override.yml): add docker-compose.override.yml file to configure Traefik proxy and services for local development
This commit adds a new file `docker-compose.override.yml` to the `deploy` directory. The file contains configuration for the Traefik proxy and services used for local development. The configuration includes:

- Enabling Docker in Traefik to read labels from Docker services
- Adding a constraint to only use services with a specific label for this stack
- Disabling the exposure of all Docker services by default
- Enabling the access log and Traefik log
- Enabling the Traefik Dashboard and API in insecure mode for local development

The file also includes configuration for the following services:

- `proxy`: Configured to listen on ports 80 and 8090, with labels for routing and load balancing
- `pgadmin`: Configured to listen on port 5050
- `flower`: Configured to listen on port 5555
- `backend`: Configured with labels for routing and load balancing on paths `/api/v1`, `/docs`, and `/health`
- `frontend`: Configured with labels for routing and load balancing on the root path

The `traefik-public` network is also defined for use by the Traefik proxy.

This file is intended to be used as an override for the main `docker-compose.yml` file during local development.

🐳 chore(docker-compose.yml): add Traefik reverse proxy configuration for services

🔧 fix(docker-compose.yml): fix path to startup-backend.sh script

🚀 feat(docker-compose.yml): add support for deploying backend, celery worker, flower, frontend, prometheus, and grafana services

🔧 fix(docker-compose.yml): fix volume configuration for db service

🔧 fix(docker-compose.yml): fix network configuration for pgadmin service

🔧 fix(docker-compose.yml): fix network configuration for traefik proxy service

🔧 fix(docker-compose.yml): fix network configuration for flower service

🔧 fix(docker-compose.yml): fix network configuration for frontend service

🔧 fix(docker-compose.yml): fix network configuration for prometheus service

🔧 fix(docker-compose.yml): fix network configuration for grafana service
2023-08-20 23:39:19 -03:00
Gabriel Luiz Freitas Almeida
9baf588e5e 🔥 refactor(nginx.conf): remove redundant code for proxying /api/v1/ and /health routes to backend service 2023-08-20 23:38:47 -03:00
Gabriel Luiz Freitas Almeida
bff329e278 🔧 chore(flower.env): add FLOWER_UNAUTHENTICATED_API=True to allow unauthenticated access to Flower API 2023-08-20 13:26:29 -03:00
Gabriel Luiz Freitas Almeida
2d85ae9dd4 🚀 feat(docker-compose.yml): upgrade docker-compose version to 3.3 for compatibility with newer features and syntax
🔧 chore(docker-compose.yml): update backend.env file path to remove leading './' for consistency

🔧 chore(docker-compose.yml): remove explicit port mapping for backend service to use the default port

🔧 chore(docker-compose.yml): add deploy configuration for celery worker service to ensure only one replica is deployed

🔧 chore(docker-compose.yml): add prometheus and grafana services with necessary configurations and dependencies

📝 docs(prometheus.yml): add prometheus configuration file with scrape targets for prometheus and flower services
2023-08-20 13:26:02 -03:00
Gabriel Luiz Freitas Almeida
afcd1f847c 🔧 chore(locustfile.py): update Locust test file to use FastHttpUser instead of HttpUser for improved performance
🔧 chore(locustfile.py): update host URL to remove unnecessary colon in the port number
🔧 chore(locustfile.py): refactor send_name_and_check task to use a more efficient polling mechanism for task status
🔧 chore(locustfile.py): update flow_id and session_id generation logic to use more meaningful values
🔧 chore(locustfile.py): refactor send_name_and_check task to use a separate process function for better code organization and readability
🔧 chore(locustfile.py): update payload2 to include a more descriptive text for the input
🔧 chore(locustfile.py): update assertion in send_name_and_check task to check if the name is present in the result2 response
2023-08-20 13:25:11 -03:00
Gabriel Luiz Freitas Almeida
3d84aace37 🔧 fix(endpoints.py): import missing dependencies to resolve NameError
 feat(endpoints.py): add new endpoint to get task status by task ID
🔧 fix(schemas.py): update ProcessResponse schema to use 'id' instead of 'session_id' for consistency
 feat(schemas.py): add new schema for TaskStatusResponse
2023-08-20 13:24:47 -03:00
Gabriel Luiz Freitas Almeida
298e499f72 🚀 feat(base.Dockerfile): copy specific file 'main.py' from src/backend/langflow to improve build performance and reduce unnecessary copying
🐛 fix(base.Dockerfile): fix copying of src/backend directory to ensure all files are included in the build context
2023-08-18 10:09:45 -03:00
Gabriel Luiz Freitas Almeida
8bdde3bc05 🔨 refactor(custom_component.py): remove unused import and update function name for better code organization and clarity
📝 docs(custom_component.py): update docstring for better readability and understanding
🔧 chore(custom_component.py): add new file names.txt for locust tests with a list of names for load testing
2023-08-18 08:57:53 -03:00
Gabriel Luiz Freitas Almeida
7f217bd518 🔧 refactor(process.py): remove unused imports and variables, refactor function names for clarity
 feat(process.py): introduce SessionManager to handle loading and updating langchain_object sessions
🐛 fix(process.py): update cache with the updated langchain_object after processing graph
2023-08-18 08:57:38 -03:00
Gabriel Luiz Freitas Almeida
2183f167cd 🐛 fix(manager.py): add cache_manager.set() to store langchain_object in cache after successful initialization
🐛 fix(celeryconfig.py): fix condition to check if BROKER_URL and RESULT_BACKEND are present in os.environ before using them, fallback to langflow_redis_host and langflow_redis_port if not present
2023-08-18 08:57:24 -03:00
Gabriel Luiz Freitas Almeida
682e611947 🔧 fix(endpoints.py): remove unused import and function call to process_graph_cached
🔧 fix(worker.py): refactor process_graph_cached into process_graph_cached_task and update function signature and implementation to use SessionManager for loading and updating the graph
2023-08-18 08:57:12 -03:00
Gabriel Luiz Freitas Almeida
c195456c49 🔧 fix(base.py): update debug log message to provide more meaningful information about the number of vertices in the graph
🔧 fix(run.py): comment out the caching functionality for building sorted vertices to prevent caching issues
2023-08-18 08:56:58 -03:00
Gabriel Luiz Freitas Almeida
f4a0c9f436 🐛 fix(manager.py): remove commented code block to improve code readability and maintainability
 feat(manager.py): add initialization for session manager and its dependencies (cache manager and settings manager) to enable session management functionality
2023-08-18 08:52:26 -03:00
Gabriel Luiz Freitas Almeida
853648ae33 📝 chore(locustfile.py): add locustfile.py for load testing the API
🐛 fix(test_process.py): refactor test_load_langchain_object_with_cached_session to use session_manager
🐛 fix(test_process.py): refactor test_load_langchain_object_with_no_cached_session to use session_manager
🐛 fix(test_process.py): refactor test_load_langchain_object_without_session_id to use session_manager
2023-08-18 08:51:56 -03:00
Gabriel Luiz Freitas Almeida
a7ff7da778 🐛 fix(base.Dockerfile): remove unnecessary copy of ./src/backend directory to improve build performance
 feat(base.Dockerfile): add healthcheck for queue and celeryworker services to ensure their availability
 feat(docker-compose.yml): add healthcheck for queue, celeryworker, and flower services to ensure their availability
🐛 fix(docker-compose.yml): fix the path in the command for backend service startup
🐛 fix(flower.env): add missing double quote at the end of C_FORCE_ROOT value
🐛 fix(startup-backend.sh): remove unnecessary --reload flag from uvicorn command and add --workers -1 flag to utilize all available CPU cores
2023-08-18 08:51:30 -03:00
Gabriel Luiz Freitas Almeida
79b48efddf 🔧 chore(docker-compose.yml): update volume path to correctly mount parent directory for the app
🔧 chore(docker-compose.yml): update Redis image version to 7.2.0 for the queue service
🔧 chore(docker-compose.yml): update command for the flower service to use environment variables for Redis connection details
🔧 chore(flower.env): add LANGFLOW_REDIS_PASSWORD environment variable
2023-08-17 18:09:33 -03:00
Gabriel Luiz Freitas Almeida
26e6c325aa 🐛 fix(manager.py): add support for registering factory dependencies to handle service dependencies
 feat(manager.py): add support for handling service dependencies when creating services
🔧 chore(manager.py): comment out validation for creating services before the settings service
🔧 chore(utils.py): add get_session_manager() function to retrieve the session manager service
2023-08-17 18:00:27 -03:00
Gabriel Luiz Freitas Almeida
632eef48b2 🐛 fix(manager.py): change threading.Lock to threading.RLock to allow reentrant locking and prevent deadlocks
🔀 merge(manager.py): refactor _get method to extract logic into _get_without_lock method for code reuse and readability
🔀 merge(manager.py): refactor set method to use _get_without_lock method for code reuse and readability
🔀 merge(manager.py): add lock acquisition in delete method to ensure thread safety
🔀 merge(utils.py): add update_cache method to Memoize class for updating cache values
2023-08-17 17:59:00 -03:00
Gabriel Luiz Freitas Almeida
cf2940be05 feat(session): add SessionManagerFactory, SessionManager, and related methods
- Added `SessionManagerFactory` class in `src/backend/langflow/services/session/factory.py` to create instances of `SessionManager`.
- Added `SessionManager` class in `src/backend/langflow/services/session/manager.py` to manage sessions.
- Added `load_session`, `generate_key`, `update_session`, and `clear_session` methods to `SessionManager` to handle session-related logic.

These changes were made to introduce session management functionality to the application.
2023-08-17 17:58:10 -03:00
Gabriel Luiz Freitas Almeida
c49e660e80 🐛 fix(cache/factory.py): change variable name from settings_service to settings_manager for consistency and clarity
🐛 fix(cache/factory.py): change variable name from settings_service to settings_manager for consistency and clarity
🐛 fix(database/factory.py): change variable name from settings_service to settings_manager for consistency and clarity
2023-08-17 17:23:31 -03:00
Gabriel Luiz Freitas Almeida
39e25c294c Merge dev 2023-08-17 10:59:54 -03:00
Gabriel Luiz Freitas Almeida
f3343b81c5 Poetry lock 2023-08-17 10:22:59 -03:00
Gabriel Luiz Freitas Almeida
2cdb860d09 Merge remote-tracking branch 'origin/dev' into celery 2023-08-17 10:16:44 -03:00
Gabriel Luiz Freitas Almeida
82e6b38ca4 🐛 fix(worker.py): add exception handling and retry mechanism to build_vertex task to handle SoftTimeLimitExceeded error and retry the task up to 3 times with a countdown of 2 seconds
 feat(worker.py): add import statement for SoftTimeLimitExceeded exception from celery.exceptions module to handle SoftTimeLimitExceeded error in build_vertex task
2023-08-17 10:16:00 -03:00
Gabriel Luiz Freitas Almeida
2dd43d3f99 🐛 fix(chat.py): add support for running celery tasks for building vertices and fallback to local build if celery task fails 2023-08-17 10:15:49 -03:00
Gabriel Luiz Freitas Almeida
24344ee0fa 🐛 fix(base.py): remove unnecessary import statement for celery.result.AsyncResult
🔀 refactor(base.py): refactor the build method in Vertex class to improve readability and remove redundant code
 feat(base.py): add get_task method to Vertex class to retrieve the task from celery using task_id
2023-08-17 10:15:38 -03:00
Gabriel Luiz Freitas Almeida
ab6515515d 🐛 fix(types.py): add conditional check for task_id and is_task to improve object representation in CustomComponentVertex 2023-08-17 10:15:21 -03:00
Gabriel Luiz Freitas Almeida
d393a66b2f 🐛 fix(base.py): handle ImportError when importing celery.result.AsyncResult to allow building the vertex locally when Celery is not installed 2023-08-17 09:11:52 -03:00
Gabriel Luiz Freitas Almeida
c1511d7773
Add poetry to devcontainer (#780) 2023-08-17 11:55:19 +00:00
Gabriel Luiz Freitas Almeida
e210fc316a 🐛 fix(__main__.py): import and call initialize_settings_manager() to ensure settings manager is initialized
 feat(manager.py): add check to prevent duplicate registration of service factories in ServiceManager class
 feat(manager.py): add initialize_settings_manager() function to initialize the settings manager
2023-08-17 08:23:50 -03:00
hsm207
72042b315f add poetry to devcontainer 2023-08-17 11:02:42 +00:00
Gabriel Luiz Freitas Almeida
45c7656e57 Merge remote-tracking branch 'origin/main' into celery 2023-08-16 22:56:34 -03:00
Gabriel Luiz Freitas Almeida
e77ce91f24 Merge remote-tracking branch 'origin/release' into celery 2023-08-16 22:56:26 -03:00
Gabriel Luiz Freitas Almeida
cf96523dc3 📦 feat(pyproject.toml): add locust package as a dependency to enable load testing capabilities 2023-08-16 22:50:34 -03:00
Gabriel Luiz Freitas Almeida
d39dd5fc4a 🐛 fix(test_cache.py): import correct compute_dict_hash function from langflow.services.cache.utils module
🐛 fix(test_cache.py): fix clear_cache function call by passing session_id parameter
🐛 fix(test_cache_manager.py): import CacheManager from langflow.services.chat.cache module instead of langflow.services.cache.manager
🐛 fix(test_cli.py): convert temp_dir to string before checking if it is in COMPONENTS_PATH
🐛 fix(test_process.py): fix clear_cache function call by passing session_id parameter
2023-08-16 22:38:18 -03:00
Gabriel Luiz Freitas Almeida
ce8fc2739d 🔧 chore(run.py): replace deprecated memoize_dict decorator with Memoize class to improve code maintainability and readability
🔧 chore(process.py): replace deprecated build_sorted_vertices_with_caching.hash with build_sorted_vertices_with_caching.session_id to fix incorrect session_id assignment
🔧 chore(utils.py): add get_cache_manager function to retrieve the cache manager from the service manager
2023-08-16 22:36:34 -03:00
Gabriel Luiz Freitas Almeida
eb17233cde Merge remote-tracking branch 'origin/dev' into celery 2023-08-16 21:49:42 -03:00
Gabriel Luiz Freitas Almeida
500b6d533c Merge remote-tracking branch 'origin/dev' into celery 2023-08-16 21:47:57 -03:00
Gabriel Luiz Freitas Almeida
489075da17
Add_session_id (#779) 2023-08-17 00:45:43 +00:00
Gabriel Luiz Freitas Almeida
2f95e13026 ⬆️ chore(pyproject.toml): update types-python-jose and types-passlib versions to their latest versions for compatibility and bug fixes 2023-08-16 21:44:09 -03:00
Gabriel Luiz Freitas Almeida
87958c255e 🐛 fix(endpoints.py): change type annotation of session_id parameter in process_flow function to Union[None, str] to allow for None value
🐛 fix(schemas.py): change type annotation of session_id field in ProcessResponse schema to Optional[str] to allow for None value
🐛 fix(run.py): change return type annotation of build_sorted_vertices_with_caching function to Tuple[Any, Dict] to specify the return types
🐛 fix(process.py): change return type annotation of load_langchain_object function to Tuple[Union[Chain, VectorStore], Dict[str, Any], str] to include the session_id value in the return tuple
2023-08-16 21:43:35 -03:00
Gabriel Luiz Freitas Almeida
8ff739a288 🚀 feat(test_process.py): add tests for loading langchain object with and without cached session
🐛 fix(test_process.py): import missing functions and modules to fix test failures
2023-08-16 21:30:07 -03:00
Gabriel Luiz Freitas Almeida
199ea3b1b8 🔧 fix(process.py): refactor process_graph_cached function for better readability and maintainability
 feat(process.py): add clear_caches_if_needed function to clear cache if clear_cache flag is set
 feat(process.py): add load_langchain_object function to load langchain_object and artifacts from data_graph
 feat(process.py): add process_inputs function to process inputs and add artifacts to inputs
 feat(process.py): add generate_result function to generate result and thought based on langchain_object and inputs
2023-08-16 21:29:17 -03:00
Gabriel Luiz Freitas Almeida
2f928c7d84 Merge remote-tracking branch 'origin/dev' into add_session_id 2023-08-16 19:31:29 -03:00