-
Notifications
You must be signed in to change notification settings - Fork 141
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
Setup local proxy via nginx for local development #58
base: master
Are you sure you want to change the base?
Setup local proxy via nginx for local development #58
Conversation
@timlevett based on our changes to how we handle runtime config, you might want to take a gander at those to rework a bit of this. Other than that, this is all great! I'll work with you to merge it at some point soon! |
local-nginx.conf
Outdated
proxy_pass https://ossindex.sonatype.org/; | ||
} | ||
|
||
location /api/2/ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QUESTION: What is this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy/pasta, I fix it.
local-nginx.conf
Outdated
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trivial: Newline
local-nginx.conf
Outdated
try_files $uri$args $uri$args/ $uri $uri/ /index.html =404; | ||
} | ||
|
||
#error_page 404 /404.html; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We actually take 404s and send them back to index.html (this allows the Angular router to attempt to load URLs that wouldn't typically load like: https://search.maven.org/artifact/org.robolectric/junit/4.0-beta-1/jar (since this wouldn't load the index.html page)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems logical, will do
local.Dockerfile
Outdated
@@ -0,0 +1,3 @@ | |||
FROM nginx:stable-alpine | |||
|
|||
COPY local-nginx.conf /etc/nginx/conf.d/default.conf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trivial: Newline
run-local.sh
Outdated
-p 80:80 \ | ||
--name mvn-search \ | ||
-v `pwd`/dist:/usr/share/nginx/html \ | ||
mvn-search:latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trivial: Newline
run-local.sh
Outdated
docker run \ | ||
-p 80:80 \ | ||
--name mvn-search \ | ||
-v `pwd`/dist:/usr/share/nginx/html \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to do: -v $(pwd)/dist:/usr/share/nginx/html \
here
As well, I believe docker-compose
will allow a relative path for a volume, so you might check that out (as you can see all these values using that)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe you can do rel path with volumes. Found moby/moby#4830 but looks like they said nope.
7758a65
to
f49768d
Compare
Refactored changes and minor cleanup done in f49768d @DarthHater let me know if you see anything else. Cheers. |
It works well and allowed me to work on SMO locally without any issue, unlike the method of running @timlevett While this works as advertised, is there anything that can be done to improve performance? Any change I make consistently takes over one minute to be synchronised:
|
Interesting observation @dawidsawa, I have not experienced this. |
Remove needing to disable security around cross origin by running a nginx proxy_pass via Docker for local running/debugging. I've had good success with this approach in other projects, thought I'd share.
This pull request makes the following changes:
local.Dockerfile
that is just nginx alpine with added configlocal-nginx.conf
which is the proxy serverrun-local.sh
which builds and deploys the docker image with the volume mountyarn install
. /shrug