Skip to content

Commit 349f3a0

Browse files
committed
Add dashboard-uvicorn support and update app.py to use configurable dashboard port
- Added new Makefile targets for starting the dashboard with Uvicorn. - Updated .example.env to include a configurable dashboard port. - Modified app.py to serve the application on the specified dashboard port from the environment variable.
1 parent 74225db commit 349f3a0

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

.example.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,6 @@ ANOMSTACK_CLICKHOUSE_PORT=8123
118118
ANOMSTACK_CLICKHOUSE_USER=anomstack
119119
ANOMSTACK_CLICKHOUSE_PASSWORD=anomstack
120120
ANOMSTACK_CLICKHOUSE_DATABASE=default
121+
122+
# dashbooard port
123+
ANOMSTACK_DASHBOARD_PORT = 5001

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ SHELL=/bin/bash
1212
.PHONY: ps-locald
1313
.PHONY: dashboard
1414
.PHONY: dashboardd
15+
.PHONY: dashboard-uvicorn
16+
.PHONY: dashboardd-uvicorn
1517
.PHONY: requirements-install
1618

1719
# start dagster locally
@@ -59,8 +61,14 @@ requirements:
5961
dashboard:
6062
python dashboard/app.py
6163

64+
dashboard-uvicorn:
65+
uvicorn dashboard.app:app --host 0.0.0.0 --port 5003 --reload
66+
6267
dashboardd:
6368
nohup python dashboard/app.py > /dev/null 2>&1 &
6469

70+
dashboardd-uvicorn:
71+
nohup uvicorn dashboard.app:app --host 0.0.0.0 --port 5003 --reload > /dev/null 2>&1 &
72+
6573
requirements-install:
6674
pip install -r requirements.txt

dashboard/app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@
4242
# Mount static files
4343
app.mount("/static", StaticFiles(directory="dashboard/static"), name="static")
4444

45+
# Set the app state
4546
app.state = AppState()
4647

4748
# Import routes after app is defined
4849
from routes import *
4950

5051
if __name__ == "__main__":
51-
serve()
52+
serve(app, port=int(os.getenv("ANOMSTACK_DASHBOARD_PORT", 5001)))

0 commit comments

Comments
 (0)