Skip to content

Commit 243ad40

Browse files
committed
feat: enhance deployment workflow with log collection on failure and update health check configurations
1 parent ec97f18 commit 243ad40

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

.github/workflows/deploy.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,11 @@ jobs:
181181
- name: Log out from Oracle Container Registry
182182
if: always()
183183
run: docker logout ${{ secrets.OCI_REGISTRY }}
184+
185+
- name: Collect container logs on failure
186+
if: failure()
187+
run: |
188+
ssh -i ${{ secrets.SSH_PRIVATE_KEY }} ${{ secrets.SSH_USERNAME }}@${{ secrets.VM_IP_ADDRESS }} '
189+
echo "==== EUREKA SERVER LOGS ====" &&
190+
docker logs vm-deploy-eureka-server-1
191+
'

eureka-server/src/main/resources/application.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ management:
1818
endpoints:
1919
web:
2020
exposure:
21-
include: health
21+
include: health,info
2222
base-path: /actuator
2323
endpoint:
2424
health:

vm-deploy/eureka-server/Dockerfile

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,22 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}"
1818
COPY --from=builder /javaruntime $JAVA_HOME
1919
COPY --from=builder /app/app.jar /app.jar
2020

21+
# Install wget and curl for health check
22+
RUN apk add --no-cache wget curl
23+
2124
# Create non-root user
2225
RUN addgroup -S spring && adduser -S spring -G spring
26+
RUN chown -R spring:spring /app.jar
2327

24-
# Install wget for health check
25-
RUN apk add --no-cache wget
26-
27-
# Configure health check
28-
HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \
29-
CMD wget -q --spider http://localhost:8761/actuator/health || exit 1
28+
# Set proper permissions
29+
USER spring:spring
3030

31+
# Expose port
3132
EXPOSE 8761
3233

33-
USER spring:spring
34-
ENTRYPOINT ["java", "-XX:+UseContainerSupport", "-XX:MaxRAMPercentage=75.0", "-jar", "/app.jar"]
34+
# Configure health check - with longer start time and using 0.0.0.0 instead of localhost
35+
HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=5 \
36+
CMD wget -q --spider http://127.0.0.1:8761/actuator/health || exit 1
37+
38+
# Use more memory and enable debug options
39+
ENTRYPOINT ["java", "-Xms256m", "-Xmx512m", "-XX:+UseContainerSupport", "-XX:MaxRAMPercentage=75.0", "-Dspring.profiles.active=docker", "-jar", "/app.jar"]

0 commit comments

Comments
 (0)