Skip to content

logiclinegmbh/fruitbagger

Repository files navigation

Fruit bagging challenge

Mongo in docker

  • Start container: sudo docker run -d -p 27017:27017 --name mongo mongo

  • Restart container : sudo docker restart mongo

Environment variables

  1. github oauth application key must be set as CLIENT_ID

  2. github oauth application secret must be set as CLIENT_SECRET

  3. mongodb host as MONGO_HOST (locally use: 0.0.0.0:27017)

  4. mongodb db name as MONGO_DBNAME

  5. port to listen as PORT

Prerequisites

  • JDK 8+

Building the project

To build the project, just use:

./gradlew shadowJar

It generates a fat-jar in the build/libs directory.

This project shows how to use the Vert.x 3.2 redeploy feature. Vert.x watches for file changes and will then compile these changes. The hello world verticle will be redeployed automatically.
Simply start the application with:

    ./gradlew run

Now point your browser at http://localhost:8080. Then you can make changes to the hello world verticle and reload the browser.

The whole configuration for this is rather simple:

    mainClassName = 'io.vertx.core.Launcher'
    def mainVerticleName = 'io.vertx.example.HelloWorldVerticle'

    // Vert.x watches for file changes in all subdirectories
    // of src/ but only for files with .java extension
    def watchForChange = 'src/**/*.java'

    // Vert.x will call this task on changes
    def doOnChange = './gradlew classes'

    run {
        args = ['run', mainVerticleName, "--redeploy=$watchForChange", "--launcher-class=$mainClassName", "--on-redeploy=$doOnChange"]
    }