Skip to content

Commit

Permalink
Initial commit of v2.0.0 refactoring
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Petisme <daniel.petisme@gmail.com>
  • Loading branch information
danielpetisme committed Aug 21, 2018
1 parent f9b1cb5 commit 17c749c
Show file tree
Hide file tree
Showing 103 changed files with 1,980 additions and 3,508 deletions.
Empty file modified .github/ISSUE_TEMPLATE.md 100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -10,6 +10,6 @@
.yardoc
.yardopts
.vertx
build
build/
target
out
Binary file removed .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
1 change: 0 additions & 1 deletion .mvn/wrapper/maven-wrapper.properties

This file was deleted.

24 changes: 1 addition & 23 deletions .travis.yml
@@ -1,26 +1,4 @@
dist: trusty
sudo: false
language: java

jdk:
- oraclejdk8
- oraclejdk9
matrix:
allow_failures:
- jdk: oraclejdk9
addons:
apt:
packages:
- oracle-java8-installer
- oracle-java9-installer
cache:
directories:
- $HOME/.m2
before_script: java -version
script: ./mvnw install
deploy:
skip_cleanup: true
provider: releases
api_key: ${GITHUB_OAUTH_TOKEN}
file: ./vertx-starter-main/target/vertx-starter-main-${TRAVIS_TAG}-fat.jar
on:
tags: true
19 changes: 0 additions & 19 deletions Dockerfile

This file was deleted.

51 changes: 51 additions & 0 deletions Jenkinsfile
@@ -0,0 +1,51 @@
pipeline {
agent any
stages {
stage('Build') {
steps {
sh '''
./gradlew clean assemble
'''
stash name: 'fatJar', includes: 'build/libs/*fat.jar'
}
}
stage('Deploy') {
steps {
unstash 'fatJar'
withCredentials(bindings: [sshUserPrivateKey(credentialsId: 'jenkins_start.vertx.io', \
keyFileVariable: 'SSH_KEY_FOR_START_VERTX_IO')]) {
sh '''
set +x
if [ -z ${REMOTE_USER+x} ] || [ -z ${REMOTE_HOSTNAME+x} ]; then
echo "Fatal: SSH information not set."
exit 1
fi
echo "Sending jar with ${REMOTE_USER}@${REMOTE_HOSTNAME}"
ssh -i "${SSH_KEY_FOR_START_VERTX_IO}" "${REMOTE_USER}"@"${REMOTE_HOSTNAME}" mkdir -p "${TEMP}"
scp -i "${SSH_KEY_FOR_START_VERTX_IO}" ./build/libs/*fat.jar "${REMOTE_USER}"@"${REMOTE_HOSTNAME}":"${TEMP}"
'''

sh '''
set +x
if [ -z ${REMOTE_USER+x} ] || [ -z ${REMOTE_HOSTNAME+x} ]; then
echo "Fatal: SSH information not set."
exit 1
fi
echo "Deploying with ${REMOTE_USER}@${REMOTE_HOSTNAME}"
ssh -i "${SSH_KEY_FOR_START_VERTX_IO}" "${REMOTE_USER}"@"${REMOTE_HOSTNAME}" "sudo -t bash -s" < ./scripts/deploy.sh
'''
}
}
}
}
environment {
REMOTE_USER = 'jenkins'
REMOTE_HOSTNAME = 'start.vertx.io'
TEMP= '/tmp/vertx'
}
}
File renamed without changes.
130 changes: 77 additions & 53 deletions README.md
@@ -1,69 +1,93 @@
# Vertx.x starter
# Vertx.x Starter

**Disclaimer**: This is a *WIP* project. Any comment, test or help is welcome!

