Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
object store: serve longhorn UI from /longhorn
Browse files Browse the repository at this point in the history
Serve Longhorn UI from /longhorn sub path. This avoids conflicts with
s3gw instances and allows redirecting the browser to the S3 management
UI

Signed-off-by: Moritz Röhrich <[email protected]>
  • Loading branch information
m-ildefons committed Oct 26, 2023
1 parent eb75703 commit ca675f7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
12 changes: 8 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ RUN npm run build
FROM registry.suse.com/bci/bci-base:15.4

RUN zypper -n ref && \
zypper -n install curl libxml2 bash gettext shadow nginx && \
rm -f /bin/sh && ln -s /bin/bash /bin/sh
zypper -n install curl libxml2 bash gettext shadow nginx

SHELL [ "/bin/bash", "-o", "pipefail", "-c" ]

RUN mkdir -p web/dist
WORKDIR /web
Expand All @@ -26,9 +27,12 @@ EXPOSE 8000
ENV LONGHORN_MANAGER_IP http://localhost:9500
ENV LONGHORN_UI_PORT 8000

RUN mkdir -p /var/config/ && touch /var/run/nginx.pid && chown -R 499 /var/config /var/run/nginx.pid
RUN mkdir -p /var/config/nginx/ \
&& cp -r /etc/nginx/* /var/config/nginx/ \
&& touch /var/run/nginx.pid \
&& chown -R 499 /var/config /var/run/nginx.pid

# Use the uid of the default user (nginx) from the installed nginx package
USER 499

CMD ["/bin/bash", "-c", "mkdir -p /var/config/nginx/ && cp -r /etc/nginx/* /var/config/nginx/; envsubst '${LONGHORN_MANAGER_IP},${LONGHORN_UI_PORT}' < /etc/nginx/nginx.conf.template > /var/config/nginx/nginx.conf && nginx -c /var/config/nginx/nginx.conf -g 'daemon off;'"]
CMD ["/bin/bash", "-c", "envsubst '${LONGHORN_MANAGER_IP},${LONGHORN_UI_PORT}' < /etc/nginx/nginx.conf.template > /var/config/nginx/nginx.conf && nginx -c /var/config/nginx/nginx.conf -g 'daemon off;'"]
8 changes: 4 additions & 4 deletions nginx.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ http {
client_max_body_size 0;
}

location ~ ^/.(images|javascript|js|css|flash|media|static)/ {
root /web/dist;
}

location / {
root /web/dist;
index index.html;
add_header Cache-Control "max-age=0";
try_files $uri $uri/ /index.html =404;
}

location ~ ^/.(images|javascript|js|css|flash|media|static)/ {
root /web/dist;
}

}
}
4 changes: 2 additions & 2 deletions src/routes/objectStorage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ class ObjectStore extends React.Component {
})
},
administrateObjectStore: (record) => {
if (record.endpoints?.length) {
window.open(record.endpoints[0], '_blank', 'noreferrer')
if (record.name?.length) {
window.open(record.name, '_blank', 'noreferrer')
}
},
deleteObjectStore: (record) => {
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.production.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
output: {
filename: "[name].[chunkhash:8].js",
path: path.resolve(__dirname, "dist"),
publicPath: "./",
publicPath: "/longhorn/",
chunkFilename: "[name].[chunkhash:8].async.js"
},
resolve: {
Expand Down

0 comments on commit ca675f7

Please sign in to comment.