mirror of
https://github.com/makeplane/plane.git
synced 2026-07-12 21:40:18 +02:00
* feat: added build meta data to monitor * feat: added versioning to prime-monitor * feat: added logger package for prime-monitor * feat: implemented logging in cmd * feat: implemented moduled monorepo architecture * feat: added cron package for healthcheck * feat: added constants and modules for healthcheck * feat: added environment service getter method * feat: added environment service parser for parsing the recieved keys * feat: added environment service provider method * feat: added retry based executer for the test methods * feat: added http health check method and placeholders for redis & pg * feat: added tests for healthcheck methods * feat: added PerformHealthCheck Controller Method for execution of healthcheck controller * feat: added healthcheck test file for testing the healthcheck * feat: added healthcheck to work file * feat: added readme for healthcheck package * feat: created healthcheck register for prime scheduler * feat: added cron command for running cron subpart of monitor * feat: added prime schedule handler for cron * feat: added start command for starting up prime scheduler * feat: added build utility files for monitor * fix: goreleaser builds * feat: removed Redis method from healthcheck methods * feat: added docker file for building prime-monitor * feat: added flag for adding healthcheck duration for cron start * chore: removed redis as a healthcheck method * chore: modified actions to build monitor on branch build and docker images * feat: added monitor service in docker compose caddy * feat: added description for HealthCheckJob * fix: status code issue for reachable and non reachable * feat: added api package for connecting with prime api * feat: modified cmd package to report healthcheck status to prime * feat: added api types inside prime-monitor * feat: added message field for meta while status reporting * fix: modified constants for environment variables * feat: added monitor readme * fix: build-branch monitor content shift to build-branch-ee * chore: added build args on release * feat: remove version meta data from cli * fix: docker file changed to fix the build to default * fix: removed build flags from github branch build * fix: moved cron start to root level start cmd * fix: passed the recieved machine signature to api headers * feat: optimised docker build for monitor
66 lines
1.7 KiB
Go
66 lines
1.7 KiB
Go
/*
|
|
Copyright © 2024 plane.so engineering@plane.so
|
|
*/
|
|
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/makeplane/plane-ee/monitor/lib/logger"
|
|
"github.com/makeplane/plane-ee/monitor/pkg/constants"
|
|
"github.com/makeplane/plane-ee/monitor/pkg/constants/descriptors"
|
|
error_msgs "github.com/makeplane/plane-ee/monitor/pkg/constants/errors"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var CmdLogger = logger.NewHandler(nil)
|
|
var LICENSE_KEY = ""
|
|
var MACHINE_SIGNATURE = ""
|
|
var LICENSE_VERSION = ""
|
|
var HOST = "https://prime.plane.so"
|
|
|
|
// rootCmd represents the base command when called without any subcommands
|
|
var rootCmd = &cobra.Command{
|
|
Use: descriptors.PRIME_MONITOR_USAGE,
|
|
Short: descriptors.PRIME_MONITOR_USAGE_DESC,
|
|
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
|
if host := os.Getenv(constants.PRIME_HOST); host != "" {
|
|
HOST = host
|
|
}
|
|
|
|
if licenseKey := os.Getenv(constants.LICENSE_KEY); licenseKey == "" {
|
|
return fmt.Errorf(error_msgs.LICENSE_ABSENT)
|
|
} else {
|
|
LICENSE_KEY = licenseKey
|
|
}
|
|
|
|
if licenseVersion := os.Getenv(constants.LICENSE_VERSION); licenseVersion == "" {
|
|
return fmt.Errorf(error_msgs.LICENSE_VERSION_ABSENT)
|
|
} else {
|
|
LICENSE_VERSION = licenseVersion
|
|
}
|
|
|
|
if machineSignature := os.Getenv(constants.MACHINE_SIGNATURE); machineSignature == "" {
|
|
return fmt.Errorf(error_msgs.MACHINE_SIG_ABSENT)
|
|
} else {
|
|
MACHINE_SIGNATURE = machineSignature
|
|
}
|
|
|
|
return nil
|
|
},
|
|
}
|
|
|
|
// Execute adds all child commands to the root command and sets flags appropriately.
|
|
// This is called by main.main(). It only needs to happen once to the rootCmd.
|
|
func Execute() {
|
|
err := rootCmd.Execute()
|
|
if err != nil {
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
|
}
|