Giter Club home page Giter Club logo

plant-simulator's Introduction

plant-simulator-ui

Codacy Badge codecov Build Status CII Best Practices Open Source Powered By

plant-simulator

De-centralized command and control of PowerPlant's that can be operated at scale!

Getting Started

For some background information on the project, please have a look here

For the impatient you, I have a version up and running on Heroku here! Please be soft on it as it is running on just 512MB RAM! But you will not be dissapointed! Give it a try!

Here is what the operation of a PowerPlant would look like! A constant command and control of the PowerPlant would end up showing you the following graph! In the graph below, you will see that the PowerPlant which was operating at its base power was asked to RampUp for some time and it did that. The plant-simulator monitored the RampUp closely and if I plot the values I end up getting this beautiful graph below!

PowerPlant Command and Control

With that little picture above, I hope you are interested to try the application! The instructions given below will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

1. Install Java Version 8
2. Install Scala Version 2.12.4
3. Install IntelliJ - Latest community edition and then install the latest Scala plugin available

Setting up the codebase locally

Follow the steps below to import the project into IntelliJ

1. Clone the project from: 
   git clone https://github.com/joesan/plant-simulator.git
   
2. Fire up IntelliJ and import the project
   
3. If you are opening IntelliJ for the first time, set up the Scala library in IntelliJ accordingly

Database Support

Though the application is multi database compliant, currently only MySQL and H2 databases are supported, the reason being that the set up scripts are only avaiable for MySQL and H2. If you need support for other relational databases, please feel free to contribute. You only need to add the set up scripts and include the JDBC driver dependency to build.sbt. Everything else works out of the box!

You have to make sure to set up your database and configure the database credentials and url in one of the applicatiox.xxxx.conf files (where xxxx stands for either test or prod)

Load Testing

This is a serious application which is ready to take a beating. Have a look here of what it could do!

Running tests

You have the option here to either run tests from IntelliJ or from the command line

To run tests from the command line, do the following:

1. Open a terminal and navigate to the project root folder 
   
2. Issue the following command: [Tests are run against an in memory H2 database and uses the application.test.conf]
   sbt clean test

To run any specific tests from within IntelliJ, simply right click the test that you wish you run and click Run

Running the application

This application is built as a web application using the Play framework. We have two options to run the application:

  • Run as a standalone jar
  • Run as a Docker container

To run as a standalone jar, do the following

+For simplicity, there is local H2 database setup (plant-simulator.mv.db). The connection details 
+are to be found under conf/application.dev.conf
   
+You can comfortably run the application using the following command (No WiFi, no Network required)
-sbt -Denv=dev run

If you want to run the application against a MySQL database, follow the instructione below:

0. First, we need a database that is up and running. Please have a look at
   this project that contains the setup script for the database (Supported databases are MySQL and H2):
   https://github.com/joesan/database-projects/tree/master/power-plant-simulator
   
   Make sure to have a running instance of your database server and to run the setup scripts.
   
   Once you have the database up and running, configure the database credentials in the 
   application.xxxx.conf file (xxxx stands for test or prod)
   
1. Open a terminal and navigate to the project root folder 
   
2. Issue one of the following commands to run:
   To run against a default (application.conf)
   sbt run
   
   To run against the qa environment
   sbt -Denv=qa run
   
   To run in production mode (application.prod.conf):
   sbt -Denv=prod -Dlogger.resource=logger-prod.xml run

3. Navigate to the following url on your favorite browser:
   http://localhost:9000
   
4. To do something meaningful with the application, have a look at the [documentation](https://github.com/joesan/plant-simulator/wiki/API-Documentation) for more information on how to call the API's!
   

To visualize the application and to do some real work with it, have a look here - Currently under development

Alternatively, you could visualize the app under the following URL:

https://plant-simulator-ui.herokuapp.com/ - More information could be found here

To run as a Docker container

1. Makue sure you have Docker installed on your host system 
   
2. Issue one of the following commands to build the docker image:
   sbt docker:publishLocal
   
   The above command would have built the image and push it to your local
   docker registry (on your host system)
   
3. Issue the following command to run the container:
   TODO - Document
   
4. Navigate to the following url on your favorite browser:
   
   
   [TODO] Add the Swagger API Docs and put the URL here
   

Deployment

I have a pre-deployed version on Heroku. More details can be found here!

[[TODO]] Add additional notes about how to deploy this on a live system

[[TODO]] See deployment for notes on how to deploy the project on a live system.

Tools Used

  • SBT - Scala Build Tool

  • Travis CI - Hosted Continuous Integration

Contributing contributions welcome

For more information on how to contribute, have a look here

Authors / Maintainers

See also the list of contributors who helped.

License License

The whole project is licensed under Apache License, Version 2.0. See LICENSE.txt.

Acknowledgments

ALERT

I stopped doing any further work on this project. I have a new architecture that I beleive is massively scalable and resillient and guess what, I will run it in K8s. I have started the work on it. Have a look in one of the following projects:

  1. plant-monitor
  2. plant-infra

It is still a WIP as I use my evenings and weekends to work on these projects.

Have a look here on what the architecture would look like:

https://github.com/joesan/plant-simulator/wiki/Application-Architecture

Keep visiting for updates!

forthebadge forthebadge forthebadge

plant-simulator's People

Contributors

joesan avatar cotsog avatar

Stargazers

 avatar

Watchers

James Cloos 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.