It has never been easy to get your cloud devlopment environment so quickly with Spring Boot and Eclipse Che
The following section details through the setup that is required to have the applications running in your local Openshift cluster.
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.
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)
-
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
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)
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)
-
Clone the Spring Intializr locally
-
build and install to local maven repo
Note
|
Current the application uses 0.5.0.BUILD-SNAPSHOT |
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)
-
Adds file
github.user
to secret -
Adds file
github.token
to secret
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://github.com/raw/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 |
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 |
Edit the application-dev.yaml to update the che service-url
to path matching your local che url