Files
plane/monitor/cli/cmd/root.go

104 lines
2.9 KiB
Go
Raw Permalink Normal View History

feat: Added Prime Monitor Go Service for monitoring, health check and feature flagging (#411) * 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
2024-06-20 12:14:46 +05:30
/*
Copyright © 2024 plane.so engineering@plane.so
*/
package cmd
import (
"fmt"
"os"
prime_api "github.com/makeplane/plane-ee/monitor/lib/api"
feat: Added Prime Monitor Go Service for monitoring, health check and feature flagging (#411) * 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
2024-06-20 12:14:46 +05:30
"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 MACHINE_SIGNATURE = ""
dev: new license activation workflow for one and pro users (#739) * feat: added feature flag package for decrypting and refreshing the feature flags value * feat: added feature flagging route for route handlers * feat: added feature flag worker for managing and distributing feature flags * feat: implemented feature flag api implementation inside ff handler * feat: added exponential retry interval inside feature flagging * fix: route pattern of feature flag endpoint from monitor * feat: created endpoint to activate workspace from monitor * feat: made changes to accomodate db and activate endpoint * dev: update multi tenant environment settings * dev: workspace license activation flow * dev: update license activate endpoint * dev: update workspace license activate endpoint * feat: added feature flag user sync logic * feat: added constants and sync logic with private key inside * feat: added port as env variable * feat: added modification for removing license key in healthcheck * feat: example env pushed * fix: update monitor endpoints and license activation function * dev: initiate free workspace only for self hosted instances * dev: self hosting license endpoint updates * dev: remove monitor db * dev: update handlers * dev: self hosted license subscription web * dev: removed computed in self hosted subscription * fix: prime server url and delete old license while creating new license in sqlite * chore: subscription activation alert after successfull activation. * dev: update feature flag endpoints * fix: handled several cases of feature flags * fix: linting errors * dev: update monitor to handle workspace activation * dev: update decryption algorithm * feat: separated activation payload with the sync payload * dev: update feature flags endpoint * dev: change type for workspace sync * feat: added isActive flag for user activation * feat: removed creation of free users in monitor * feat: added method for workspace product * dev: add user email in types * feat: added method for workspace product * fix: uer license feature flag fetch * fix: handler fixed for feature key * chore: self managed license activation * chore: update validation license flow. * chore: license activation success. * dev: resync workspace license on activation * chore: plane one success modal. * feat: added constructs to inject private key build time * feat: updated the docker file with private key build argument * feat: added consumption od DEFAULT_PRIVATE_KEY when building monitor * dev: update private key --------- Co-authored-by: Henit Chobisa <chobisa.henit@gmail.com> Co-authored-by: gurusainath <gurusainath007@gmail.com> Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com> Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
2024-08-22 17:39:19 +05:30
var APP_DOMAIN = ""
var APP_VERSION = ""
var INSTANCE_ID = ""
var PORT = "8080"
feat: Added Prime Monitor Go Service for monitoring, health check and feature flagging (#411) * 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
2024-06-20 12:14:46 +05:30
var HOST = "https://prime.plane.so"
dev: new license activation workflow for one and pro users (#739) * feat: added feature flag package for decrypting and refreshing the feature flags value * feat: added feature flagging route for route handlers * feat: added feature flag worker for managing and distributing feature flags * feat: implemented feature flag api implementation inside ff handler * feat: added exponential retry interval inside feature flagging * fix: route pattern of feature flag endpoint from monitor * feat: created endpoint to activate workspace from monitor * feat: made changes to accomodate db and activate endpoint * dev: update multi tenant environment settings * dev: workspace license activation flow * dev: update license activate endpoint * dev: update workspace license activate endpoint * feat: added feature flag user sync logic * feat: added constants and sync logic with private key inside * feat: added port as env variable * feat: added modification for removing license key in healthcheck * feat: example env pushed * fix: update monitor endpoints and license activation function * dev: initiate free workspace only for self hosted instances * dev: self hosting license endpoint updates * dev: remove monitor db * dev: update handlers * dev: self hosted license subscription web * dev: removed computed in self hosted subscription * fix: prime server url and delete old license while creating new license in sqlite * chore: subscription activation alert after successfull activation. * dev: update feature flag endpoints * fix: handled several cases of feature flags * fix: linting errors * dev: update monitor to handle workspace activation * dev: update decryption algorithm * feat: separated activation payload with the sync payload * dev: update feature flags endpoint * dev: change type for workspace sync * feat: added isActive flag for user activation * feat: removed creation of free users in monitor * feat: added method for workspace product * dev: add user email in types * feat: added method for workspace product * fix: uer license feature flag fetch * fix: handler fixed for feature key * chore: self managed license activation * chore: update validation license flow. * chore: license activation success. * dev: resync workspace license on activation * chore: plane one success modal. * feat: added constructs to inject private key build time * feat: updated the docker file with private key build argument * feat: added consumption od DEFAULT_PRIVATE_KEY when building monitor * dev: update private key --------- Co-authored-by: Henit Chobisa <chobisa.henit@gmail.com> Co-authored-by: gurusainath <gurusainath007@gmail.com> Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com> Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
2024-08-22 17:39:19 +05:30
var PRIVATE_KEY = ``
feat: Added Prime Monitor Go Service for monitoring, health check and feature flagging (#411) * 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
2024-06-20 12:14:46 +05:30
// 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
}
dev: new license activation workflow for one and pro users (#739) * feat: added feature flag package for decrypting and refreshing the feature flags value * feat: added feature flagging route for route handlers * feat: added feature flag worker for managing and distributing feature flags * feat: implemented feature flag api implementation inside ff handler * feat: added exponential retry interval inside feature flagging * fix: route pattern of feature flag endpoint from monitor * feat: created endpoint to activate workspace from monitor * feat: made changes to accomodate db and activate endpoint * dev: update multi tenant environment settings * dev: workspace license activation flow * dev: update license activate endpoint * dev: update workspace license activate endpoint * feat: added feature flag user sync logic * feat: added constants and sync logic with private key inside * feat: added port as env variable * feat: added modification for removing license key in healthcheck * feat: example env pushed * fix: update monitor endpoints and license activation function * dev: initiate free workspace only for self hosted instances * dev: self hosting license endpoint updates * dev: remove monitor db * dev: update handlers * dev: self hosted license subscription web * dev: removed computed in self hosted subscription * fix: prime server url and delete old license while creating new license in sqlite * chore: subscription activation alert after successfull activation. * dev: update feature flag endpoints * fix: handled several cases of feature flags * fix: linting errors * dev: update monitor to handle workspace activation * dev: update decryption algorithm * feat: separated activation payload with the sync payload * dev: update feature flags endpoint * dev: change type for workspace sync * feat: added isActive flag for user activation * feat: removed creation of free users in monitor * feat: added method for workspace product * dev: add user email in types * feat: added method for workspace product * fix: uer license feature flag fetch * fix: handler fixed for feature key * chore: self managed license activation * chore: update validation license flow. * chore: license activation success. * dev: resync workspace license on activation * chore: plane one success modal. * feat: added constructs to inject private key build time * feat: updated the docker file with private key build argument * feat: added consumption od DEFAULT_PRIVATE_KEY when building monitor * dev: update private key --------- Co-authored-by: Henit Chobisa <chobisa.henit@gmail.com> Co-authored-by: gurusainath <gurusainath007@gmail.com> Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com> Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
2024-08-22 17:39:19 +05:30
if appDomain := os.Getenv(constants.APP_DOMAIN); appDomain == "" {
return fmt.Errorf(error_msgs.APP_DOMAIN_ABSENT)
feat: Added Prime Monitor Go Service for monitoring, health check and feature flagging (#411) * 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
2024-06-20 12:14:46 +05:30
} else {
dev: new license activation workflow for one and pro users (#739) * feat: added feature flag package for decrypting and refreshing the feature flags value * feat: added feature flagging route for route handlers * feat: added feature flag worker for managing and distributing feature flags * feat: implemented feature flag api implementation inside ff handler * feat: added exponential retry interval inside feature flagging * fix: route pattern of feature flag endpoint from monitor * feat: created endpoint to activate workspace from monitor * feat: made changes to accomodate db and activate endpoint * dev: update multi tenant environment settings * dev: workspace license activation flow * dev: update license activate endpoint * dev: update workspace license activate endpoint * feat: added feature flag user sync logic * feat: added constants and sync logic with private key inside * feat: added port as env variable * feat: added modification for removing license key in healthcheck * feat: example env pushed * fix: update monitor endpoints and license activation function * dev: initiate free workspace only for self hosted instances * dev: self hosting license endpoint updates * dev: remove monitor db * dev: update handlers * dev: self hosted license subscription web * dev: removed computed in self hosted subscription * fix: prime server url and delete old license while creating new license in sqlite * chore: subscription activation alert after successfull activation. * dev: update feature flag endpoints * fix: handled several cases of feature flags * fix: linting errors * dev: update monitor to handle workspace activation * dev: update decryption algorithm * feat: separated activation payload with the sync payload * dev: update feature flags endpoint * dev: change type for workspace sync * feat: added isActive flag for user activation * feat: removed creation of free users in monitor * feat: added method for workspace product * dev: add user email in types * feat: added method for workspace product * fix: uer license feature flag fetch * fix: handler fixed for feature key * chore: self managed license activation * chore: update validation license flow. * chore: license activation success. * dev: resync workspace license on activation * chore: plane one success modal. * feat: added constructs to inject private key build time * feat: updated the docker file with private key build argument * feat: added consumption od DEFAULT_PRIVATE_KEY when building monitor * dev: update private key --------- Co-authored-by: Henit Chobisa <chobisa.henit@gmail.com> Co-authored-by: gurusainath <gurusainath007@gmail.com> Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com> Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
2024-08-22 17:39:19 +05:30
APP_DOMAIN = appDomain
feat: Added Prime Monitor Go Service for monitoring, health check and feature flagging (#411) * 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
2024-06-20 12:14:46 +05:30
}
dev: new license activation workflow for one and pro users (#739) * feat: added feature flag package for decrypting and refreshing the feature flags value * feat: added feature flagging route for route handlers * feat: added feature flag worker for managing and distributing feature flags * feat: implemented feature flag api implementation inside ff handler * feat: added exponential retry interval inside feature flagging * fix: route pattern of feature flag endpoint from monitor * feat: created endpoint to activate workspace from monitor * feat: made changes to accomodate db and activate endpoint * dev: update multi tenant environment settings * dev: workspace license activation flow * dev: update license activate endpoint * dev: update workspace license activate endpoint * feat: added feature flag user sync logic * feat: added constants and sync logic with private key inside * feat: added port as env variable * feat: added modification for removing license key in healthcheck * feat: example env pushed * fix: update monitor endpoints and license activation function * dev: initiate free workspace only for self hosted instances * dev: self hosting license endpoint updates * dev: remove monitor db * dev: update handlers * dev: self hosted license subscription web * dev: removed computed in self hosted subscription * fix: prime server url and delete old license while creating new license in sqlite * chore: subscription activation alert after successfull activation. * dev: update feature flag endpoints * fix: handled several cases of feature flags * fix: linting errors * dev: update monitor to handle workspace activation * dev: update decryption algorithm * feat: separated activation payload with the sync payload * dev: update feature flags endpoint * dev: change type for workspace sync * feat: added isActive flag for user activation * feat: removed creation of free users in monitor * feat: added method for workspace product * dev: add user email in types * feat: added method for workspace product * fix: uer license feature flag fetch * fix: handler fixed for feature key * chore: self managed license activation * chore: update validation license flow. * chore: license activation success. * dev: resync workspace license on activation * chore: plane one success modal. * feat: added constructs to inject private key build time * feat: updated the docker file with private key build argument * feat: added consumption od DEFAULT_PRIVATE_KEY when building monitor * dev: update private key --------- Co-authored-by: Henit Chobisa <chobisa.henit@gmail.com> Co-authored-by: gurusainath <gurusainath007@gmail.com> Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com> Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
2024-08-22 17:39:19 +05:30
if appVersion := os.Getenv(constants.APP_VERSION); appVersion == "" {
return fmt.Errorf(error_msgs.APP_VERSION_ABSENT)
feat: Added Prime Monitor Go Service for monitoring, health check and feature flagging (#411) * 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
2024-06-20 12:14:46 +05:30
} else {
dev: new license activation workflow for one and pro users (#739) * feat: added feature flag package for decrypting and refreshing the feature flags value * feat: added feature flagging route for route handlers * feat: added feature flag worker for managing and distributing feature flags * feat: implemented feature flag api implementation inside ff handler * feat: added exponential retry interval inside feature flagging * fix: route pattern of feature flag endpoint from monitor * feat: created endpoint to activate workspace from monitor * feat: made changes to accomodate db and activate endpoint * dev: update multi tenant environment settings * dev: workspace license activation flow * dev: update license activate endpoint * dev: update workspace license activate endpoint * feat: added feature flag user sync logic * feat: added constants and sync logic with private key inside * feat: added port as env variable * feat: added modification for removing license key in healthcheck * feat: example env pushed * fix: update monitor endpoints and license activation function * dev: initiate free workspace only for self hosted instances * dev: self hosting license endpoint updates * dev: remove monitor db * dev: update handlers * dev: self hosted license subscription web * dev: removed computed in self hosted subscription * fix: prime server url and delete old license while creating new license in sqlite * chore: subscription activation alert after successfull activation. * dev: update feature flag endpoints * fix: handled several cases of feature flags * fix: linting errors * dev: update monitor to handle workspace activation * dev: update decryption algorithm * feat: separated activation payload with the sync payload * dev: update feature flags endpoint * dev: change type for workspace sync * feat: added isActive flag for user activation * feat: removed creation of free users in monitor * feat: added method for workspace product * dev: add user email in types * feat: added method for workspace product * fix: uer license feature flag fetch * fix: handler fixed for feature key * chore: self managed license activation * chore: update validation license flow. * chore: license activation success. * dev: resync workspace license on activation * chore: plane one success modal. * feat: added constructs to inject private key build time * feat: updated the docker file with private key build argument * feat: added consumption od DEFAULT_PRIVATE_KEY when building monitor * dev: update private key --------- Co-authored-by: Henit Chobisa <chobisa.henit@gmail.com> Co-authored-by: gurusainath <gurusainath007@gmail.com> Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com> Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
2024-08-22 17:39:19 +05:30
APP_VERSION = appVersion
}
if port := os.Getenv(constants.PORT); port != "" {
PORT = port
}
feat: Added Prime Monitor Go Service for monitoring, health check and feature flagging (#411) * 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
2024-06-20 12:14:46 +05:30
if machineSignature := os.Getenv(constants.MACHINE_SIGNATURE); machineSignature == "" {
return fmt.Errorf(error_msgs.MACHINE_SIG_ABSENT)
} else {
MACHINE_SIGNATURE = machineSignature
}
if instanceId := os.Getenv(constants.INSTANCE_ID); instanceId == "" {
// If we don't get the instance id, we need to look up for the
// DEPLOY_PLATFORM env, such that we can decide, if we the platform is not
// docker compose then we need to create the instance on our own. As helm
// and kubernetes can't provide the instance id.
if deployPlatform := os.Getenv(constants.DEPLOY_PLATFORM); deployPlatform == "" {
return fmt.Errorf(error_msgs.DEPLOY_PLATFORM_ABSENT)
} else {
if deployPlatform != constants.DOCKER_COMPOSE {
api := prime_api.NewMonitorApi(HOST, MACHINE_SIGNATURE, "", APP_VERSION)
setupResponse, err := api.InitializeInstance(prime_api.CredentialsPayload{
ServerId: MACHINE_SIGNATURE,
Domain: APP_DOMAIN,
})
if err != nil {
return fmt.Errorf(error_msgs.FAILED_INITIALIZATION, APP_DOMAIN)
}
INSTANCE_ID = setupResponse.InstanceId
} else {
return fmt.Errorf(error_msgs.INSTANCE_ID_ABSENT)
}
}
} else {
INSTANCE_ID = instanceId
}
feat: Added Prime Monitor Go Service for monitoring, health check and feature flagging (#411) * 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
2024-06-20 12:14:46 +05:30
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.
dev: new license activation workflow for one and pro users (#739) * feat: added feature flag package for decrypting and refreshing the feature flags value * feat: added feature flagging route for route handlers * feat: added feature flag worker for managing and distributing feature flags * feat: implemented feature flag api implementation inside ff handler * feat: added exponential retry interval inside feature flagging * fix: route pattern of feature flag endpoint from monitor * feat: created endpoint to activate workspace from monitor * feat: made changes to accomodate db and activate endpoint * dev: update multi tenant environment settings * dev: workspace license activation flow * dev: update license activate endpoint * dev: update workspace license activate endpoint * feat: added feature flag user sync logic * feat: added constants and sync logic with private key inside * feat: added port as env variable * feat: added modification for removing license key in healthcheck * feat: example env pushed * fix: update monitor endpoints and license activation function * dev: initiate free workspace only for self hosted instances * dev: self hosting license endpoint updates * dev: remove monitor db * dev: update handlers * dev: self hosted license subscription web * dev: removed computed in self hosted subscription * fix: prime server url and delete old license while creating new license in sqlite * chore: subscription activation alert after successfull activation. * dev: update feature flag endpoints * fix: handled several cases of feature flags * fix: linting errors * dev: update monitor to handle workspace activation * dev: update decryption algorithm * feat: separated activation payload with the sync payload * dev: update feature flags endpoint * dev: change type for workspace sync * feat: added isActive flag for user activation * feat: removed creation of free users in monitor * feat: added method for workspace product * dev: add user email in types * feat: added method for workspace product * fix: uer license feature flag fetch * fix: handler fixed for feature key * chore: self managed license activation * chore: update validation license flow. * chore: license activation success. * dev: resync workspace license on activation * chore: plane one success modal. * feat: added constructs to inject private key build time * feat: updated the docker file with private key build argument * feat: added consumption od DEFAULT_PRIVATE_KEY when building monitor * dev: update private key --------- Co-authored-by: Henit Chobisa <chobisa.henit@gmail.com> Co-authored-by: gurusainath <gurusainath007@gmail.com> Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com> Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
2024-08-22 17:39:19 +05:30
func Execute(privateKey string) {
2024-08-23 20:56:17 +05:30
PRIVATE_KEY = privateKey
feat: Added Prime Monitor Go Service for monitoring, health check and feature flagging (#411) * 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
2024-06-20 12:14:46 +05:30
err := rootCmd.Execute()
if err != nil {
os.Exit(1)
}
}
func init() {
rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}