Skip to content

Commit be4b874

Browse files
committed
Added the ability to select the region for storing server data. Increased agent version.
1 parent b8dfc8f commit be4b874

File tree

9 files changed

+190
-151
lines changed

9 files changed

+190
-151
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ ARG RELEEM_HOSTNAME
1919
ARG RELEEM_INTERVAL_COLLECT_ALL_METRICS
2020
ARG RELEEM_QUERY_OPTIMIZATION
2121
ARG RELEEM_DATABASES_QUERY_OPTIMIZATION
22+
ARG RELEEM_REGION
2223

2324
RUN apt update \
2425
&& apt install -y \

config/config.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
)
1010

1111
const (
12-
ReleemAgentVersion = "1.21.3"
12+
ReleemAgentVersion = "1.21.3.1"
1313
)
1414

1515
type Config struct {
@@ -38,6 +38,7 @@ type Config struct {
3838
AwsRDSParameterGroup string `hcl:"aws_rds_parameter_group"`
3939
QueryOptimization bool `hcl:"query_optimization"`
4040
DatabasesQueryOptimization string `hcl:"databases_query_optimization"`
41+
ReleemRegion string `hcl:"releem_region"`
4142
}
4243

4344
func LoadConfig(filename string, logger logging.Logger) (*Config, error) {

current_version_agent

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.21.3
1+
1.21.3.1

docker/releem.conf.tpl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,9 @@ query_optimization=${RELEEM_QUERY_OPTIMIZATION:-false}
8282

8383
# databases_query_optimization string `hcl:"databases_query_optimization"`
8484
# List of databases for query optimization
85-
databases_query_optimization="${RELEEM_DATABASES_QUERY_OPTIMIZATION}"
85+
databases_query_optimization="${RELEEM_DATABASES_QUERY_OPTIMIZATION}"
86+
87+
# releem_region string `hcl:"releem_region"`
88+
# Server data storage region - EU or empty.
89+
releem_region="${RELEEM_REGION}"
90+

errors/releemErrors.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,25 @@ func (repeater ReleemErrorsRepeater) ProcessErrors(message string) interface{} {
2020
bodyReader := strings.NewReader(message)
2121

2222
repeater.logger.V(5).Info("Result Send data: ", message)
23-
var api_domain string
23+
var api_domain, domain string
2424
if repeater.configuration != nil {
2525
env = repeater.configuration.Env
2626
} else {
2727
env = "prod"
2828
}
29+
if repeater.configuration.ReleemRegion == "EU" {
30+
domain = "eu.releem.com"
31+
} else {
32+
domain = "releem.com"
33+
}
2934
if env == "dev2" {
30-
api_domain = "https://api.dev2.releem.com/v2/events/agent_errors_log"
35+
api_domain = "https://api.dev2." + domain + "/v2/events/agent_errors_log"
3136
} else if env == "dev" {
32-
api_domain = "https://api.dev.releem.com/v2/events/agent_errors_log"
37+
api_domain = "https://api.dev." + domain + "/v2/events/agent_errors_log"
3338
} else if env == "stage" {
34-
api_domain = "https://api.stage.releem.com/v2/events/agent_errors_log"
39+
api_domain = "https://api.stage." + domain + "/v2/events/agent_errors_log"
3540
} else {
36-
api_domain = "https://api.releem.com/v2/events/agent_errors_log"
41+
api_domain = "https://api." + domain + "/v2/events/agent_errors_log"
3742
}
3843
req, err := http.NewRequest(http.MethodPost, api_domain, bodyReader)
3944
if err != nil {

install.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# install.sh - Version 1.21.3
2+
# install.sh - Version 1.21.3.1
33
# (C) Releem, Inc 2022
44
# All rights reserved
55

@@ -9,7 +9,7 @@ export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/
99
# using the package manager.
1010

1111
set -e -E
12-
install_script_version=1.21.3
12+
install_script_version=1.21.3.1
1313
logfile="/var/log/releem-install.log"
1414

1515
WORKDIR="/opt/releem"
@@ -19,7 +19,6 @@ RELEEM_COMMAND="/bin/bash $WORKDIR/mysqlconfigurer.sh"
1919

2020
# Read configuration
2121

22-
2322
# Set up a named pipe for logging
2423
npipe=/tmp/$$.install.tmp
2524
mknod $npipe p
@@ -30,7 +29,12 @@ exec 1>&-
3029
exec 1>$npipe 2>&1
3130

3231
function on_exit() {
33-
curl -s -L -d @$logfile -H "x-releem-api-key: $apikey" -H "Content-Type: application/json" -X POST https://api.releem.com/v2/events/saving_log
32+
if [[ "${RELEEM_REGION}" == "EU" ]]; then
33+
API_DOMAIN="api.eu.releem.com"
34+
else
35+
API_DOMAIN="api.releem.com"
36+
fi
37+
curl -s -L -d @$logfile -H "x-releem-api-key: $apikey" -H "Content-Type: application/json" -X POST https://${API_DOMAIN}/v2/events/saving_log
3438
rm -f $npipe
3539
}
3640

@@ -540,6 +544,9 @@ fi
540544
if [ -n "$RELEEM_DATABASES_QUERY_OPTIMIZATION" ]; then
541545
echo "databases_query_optimization=\"$RELEEM_DATABASES_QUERY_OPTIMIZATION\"" | $sudo_cmd tee -a $CONF >/dev/null
542546
fi
547+
if [ -n "$RELEEM_REGION" ]; then
548+
echo "releem_region=\"$RELEEM_REGION\"" | $sudo_cmd tee -a $CONF >/dev/null
549+
fi
543550

544551
echo "interval_seconds=60" | $sudo_cmd tee -a $CONF >/dev/null
545552
echo "interval_read_config_seconds=3600" | $sudo_cmd tee -a $CONF >/dev/null

0 commit comments

Comments
 (0)