diff --git a/.github/workflows/robot.yml b/.github/workflows/robot.yml index ca630329..9cee5a2a 100644 --- a/.github/workflows/robot.yml +++ b/.github/workflows/robot.yml @@ -35,7 +35,7 @@ jobs: run: | docker compose ps -a docker compose logs - # wget --retry-connrefused --retry-on-http-error=502 http://localhost:8901/api/health || (docker compose logs && exit 1) + wget --retry-connrefused --retry-on-http-error=502 http://localhost:8901/auth/health - name: Run robot tests run: | @@ -43,7 +43,9 @@ jobs: - name: Show logs if: failure() - run: docker compose logs + run: | + docker compose --profile v5 -f docker-compose.build.yml ps -a + docker compose --profile v5 -f docker-compose.build.yml logs - uses: actions/upload-artifact@v4 with: diff --git a/auth/Dockerfile b/auth/Dockerfile index 798b7db4..a5d02dc1 100644 --- a/auth/Dockerfile +++ b/auth/Dockerfile @@ -22,4 +22,5 @@ USER nonroot:nonroot COPY --from=build /keibi /app/keibi COPY sql ./sql + CMD ["/app/keibi"] diff --git a/auth/main.go b/auth/main.go index d0a1369b..77e59c87 100644 --- a/auth/main.go +++ b/auth/main.go @@ -53,6 +53,10 @@ func (v *Validator) Validate(i interface{}) error { return nil } +func (h *Handler) CheckHealth(c echo.Context) error { + return c.JSON(200, struct{ Status string }{Status: "healthy"}) +} + func OpenDatabase() (*pgxpool.Pool, error) { ctx := context.Background() @@ -160,9 +164,11 @@ func main() { r := e.Group("") r.Use(echojwt.WithConfig(echojwt.Config{ SigningMethod: "RS256", - SigningKey: h.config.JwtPublicKey, + SigningKey: h.config.JwtPublicKey, })) + e.GET("/health", h.CheckHealth) + r.GET("/users", h.ListUsers) r.GET("/users/:id", h.GetUser) r.GET("/users/me", h.GetMe)