Entradas

Mostrando entradas de 2019

Create a docker image from a spring boot project

In order to create a docker image from a spring boot project, First, your pom.xml has to be configured. <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <!-- Cofiguration for creating a docker image --> <image> <name>chamow01/${project.artifactId}</name> </image> </configuration> </plugin> </plugins> </build> Then, the next maven command needs to be applied, so spring boot uses paketo-buildpacks in order to create a docker image based on you Java code mvn spring-boot:build-image ... [INFO] > Running creator [INFO] [creator] ===> DETECTING [INFO] [creator] 6 of 24 buildpacks participating [INFO] [creator] paketo-buildpacks/ca-certificates 3.2.0 [INFO] [creator] paketo-buildpacks/bellsoft-liberica 9.3.2 [INFO]

Error librería de python con npm

Al utilizar npm, es posible que se obtenga un error debido a que no existe python instalado, esto se resuelve ejecutando las siguientes instrucciones. Error python: gyp verb check python checking for Python executable "python2" in the PATH gyp verb `which` failed Error: not found: python2 Solución: npm --add-python-to-path='true' --debug install --global windows-build-tools npm install --global node-gyp Fuentes: 1.  https://github.com/JeremyEnglert/JointsWP/issues/317

Error al activar módulo mod_ssl.so en Apache

Si activar el módulo mod_ssl.so en Apache y reiniciar el servidor se obtiene el siguiente mensaje de error: " mod_ssl.so into server: %1 is not a valid Win32 application. " Se tiene la siguiente solución: Descargar la versión compatible de OpenSSL (Win32), en mi caso funcionó con: Win32 OpenSSL v1.0.2t Light Al momento de instalar OpenSSL, activar la casilla para copiar archivos en el directorio de Windows. Reiniciar Apache Fuentes: https://stackoverflow.com/questions/40017498/cannot-load-modules-mod-ssl-so-into-server http://slproweb.com/products/Win32OpenSSL.html

Crear una instancia de apache server como servicio

Se debe utilizar el siguiente comando, indicando el path del archivo httpd.conf del nuevo servidor apache.   httpd.exe -k install -n "New Apache" -f "C:/path/to/httpd.conf" Donde: "New Apache", es el nombre del servicio Windows a ser creado. Con el anterior comando se crea en servicio y muestra errores en el caso de haberlos; Una ver correjidos los errores se procede a ejecutar el siguiente comando, para terminar la configuración: httpd.exe -k config -n "New Apache" -f "C:\path\to\httpd.conf En el caso de que se quiera eliminar el servicio windows creado, ejecutar el siguiente comando: sc delete <Nombre del servicio> Ej. sc delete "New Apache" Fuentes: https://stackoverflow.com/questions/16959839/how-we-can-run-two-instance-of-apache-http-server-on-same-machine-windows-7 http://geekswithblogs.net/shahedul/archive/2006/10/13/93984.aspx

Configuración de perfiles en maven

Para configurar un perfil en mave, se debe utilizar las siguientes etiquetas: <profiles>    <profile>       <id>nombre del perfil</id>       <properties>              </properties>    </profile> </profiles> Ejemplo: <profiles>    <profile>       <id>dev5</id>       <properties>          <enviroment.name>DEV5</enviroment.name>  <enviroment.version>2.6.0.5.RC1</enviroment.version>       </properties>    </profile> </profiles> Para ejecutar un perfil de maven, se puede utilizar el siguiente comando mvn <opciones> -P <nombre del perfil> Ejemplo: mvn clean package deploy -P dev5

Generación de reporte sonar desde consola

Para generar el reporte sonar desde consola, se puede utilizar el siguiente comando mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install -Dmaven.test.failure.ignore=true org.codehaus.mojo:sonar-maven-plugin:LATEST:sonar -e -Dsonar.branch= <Nombre para identificar>

Configuraciones para subir archivos (Spring-boot)

Configuración de formulario Agregar: enctype="multipart/form-data"   <form th:action="@{/createUser}" th:object="${cliente}" method="post" enctype="multipart/form-data"> Configuración de application.properties Agregar las siguientes propiedades: spring.http.multipart.max-file-size=10MB spring.http.multipart.max-request-size=10MB Configuración de Controller Agregar en el RequestMapping el parámetro: @RequestParam("file") MultipartFile foto

Configuración de datasource H2 (Spring-boot)

En el archivo application.properties, digitamos las siguientes propiedades: spring.h2.console.enabled=true spring.datasource.url=jdbc:h2:mem:clientesdb spring.datasource.username=admin spring.datasource.password=1234 spring.datasource.driver-class-name=org.h2.Driver

Habilitar consola de H2 (Spring-boot)

Imagen
En el archivo application.properties digitamos la siguiente propiedad: spring.h2.console.enabled=true En el navegador digitamos: http://localhost:8080/h2-console  Se muestra la pantalla de conexión, dar clic en el botón Conectar Se muestra la consola de H2