Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Host Admin UI dist on a subdirectory #10

Closed
fahadpf opened this issue Jun 3, 2021 · 2 comments
Closed

Host Admin UI dist on a subdirectory #10

fahadpf opened this issue Jun 3, 2021 · 2 comments

Comments

@fahadpf
Copy link

fahadpf commented Jun 3, 2021

Hi there,

I want to host the Admin UI dist on my own server due to some privacy policies, but I don't want to have a separate domain or subdomain for this repo. I want to define a new location in my Nginx configuration and host the original dist provided here on that particular location, let's say at /admin-ui.

But the problem is, my implementation fails to serve the JS and CSS resources when I try to access the Admin UI on my subdirectory route. I have tried setting the base tag in my dist/index.html file but it is also not working.

Is there any way I can clone this project directly on my server and then serve the static UI on a subdirectory route?

@darrachequesne
Copy link
Member

I think you'll have to edit the index.html file in the ui/dist directory, and replace the reference for the JS and CSS resources:

Before:

<link href="/css/app.64cb6d3f.css" rel="preload" as="style">
<script src="/js/chunk-vendors.d91c80d5.js">

After:

<link href="/admin-ui/css/app.64cb6d3f.css" rel="preload" as="style">
<script src="/admin-ui/js/chunk-vendors.d91c80d5.js">

I'm not sure how we could improve it though.

@fahadpf
Copy link
Author

fahadpf commented Jun 3, 2021

It really seemed like a hectic task to manually update all the URLs after every new pull. To add some ease to my life, I created a bash script that I execute to pull the latest changes from the server and then updating the resource URLs with a single command.

I'm attaching the said script here for other people as a reference.

#!/bin/bash

# Remove any existing changes
echo "Removing any existing changes in the repo..."
git checkout .

# Pull latest changes from the remote
echo "Fetching latest updates from remote..."
git pull

# Update resource URLs
echo "Updating resource URLs in ui/dist/index.html file"
sed -i "s/\/js\//\/admin-ui\/js\//g" ui/dist/index.html
sed -i "s/\/css\//\/admin-ui\/css\//g" ui/dist/index.html
sed -i "s/\/favicon\//\/admin-ui\/favicon\//g" ui/dist/index.html

echo "Done"

@fahadpf fahadpf closed this as completed Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants