anilallewar / microservices-basics-spring-boot Goto Github PK
View Code? Open in Web Editor NEWBasic architecture framework to create complete microservices using Spring boot and Spring cloud
License: Apache License 2.0
Basic architecture framework to create complete microservices using Spring boot and Spring cloud
License: Apache License 2.0
You need to update documentation to reflect your image name and version on some of your docker run examples.
docker run -d --name config-server -p 8888:8888 anilallewar/config-server
Should be
docker run -d --name config-server -p 8888:8888 anilallewar/basic-config-server:0.0.1
Dockercompoise appears OK
Hi all,
I'm building webservice-registry. but i have a problem with webservice-registry.
I'm using gradle version 4.2 and java 8.
Please tell me about. How to fix it.
Thanks.
FAILURE: Build failed with an exception.
java.lang.UnsupportedOperationException (no error message)
Hi,
I am trying to run this example application i have set up everything and its working fine but there are some exception is task-service.
when i am trying to access http://localhost:8765/task-service i am getting following error
Invalid access token: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MDcxNjUwNzIsInVzZXJfbmFtZSI6ImFuaWwiLCJhdXRob3JpdGllcyI6WyJST0xFX0FETUlOIiwiUk9MRV9VU0VSIl0sImp0aSI6ImVhZGIxM2ViLWRlOGYtNDk3Mi04ZGJlLTBhYmMzNzE0OTZkYiIsImNsaWVudF9pZCI6ImFjbWUiLCJzY29wZSI6WyJvcGVuaWQiXX0.XkcrzfnoxkJCsbZFA3DvPrwLyRtURXQqu8iQW9RJaeE6cyGmsLYPLEwDBaUlfiIkuSdMjZJLtIOfG9B9rP7qD-JlqQu27t5EUjEY6SpgVR7vg2Wm-RxP69nqQatEmJ72U5h17JCHEX_buQNtmnzNRhzIrN0t2pYjjJzFTeZYtzG0vIXsDpPpi3ASTpdT17wWM6EvEiU4vIloLuqbNUEOS7JbcoMDOzizHMD9Bc1SEJ7wbGI8Esib7FvcAkVf_MKwobeWWRoeLeP96g5FsnpIJVhLfJ3HHJAtofmMXpfiP9_K6FDoaXPddeaFG2SZY9Uo2YkeJu_OsTq4fcaXTUqvbQ invalid_tokenwhen service container stop by user.service not remove from eureka server
after search in internet i found this post
https://stackoverflow.com/questions/31836498/sigterm-not-received-by-java-process-using-docker-stop-and-the-official-java-i
and i solved this problem by change entry point in docker file.
#-----------------------------------------------------------------------------------------------------
# User Service
#-----------------------------------------------------------------------------------------------------
FROM openjdk:8u121-jdk-alpine
MAINTAINER Anil Allewar <[email protected]>
# Keep consistent with build.gradle
ENV APP_JAR_NAME basic-user-webservice
ENV APP_JAR_VERSION 0.0.1
# Install curl
RUN apk --update add curl bash && \
rm -rf /var/cache/apk/*
RUN mkdir /app
ADD ${APP_JAR_NAME}-${APP_JAR_VERSION}.jar /app/service.jar
ADD run.sh /app/
RUN chmod +x /app/run.sh
WORKDIR /app
EXPOSE 8080
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/urandom", "-Dspring.profiles.active=docker", "-jar", "/app/service.jar"]
I know this project is an example but in real world should I have one config-server and one service-registry for each application?
Or should I have a global config server and a global service-registry which all the services of all projects will use?
Hi,
how to resolve cors problem? I have an application on different host.
When i call http://localhost:8899/userauth/oauth/token?grant_type=password&username....
from http://localhost:3000/.... Chrome call url in OPTIONS method.
From AuthService i receive a 401 and log show
2017-12-28 15:58:41.214 DEBUG 8300 --- [nio-8899-exec-2] o.s.security.web.FilterChainProxy : /oauth/token?grant_type=password&username=anil&password=password at position 5 of 11 in additional filter chain; firing Filter: 'BasicAuthenticationFilter'
2017-12-28 15:58:41.214 DEBUG 8300 --- [nio-8899-exec-2] o.s.security.web.FilterChainProxy : /oauth/token?grant_type=password&username=anil&password=password at position 6 of 11 in additional filter chain; firing Filter: 'RequestCacheAwareFilter'
2017-12-28 15:58:41.214 DEBUG 8300 --- [nio-8899-exec-2] o.s.security.web.FilterChainProxy : /oauth/token?grant_type=password&username=anil&password=password at position 7 of 11 in additional filter chain; firing Filter: 'SecurityContextHolderAwareRequestFilter'
2017-12-28 15:58:41.216 DEBUG 8300 --- [nio-8899-exec-2] o.s.security.web.FilterChainProxy : /oauth/token?grant_type=password&username=anil&password=password at position 8 of 11 in additional filter chain; firing Filter: 'AnonymousAuthenticationFilter'
2017-12-28 15:58:41.219 DEBUG 8300 --- [nio-8899-exec-2] o.s.s.w.a.AnonymousAuthenticationFilter : Populated SecurityContextHolder with anonymous token: 'org.springframework.security.authentication.AnonymousAuthenticationToken@9055c2bc: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@b364: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: null; Granted Authorities: ROLE_ANONYMOUS'
2017-12-28 15:58:41.219 DEBUG 8300 --- [nio-8899-exec-2] o.s.security.web.FilterChainProxy : /oauth/token?grant_type=password&username=anil&password=password at position 9 of 11 in additional filter chain; firing Filter: 'SessionManagementFilter'
2017-12-28 15:58:41.219 DEBUG 8300 --- [nio-8899-exec-2] o.s.security.web.FilterChainProxy : /oauth/token?grant_type=password&username=anil&password=password at position 10 of 11 in additional filter chain; firing Filter: 'ExceptionTranslationFilter'
2017-12-28 15:58:41.219 DEBUG 8300 --- [nio-8899-exec-2] o.s.security.web.FilterChainProxy : /oauth/token?grant_type=password&username=anil&password=password at position 11 of 11 in additional filter chain; firing Filter: 'FilterSecurityInterceptor'
2017-12-28 15:58:41.221 DEBUG 8300 --- [nio-8899-exec-2] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/oauth/token'; against '/oauth/token'
2017-12-28 15:58:41.221 DEBUG 8300 --- [nio-8899-exec-2] o.s.s.w.a.i.FilterSecurityInterceptor : Secure object: FilterInvocation: URL: /oauth/token?grant_type=password&username=anil&password=password; Attributes: [fullyAuthenticated]
2017-12-28 15:58:41.222 DEBUG 8300 --- [nio-8899-exec-2] o.s.s.w.a.i.FilterSecurityInterceptor : Previously Authenticated: org.springframework.security.authentication.AnonymousAuthenticationToken@9055c2bc: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@b364: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: null; Granted Authorities: ROLE_ANONYMOUS
2017-12-28 15:58:41.232 DEBUG 8300 --- [nio-8899-exec-2] o.s.s.access.vote.AffirmativeBased : Voter: org.springframework.security.web.access.expression.WebExpressionVoter@1ff98b36, returned: -1
2017-12-28 15:58:41.246 DEBUG 8300 --- [nio-8899-exec-2] o.s.s.w.a.ExceptionTranslationFilter : Access is denied (user is anonymous); redirecting to authentication entry point
org.springframework.security.access.AccessDeniedException: Access is denied
I couldn't access Eureka, User, Task and Comments services from browser after starting the application. Can you please mention the end point URLs to access the application and each service?
Using my browser for authentication works fine. I get redirected to auth-server, log in successfully and get redirected to zuul again and getting information from a protected microservice.
Using curl to obtain a token also works fine but using this token with the "Authorization: Bearer xxx..." header to get a resource doesn't work. I always get redirected to the login page.
Maybe this is related to:
kakawait/uaa-behind-zuul-sample#13
The documentation from the auth-server (in this project) says that getting resources via curl should be also possible. What am i doing wrong?
UPDATE
Got it working using @ResourceServer
annotation instead of @EnableOAuth2Sso
annotation (both isn't possible so easy at this time) and extending ResourceServerConfigurerAdapter
.
...
@EnableResourceServer
public class ZuulServerApplication extends ResourceServerConfigurerAdapter {
...
I would be glad if you could provide a solution which is able to handle both.
Its great microservice project, I am using this template as my reference and developed a microservice application every thing working fine, now the problem is when i do the proxy call to the microservices the data from microservice are coming as excepted but if I hit the url continuously getting the empty response..
What may be the reason for it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.