The atoms of your platform
Kotlin Shell FreeMarker Batchfile JavaScript Groovy Other
Latest commit 111ee49 Jan 14, 2017 @jaguililla committed on GitHub Merge pull request #17 from jaguililla/develop
Develop

readme.md

BuildImg CoverageImg DownloadImg WebImg

HEXAGON

The atoms of your platform

Hexagon is a micro services framework that doesn't follow the flock. It is written in Kotlin and uses RabbitMQ and MongoDB. It takes care of:

The purpose of the project is to provide a micro services framework with the following priorities (in order):

  1. Simple to use
  2. Easily hackable
  3. Be small

The name and logo are an hexagon because it is the usual way of representing a microservice in a diagram.

DISCLAIMER: The project status right now is beta. Use it at your own risk

Getting started

Get the dependency from JCenter (you need to setup de repository first):

Gradle:

compile ('co.there4:hexagon:${version}')

Maven:

<dependency>
  <groupId>co.there4</groupId>
  <artifactId>hexagon</artifactId>
  <version>${version}</version>
</dependency>

Write the code:

import co.there4.hexagon.web.*

fun main(args: Array<String>) {
    get("hello/:name") { ok("Hello ${pathTokens["name"]}!") }
    run()
}

Launch it and view the results at: [http://localhost:2010/hello]

Build and Contribute

Requires Docker Compose installed

Prior to running the tests you need to import sample data with the following commands:

tar -Jxvf db.txz && \
mongorestore dump/hello_world/ --db hello_world && \
rm -rf dump

You can build the project, generate the documentation and install it in your local repository typing:

git clone https://github.com/jaguililla/hexagon.git
cd hexagon
docker-compose -f src/test/services.yml up -d
./gradle/wrapper --no-daemon clean docs site publishToMavenLocal

The results are located in the /build directory

Code coverage grid:

coverage

Lazybones template project

You have just created a simple project for managing your own Lazybones project templates. You get a build file (build.gradle) and a directory for putting your templates in (templates).

To get started, simply create new directories under the templates directory and put the source of the different project templates into them. You can then package and install the templates locally with the command:

./gradlew installAllTemplates

You'll then be able to use Lazybones to create new projects from these templates. If you then want to distribute them, you will need to set up a Bintray account, populate the repositoryUrl, repositoryUsername and repositoryApiKey settings in build.gradle, add new Bintray packages in the repository via the Bintray UI, and finally publish the templates with

./gradlew publishAllTemplates

You can find out more about creating templates on the GitHub wiki.

Gradle wrapper setup

You can change Gradle version in gradle/wrapper.properties, but if you need to regenerate the wrapper, follow the next steps:

  1. Add this to build.gradle:
    import static org.gradle.api.tasks.wrapper.Wrapper.DistributionType.*

    wrapper {
        String wrapperBaseFile = "$projectDir/gradle/wrapper"

        gradleVersion = '3.2.1'
        jarFile = wrapperBaseFile + ".jar"
        scriptFile = wrapperBaseFile
        distributionType = ALL
    }
  1. Execute gradle wrapper

  2. Remove the lines added in point 1 as they may cause problems in continuous integration environments

LICENSE

MIT License

Copyright (c) 2016 Juanjo Aguililla

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.