Skip to content

Commit

Permalink
Added supporting OS Windows (#381)
Browse files Browse the repository at this point in the history
* Changed package for logging for supported windows. Added setting of file names depending on OS. Chnaged collect metrics for swap memory.

* Changed the application launch algorithm to support Windows.

* Fixed CI/CD. Added build for Windows
  • Loading branch information
kochetovd authored Dec 6, 2024
1 parent cb017ed commit 3aa2b26
Show file tree
Hide file tree
Showing 23 changed files with 275 additions and 335 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Create upload dir
run: |
mkdir -p ../v2
cp current_version_agent install.sh mysqlconfigurer.sh releem-agent-x86_64 releem-agent-amd64 releem-agent-aarch64 releem-agent-freebsd-amd64 releem-agent-i686 ../v2/
cp current_version_agent install.sh mysqlconfigurer.sh releem-agent-x86_64 releem-agent-amd64 releem-agent-aarch64 releem-agent-freebsd-amd64 releem-agent-i686 releem-agent.exe ../v2/
- uses: shallwefootball/s3-upload-action@master
name: Upload S3 current_version_agent
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
test-project/test.sh
.DS_Store
releem-install.log
releem-agent-*
releem-agent*
releem1.conf
releem_rds.conf
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o releem-agent-amd64
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o releem-agent-aarch64
CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -o releem-agent-i686
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -o releem-agent-freebsd-amd64
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o releem-agent.exe
7 changes: 2 additions & 5 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"os"
"time"

"github.com/advantageous/go-logback/logging"
logging "github.com/google/logger"
"github.com/hashicorp/hcl"
)

Expand Down Expand Up @@ -41,10 +41,7 @@ type Config struct {
}

func LoadConfig(filename string, logger logging.Logger) (*Config, error) {
if logger == nil {
logger = logging.NewSimpleLogger("config")
}
logger.Printf("Loading config %s", filename)
logger.Infof("Loading config %s", filename)
configBytes, err := os.ReadFile(filename)
if err != nil {
return nil, err
Expand Down
11 changes: 5 additions & 6 deletions errors/releemErrors.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"

"github.com/Releem/mysqlconfigurer/config"
"github.com/advantageous/go-logback/logging"
logging "github.com/google/logger"

"time"
)
Expand All @@ -19,7 +19,7 @@ func (repeater ReleemErrorsRepeater) ProcessErrors(message string) interface{} {
var env string
bodyReader := strings.NewReader(message)

repeater.logger.Debug("Result Send data: ", message)
repeater.logger.V(5).Info("Result Send data: ", message)
var api_domain string
if repeater.configuration != nil {
env = repeater.configuration.Env
Expand Down Expand Up @@ -53,11 +53,10 @@ func (repeater ReleemErrorsRepeater) ProcessErrors(message string) interface{} {
repeater.logger.Error("Request: error making http request: ", err)
return nil
}
repeater.logger.Debug("Response: status code: ", res.StatusCode)
return nil
repeater.logger.V(5).Info("Response: status code: ", res.StatusCode)
return res
}

func NewReleemErrorsRepeater(configuration *config.Config) ReleemErrorsRepeater {
logger := logging.NewSimpleLogger("ReleemRepeaterMetrics")
func NewReleemErrorsRepeater(configuration *config.Config, logger logging.Logger) ReleemErrorsRepeater {
return ReleemErrorsRepeater{logger, configuration}
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.22.0

require (
github.com/Releem/daemon v0.0.0-20241028135502-b7f24658ba58
github.com/advantageous/go-logback v0.0.0-20161215180304-6db19679ca3e
github.com/aws/aws-sdk-go v1.53.7
github.com/aws/aws-sdk-go-v2 v1.27.0
github.com/aws/aws-sdk-go-v2/config v1.27.15
Expand All @@ -13,6 +12,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/ec2 v1.161.3
github.com/aws/aws-sdk-go-v2/service/rds v1.79.1
github.com/go-sql-driver/mysql v1.8.1
github.com/google/logger v1.1.1
github.com/hashicorp/hcl v1.0.0
github.com/pkg/errors v0.9.1
github.com/shirou/gopsutil/v4 v4.24.10
Expand Down
5 changes: 3 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
github.com/Releem/daemon v0.0.0-20241028135502-b7f24658ba58 h1:ISdzv2VqJ4GVjtvT0WAWsg9n2iKOjYMcMpSL3VJSoqg=
github.com/Releem/daemon v0.0.0-20241028135502-b7f24658ba58/go.mod h1:GxsvZP6BRrh+rSHnXaXzuShSiiiMEfDxuutowpgCG8w=
github.com/advantageous/go-logback v0.0.0-20161215180304-6db19679ca3e h1:zDwXL5E118a4JRyWUVVzGUg4zDXY2CfllYYu+B6Vgy8=
github.com/advantageous/go-logback v0.0.0-20161215180304-6db19679ca3e/go.mod h1:pynxONZJ8msfhJ8u3t9OQZVPsn9i9AW4VW55zv9K9+I=
github.com/aws/aws-sdk-go v1.53.7 h1:ZSsRYHLRxsbO2rJR2oPMz0SUkJLnBkN+1meT95B6Ixs=
github.com/aws/aws-sdk-go v1.53.7/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=
github.com/aws/aws-sdk-go-v2 v1.27.0 h1:7bZWKoXhzI+mMR/HjdMx8ZCC5+6fY0lS5tr0bbgiLlo=
Expand Down Expand Up @@ -54,6 +52,8 @@ github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqw
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/logger v1.1.1 h1:+6Z2geNxc9G+4D4oDO9njjjn2d0wN5d7uOo0vOIW1NQ=
github.com/google/logger v1.1.1/go.mod h1:BkeJZ+1FhQ+/d087r4dzojEg1u2ZX+ZqG1jTUrLM+zQ=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
Expand Down Expand Up @@ -81,6 +81,7 @@ github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
Expand Down
Loading

0 comments on commit 3aa2b26

Please sign in to comment.