Git Product home page Git Product logo

che-bootializr's Introduction

CheBootializr

It has never been easy to get your cloud devlopment environment so quickly with Spring Boot and Eclipse Che

Setup

The following section details through the setup that is required to have the applications running in your local Openshift cluster.

Pre-requisites

Eclipse Che on OpenShift

Please follow the instructions at https://www.eclipse.org/che/docs/setup/openshift/index.html, to have the Eclipse Che installed on your OpenShift Cluster.

Docker Image

Since the application requires git executable, use the Dockerfile to build the required OpenShift s2i-java

docker build --rm -t kameshsampath/fabric8-s2i-java (1)
  1. if you tend to change the tag kameshsampath/fabric8-s2i-java then also update the property <fabric8.generator.from>kameshsampath/fabric8-s2i-java</fabric8.generator.from> in pom.xml

OpenShift Service Account Permissions

The spring-cloud-kubernetes library used in the project requires the default service account to have view permissions, to enable that we execute the following command,

oc policy add-role-to-user view -z default -n $(oc project -q)

Build and Install Spring Initializr

The project relies on Spring Initializr to generate Spring Boot projects, as Spring Initializr is not available in maven central, we need to clone, build and install locally.

git clone https://github.com/spring-io/initializr.git (1)
cd initializr
./mvnw clean install (2)
  1. Clone the Spring Intializr locally

  2. build and install to local maven repo

Note
Current the application uses 0.5.0.BUILD-SNAPSHOT

Creating Github Secret

The project will use your GitHub account to create projects, hence would require you to have Personal Access Token created and configured.

Once you have created Personal Access Token, add your GitHub userId to a file called github.user and add your GitHub personal access token to a file called github.token. Once you have those files generated follow the steps below have Kubernetes Secrets created for the same.

kubectl create secret generic github-config \
  --from-file ./github.user \ (1)
  --from-file ./github.token (2)
  1. Adds file github.user to secret

  2. Adds file github.token to secret

Enable Github oAuth with Che

You also need to edit Che Installation to make use of the GitHub oAuth to enable commit and push the code to your repository, follow the steps below to edit the existing Che Deployment on OpenShift to add GitHub credentials,

Follow instructions Registering OAuth Apps to create a GitHub oAuth. Note the clientId and secret from your oAuth settings page and set the following two variables in your local environment,

CHE_OAUTH_GITHUB_CLIENTID - the GitHub oAuth ClientId

CHE_OAUTH_GITHUB_CLIENTSECRET - the GitHub oAuth Client Secret

ENABLE_GITHUB_SCRIPT_URL=https://raw.githubusercontent.com/workspace7/cloud-workspaces/master/scripts/enable_github_oauth.sh

curl -fsSL ${ENABLE_GITHUB_SCRIPT_URL} -o ./enable_github_che.sh

bash ./enable_github_che.sh
Note
The applications will use oAuth and personal access token over ssh/password for better security

Build and Deploy application

Local
Personal Access Token

To run the application locally, you need to create Github Personal Access token. Once you have created the GitHub personal access token, create a file called ~/.github with the content like the following,

login=<your github login>
oauth=<personal access token created earlier>
Important

When creating Github Personal Access token, please remember to add the parent scopes and all their children for the following: * repo * admin:repo_hook

Update application-dev.yaml

Edit the application-dev.yaml to update the che service-url to path matching your local che url

Running the Application
./mvnw clean spring-boot:run -Drun.profiles=dev
Openshift

Once you have all the above steps done, you just need to execute the following command to have the application deployed on to the OpenShift cluster.

./mvnw -DskipTests clean fabric8:deploy

che-bootializr's People

Contributors

kameshsampath avatar

Watchers

 avatar  avatar  avatar

Forkers

arunkumars08

che-bootializr's Issues

Permission denied (publickey) during "git clone [email protected]:spring-io/initializr.git"

I'm unsure what the root cause is when I try to do "git clone [email protected]:spring-io/initializr.git" then I got the following permission error.

[daniel@daniel che-springboot] $ git clone [email protected]:spring-io/initializr.git
Cloning into 'initializr'...
The authenticity of host 'github.com (192.30.255.112)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
RSA key fingerprint is MD5:16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.255.112' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

==> Retry
[daniel@daniel che-springboot] $ git clone [email protected]:spring-io/initializr.git
Cloning into 'initializr'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

However I've succeeded this via http protocol instead git as below.
git clone https://github.com/spring-io/initializr.git

Error during "./mvnw clean fabric8:deploy"

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Spring Initializr .................................. SKIPPED
[INFO] Spring Initializr :: Generator ..................... SKIPPED
[INFO] Spring Initializr :: Web ........................... SKIPPED
[INFO] Spring Initializr :: Actuator ...................... SKIPPED
[INFO] Spring Initializr :: Docs .......................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.610 s
[INFO] Finished at: 2017-10-04T23:25:28+09:00
[INFO] Final Memory: 20M/187M
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'fabric8' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/home/daniel/.m2/repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException

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.