LogoLogo
HomeWeb PlatformForum
  • User Manual
  • Get Started
    • Create a Pollination Account
    • Setting up an Organization
      • 1. Create an Organization
      • 2. Add Organization Seats
      • 3. Add Team Members
      • 4. Purchase and Manage CAD Licenses
      • 5. Manage License Pools
      • 6. Add Additional Computing Resources
    • Setting up Rhino, Grasshopper and Revit Plugins
      • Download CAD Plugins
      • Install CAD Plugins
      • Purchase and Manage CAD Plugins
      • The Difference between CAD Licenses and Organization Seats
  • REVIT PLUGIN
    • Getting Started in Revit
    • Exporting Energy Models from Revit
      • Understanding the Export Process
      • Managing Pollination Revit License
      • Setting Up Linked Models
      • Creating Snapshots
      • Editing and Exporting Snapshots
    • Modeling Best Practices
  • Model Editor
    • What is Pollination Model Editor
    • Getting Started
    • Workflows
    • Commands
      • By Use Case
        • Room Commands
          • Edit
          • Windows
          • New
          • Adjacency
          • Line
          • Visualize
        • Line Commands
        • Roof Commands
        • Model Commands
      • Alphabetically
        • 3D preview
        • Align
        • Auto align
        • Auto top ground
        • Change units
        • Convert to room2D
        • Create boundary
        • Create rooms
        • Explode polyline
        • Export roofs
        • Fill holes
        • Find adjacency gaps
        • Find roof gaps
        • Find roof intersection
        • Floor area change
        • Generate alignment axes
        • Import roofs
        • Join coplanar faces
        • Join segments
        • Merge Small Rooms
        • Merge rooms
        • Multipliers to geometry
        • Offset
        • Offset windows
        • Preview roofs
        • Pull to room
        • Remove colinear vertices
        • Remove holes
        • Remove short segments
        • Repair windows
        • Resolve roof overlaps
        • Roof to shade
        • Separate plenums
        • Set air boundaries
        • Show tilt
        • Simplify Curved Edges
        • Simplify windows
        • Snap to grid
        • Solve adjacency
        • Split
        • Split core and perimeter
        • Subtract roofs
        • Subtract rooms
        • Validate model
        • Vertically split
    • Supported File Formats
      • Export
      • Import
    • Python Script Editor
      • Your First Python Script
      • Editor Class API Documentation
      • Available Python Libraries
    • FAQ
    • Changelog
  • Rhino Plugin
    • Getting Started in Rhino
    • Modeling Best Practices
      • Create Rooms
      • Create Apertures
      • Create Doors
      • Solve Adjacency
      • Create Shade or Context
      • Editing your Model
      • Using Room Selection Mode
    • Energy Modeling
      • Assign Program Types
      • Assign Construction Sets
      • Assign HVAC Systems
      • Energy Settings and Parameters
      • Run Simulation and Load Results
    • Daylight Modeling
      • Assign Modifier Sets
      • Assign Modifiers
      • Add Sensor Grid
      • Add View
      • Run Simulation and Visualize Daylighting Results
    • Interoperability
      • Ladybug Tools Grasshopper Plugins
        • Entity components
      • Import
        • Import HBJSON
        • Import gbXML
        • Import OSM
        • Import IDF
      • Export
        • Export HBJSON
        • Export gbXML
        • Export OSM and IDF
    • Troubleshooting
      • Rhino Plugin Errors
      • Validation Error Codes
    • Pollination Commands
      • By Use Case
        • General
        • Geometry Setup
        • Model Alignment & Updates
        • Setup & Run Simulation
        • Load, Visualize, and Export Results
      • Alphabetically
        • PO_AddApertureShades
        • PO_AddApertures
        • PO_AddAperturesByWWR
        • PO_AddBuildingShades
        • PO_AddDoors
        • PO_AddOpaqueFaces
        • PO_AddRadialGrid
        • PO_AddRooms
        • PO_AddRoomsByLayer
        • PO_AddSensorGrid
        • PO_AddShades
        • PO_AddSiteContext
        • PO_AddSkylightsByRatio
        • PO_AddView
        • PO_Align2DPlans
        • PO_AlignInElevation
        • PO_AlignInPlan
        • PO_AlignInPlan2D
        • PO_Check2DOrtho
        • PO_CheckAdjacency
        • PO_CheckPlanarity
        • PO_CheckUpdates
        • PO_ColorByBoundaryCondition
        • PO_ColorByFaceNormal
        • PO_ColorByFaceType
        • PO_ConstructionSetManager
        • PO_ConstructionManager
        • PO_DownloadModel
        • PO_DrawApertures
        • PO_DrawDoors
        • PO_DrawPlanarSurface
        • PO_DrawRoom
        • PO_DupAperturesDoors
        • PO_EditApertureProperties
        • PO_EditDoorProperties
        • PO_EditFaceProperties
        • PO_EditInPlace
        • PO_EditProperties
        • PO_EditRoomProperties
        • PO_EditSensorGridProperties
        • PO_EditShadeProperties
        • PO_EditViewProperties
        • PO_EmbedUserLibrary
        • PO_Extrude2DPlans
        • PO_FixRoomChildrenLinks
        • PO_GenAlignGrids
        • PO_GenRoomPerimeters
        • PO_HVACManager
        • PO_IsolateAdjacencies
        • PO_LicenseManager
        • PO_LoadResults
        • PO_MaterialManager
        • PO_MatchChildGeometry
        • PO_MatchRoomProperties
        • PO_MergeRooms
        • PO_ModifierSetManager
        • PO_ModifierManager
        • PO_OffsetChildObjects
        • PO_PluginInfo
        • PO_Pollination
        • PO_ProgramTypeManager
        • PO_ProjectChildToHost
        • PO_ProjectSrf
        • PO_PurgeUserLibrary
        • PO_RebuildRooms
        • PO_RemoveProperties
        • PO_RemoveShortSegments
        • PO_RebuildAperturesDoors
        • PO_ResetBoundaryCondition
        • PO_ResetDisplayName
        • PO_ResetIdentifier
        • PO_ResetLegendLocation
        • PO_ResetResourceIDs
        • PO_RunSimulation
        • PO_SaveToUserLibrary
        • PO_SelApertures
        • PO_SelDoors
        • PO_SelOpaqueFaces
        • PO_SelRooms
        • PO_SelSensorGrids
        • PO_SelShades
        • PO_SelSiteContexts
        • PO_SelViews
        • PO_SetAirBoundariesByGuides
        • PO_SetRoomStoryByElevation
        • PO_ShowObjectNotes
        • PO_SHWManager
        • PO_ScheduleManager
        • PO_SimulationParameter
        • PO_SolveAdjacency
        • PO_SplitRooms
        • PO_SyncModel
        • PO_TestLocalAppEnvironment
        • PO_UnitsSetting
        • PO_UploadModel
        • PO_UserManual
        • PO_ValidateModel
  • Grasshopper Plugin
    • Download and Install the Grasshopper Plugin
    • Grasshopper User Interface
      • 1:Primitives
        • PO_Aperture
        • PO_Door
        • PO_Face
        • PO_Model
        • PO_Room
        • PO_SensorGrid
        • PO_Shade
        • PO_View
        • PO_VisualizationSet
        • PO_Construction
        • PO_ConstructionSet
        • PO_Material
        • PO_Modifier
        • PO_ModifierSet
        • PO_ProgramType
        • PO_Schedule
      • 2:Pollination
        • Check_Run_Inputs
        • Check_Run_Results
        • List_Run_Assets
        • Setup_Runs
        • User_Data
        • Pollinate
        • Check_Study_Status
        • List_Studies
        • Add_a_project
        • Get_a_project
        • List_Project_Assets
        • Load_Assets
        • Upload_Assets
        • Login
      • 3:Parametric
        • Fly
        • Fly_ID
      • 4:Serialization
        • PO_Dump_GEM
        • PO_Dump_IDM
        • PO_Dump_INP
        • PO_Dump_SDD
    • Your First Simulation
    • Create a Parametric Run
    • Visualize Results
  • Web Platform
    • Create a New Project
    • Manage Access to a Project
    • Create a New Study
    • Create Teams
  • Developers
    • Create an API Key
    • API
      • Add Members to an Organization
      • Create a New Project
      • Schedule a Study on Pollination
    • Apps
      • Create a Simple Chart
      • Create a Filtered Chart
      • Create a Study
      • Check Study Status
      • Download an Output
      • Visualize Results on the Web
      • Integrate the Pollination Viewer
      • Visualize Results in Rhino
      • Prepare an App folder
      • Deploy an App using the Command Line
      • Deploy an App using Github
      • Automate the App Deployment
      • Update an App
  • Legal
    • Terms of Service
    • Privacy Policy
    • Subprocessors
    • Data Processing Addendum
    • Service Level Agreement
