cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Administration & Architecture
Explore discussions on Databricks administration, deployment strategies, and architectural best practices. Connect with administrators and architects to optimize your Databricks environment for performance, scalability, and security.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Databricks Asset Bundles Deploy Apps

lion_king_84
New Contributor III

Hello,

I checked bundle app example in Github. https://github.com/databricks/bundle-examples/blob/main/knowledge_base/app_with_database/resources/m...
Then, I deployed a streamlit app via Databricks Asset Bundles. Then I opened the related app from Compute/Apps tab. No Source Code is written there. 
How can I deploy my streamlit app with source code?

databricks.yml:

# This is a Databricks asset bundle definition for a-simple-app.
bundle:
  name: app_example

include:
  - resources/*.yml

targets:
  dev:
    default: true
    mode: development

 myapp.app.yml:

resources:
  apps:
    my_app:
      name: "a-simple-app"
      source_code_path: ../app
      description: "A basic streamlit app"

 Compute/Apps page: (No Source Code)

lion_king_84_0-1770882935941.png

 

1 ACCEPTED SOLUTION

Accepted Solutions

sarahbhord
Databricks Employee
Databricks Employee

I looked further - the databricks.yml file is not used in this UI-based workflow - it's only for CLI deployments. Your app configuration therefore comes from selecting options in the UI. I believe that is why the code is never getting deployed here.

The pull from Git cant be automated without CLI access. Apologies for this confusion!! 

View solution in original post

10 REPLIES 10

sarahbhord
Databricks Employee
Databricks Employee

Hey @lion_king_84!

If the source code is not appearing, it is likely your Asset Bundle configuration omitted the correct source_code_path or the deployment didn't sync your local files.

Do the deploy logs confirm the upload of source files? Have you completed all 5 steps here?

Let me know - 

Sarah

 

Thank you @sarahbhord 

I am unable to run the databricks bundle deploy command because I do not have CLI access. Therefore, I am deploying the application directly through the Databricks Workspace UI.

Streamlit app files are successfully deployed into the deployment target:

lion_king_84_0-1770914601575.png

Streamlit app files are successfully deployed into the deployment target:

lion_king_84_0-1770914232462.png

I still see No Source Code in the app page. I need to click the Deploy button and then select the path of the source code. I don't want to make it manually. How can I make it via databricks.yml file or Github actions code?

lion_king_84_1-1770914636876.png

 

sarahbhord
Databricks Employee
Databricks Employee

I noticed your databricks.yml uses include: - resources/*.yml, so you need to define the source_code_path in a separate file inside the resources/ folder.

Create resources/app.yml:

resources:
  apps:
    my_app:
      name: "my-streamlit-app"
      source_code_path: ./app  # Path to your app files relative to databricks.yml

Then, adjust the path based on your structure. The path should point to where your app.py and requirements.txt live. Let me know if that does the trick.

- Sarah

In order to make it simpler, I removed include statement and added apps resource into the databricks.yml file.

 

# This is a Databricks asset bundle definition for a-simple-app.
bundle:
  name: app_example

workspace:
  root_path: /Shared/bundles/snri-bundle

sync:
  paths:
    - app

resources:
  apps:
    my_app:
      name: "my-streamlit-app"
      source_code_path: ./app

targets:
  dev:
    mode: production
    default: true
    

 

Deployment output and folder structure:

lion_king_84_0-1770929876241.png

app was deployed successfully:

lion_king_84_2-1770929944670.png

still getting No Source Code error message:

lion_king_84_3-1770929993860.png

 

Thanks - can you please try removing sync.pathsThat way the bundle handles file deployment automatically and ./app should work correctly.

Thank you!

databricks.yml

 

# This is a Databricks asset bundle definition for a-simple-app.
bundle:
  name: app_example

workspace:
  root_path: /Shared/bundles/snri-bundle

resources:
  apps:
    my_app:
      name: "my-streamlit-app"
      source_code_path: ./app

targets:
  dev:
    mode: production
    default: true
    

 


deployment target:

lion_king_84_0-1770934730966.png

Databricks Compute/Apps: 
- still getting No Source Code

lion_king_84_1-1770934779399.png

Do I need to run a command as below after Databricks Asset Bundle deployment?

 

databricks apps deploy my-streamlit-app --source-code-path /Workspace/Shared/bundles/snri-bundle/files/app

 

 

Yes if you have CLI access -databricks bundle deploy creates the app resource, while databricks bundle run my_appdeploys the code and starts it (use my_app  - your resource key from databricks.yml, not my-streamlit-app - the app name). Both are required here 

 

 

sarahbhord
Databricks Employee
Databricks Employee

I looked further - the databricks.yml file is not used in this UI-based workflow - it's only for CLI deployments. Your app configuration therefore comes from selecting options in the UI. I believe that is why the code is never getting deployed here.

The pull from Git cant be automated without CLI access. Apologies for this confusion!! 

Thank you very much.

Did you find this information in the official documentation โ€” specifically the statement that โ€œthe databricks.yml file is not used in this UI-based workflowโ€?

I may need to reference the source documentation to support this point.

rvm1975
New Contributor II

Hi @sarahbhord 
App deploy as part of asset bundle quite confusing and do not looks logical and finished.

You need to run "databricks bundle deploy", then "databricks apps deploy", then "databricks apps start"
After plain "bundle deploy" you will see "no source code" but only after "databricks apps deploy" you will see some folder either local workspace or dbfs