Replies: 3 comments 1 reply
-
Yes, it is possible to have a local collection shared among multiple users in addition to the "Community examples" when installing a local instance of Langflow. You can achieve this by configuring the database to be stored in a shared location. To do this, set the Here is an example configuration in the # Config directory
# Directory where files, logs and database will be stored
# Example: LANGFLOW_CONFIG_DIR=/path/to/shared/directory
LANGFLOW_CONFIG_DIR=/path/to/shared/directory
# Save database in the config directory
# Values: true, false
# If false, the database will be saved in Langflow's root directory
# This means that the database will be deleted when Langflow is uninstalled
# and that the database will not be shared between different virtual environments
# Example: LANGFLOW_SAVE_DB_IN_CONFIG_DIR=true
LANGFLOW_SAVE_DB_IN_CONFIG_DIR=true Make sure that the shared directory specified in Additionally, you can utilize the def create_or_update_starter_projects():
components_paths = get_settings_service().settings.components_path
try:
all_types_dict = get_all_components(components_paths, as_dict=True)
except Exception as e:
logger.exception(f"Error loading components: {e}")
raise e
with session_scope() as session:
new_folder = create_starter_folder(session)
starter_projects = load_starter_projects()
delete_start_projects(session, new_folder.id)
for project_path, project in starter_projects:
(
project_name,
project_description,
project_is_component,
updated_at_datetime,
project_data,
project_icon,
project_icon_bg_color,
) = get_project_data(project)
updated_project_data = update_projects_components_with_latest_component_versions(
project_data, all_types_dict
)
if updated_project_data != project_data:
project_data = updated_project_data
# We also need to update the project data in the file
update_project_file(project_path, project, updated_project_data)
if project_name and project_data:
for existing_project in get_all_flows_similar_to_project(session, new_folder.id):
session.delete(existing_project)
create_new_project(
session,
project_name,
project_description,
project_is_component,
updated_at_datetime,
project_data,
project_icon,
project_icon_bg_color,
new_folder.id,
) This function will help maintain a consistent set of starter projects that can be shared among multiple users [1][2]. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your answer.
I will test it but just to be sure, the LANGFLOW_SAVE_DB_IN_CONFIG_DIR
Could be used also LANGFLOW_DATABASE_URL environment variable?
I am a little confused.
#Database, configuration FAILED
#1432
- DB_USER=${DB_USER}
- DB_PASSWORD=${DB_PASSWORD}
- DB_HOST=${DB_HOST}
- DB_PORT=${DB_PORT}
- DB_NAME=${DB_NAME}
- LANGFLOW_DATABASE_URL=postgresql://${DB_USER}:${DB_PASSWORD}@
${DB_HOST}:${DB_PORT}/${DB_NAME}
# This variable defines
Le mar. 11 juin 2024, 13:01, dosubot[bot] ***@***.***> a
écrit :
… Yes, it is possible to have a local collection shared among multiple users
in addition to the "Community examples" when installing a local instance of
Langflow. You can achieve this by configuring the database to be stored in
a shared location.
To do this, set the LANGFLOW_SAVE_DB_IN_CONFIG_DIR to true and specify a
shared directory for LANGFLOW_CONFIG_DIR in the .env file. This way, the
database will be stored in the specified config directory, which can be
accessed by multiple users.
Here is an example configuration in the .env file:
# Config directory# Directory where files, logs and database will be stored# Example: LANGFLOW_CONFIG_DIR=/path/to/shared/directoryLANGFLOW_CONFIG_DIR=/path/to/shared/directory
# Save database in the config directory# Values: true, false# If false, the database will be saved in Langflow's root directory# This means that the database will be deleted when Langflow is uninstalled# and that the database will not be shared between different virtual environments# Example: LANGFLOW_SAVE_DB_IN_CONFIG_DIR=trueLANGFLOW_SAVE_DB_IN_CONFIG_DIR=true
Make sure that the shared directory specified in LANGFLOW_CONFIG_DIR is
accessible to all users who need to share the local collection.
Additionally, you can utilize the create_or_update_starter_projects
function to load and update starter projects in the shared database. This
function ensures that the starter projects are up-to-date and available for
all users:
def create_or_update_starter_projects():
components_paths = get_settings_service().settings.components_path
try:
all_types_dict = get_all_components(components_paths, as_dict=True)
except Exception as e:
logger.exception(f"Error loading components: {e}")
raise e
with session_scope() as session:
new_folder = create_starter_folder(session)
starter_projects = load_starter_projects()
delete_start_projects(session, new_folder.id)
for project_path, project in starter_projects:
(
project_name,
project_description,
project_is_component,
updated_at_datetime,
project_data,
project_icon,
project_icon_bg_color,
) = get_project_data(project)
updated_project_data = update_projects_components_with_latest_component_versions(
project_data, all_types_dict
)
if updated_project_data != project_data:
project_data = updated_project_data
# We also need to update the project data in the file
update_project_file(project_path, project, updated_project_data)
if project_name and project_data:
for existing_project in get_all_flows_similar_to_project(session, new_folder.id):
session.delete(existing_project)
create_new_project(
session,
project_name,
project_description,
project_is_component,
updated_at_datetime,
project_data,
project_icon,
project_icon_bg_color,
new_folder.id,
)
This function will help maintain a consistent set of starter projects that
can be shared among multiple users [1]
<https://github.com/langflow-ai/langflow/blob/dev/.env.example>[2]
<https://github.com/langflow-ai/langflow/blob/dev/src/backend/base/langflow/initial_setup/setup.py>
.
*To continue talking to Dosu <https://dosu.dev>, mention @dosu
<https://github.com/dosu>.*
—
Reply to this email directly, view it on GitHub
<#2135 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKZRFFV2PK5WRG7SNBFNDTZG3KKHAVCNFSM6AAAAABJDUBPFCVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TOMZXHAYDE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hi! 👋 We are using other channels as our official means of communication with users. We apologize for the delayed response. Thank you for your understanding. Best regards, |
Beta Was this translation helpful? Give feedback.
-
Dear Langflow team,
If i install a local instance of langflow, and I have multiple users in my research laboratory.
How can they share the different workflows they have created?
Is it possible to have a local collection shared additionnaly to "Community examples" ?
Thanks for your help
François
NB: i was not sure if i have to ask here or in discord, tell me your preference for next time
Beta Was this translation helpful? Give feedback.
All reactions