Git Product home page Git Product logo

movie-database's Introduction

movie-database

Description

The movie-database is a ROCA-style web application built on Bootstrap, jQuery, Thymeleaf, Spring MVC and Spring Boot, see Self-Contained Systems and ROCA: A complete example using Spring Boot, Thymeleaf and Bootstrap for concepts and pointers to details in the implementation. This repository has been updated Nov 2014, the old version referenced in this blog post is still available in the branch classic.

Build & Run

The movie-database is a system of self-contained systems (take a look at the blog posts referenced above). There are three self-contained systems, one for movies, one for actors and one for a shop. The movies and the actors system are ROCA-style applications with server-side rendering, while the shop system is a SPA with AngularJS on the client side and a REST service on the backend side. In addition to these three systems we have two applications serving cross-cutting concerns: one for delivering navigation snippets and one for monitoring. An SSO mechanism is used for security, the infrastructure setup to support this involves Redis and nginx. If you already have those two installed, good, and if not, it's a 15 minute thing (at least on Mac). If you shy away from that you're still able to run a non-integrated movie or actor application, I'll get to that later. The whole setup also includes an instance of Spring Boot Admin, a complete tool for monitoring Spring Boot applications. You can do and see everything you need in there, like health status, log files, thread dumps, environment variables, a JMX console and much more.

You need to have Homebrew installed to do the following.

nginx

Follow these instructions to install nginx. When editing the /private/etc/hosts file, add the line

127.0.0.1 moviedatabase.com

Now copy moviedatabase.conf to /usr/local/etc/nginx/conf.d/. Start nginx with sudo nginx, stop it with sudo nginx -s stop.

Redis

Linux

Redis is available in the repositories of most mainstream distros. Installing it is usually a matter of running something along the lines of (for Ubuntu):

sudo apt-get install redis

After the command finishes you can (again on Ubuntu) run:

redis-cli ping

Redis should now reply

PONG

Update application.properties in movie-database-movies and movie-database-actors and set

spring.redis.host=127.0.0.1
Mac and Windows

One fast way to get Redis running is to use a Docker image. If you're on Mac or Windows, you'll need to install Boot2Docker first and start it. My colleague Ben Ripkens wrote a nice tool to install standard Docker images fast. To install it, do the following

brew tap bripkens/dock
brew install dock

To install and startup Redis:

dock redis

Now Redis is running under 192.168.59.103:6379, which is exactly what the movie database expects. If you already have a Redis installed somewhere else, take a look at the application.properties files contained in the projects, there you may change the host and port used for connecting to Redis (for changing the port you need to add the property spring.redis.port, for a list of all Spring Boot properties take a look here).

Running the applications

Now clone this repository and check out master. From command line you may just call ./buildAndStartup.sh. This script stops boot2docker, nginx and all movie-database applications and then builds all applications, starts boot2docker and Redis, starts nginx, copies the static Angular app to a specific place and then starts all movie-database applications. You need to have mvn and java and boot2docker and dock and grunt and bower on your path for that (and maybe some other stuff, better take a look at the script). If you're not on OSX it should be easy to adapt the script to your OS. I piped the logs to dev/null because the applications themselves are logging to /tmp.

Alternatively start nginx and Redis yourself, build the Angular app yourself and copy it to the folder accessed by nginx, and then in your IDE import all Maven projects, then run the class ShopApplication in the project movie-database-shop-rest, the class NavigationApplication in the project movie-database-navigation, the class ActorsApplication in the project movie-database-actors, the class MoviesApplication in the project movie-database-movies and the class MonitoringApplicationin the project movie-database-monitoring.

Then access http://moviedatabase.com in your browser for the application. Currently there are two users, admin/admin and user/user. For monitoring with Spring Boot Admin access http://localhost:8083.

Build & Run without security

If you really shy away from installing nginx and Redis, you may just start the applications without security. Remove the dependency to movie-database-security from movie-database-movies and movie-database-actors, then remove the reference to SecurityConfiguration from those two projects (making them compile-clean again). Now start NavigationApplication and MoviesApplication (or ActorsApplication) and browse to http://localhost:8080/movie-app (http://localhost:8082/actor-app). Navigation links won't work, search works.

Build & Run (classic branch)

From the command line do:

git clone https://github.com/tobiasflohre/movie-database.git
git checkout classic
cd movie-database
mvn jetty:run

Access http://localhost:8080/movies in your browser.

movie-database's People

Contributors

tobiasflohre avatar bripkens avatar mlex avatar britter avatar rreimann avatar robertmaier avatar eitland avatar

Watchers

张伟 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.