diff --git a/.gitignore b/.gitignore
index fb09f47..eb72ce0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,4 +26,5 @@ replay_pid*
target/
-logs/
\ No newline at end of file
+logs/
+.vscode/
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..300c61e
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,10 @@
+FROM amazoncorretto:11-alpine-full
+WORKDIR /work
+COPY target/*-runner.jar /work/application.jar
+
+ENV TZ="America/Santiago"
+ENV MS_PORT=8080
+
+EXPOSE 8080
+
+CMD ["java","-jar","application.jar"]
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 0000000..82befdd
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,123 @@
+pipeline {
+ agent {
+ node {
+ label 'MachineSlave1'
+ }
+ }
+ environment {
+ SUCCESS = 'true'
+ STAGE = 'none'
+ IMAGE_DOCKER = 'registry.vodorod.cl/deal/tienda-playa-servicio:latest'
+ }
+ stages {
+ stage('Quarkus Compile') {
+ steps {
+ sh 'chmod +x mvnw && ./mvnw package -Dquarkus.package.type=uber-jar -Dquarkus.profile=prod'
+ }
+ post {
+ success {
+ script {
+ SUCCESS = 'true'
+ STAGE = 'Quarkus Compile'
+ }
+ }
+ failure {
+ script {
+ SUCCESS = 'false'
+ STAGE = 'Quarkus Compile'
+ }
+ }
+ aborted {
+ script {
+ SUCCESS = 'false'
+ STAGE = 'Quarkus Compile'
+ }
+ }
+ }
+ }
+ stage('Docker Build') {
+ when { equals expected: 'true', actual: SUCCESS }
+ steps {
+ sh 'docker build -t ${IMAGE_DOCKER} .'
+ }
+ post {
+ success {
+ script {
+ SUCCESS = 'true'
+ STAGE = 'Docker Build'
+ }
+ }
+ failure {
+ script {
+ SUCCESS = 'false'
+ STAGE = 'Docker Build'
+ }
+ }
+ aborted {
+ script {
+ SUCCESS = 'false'
+ STAGE = 'Docker Build'
+ }
+ }
+ }
+ }
+ stage('Docker Push') {
+ when { equals expected: 'true', actual: SUCCESS }
+ steps {
+ withCredentials([usernamePassword(credentialsId: 'vodorodRegistry', passwordVariable: 'vodorodRegistryPassword', usernameVariable: 'vodorodRegistryUser')]) {
+ sh "docker login registry.vodorod.cl -u ${env.vodorodRegistryUser} -p ${env.vodorodRegistryPassword}"
+ sh 'docker push ${IMAGE_DOCKER}'
+ }
+ }
+ post {
+ success {
+ script {
+ SUCCESS = 'true'
+ STAGE = 'Docker Push'
+ }
+ }
+ failure {
+ script {
+ SUCCESS = 'false'
+ STAGE = 'Docker Push'
+ }
+ }
+ aborted {
+ script {
+ SUCCESS = 'false'
+ STAGE = 'Docker Push'
+ }
+ }
+ }
+ }
+ }
+ post {
+ success {
+ script {
+ withCredentials([string(credentialsId: 'telegramToken', variable: 'TOKEN'), string(credentialsId: 'telegramChatId', variable: 'CHAT_ID')]) {
+ sh """
+ curl -s -X POST https://api.telegram.org/bot${TOKEN}/sendMessage -d chat_id=${CHAT_ID} -d parse_mode="HTML" -d text="Project : ${env.JOB_NAME} \nBranch: ${BRANCH_NAME} \nBuild : Complete \nStatus : Passed \nNode : ${env.NODE_NAME}"
+ """
+ }
+ }
+ }
+ failure {
+ script {
+ withCredentials([string(credentialsId: 'telegramToken', variable: 'TOKEN'), string(credentialsId: 'telegramChatId', variable: 'CHAT_ID')]) {
+ sh """
+ curl -s -X POST https://api.telegram.org/bot${TOKEN}/sendMessage -d chat_id=${CHAT_ID} -d parse_mode="HTML" -d text="Project : ${env.JOB_NAME} \nBranch: ${BRANCH_NAME} \nBuild : ${STAGE} \nStatus : Failed \nNode : ${env.NODE_NAME}"
+ """
+ }
+ }
+ }
+ aborted {
+ script {
+ withCredentials([string(credentialsId: 'telegramToken', variable: 'TOKEN'), string(credentialsId: 'telegramChatId', variable: 'CHAT_ID')]) {
+ sh """
+ curl -s -X POST https://api.telegram.org/bot${TOKEN}/sendMessage -d chat_id=${CHAT_ID} -d parse_mode="HTML" -d text="Project : ${env.JOB_NAME} \nBranch: ${BRANCH_NAME} \nBuild : ${STAGE} \nStatus : Aborted \nNode : ${env.NODE_NAME}"
+ """
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index 62222e6..7bc9446 100644
--- a/README.md
+++ b/README.md
@@ -29,6 +29,15 @@ kill -9 `cat pid`
eliminacion de una orden
+## Environment
+
+DATABASE_USER
+DATABASE_PASS
+DATABASE_JDBC
+
+CONFIG_PUBLIC_KEY
+CONFIG_PRIVATE_KEY
+
# api-menu-playa Project
This project uses Quarkus, the Supersonic Subatomic Java Framework.
diff --git a/compose/dev/docker-compose.yml b/compose/dev/docker-compose.yml
new file mode 100644
index 0000000..dad24c5
--- /dev/null
+++ b/compose/dev/docker-compose.yml
@@ -0,0 +1,14 @@
+version: '3.9'
+
+services:
+ servicio:
+ image: registry.vodorod.cl/deal/tienda-playa-servicio:latest
+ restart: always
+ ports:
+ - "8181:8080"
+ environment:
+ DATABASE_USER: 'postgres'
+ DATABASE_PASS: '13467982'
+ DATABASE_JDBC: 'jdbc:postgresql://192.168.1.4:5432/postgres?currentSchema=playa'
+ volumes:
+ - ./logs:/work/logs
\ No newline at end of file
diff --git a/compose/prod/docker-compose.yml b/compose/prod/docker-compose.yml
new file mode 100644
index 0000000..cb645b4
--- /dev/null
+++ b/compose/prod/docker-compose.yml
@@ -0,0 +1,14 @@
+version: '3.9'
+
+services:
+ servicio:
+ image: registry.vodorod.cl/deal/tienda-playa-servicio:latest
+ restart: always
+ ports:
+ - "8181:8080"
+ environment:
+ DATABASE_USER: 'playa_tienda'
+ DATABASE_PASS: 'ED8eqKY5ZyQAH9px'
+ DATABASE_JDBC: 'jdbc:postgresql://45.236.128.250:5432/postgres?currentSchema=playa'
+ volumes:
+ - ./logs:/work/logs
\ No newline at end of file
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 7e8d57a..9b7afcf 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -34,10 +34,10 @@ quarkus.log.file.rotation.max-backup-index=30
%prod.quarkus.http.cors.origins=https://tienda.vodorod.cl,https://menu.vodorod.cl
-%prod.quarkus.datasource.username=playa_tienda
-%prod.quarkus.datasource.password=ED8eqKY5ZyQAH9px
-%prod.quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/postgres?currentSchema=playa
+%prod.quarkus.datasource.username=${DATABASE_USER:playa_tienda}
+%prod.quarkus.datasource.password=${DATABASE_PASS:ED8eqKY5ZyQAH9px}
+%prod.quarkus.datasource.jdbc.url=${DATABASE_JDBC:jdbc:postgresql://localhost:5432/postgres?currentSchema=playa}
-# %prod.config.private.key=file://${CONFIG_PUBLIC_KEY:/api/tienda-playa/privateKey.pem}
-# %prod.mp.jwt.verify.publickey.location=file://${CONFIG_PRIVATE_KEY:publicKey.pem}
+# %prod.config.private.key=file://${CONFIG_PRIVATE_KEY:/api/tienda-playa/privateKey.pem}
+# %prod.mp.jwt.verify.publickey.location=file://${CONFIG_PUBLIC_KEY:publicKey.pem}
# %prod.mp.jwt.verify.issuer=https://vodorod.cl
\ No newline at end of file