Skip to content

Commit

Permalink
feat: add container and proxy for kmeans-peakfinding
Browse files Browse the repository at this point in the history
  • Loading branch information
maffettone committed Apr 12, 2024
1 parent 5ec54ba commit f8e5aa7
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
42 changes: 42 additions & 0 deletions containers/mmm5-tax-day-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,44 @@ services:
interval: 20s
timeout: 10s
retries: 5

kmeans-peakfinding-agent:
image: gsas:conda
command: conda run -n GSASII --no-capture-output uvicorn bluesky_adaptive.server:app --host 0.0.0.0 --root-path /kmeans-peakfinding-agent
environment:
- TILED_API_KEY=$TILED_API_KEY
- HTTPSERVER_API_KEY=$HTTPSERVER_API_KEY
- BS_AGENT_STARTUP_SCRIPT_PATH=/src/pdf-agents/pdf_agents/startup_scripts/mmm5-tax-day/kmeans-peakfit.py
volumes:
- type: bind
source: ../
target: /src/pdf-agents/
read_only: true
- type: bind
source: /etc/bluesky/kafka.yml
target: /etc/bluesky/kafka.yml
read_only: true

kmeans-peakfinding-ui:
image: ghcr.io/maffettone/bluesky-adaptive-ui:latest
entrypoint: /modify_dns.sh
command: python3 /src/bluesky-adaptive-ui/bluesky_adaptive_ui/default_dash_app/app.py --agent-address kmeans-peakfinding-agent --agent-port 8000
environment:
- DASH_REQUEST_PATHNAME_PREFIX=/kmeans-peakfinding/
volumes:
- ./modify_dns.sh:/modify_dns.sh
- type: bind
source: ../../bluesky-adaptive-ui
target: /src/bluesky-adaptive-ui
read_only: true
depends_on:
kmeans-peakfinding-agent:
condition: service_started
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8050"]
interval: 20s
timeout: 10s
retries: 5

proxy:
image: docker.io/nginx
Expand Down Expand Up @@ -154,6 +192,10 @@ services:
condition: service_started
peakfinding-ui:
condition: service_healthy
kmeans-peakfinding-agent:
condition: service_started
kmeans-peakfinding-ui:
condition: service_healthy
restart: always


2 changes: 2 additions & 0 deletions containers/nginx/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ <h2>Available Agents</h2>
<li><a href="/kmeans-gsas-agent/docs">KMeans-GSAS (FastAPI)</a></li>
<!-- Link to the Peakfinding service -->
<li><a href="/peakfinding-agent/docs">Peakfinding Service (FastAPI)</a></li>
<li><a href="/kmeans-peakfinding-agent/docs">Kmeans Peakfinding Service (FastAPI)</a></li>
<!-- Add more services here -->
<!-- Example: <li><a href="/your-service/">Your Service Name</a></li> -->
</ul>
Expand All @@ -81,6 +82,7 @@ <h2>Available Agent User Interfaces</h2>
<li><a href="/kmeans-gsas/">KMeans-GSAS UI</a></li>
<!-- Link to the Peakfinding service -->
<li><a href="/peakfinding/">Peakfinding UI</a></li>
<li><a href="/kmeans-peakfinding/">Kmeans Peakfinding UI</a></li>
<!-- Add more services here -->
<!-- Example: <li><a href="/your-service/">Your Service Name</a></li> -->
</ul>
Expand Down
16 changes: 16 additions & 0 deletions containers/nginx/locs.d/kmeans-peakfinding.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
location /kmeans-peakfinding/ {
proxy_pass http://kmeans-peakfinding-ui:8050/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 60s;
}

location /kmeans-peakfinding-agent/ {
proxy_pass http://kmeans-peakfinding-agent:8000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 60s;
}

0 comments on commit f8e5aa7

Please sign in to comment.