diff --git a/streamlit_demo_apps/README.md b/streamlit_demo_apps/README.md index 4e9ad9a..669e9d4 100644 --- a/streamlit_demo_apps/README.md +++ b/streamlit_demo_apps/README.md @@ -1,15 +1,19 @@ # Deploying Streamlit Apps -To deploy Streamlit apps, they need to be written and committed to a public GitHub repository. +This guide will show you how to quickly spin up a Nillion Testnet connected, live Streamlit app from our template using the simple generate-streamlit-app script. Once your app is ready, you can easily deploy it by pushing it to a public GitHub repo. Just follow these steps to get started: ## How to add a new Streamlit App -### 0. Create a streamlit secrets file and add your nilchain private key within `.streamlit/secrets.toml` +### 0. Create a streamlit secrets file + +Run this command to create a `.streamlit/secrets.toml` copied from the example. ``` cp .streamlit/secrets.toml.example .streamlit/secrets.toml ``` +Add your Nilchain private key to the .streamlit/secrets.toml file. The private key must be linked to a funded Nillion Testnet address that was created using a Google account (not a mnemonic). This allows you to retrieve the private key from Keplr. If you don’t have a Testnet wallet yet, you can learn how to create one here: https://docs.nillion.com/testnet-guides + ### 1. Run the script to generate a new streamlit app for your program From the root folder of this repo, run the generate-streamlit-app script: @@ -33,7 +37,7 @@ streamlit run streamlit_demo_apps/app_[your_program_name].py` View the app in your browser to make sure everything works as expected. -### 4. Deploy your app +### 4. Commit your code to Github Add and commit your new streamlit app code to your forked Github repo. (Code must be connected to a remote, open source GitHub repository to deploy a Streamlit app.) @@ -45,9 +49,16 @@ git push origin main Once you've committed the open source code, you can click the "deploy" button within your local streamlit app. Sign in with Github and select the "Deploy Now" on Streamlit Community Cloud option to deploy the app for free. -#### Deploy an app settings + Streamlit Community Cloud + + +### 5. Deploy your app from Streamlit.io + +When you click "Deploy Now" from your local app, you'll be taken to streamlit.io and asked to log in with Github to create a new Streamlit app. Set the main file path to your new app `streamlit_demo_apps/app_[your_program_name].py` -Set the main file path to your new app `streamlit_demo_apps/app_[your_program_name].py` + streamlit settings + +#### Add your Nilchain Private Key using Advanced Settings > Secrets Go to "Advanced settings" and in Secrets, copy in the contents of your .streamlit/secrets.toml file. At a minimum, make sure to add your secret private key: @@ -55,4 +66,12 @@ Go to "Advanced settings" and in Secrets, copy in the contents of your .streamli nilchain_private_key = "YOUR_FUNDED_PRIVATE_KEY" ``` -Save and click "Deploy" to deploy your testnet Streamlit app! + advanced settings + +Save and click "Deploy" to deploy your testnet-connected Streamlit app. + +### 6. Access Your Live Streamlit App + +Once deployed, you’ll get a live link to your Nillion Testnet Streamlit app! + +Example live Streamlit App: https://stephs-nada-multiplication-app.streamlit.app/