This commit is contained in:
@@ -14,6 +14,9 @@ COPY --from=build /app/build/libs/*.jar app.jar
|
|||||||
|
|
||||||
RUN mkdir -p /data/uploads && chmod 755 /data/uploads
|
RUN mkdir -p /data/uploads && chmod 755 /data/uploads
|
||||||
|
|
||||||
|
ENV BUILD_TIME_BACK="unknown"\
|
||||||
|
BUILD_TIME_FRONT="unknown"
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
CMD ["java", "-jar", "app.jar"]
|
CMD ["java", "-jar", "app.jar"]
|
||||||
@@ -39,6 +39,7 @@ pipeline {
|
|||||||
stage('Deploy with docker-compose') {
|
stage('Deploy with docker-compose') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
|
def buildTime = sh(script: "date '+%d-%m-%Y %H:%M:%S'", returnStdout: true).trim()
|
||||||
withCredentials([
|
withCredentials([
|
||||||
usernamePassword(
|
usernamePassword(
|
||||||
credentialsId: 'server-root-password',
|
credentialsId: 'server-root-password',
|
||||||
@@ -85,6 +86,7 @@ pipeline {
|
|||||||
-e POSTGRES_USER=${DB_USER} \\
|
-e POSTGRES_USER=${DB_USER} \\
|
||||||
-e POSTGRES_PASSWORD=${DB_PASSWORD} \\
|
-e POSTGRES_PASSWORD=${DB_PASSWORD} \\
|
||||||
-v pgdata_${params.PORT}:/var/lib/postgresql/data \\
|
-v pgdata_${params.PORT}:/var/lib/postgresql/data \\
|
||||||
|
-e BUILD_TIME_BACK='${buildTime}' \\
|
||||||
postgres:17.7
|
postgres:17.7
|
||||||
|
|
||||||
echo '4. Запускаем storage...'
|
echo '4. Запускаем storage...'
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ pipeline {
|
|||||||
stage('Deploy with docker-compose') {
|
stage('Deploy with docker-compose') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
|
def buildTime = sh(script: "date '+%d-%m-%Y %H:%M:%S'", returnStdout: true).trim()
|
||||||
withCredentials([
|
withCredentials([
|
||||||
usernamePassword(
|
usernamePassword(
|
||||||
credentialsId: 'server-root-password',
|
credentialsId: 'server-root-password',
|
||||||
@@ -92,6 +93,7 @@ pipeline {
|
|||||||
-e POSTGRES_PASSWORD=$DB_PASSWORD \\
|
-e POSTGRES_PASSWORD=$DB_PASSWORD \\
|
||||||
-e POSTGRES_PORT=5432 \\
|
-e POSTGRES_PORT=5432 \\
|
||||||
-e POSTGRES_HOST=db \\
|
-e POSTGRES_HOST=db \\
|
||||||
|
-e BUILD_TIME_BACK='${buildTime}' \\
|
||||||
--restart unless-stopped \\
|
--restart unless-stopped \\
|
||||||
app-backend:latest
|
app-backend:latest
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package ru.soune.nocopy.controller;
|
package ru.soune.nocopy.controller;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -15,6 +16,17 @@ public class HealtCheckController {
|
|||||||
return HttpStatus.OK;
|
return HttpStatus.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Value("${BUILD_TIME_BACK:unknown}")
|
||||||
|
private String buildTimeBack;
|
||||||
|
|
||||||
|
@Value("${BUILD_TIME_FRONT:unknown}")
|
||||||
|
private String buildTimeFront;
|
||||||
|
|
||||||
|
@GetMapping("/build")
|
||||||
|
public BuildInfo getBuildInfo() {
|
||||||
|
return new BuildInfo(buildTimeBack, buildTimeFront);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/api/debug/memory")
|
@GetMapping("/api/debug/memory")
|
||||||
public Map<String, String> getMemoryInfo() {
|
public Map<String, String> getMemoryInfo() {
|
||||||
Runtime runtime = Runtime.getRuntime();
|
Runtime runtime = Runtime.getRuntime();
|
||||||
@@ -32,4 +44,14 @@ public class HealtCheckController {
|
|||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static class BuildInfo {
|
||||||
|
public String buildTimeBack;
|
||||||
|
public String buildTimeFront;
|
||||||
|
|
||||||
|
public BuildInfo(String buildTimeBack, String buildTimeFront) {
|
||||||
|
this.buildTimeBack = buildTimeBack;
|
||||||
|
this.buildTimeFront = buildTimeFront;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user