Refactor Dockerfile and CI Configuration

- Updated the CI configuration in .drone.yml to use the new Dockerfile located at ./cmd/web/Dockerfile.
- Removed the old Dockerfile and Dockerfile-drone as they are no longer needed.
- Refactored the cmd/web/Dockerfile to streamline the build process and improve organization.
- Introduced a new bootstrap package to handle application initialization, including configuration, logging, MongoDB, Redis, and authorization service setup.
- Added a health check endpoint for monitoring the server status, enhancing the API's operational capabilities.
This commit is contained in:
n.nakhostin
2025-08-31 14:16:37 +03:30
parent 4b3172d058
commit 511155e0a7
8 changed files with 42 additions and 121 deletions
+35
View File
@@ -0,0 +1,35 @@
package bootstrap
import (
"net/http"
"time"
"github.com/labstack/echo/v4"
)
// @Summary Health check endpoint
// @Description Get comprehensive server health status including system information, dependencies status, and performance metrics. This endpoint is used for monitoring and load balancer health checks.
// @Tags Admin-Health
// @Accept json
// @Produce json
// @Success 200 {object} HealthResponse "System is healthy and operational"
// @Failure 503 {object} HealthResponse "System is unhealthy or experiencing issues"
// @Router /admin/v1/health [get]
func healthHandler(c echo.Context) error {
return c.JSON(http.StatusOK, HealthResponse{
Status: "healthy",
Time: time.Now().Unix(),
Version: "2.0.0",
Service: "tender-management-api",
Uptime: time.Since(time.Now()).String(),
})
}
// HealthResponse represents the comprehensive health check response
type HealthResponse struct {
Status string `json:"status" example:"healthy"` // Current health status
Time int64 `json:"time" example:"1699123456"` // Current Unix timestamp
Version string `json:"version" example:"2.0.0"` // API version
Service string `json:"service" example:"tender-management-api"` // Service name
Uptime string `json:"uptime,omitempty" example:"24h30m15s"` // Service uptime duration
}