mirror of
https://github.com/ultravioletrs/cocos.git
synced 2026-06-23 04:10:25 +00:00
Remove redundant agent dir
Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
This commit is contained in:
@@ -18,13 +18,13 @@ sudo apt-get install libguestfs-tools
|
||||
|
||||
QCOW2_PATH=~/go/src/github.com/ultravioletrs/manager/cmd/manager/img/boot.img
|
||||
|
||||
HOST_AGENT_PATH=~/go/src/github.com/ultravioletrs/agent/bin/cocos-agent; \
|
||||
GUEST_AGENT_PATH=/root/; \
|
||||
sudo virt-copy-in -a $QCOW2_PATH $HOST_AGENT_PATH $GUEST_AGENT_PATH
|
||||
HOST_AGENT_BIN_PATH=~/go/src/github.com/ultravioletrs/agent/bin/cocos-agent; \
|
||||
GUEST_AGENT_BIN_PATH=/root/; \
|
||||
sudo virt-copy-in -a $QCOW2_PATH $HOST_AGENT_BIN_PATH $GUEST_AGENT_BIN_PATH
|
||||
|
||||
HOST_AGENT_PATH=~/go/src/github.com/ultravioletrs/agent/alpine/agent; \
|
||||
GUEST_AGENT_PATH=/etc/init.d/; \
|
||||
sudo virt-copy-in -a $QCOW2_PATH $HOST_AGENT_PATH $GUEST_AGENT_PATH
|
||||
HOST_AGENT_SCRIPT_PATH=~/go/src/github.com/ultravioletrs/agent/alpine/agent; \
|
||||
GUEST_AGENT_SCRIPT_PATH=/etc/init.d/; \
|
||||
sudo virt-copy-in -a $QCOW2_PATH $HOST_AGENT_SCRIPT_PATH $GUEST_AGENT_SCRIPT_PATH
|
||||
```
|
||||
|
||||
### OpenRC
|
||||
|
||||
@@ -40,12 +40,12 @@ func NewClient(tracer opentracing.Tracer, conn *grpc.ClientConn, timeout time.Du
|
||||
// encodeRunRequest is a transport/grpc.EncodeRequestFunc that
|
||||
// converts a user-domain runReq to a gRPC request.
|
||||
func encodeRunRequest(_ context.Context, request interface{}) (interface{}, error) {
|
||||
req, ok := request.(runReq)
|
||||
req, ok := request.(*agent.RunRequest)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("invalid request type: %T", request)
|
||||
}
|
||||
|
||||
return &req, nil
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// decodeRunResponse is a transport/grpc.DecodeResponseFunc that
|
||||
+2
-2
@@ -8,9 +8,9 @@ depend() {
|
||||
}
|
||||
|
||||
start() {
|
||||
CC_AGENT_GRPC_ADDR=$(ifconfig eth0 | grep "inet addr" | cut -d ':' -f 2 | cut -d ' ' -f 1):7002
|
||||
AGENT_GRPC_ADDR=$(ifconfig eth0 | grep "inet addr" | cut -d ':' -f 2 | cut -d ' ' -f 1):7002
|
||||
ebegin "Starting cocos-agent"
|
||||
env CC_AGENT_GRPC_ADDR="${CC_AGENT_GRPC_ADDR}" start-stop-daemon -S -q -b -m -p /run/cocos-agent.pid -x $command -- $command_args
|
||||
env AGENT_GRPC_ADDR="${AGENT_GRPC_ADDR}" start-stop-daemon -S -q -b -m -p /run/cocos-agent.pid -x $command -- $command_args
|
||||
eend $?
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
AGENT_NAME="cocos-agent"
|
||||
AGENT_PATH="$HOME/agent/$AGENT_NAME"
|
||||
|
||||
while true
|
||||
do
|
||||
# find the process IDs of running processes based on their name
|
||||
if pgrep -x "$AGENT_NAME" >/dev/null; then
|
||||
echo "Executable $AGENT_NAME is already running."
|
||||
else
|
||||
if [ -x "$AGENT_PATH" ]; then
|
||||
echo "Executing $AGENT_NAME..."
|
||||
"$AGENT_PATH"
|
||||
else
|
||||
echo "Executable $AGENT_NAME not found at path $AGENT_PATH."
|
||||
fi
|
||||
fi
|
||||
|
||||
# wait for 15 seconds before running the loop again
|
||||
sleep 15
|
||||
done
|
||||
+9
-9
@@ -22,8 +22,8 @@ import (
|
||||
"github.com/mainflux/mainflux/logger"
|
||||
agent "github.com/ultravioletrs/agent/agent"
|
||||
"github.com/ultravioletrs/agent/agent/api"
|
||||
agentgrpc "github.com/ultravioletrs/agent/agent/api/agent/grpc"
|
||||
agenthttpapi "github.com/ultravioletrs/agent/agent/api/agent/http"
|
||||
agentgrpc "github.com/ultravioletrs/agent/agent/api/grpc"
|
||||
agenthttpapi "github.com/ultravioletrs/agent/agent/api/http"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
kitprometheus "github.com/go-kit/kit/metrics/prometheus"
|
||||
@@ -41,13 +41,13 @@ const (
|
||||
defSecret = "secret"
|
||||
defGRPCAddr = "localhost:7002"
|
||||
|
||||
envLogLevel = "CC_AGENT_LOG_LEVEL"
|
||||
envHTTPPort = "CC_AGENT_HTTP_PORT"
|
||||
envServerCert = "CC_AGENT_SERVER_CERT"
|
||||
envServerKey = "CC_AGENT_SERVER_KEY"
|
||||
envSecret = "CC_AGENT_SECRET"
|
||||
envJaegerURL = "CC_JAEGER_URL"
|
||||
envGRPCAddr = "CC_AGENT_GRPC_ADDR"
|
||||
envLogLevel = "AGENT_LOG_LEVEL"
|
||||
envHTTPPort = "AGENT_HTTP_PORT"
|
||||
envServerCert = "AGENT_SERVER_CERT"
|
||||
envServerKey = "AGENT_SERVER_KEY"
|
||||
envSecret = "AGENT_SECRET"
|
||||
envJaegerURL = "JAEGER_URL"
|
||||
envGRPCAddr = "AGENT_GRPC_ADDR"
|
||||
)
|
||||
|
||||
type config struct {
|
||||
|
||||
Reference in New Issue
Block a user