Skip to content

Commit fac8920

Browse files
committed
cloud docs
1 parent 47b70a6 commit fac8920

File tree

1 file changed

+166
-0
lines changed

1 file changed

+166
-0
lines changed

running_urbanopt_in_the_cloud.md

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# Running on the Cloud
2+
3+
### Option 1: Docker-Based URBANopt Execution
4+
5+
For a single-server cloud deployment (for example, an AWS EC2 instance), the simplest and most reproducible approach is to run **URBANopt inside a Docker container**. This avoids installing URBANopt directly on the cloud instance and makes upgrades, rollbacks, and environment consistency as simple as changing the container tag.
6+
7+
In this workflow, URBANopt runs entirely inside a container, while project files and simulation outputs live on the host filesystem.
8+
9+
**URBANopt CLI commands and workflows are unchanged.** You will still use familiar commands such as `uo create`, `uo run`, `uo process`, and related workflows — the only difference is that these commands are executed inside the container rather than directly on the host operating system.
10+
11+
> **Note on cloud costs**
12+
>
13+
> URBANopt simulations can be CPU- and disk-intensive. Be sure to stop or terminate cloud instances when simulations complete to avoid unnecessary charges.
14+
15+
---
16+
17+
## Step 1: Launch a Cloud Instance
18+
19+
Launch a Linux-based instance on your preferred cloud platform:
20+
21+
- AWS EC2
22+
- Azure Virtual Machines
23+
- Google Compute Engine
24+
- On-premise or HPC cloud nodes
25+
26+
**Recommended configuration**
27+
- Ubuntu 22.04 LTS
28+
- Adequate CPUs for parallel simulations
29+
- Sufficient disk space for OpenStudio/EnergyPlus outputs
30+
31+
---
32+
33+
## Step 2: Connect via SSH
34+
35+
Once the instance is running, get its IP address and connect a terminal to it using SSH:
36+
37+
```
38+
ssh user@your-instance-ip
39+
```
40+
41+
**All remaining steps are performed inside this SSH session.**
42+
43+
---
44+
45+
## Step 3: Install Docker
46+
47+
Most cloud instances do **not** include Docker by default, so make sure that it is installed so you can run the URBANopt docker container.
48+
49+
On Ubuntu 22.04:
50+
51+
```
52+
sudo apt-get update
53+
sudo apt-get install -y docker.io
54+
sudo systemctl enable docker
55+
sudo systemctl start docker
56+
```
57+
58+
To allow running Docker without `sudo`, add your user to the `docker` group:
59+
60+
```
61+
sudo usermod -aG docker $USER
62+
newgrp docker
63+
```
64+
65+
Log out and back in if Docker commands still require `sudo`.
66+
67+
Managed container services (AWS ECS, AWS Batch, Kubernetes) already include Docker and do not require this step.
68+
69+
---
70+
71+
## Step 4: Obtain Your URBANopt Project Files
72+
73+
This guide assumes your URBANopt project is stored in a Git repository and can be cloned onto the instance:
74+
75+
```
76+
git clone https://github.com/your-org/your-urbanopt-project.git
77+
cd your-urbanopt-project
78+
```
79+
80+
Other transfer methods (for example, SCP, rsync, or cloud storage downloads) may also be used.
81+
82+
---
83+
84+
## Step 5: Pull the URBANopt Docker Image
85+
86+
URBANopt is provided as a prebuilt Docker image on [Docker Hub](https://hub.docker.com/r/nrel/docker-urbanopt).
87+
For example, version 1.1.0 is named:
88+
89+
```
90+
nrel/docker-urbanopt:1.1.0
91+
```
92+
93+
To pull the URBANopt 1.1.0 image locally to the instance, execute the following command:
94+
95+
```
96+
docker pull nrel/docker-urbanopt:1.1.0
97+
```
98+
99+
---
100+
101+
## Step 6: Run URBANopt Using Docker
102+
103+
Run the URBANopt container and mount the project directory into the container, so that URBANopt CLI has access to the project files.
104+
105+
```
106+
docker run --rm -it \
107+
-v "$(pwd):/work" \
108+
nrel/docker-urbanopt:1.1.0 \
109+
uo run -f example_uo/example_project.json \
110+
-s example_uo/baseline_scenario.csv
111+
```
112+
113+
### Notes
114+
115+
- `docker run` starts a new container from a Docker image.
116+
- `--rm` automatically removes the container after it exits (optional).
117+
- `-it` runs the container in interactive mode with a TTY attached.
118+
- `-v "$(pwd):/work"` mounts the current host directory into the container at `/work`.
119+
- `nrel/docker-urbanopt:1.1.0` is the Docker image containing URBANopt version 1.1.0 and its dependencies.
120+
- `uo run` invokes the URBANopt CLI inside the container.
121+
- `-f example_uo/example_project.json` specifies the URBANopt project definition file.
122+
- `-s example_uo/baseline_scenario.csv` specifies the scenario CSV used for the run.
123+
- `example_project.json` and `baseline_scenario.csv` are **example files provided by URBANopt**
124+
- User projects will typically use different filenames
125+
- URBANopt CLI usage and workflows are unchanged from a native installation
126+
---
127+
128+
## Simulation Outputs
129+
130+
Because the project directory is mounted into the container, **all outputs are written directly to the host filesystem**.
131+
132+
133+
For example:
134+
135+
```
136+
/work/example_uo/run/
137+
```
138+
139+
maps to:
140+
141+
```
142+
your-urbanopt-project/example_uo/run/
143+
```
144+
145+
No results are stored only inside the container.
146+
147+
---
148+
149+
## Parallel Execution
150+
151+
The number of parallel URBANopt simulations is controlled in project config file `runner.conf`:
152+
153+
```
154+
num_parallel = 10
155+
```
156+
157+
The container uses the CPUs available on the host VM. No special Docker configuration is required on Linux-based cloud instances.
158+
159+
---
160+
---
161+
162+
## Troubleshooting and Monitoring
163+
164+
- Use `docker logs <container-id>` to inspect container output if running without `-it`.
165+
- Check `example_uo/run/logs/` for OpenStudio and EnergyPlus logs.
166+
- Monitor CPU and memory usage on the VM during large runs to ensure adequate resources.

0 commit comments

Comments
 (0)