Vert.x starter
![Travis (.org)](https://img.shields.io/travis/vert-x3/vertx-starter.svg)
![GitHub](https://img.shields.io/github/license/vert-x3/vertx-starter.svg)

## Installation
**Disclaimer**: This is a *WIP* project. Any comment, test or help is welcome!

```
git clone https://github.com/danielpetisme/vertx-starter.git
cd vertx-starter
./build_and_run.sh
```
[Vert.x Starter](http://start.vertx.io) is an open-source web application for creating [Vert.x](https://vertx.io/) applications.

## Default values
Have a look to `vertx-starter-main/conf/default-conf.json`
```
{
"api": {
"http.port": 9090,
"prefix": "api",
"project.request": {
"version": "3.5.0",
"format": "zip",
"language": "java",
"build": "maven",
"groupId": "io.vertx",
"artifactId": "sample",
"dependencies": [
"vertx-core",
"vertx-unit"
]
},
"dependencies.path": "./dependencies.json"
},
"web": {
"http.port": 8080
},
"generator": {
"temp.dir": "."
}
}
```
## Generating a project
## Quickstart

Simply click on "Generate Project" on the web interface to download a project archive.

It your a CLI adept, you can achieve the same result with `curl`
It your a CLI adept, you can use any http client (curl, [httpie](https://httpie.org/)) to invoke the API.

`$ curl -X GET http://start.vertx.io/starter.zip -d groupId=com.acme -d language=java -d vertxVersion=3.5.3 -o starter.zip`

## API

`$ http://<api_url>/starter.zip -o starter.zip`
## Generating a Vert.x application

All the web ui inputs are mapped to the following attributes
`http://start.vertx.io/starter.{archiveFormat}`

*Note*: `{archiveFromat}` can be `zip`, `tgz`, `tar.gz`, etc. if the project generator can handle the format, it will use the appropriate compression tool.

You can provide the following query parameters to customize the project
* `type`: The type of project (`core`, `openapi`, etc.).
* Basic information for the generated project `groupId`, `artifactId`
* `version`: the Vert.x version
* `build`: `maven` or `gradle` build tool
* `language`: `java`, `groovy`, `kotlin`, `js`, `scala`
* `dependencies`: a comma separated list of artifactIds of the vert.x modules
* `language`: `java` or `kotlin`
* `buildTool`: `maven` or `gradle` build tool
* `vertxVersion`: the Vert.x version
* `vertxDependencies`: a comma separated list of artifactIds of the vert.x modules

Full example:
```
$ http://<api_url>/starter.zip \
-d version=3.5.0 \
-d language=java \
-d groupId=io.vertx \
-d artifactId=sample \
-d depencies=vertx-web,vertx-web-client \
-o starter.zip`
curl -X GET \
'http://start.vertx.io/starter.zip?artifactId=starter&buildTool=maven&groupId=io.vertx&language=java&type=core&vertxDependencies=&vertxVersion=3.5.3' \
-o starter.zip
```

The HTTPie equivalent:
```
$ http http://start.vertx.io/starter.zip \
type==core \
groupId==io.vertx \
artitfactId==starter \
language==java \
buildTool==maven \
vertxVersion==3.5.3 \
vertxDependencies==vertx-web,vertx-web-client \
-o starter.zip
```
## Vert.x Starter metadata

The vert.x starter metadata lists all the capabilities proposed by the API. The metadata is used to build the Web UI is exposed to ease the creation of third-party clients (IDE integration, CLI, etc).

`http://start.vertx.io/metadata`


## Running your own starter

## Build from sources

For now, the vertx-starter project is not available on Maven-Central, so you need to build it from source.

In order to build it, you will need Java 1.8.

### Building fat jar

`$ ./gradlew shadowJar`

### Running the app locally

`$ ./gradlew vertxRun`

### Configuration

Vert.x starter relies on the [`vertx-boot`](https://github.com/jponge/vertx-boot) launcher.
The application is configured by [`src/main/resources/application.conf`](./src/main/resources/application.conf).
Please see the according documentation to know how to override the configuration.

### Vert.x Project Generator
The project generation is delegated to the [vertx-project-generator](https://github.com/vert-x3/vertx-project-generator) project.
You should clone the project and configure the starter to have a complete stack locally.

## Docker

**WIP**

## License

Vert.x Starter is Open Source software released under the [Apache 2.0 license](http://www.apache.org/licenses/LICENSE-2.0.html).
79 changes: 79 additions & 0 deletions build.gradle
@@ -0,0 +1,79 @@
/*
* Copyright (c) 2017-2018 Daniel Petisme
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

plugins {
id 'io.vertx.vertx-plugin' version '0.0.8'
}

apply plugin: 'idea'


repositories {
jcenter()
mavenCentral()
maven { url 'https://repo.gradle.org/gradle/libs-releases' }
}

group 'io.vertx'
version '2.0.0-SNAPSHOT'
description = 'A web application to generate Vert.x projects '

ext {
vertx_version = '3.5.3'
logback_version = '1.2.3'
gradle_tooking_api_version = '4.3'
vertx_boot_version = '0.0.2'
assertj_core_version = '3.10.0'
junit_version = '5.2.0'
}

dependencies {
implementation 'io.vertx:vertx-web'
implementation 'io.vertx:vertx-mongo-client'
implementation 'io.vertx:vertx-web-client'

implementation "ch.qos.logback:logback-classic:${logback_version}"
implementation "org.gradle:gradle-tooling-api:${gradle_tooking_api_version}"
implementation "io.github.jponge:vertx-boot:${vertx_boot_version}"

testImplementation "org.assertj:assertj-core:${assertj_core_version}"
testImplementation 'io.vertx:vertx-junit5'
testImplementation "org.junit.jupiter:junit-jupiter-api:${junit_version}"

//When present gradle test work but intellij not and vice-versa
testRuntime "org.junit.jupiter:junit-jupiter-engine:${junit_version}"

}

vertx {
vertxVersion = "${vertx_version}"
mainVerticle = 'io.github.jponge.vertx.boot.BootVerticle'
jvmArgs = ['-Dvertx.logger-delegate-factory-class-name=io.vertx.core.logging.SLF4JLogDelegateFactory']
}


test {
useJUnitPlatform()
failFast = true
jvmArgs '-Dvertx.logger-delegate-factory-class-name=io.vertx.core.logging.SLF4JLogDelegateFactory'

}

apply from: 'gradle/docker.gradle'

task wrapper(type: Wrapper) {
gradleVersion = '4.8'
}
8 changes: 0 additions & 8 deletions build_and_run.sh

This file was deleted.

48 changes: 48 additions & 0 deletions gradle/docker.gradle
@@ -0,0 +1,48 @@
/*
* Copyright (c) 2017-2018 Daniel Petisme
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

buildscript {
repositories {
jcenter()
}

dependencies {
classpath 'com.bmuschko:gradle-docker-plugin:3.5.0'
}
}

apply plugin: com.bmuschko.gradle.docker.DockerRemoteApiPlugin

task prepareDockerImageBuild(type: Copy) {
description = "Copy Dockerfile and fat jar to prepare the Docker build"
from('src/main/docker/') {
include 'Dockerfile'
}
from ("${project.buildDir}/libs") {
include "*-fat.jar"
}
into { "${project.buildDir}/docker" }

}

task buildDockerImage(type: com.bmuschko.gradle.docker.tasks.image.DockerBuildImage) {
description = "Build vertx-starter as Docker image"
group = "Docker"
inputDir = project.file("${project.buildDir}/docker")
tags = ["vertx-starter:latest".toString(), "vertx-starter:${project.version}".toString()]
}

buildDockerImage.dependsOn prepareDockerImageBuild
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.

0 comments on commit 17c749c

Please sign in to comment.