Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
112 lines (84 sloc) 5.69 KB
id title date author layout guid permalink dsq_thread_id categories tags
570
OpenShift + Keycloak + AngularJS + JavaEE + MongoDB + CSS = MyCV
2016-03-14 17:15:13 +0000
Marco Molteni
post
/2016/03/14/openshift-angularjs-javaee-mongodb-css-mycv/
5565926367
AngularJS
EJB
Java EE
JSON
mongodb
REST
tutorial
Uncategorized
Web Services
java ee
JAX-RS
mongodb
OpenShift
REST
tutorial

—— Update Jul 25, 2016 ——

OpenShift is a great enterprise service. Unfortunately the resources needed by MongoDB and WildFly require some medium gears for an expense of $30 per month and the expense is not justified for a simple example website.

For this reason I rented a VPS, I installed everything from scrath and I moved to the  application to the new server. I will explain how to configure the server in a new post.

I used OVH as server provider but the procedure is the same with DigitalOcean. The goal was to spend less than $5/month and learn how to do it.

Preview: CentOS, WildFly, Java 8, MongoDB, Apache, Multiple websites.

—— END ——

Website: http://mycv.host

GitHub: https://github.com/marco76/myCv

I’ve a bit of time in this period and I’m updating (or, better, upgrading) my knowledge with the new trends on the market (recently I had to work with jsp and db2 ;))

I published a website that uses the following technologies:stack

  • OpenShift as PaaS (it manages all this architecture for … free …)
  • WildFly 10 + RESTful (RESTeasy)
  • MongoDB for the data
  • Keycloak for the Oauth2 security (google, github, facebook access)
  • AngularJS as JavaScript framework
  • HTML5 + CSS for the pages views

 

The goal of the website is to glue all these technologies together and try to shrink my CV to only one page (frscreencapture-www-mycv-host-1457966794473om the original 5 pages).

The formatting of the CV is done using almost only ‘

’ combined with CSS (the original template is not mine).

The data that fill the CV comes from a MongoDB server that contains the values. The data is in JSON format, a Java EE rest service send the data to AngularJS that fill the template.

2016-03-14_16-06-01_mongo

For each request to the CV a document with the information of the visitor is created in MongoDB an @Asynchronous method retrieve the visitor geographic information from freegeoip.net.

Using only CSS is possible to change the CV if the recruiter decide to print it. In this case the border are eliminated from the document and the social icon (links) are replaced by the email address.

2016-03-14_16-18-19_print

I don’t add code in this Post, you can find it on github. The code is changing frequently. I just show how easy is to connect to the DB on OpenShift:

private MongoClient mongoClient = null;
 if (System.getenv("OPENSHIFT_MONGODB_DB_URL") == null){
    //localhost
     mongoClient = new MongoClient();
} else {
     // Openshift URL
     mongoClient = new MongoClient(new MongoClientURI(System.getenv("OPENSHIFT_MONGODB_DB_URL")));
 };

**Security with Keycloak (and Google Oauth2)

** I initially started implementing the security using Oauth2 (you can find it at this endpoint http://mycv.host/rest/login) but I found a better solution : Keycloak. It handles almost everything (email verification, social auth, password policies etc). The feature are impressive and allow to avoid a lot of risky plumbing on the security side.

Email verification request:

2016-03-17_10-46-32

Supported providers:

2016-03-17_11-32-48

Next steps:

  • Angular 2
  • Bootstrap or Material Design
  • Multiple users
  • Min js