Powered by GitBook
On this page
  • Prerequisite
  • Step-1: Updating Dependencies
  • Step-2: Installing Libraries
  • Step-3: Writing the App
  • Step-4: Running the App inside a Docker Container
  • Step-5: Generating API Token
  • Step-6: Deploying the App

Was this helpful?

  1. Developers
  2. Apps

Deploy an App using the Command Line

PreviousPrepare an App folderNextDeploy an App using Github

Last updated 4 months ago

Was this helpful?

In this section, we will see how you can deploy your own app on Pollination Cloud using the command line. As an example to demonstrate the process, we will write and deploy an app that draws a wind rose using the EPW data. At the end of this section, you will have deployed an app named wind-rose that appears under the Apps tab on your profile.

Prerequisite

wind-rose
│   README.md
│
└───app
        app.py
        Dockerfile
        requirements.txt

Step-1: Updating Dependencies

The requirements.txt file inside the app folder contains a list of dependencies that your app needs to run. We will update the requirements.txt file to include the libraries we need to run the app. This list will mostly differ for each app based on the libraries we need to run the app. if you are unsure about the libraries you need in this file, go ahead and start writing your app. Once you have finished writing the app, make sure to come back and update the requirements.txt file to reflect all the necessary libraries.

In the requirements.txt file, we will make sure to have the latest version of the libraries we need to run the app. Let's make the content of the file as follows;

pollination-streamlit>=0.2.1
ladybug-charts>=1.18.3

Step-2: Installing Libraries

Change directory and arrive at the app folder created inside the wind-rose folder. Once app folder is your current working directory, run the following command. This will install all the dependencies in the requirements.txt file.

pip install -r requirements.txt

Step-3: Writing the App

Now that we have the folder in place. We can write the app. We will be using the app.py file created in the app folder to write the app. Let's clear the file and write the following to generate a wind rose using the EPW data.

import streamlit as st
from ladybug.epw import EPW
from ladybug.windrose import WindRose


st.set_page_config(
    page_title='Wind rose', layout='wide'
)


epw = EPW("./assets/sample.epw")
wind_directions = epw.wind_direction
wind_speeds = epw.wind_speed


wind_rose = WindRose(wind_directions, wind_speeds)
figure = wind_rose.plot()

st.title("Wind rose")
st.plotly_chart(figure, use_container_width=True)

Please note that we created a subfolder called assets inside the app folder. This subfolder contains the EPW data file we are using renamed as sample.epw. So after creating the assets folder, the structure of the wind-rose folder will look like the following;

wind-rose
│   README.md
│
└───app
    │   app.py
    │   Dockerfile
    │   requirements.txt
    │
    └───assets
            sample.epw

Once done, run the following command from inside the app folder;

streamlit run app.py

This should render the following in the browser;

If the app runs as expected, enter ctrl + c on the command line to stop the app.

Step-4: Running the App inside a Docker Container

Once the docker desktop is running, Let's go to the app folder and use the run command from the Pollination-apps library to run the app in a Docker container.

You can find out the structure of this command by using the following command;

pollination-apps run --help

This should show the following in the command line;

Usage: pollination-apps run [OPTIONS] PATH OWNER

  Build and run the application locally.

  Args:     path: Full path to apps folder.
  owner: The owner of the app on pollination. e.g. ladybug-tools

Options:
  -n, --name TEXT  the name of the app (defaults to folder name)
  -t, --tag TEXT   the tag for this version of the app
  --help           Show this message and exit.

Let's run the command now to run the app in a Docker container. The . here means that we want the current working directory to be the path.

pollination-apps run . YOUR_USERNAME

This will take a while depending on the size of the app and the number of dependencies in the requirements.txt file. If everything works fine you should see the following appear in the command line;

  You can now view your Streamlit app in your browser.

  Network URL: http://172.17.0.2:8501
  External URL: http://24.150.248.87:8501

Now, you can view the app in your browser by going to the following URL;

localhost:8501

You should see your app running in the browser. If the app works as expected. Come back to the command line and use the ctrl + c command to stop the app.

Step-5: Generating API Token

Once we have tested that the app works inside the Docker container. We are ready to deploy it to Pollination Cloud. To deploy the app, we will login to Pollination cloud first and will create an API token. Go to the Developer Settings section of the Settings page on your profile and create a new API or retrieve an existing API token. Here, we created a new API token with the name of wind-rose. We will click on the refresh button to get the API token and will copy the API token to the clipboard.

Warning Treat this API token as confidential. Make sure you don't commit it as part of your app to a public repository or share with others.

Step-6: Deploying the App

To deploy the app we will use the deploy command from the Pollination-apps library.

In order to learn the structure of the command above, use the following command;

pollination-apps deploy --help

Finally, run the command inside the app folder and use the API token created in the step above.

pollination-apps deploy . --name "wind-rose" --api-token XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Once you deploy the app, you should see the following message appear on the command line;

Congrats! The "wind-rose" app is successfully scheduled for deployment.
It can take up to 10 minutes before the new version of the app is deployed to Pollination. You can check the app at this URL: https://app.pollination.solutions/YOUR_USERNAME/applications/wind-rose

If you reached here, congratulations! You have successfully deployed the app to Pollination Cloud. Go to the wind-rose app under the Apps tab on your profile and check the live app after 10 minutes of deployment. You should see the wind-rose app live on Pollination cloud.

Since this section builds on it, it is necessary that you go through section first. Make sure that before you start going through this section, you have an app folder named "wind-rose" with the following structure.

These are the libraries we need to run the app. To find the latest version of any library that you may want to use with your app, please search for that library on the website.

Before, deploying the app, it is necessary to run the app in a Docker container. In order to run the app in a Docker container, we will need to install Docker desktop first. Visit this to download the Docker desktop and install it on your system. Once installed, run the docker desktop and keep it running in the background.

In the section, we will see how we can use the CI generated by the github-manual option to deploy this same app to Pollination.

this
pypi
link
next