This is an automated email from the ASF dual-hosted git repository.
agrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-ballista.git
The following commit(s) were added to refs/heads/master by this push:
new 08fa42bb Fix Scheduler UI in Docker image (#251)
08fa42bb is described below
commit 08fa42bb2cc62fc5e1f72214101364e2addbeb8d
Author: Andy Grove <[email protected]>
AuthorDate: Tue Sep 20 11:15:32 2022 -0600
Fix Scheduler UI in Docker image (#251)
---
ballista/rust/scheduler/src/api/mod.rs | 2 +-
ballista/ui/scheduler/src/App.tsx | 2 +-
dev/docker/ballista-scheduler.dockerfile | 1 +
dev/docker/nginx.conf | 53 ++++++++++++++++++++++++++++++++
4 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/ballista/rust/scheduler/src/api/mod.rs
b/ballista/rust/scheduler/src/api/mod.rs
index c3eba901..2f19f68d 100644
--- a/ballista/rust/scheduler/src/api/mod.rs
+++ b/ballista/rust/scheduler/src/api/mod.rs
@@ -85,7 +85,7 @@ fn with_data_server<T: AsLogicalPlan + Clone, U: 'static +
AsExecutionPlan>(
pub fn get_routes<T: AsLogicalPlan + Clone, U: 'static + AsExecutionPlan>(
scheduler_server: SchedulerServer<T, U>,
) -> BoxedFilter<(impl Reply,)> {
- let routes = warp::path("state")
+ let routes = warp::path!("api" / "state")
.and(with_data_server(scheduler_server))
.and_then(handlers::scheduler_state);
routes.boxed()
diff --git a/ballista/ui/scheduler/src/App.tsx
b/ballista/ui/scheduler/src/App.tsx
index adb5896a..43d7aa1b 100644
--- a/ballista/ui/scheduler/src/App.tsx
+++ b/ballista/ui/scheduler/src/App.tsx
@@ -66,7 +66,7 @@ const App: React.FunctionComponent<any> = () => {
const [schedulerState, setSchedulerState] = useState(undefined);
function getSchedulerState() {
- return fetch(`/state`, {
+ return fetch(`/api/state`, {
method: "POST",
headers: {
Accept: "application/json",
diff --git a/dev/docker/ballista-scheduler.dockerfile
b/dev/docker/ballista-scheduler.dockerfile
index ab8b45ff..9d107c71 100644
--- a/dev/docker/ballista-scheduler.dockerfile
+++ b/dev/docker/ballista-scheduler.dockerfile
@@ -29,6 +29,7 @@ FROM apache/arrow-ballista:$VERSION
RUN apt -y install nginx
RUN rm -rf /var/www/html/*
COPY --from=ui-build /app/build /var/www/html
+COPY dev/docker/nginx.conf /etc/nginx/sites-enabled/default
ENV RUST_LOG=info
ENV RUST_BACKTRACE=full
diff --git a/dev/docker/nginx.conf b/dev/docker/nginx.conf
new file mode 100644
index 00000000..ba78e55f
--- /dev/null
+++ b/dev/docker/nginx.conf
@@ -0,0 +1,53 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+server {
+ listen 80 default_server;
+ listen [::]:80 default_server;
+
+ root /var/www/html;
+
+ index index.html index.htm index.nginx-debian.html;
+
+ server_name _;
+
+ location / {
+ # First attempt to serve request as file, then
+ # as directory, then fall back to displaying a 404.
+ try_files $uri $uri/ =404;
+ }
+
+ # pass REST api calls through to Ballista scheduler process
+ location /api/ {
+ proxy_redirect http://localhost:50050/ /api/;
+ proxy_pass_header Server;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Scheme $scheme;
+ proxy_set_header Host $http_host;
+ proxy_set_header X-NginX-Proxy true;
+ proxy_connect_timeout 5;
+ proxy_read_timeout 240;
+ proxy_intercept_errors on;
+
+ # no longer sure if this part is needed
+ proxy_next_upstream error http_403 non_idempotent;
+ proxy_next_upstream error http_502 non_idempotent;
+
+ proxy_pass http://localhost:50050;
+ }
+}