Skip to content
This repository has been archived by the owner on May 20, 2021. It is now read-only.
/ estuary-agent Public archive

Estuary agent will run your commands and tests. Part of the Estuary stack.

License

Notifications You must be signed in to change notification settings

estuaryoss/estuary-agent

Repository files navigation

Testing as a service with Docker

Support project:

! The original version of the agent. Won't be maintained. It is replaced by go and java versions.

Estuary agent

Estuary agent is a service that exposes your cli commands/app via REST API.

Code quality

Codacy Badge Maintainability

Linux status

Build Status

Windows status

CircleCI

Docker Hub

alpine
centos

Api docs

4.2.0

Postman collection

Postman

Katacoda playground

estuary-agent

Compile on Alpine

docker run --rm -v "${PWD}:/src" six8/pyinstaller-alpine --noconfirm --onefile --clean --log-level DEBUG main_flask.py
docker run --rm -v "${PWD}:/src" six8/pyinstaller-alpine --noconfirm --onefile --clean --log-level DEBUG start.py

docker run --rm -v "${PWD}:/src" cdrx/pyinstaller-linux "pyinstaller --onefile --clean main_flask.py"
docker run --rm -v "${PWD}:/src" cdrx/pyinstaller-linux "pyinstaller --onefile --clean start.py

General use cases:

  • remote command executor
  • exposing CLI app through REST API
  • controlling the test automation framework (maven/python, etc)
  • integration testing by controlling and configuring the SUT

Testing use cases:

Some use cases are documented in wiki

Service run

Docker compose

docker-compose up

Docker run

docker run  
-d 
-p 8080:8080
estuaryoss/agent:<tag>

Kubernetes

kubectl apply -f k8sdeployment.yml

Eureka registration

To have all your estuary-agent instances in a central location, Netflix Eureka is used. This means your client will discover all services used for your test and then spread the tests across all.

Start Eureka server with docker:

docker run -p 8080:8080 estuaryoss/netflix-eureka:1.9.25

Start your containers by specifying the full hostname or ip of the host machine on where your agent service resides. Optionally you can define the WORKSPACE (default=/tmp)or PORT (default=8080).

docker run \
-e EUREKA_SERVER=http://10.10.15.30:8080/eureka/v2 -> the eureka server
-e APP_IP_PORT=10.10.15.28:8081 -> the ip and port of the app
-e WORKSPACE=/tmp/ -> optional;for multiplatform set it to your needs;default is /tmp/;E.g /workspace/
-p 8081:8080
estuaryoss/agent:<tag>

Fluentd logging

Please consult Fluentd for logging setup.
Agent tags all logs in format estuary-agent.**

Matcher example:

<match estuary*.**>
    @type stdout
</match>

Run example:

docker run \
-e FLUENTD_IP_PORT=10.10.15.28:24224
-p 8080:8080
estuaryoss/agent:<tag>

Authentication

For auth set HTTP_AUTH_TOKEN env variable.

!!! Use this env variable, otherwise you will open a major security hole. The attacker will have access to your system. !!!

Run example:

docker run \
-e HTTP_AUTH_TOKEN=mysecret
-p 8080:8080
estuaryoss/agent:<tag>

Then, access the Http Api. Call example:

curl -i -H 'Token:mysecret' http:localhost:8080/about

Enable HTTPS

Set HTTPS_ENABLE env var option to true or false.
Set the certificate and the private key path with HTTPS_CERT and HTTPS_KEY env variables. If you do not set cert and private key file env vars, it defaults to a folder in the same path called https, and the default files https/cert.pem and https/key.pem.

Environment variables injection

User defined environment variables will be stored in a 'virtual' environment. The extra env vars will be used by the process that executes system commands.
There are two ways to inject user defined environment variables.

  • call POST on /env endpoint. The body will contain the env vars in JSON format. E.g. {"FOO1":"BAR1"}
  • create an environment.properties file with the extra env vars needed and place it in the same path as the JAR. Example in this repo.

! All environment variables described above can also be set using environment.properties.

Example output

curl -X POST -d 'ls -lrt' http://localhost:8080/command

{
    "code": 1000,
    "message": "Success",
    "description": {
        "finished": true,
        "started": false,
        "startedat": "2020-08-15 19:38:16.138962",
        "finishedat": "2020-08-15 19:38:16.151067",
        "duration": 0.012,
        "pid": 2315,
        "id": "none",
        "commands": {
            "ls -lrt": {
                "status": "finished",
                "details": {
                    "out": "total 371436\n-rwxr-xr-x 1 dinuta qa  13258464 Jun 24 09:25 main-linux\ndrwxr-xr-x 4 dinuta qa        40 Jul  1 11:42 tmp\n-rw-r--r-- 1 dinuta qa  77707265 Jul 25 19:38 testrunner-linux.zip\n-rw------- 1 dinuta qa   4911271 Aug 14 10:00 nohup.out\n",
                    "err": "",
                    "code": 0,
                    "pid": 6803,
                    "args": [
                        "/bin/sh",
                        "-c",
                        "ls -lrt"
                    ]
                },
                "startedat": "2020-08-15 19:38:16.138970",
                "finishedat": "2020-08-15 19:38:16.150976",
                "duration": 0.012
            }
        }
    },
    "timestamp": "2020-08-15 19:38:16.151113",
    "path": "/command?",
    "name": "estuary-agent",
    "version": "4.0.8"
}

Estuary stack

Estuary deployer
Estuary agent
Estuary discovery
Estuary viewer

Templating service

Jinja2Docker

About

Estuary agent will run your commands and tests. Part of the Estuary stack.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages