Runs
Runs are executions of a particular app version inside a chosen environment.
Running apps
You can use the Tower CLI (see the Tower CLI reference as well) to run an app from the command line. Additionally, apps can be run via the "Run App" feature in the Tower UI, or via the run REST API.
When running an app, you run its latest version.
Running an app locally
When developing and debugging an app, running it locally helps with observing resource consumption and getting access to logs without delay. However, it is important to create the same execution environment locally as your application will have when it runs in the Tower cloud. For this purpose, when you run an app in Tower locally, Tower will install the same dependencies, and set the same environment variables that it would do in regular, Tower-cloud mode.
tower run --local
✔ Getting secrets... Done!
✔ Building package... Done!
Success! App `hello-world` has been launched
2024-11-20 08:44:45 | Hello, world!
2024-11-20 08:44:46 | Hello, world!
2024-11-20 08:44:47 | Hello, world!
2024-11-20 08:44:48 | Hello, world!
2024-11-20 08:44:49 | Hello, world!
Success! Your app exited cleanly.
Running an app in the Tower cloud
Once you tested the app and are ready to execute it in the Tower cloud for production purposes, run the command without the --local parameter.
tower run
✔ Scheduling run... Done!
Success! Run #12 for app `hello-world` has been scheduled
By running an app in the Tower cloud, you are creating a record of the run that you can then analyze, retrieve logs and metrics for, get alerted on etc.
Use tower apps show <app-name>
to get the run status, or observe the run in the Tower UI (> Apps > hello-world).
tower apps show hello-world
Name: hello-world
Description:
A simple 'Hello, world!' app for demonstrating Tower.
Recent runs:
# Status Start Time Elapsed Time
------------------------------------------------
12 exited 2024-11-20 08:46:11 8s
11 exited 2024-11-19 20:14:46 9s
10 exited 2024-11-19 20:14:20 5s
9 exited 2024-11-19 20:13:36 3s
8 exited 2024-11-19 19:46:01 7s
7 exited 2024-11-16 15:31:23 7s
6 exited 2024-11-15 15:40:23 7s
5 exited 2024-11-15 11:07:51 5s
4 exited 2024-11-15 08:44:23 10s
3 exited 2024-11-14 16:02:31 8s
Running an app with parameters
When you run the application with no parameters specified, parameter values will be set to defaults specified in the Towerfile.
tower run --local
✔ Getting secrets... Done!
✔ Building package... Done!
Success! App `hello-world` has been launched
2024-11-20 16:39:47 | Hello, Steve! Boo to Carl
2024-11-20 16:39:48 | Hello, Steve! Boo to Carl
2024-11-20 16:39:49 | Hello, Steve! Boo to Carl
2024-11-20 16:39:50 | Hello, Steve! Boo to Carl
2024-11-20 16:39:51 | Hello, Steve! Boo to Carl
Success! Your app exited cleanly.
You can change the parameter values when you invoke the application using the --parameter
CLI options.
tower run --local \
--parameter=friend=Nick \
--parameter=foe=nobody
✔ Getting secrets... Done!
✔ Building package... Done!
Success! App `hello-world` has been launched
2024-11-20 16:39:47 | Hello, Nick! Boo to nobody
2024-11-20 16:39:48 | Hello, Nick! Boo to nobody
2024-11-20 16:39:49 | Hello, Nick! Boo to nobody
2024-11-20 16:39:50 | Hello, Nick! Boo to nobody
2024-11-20 16:39:51 | Hello, Nick! Boo to nobody
Success! Your app exited cleanly.
The same syntax works for running remotely (e.g. without the --local
flag).