Skip to content

maximilianoPizarro/jhipster-devspace

Repository files navigation

JHipster v8.1.0 Monolithic application On Red Hat OpenShift Dev Spaces

java nodejs VueJS Spring Redhat kubernetes Docker shell linkedin

Open

Install JHipster DevSpace on OpenShift Dev Spaces

  1. Login with your Red Hat Account. https://console.redhat.com/openshift/sandbox. Select "OpenShift Dev Spaces".

  1. Fork this repo and complete Git Repo URL parameter with your repo info.

Re-generate JHipster application from JDL File on Red Hat OpenShift Dev Spaces

  1. Open terminal on Red Hat OpenShift Dev Spaces and run.

jhipster-devspace (master) $ rm -r app && mkdir app

rm -r app && mkdir app
  1. Copy jhipster-devspace-model.jdl to app directory.
cp template-jdl/jhipster-devspace-model.jdl app

  1. Run 'jhipster jdl' command. info https://www.jhipster.tech/jdl/getting-started JDL Studio.

jhipster-devspace (master) $cd app && jhipster jdl jhipster-devspace-model.jdl

cd app
jhipster jdl jhipster-devspace-model.jdl
Output:

jhipster-devspace (master) $ cd app
app (master) $ jhipster jdl jhipster-devspace-model.jdl
INFO! Using JHipster version installed globally
INFO! Executing import-jdl jhipster-devspace-model.jdl
INFO! The JDL is being parsed.
warn: An Entity name 'User' was used: 'User' is an entity created by default by JHipster. All relationships toward it will be kept but any attributes and relationships from it will be disregarded.
INFO! Found entities: Producto, ProductoCategoria, Cliente, Carrito, ProductoOrden.
INFO! The JDL has been successfully parsed
INFO! Generating 1 application.


        ██╗ ██╗   ██╗ ████████╗ ███████╗   ██████╗ ████████╗ ████████╗ ███████╗
        ██║ ██║   ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
        ██║ ████████║    ██║    ███████╔╝ ╚█████╗     ██║    ██████╗   ███████╔╝
  ██╗   ██║ ██╔═══██║    ██║    ██╔════╝   ╚═══██╗    ██║    ██╔═══╝   ██╔══██║
  ╚██████╔╝ ██║   ██║ ████████╗ ██║       ██████╔╝    ██║    ████████╗ ██║  ╚██╗
   ╚═════╝  ╚═╝   ╚═╝ ╚═══════╝ ╚═╝       ╚═════╝     ╚═╝    ╚═══════╝ ╚═╝   ╚═╝

                            https://www.jhipster.tech

Welcome to JHipster v8.1.0
Application files will be generated in folder: /projects/jhipster-devspace/app
 _______________________________________________________________________________________________________________

  Documentation for creating an application is at https://www.jhipster.tech/creating-an-app/
  If you find JHipster useful, consider sponsoring the project at https://opencollective.com/generator-jhipster
 _______________________________________________________________________________________________________________

 ______________________________________________________________________________

...more lines...
Entity Producto generated successfully.
Entity ProductoCategoria generated successfully.
Entity Cliente generated successfully.
Entity Carrito generated successfully.
Entity ProductoOrden generated successfully.
INFO! Generator app succeed
Congratulations, JHipster execution is complete!
Sponsored with ❤️  by @oktadev.
  1. Run Development Mode the JHipster Application on Red Hat OpenShift Dev Spaces.
./mvnw

Deploy JHipster v8.1.0 Monolithic application on ⭕ Red Hat OpenShift Pipelines ⭕

From terminal on Red Hat Openshift Dev Spaces an Red Hat OpenShift

By default, the repo contains a version generated for testing this section with the name "Delivery", if you want to change it in your fork you will need to change it to the new value in the yaml objects and the jhispter JDL file.

  1. Fork this repo and modify the yaml files with your environment keys.
  k8s/overlay/develop/route.yaml <---
  spec:
    host: delivery-<NAMESPACE>.apps.sandbox-m2.ll9k.p1.openshiftapps.com
  k8s/overlay/develop/deployment-patches.yaml <---
    spec:
      containers:
      - name: delivery
        image: image-registry.openshift-image-registry.svc:5000/<NAMESPACE>/delivery 
        env:
          - name: SPRING_DATASOURCE_URL
            value: jdbc:mariadb://mariadb.<NAMESPACE>.svc.cluster.local:3306/delivery                  
  1. Create a Tekton Pipeline, Tekton Task and PVC with oc apply command.
jhipster-devspace (master) $ oc apply -f pipeline.yaml
Output
persistentvolumeclaim/workspace created
task.tekton.dev/npm created
pipeline.tekton.dev/jhipster-devspace created
  1. Run a Pipeline jhipster-devspace from Red Hat OpenShift Pipelines.

  1. View Topology and logs java POD.

  1. Check in your browser the app run in production mode, status and metric views.

JHipster & PyHipster Generator Tekton Pipeline (Oficial JHipster v8.1.0 & PyHipster 0.0.9)

  1. Create Pipeline jhipster-pyhipster-generator-pipeline
oc apply -f jhipster-pyhipster-generator-pipeline.yaml 
Output
jhipster-devspace (master) $ oc apply -f jhipster-pyhipster-generator-pipeline.yaml 
persistentvolumeclaim/workspace created
task.tekton.dev/cleanup-workspace created
task.tekton.dev/pyhipster-generator created
task.tekton.dev/jhipster-generator created
pipeline.tekton.dev/jhipster-pyhipster-generator-pipeline created
  1. Generate Access Token from your gitlab repo with api, read_repository, write_repository rule.
https://gitlab.com/-/user_settings/personal_access_tokens 

  1. Run pipeline jhipster-generator-tekton-pipeline on OpenShift Pipeline. Complate de GITLAB paramaters with your repo info.

  1. Check your GitLab Repository to see if the app was created

NOTE: You need destroy jhipster-devspace or pyhipster-devpsace workspace for try devspaces app create because the application was build with devfile.yaml from this repository. Custom tasks "cleanup-workspace" fail but work because remove all files from directory workspace and don't remove mountpath.

An Example of JDL File modification to change the style of Bootswatch Theme (Optional)

Try to changing the value from "quartz" to "vapor" in "clientTheme" from template-jdl/jhipster-despace-model.jdl and run steps 1 to 4 for re-generate proyect section.

template-jdl/jhipster-despace-model.jdl
application {
  config {
  	applicationType monolith
    baseName delivery
    packageName com.delivery.app
    authenticationType jwt
    prodDatabaseType mariadb
    databaseType sql
    devDatabaseType h2Memory
    buildTool maven
    clientFramework vue
    clientTheme vapor           //<---This
    clientThemeVariant dark
    enableTranslation true
    nativeLanguage es
    languages [en, nl]
  }
  entities *
}

The landing page should look like this:

H2 Console (DEV MODE) on Red Hat OpenShift Dev Spaces