Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

Commit

Permalink
Merge pull request #660 from arbulu89/remove/remove-ara-leftovers
Browse files Browse the repository at this point in the history
Goodbye ARA
  • Loading branch information
arbulu89 committed Dec 23, 2021
2 parents f15142e + 0c79b1d commit 95a5970
Show file tree
Hide file tree
Showing 39 changed files with 32 additions and 970 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ jobs:
run: pip install -r requirements.dev.txt
- name: ansible playbooks and roles lint check
run: |
export ANSIBLE_ACTION_PLUGINS=$(python3 -m ara.setup.action_plugins)
ansible-lint -vv -x role-name,risky-shell-pipe,no-tabs -w yaml \
runner/ansible/* runner/ansible/roles/* \
runner/ansible/roles/checks/* runner/ansible/vars/*
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RUN make build
FROM python:3.7-slim AS trento-runner
RUN ln -s /usr/local/bin/python /usr/bin/python \
&& /usr/bin/python -m venv /venv \
&& /venv/bin/pip install 'ansible~=4.6.0' 'ara~=1.5.7' 'rpm==0.0.2' 'pyparsing~=2.0' \
&& /venv/bin/pip install 'ansible~=4.6.0' 'requests~=2.26.0' 'rpm==0.0.2' 'pyparsing~=2.0' \
&& apt-get update && apt-get install -y --no-install-recommends \
ssh \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
Expand Down
49 changes: 7 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ of existing clusters, rather than deploying new one.
* [Manually running Trento](#manually-running-trento)
+ [Trento Agents](#trento-agents)
+ [Trento Runner](#trento-runner)
- [Setting up and starting ARA](#setting-up-and-starting-ara)
- [Starting the Trento Runner](#starting-the-trento-runner)
+ [Trento Web UI](#trento-web-ui)
- [Configuration](#configuration)
Expand Down Expand Up @@ -68,11 +67,10 @@ The _Trento Server_ is an independent, cloud-native, distributed system and shou

- The `trento web` application;
- The `trento runner` worker;
- An [ARA] service.

The _Trento Agent_ is a single background process (`trento agent`) running in each host of the target infrastructure the user desires to monitor.

Please note that, except for the third-party ones like ARA, all the components are embedded within one single `trento` binary.
Please note that, except for the third-party ones like Ansible, all the components are embedded within one single `trento` binary.

See the [architecture document](./docs/trento-architecture.md) for additional details.

Expand Down Expand Up @@ -331,57 +329,27 @@ Those are useful in order to test `mTLS` communication between the Agent and the

### Trento Runner

The Trento Runner is a worker process responsible for driving automated configuration audits. It is based on [Ansible](https://docs.ansible.com/ansible/latest/index.html) and [ARA](https://ara.recordsansible.org/).
These 2 components (the Runner and ARA) can be executed in the same host as the Web UI, but it is not mandatory: they can be executed in any other host with network access to the Trento Agents.

The Runner itself and ARA can be even executed in different hosts too, as long as the network connection is available between them.
The Trento Runner is a worker process responsible for driving automated configuration audits. It is based on [Ansible](https://docs.ansible.com/ansible/latest/index.html).
This component can be executed in the same host as the Web UI, but it is not mandatory: it can be executed in any other host with network access to the Trento Agents.

Find more information about how to create more Trento health checks [here](docs/runner.md).

In order to start them, some packages must be installed and started. Here a quick go through:

#### Setting up and starting ARA

```shell
# Install ARA with server dependencies
pip install 'ara[server]~=1.5.7'
# Setup ARA database
ara-manage migrate
# Start ARA server. This process can be started in background or in other shell terminal
ara-manage runserver ip:port
```

> The installed ara version should be at least ara~=1.5.7
If the requests to ARA server fail with a message like the next one, it means that the server address must be allowed:

```
2021-09-02 07:13:48,715 ERROR django.security.DisallowedHost: Invalid HTTP_HOST header: '10.74.1.5:8000'. You may need to add '10.74.1.5' to ALLOWED_HOSTS.
2021-09-02 07:13:48,732 WARNING django.request: Bad Request: /api/
```

To fix it run:

```
export ARA_ALLOWED_HOSTS="['10.74.1.5']"
# Or allow all the addresses with
export ARA_ALLOWED_HOSTS=['*']
```

#### Starting the Trento Runner

Independently where you decide to run ARA, the Runner needs the `ansible` and `ara` Python packages available locally:
The Runner needs the `ansible` Python package available locally:

```shell
pip install 'ansible~=4.6.0' 'ara~=1.5.7'
pip install 'ansible~=4.6.0'
```

> The installed ansible components versions should be at least ansible~=4.6.0 and ansible-core~=2.11.5
Once dependencies are in place, you can start the Runner itself:

```shell
./trento runner start --ara-server http://$ARA_IP:$ARA_PORT --api-host $WEB_IP --api-port $WEB_PORT -i 5
./trento runner start --api-host $WEB_IP --api-port $WEB_PORT -i 5
```

> *Note:* The Trento Runner component must have SSH access to all the agents via a password-less SSH key pair.
Expand All @@ -392,8 +360,6 @@ At this point, we can start the web application as follows:

```shell
./trento web serve
# If ARA server is not running in the same machine set the ara-addr flag
./trento web serve --ara-addr araIP:port
```

Please consult the `help` CLI command for more insights on the various options.
Expand Down Expand Up @@ -430,7 +396,7 @@ Example locations:

`/etc/trento/runner.yaml`

or
or

`/usr/etc/trento/agent.yaml`

Expand Down Expand Up @@ -579,5 +545,4 @@ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.

[ARA]: https://ara.recordsansible.org
[K3S]: https://k3s.io
1 change: 0 additions & 1 deletion cmd/runner/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ func LoadConfig() *runner.Config {
return &runner.Config{
ApiHost: viper.GetString("api-host"),
ApiPort: viper.GetInt("api-port"),
AraServer: viper.GetString("ara-server"),
Interval: time.Duration(interval) * time.Minute,
AnsibleFolder: viper.GetString("ansible-folder"),
}
Expand Down
2 changes: 0 additions & 2 deletions cmd/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/trento-project/trento/runner"
)

var araServer string
var apiHost string
var apiPort int
var interval int
Expand All @@ -36,7 +35,6 @@ func NewRunnerCmd() *cobra.Command {
},
}

startCmd.Flags().StringVar(&araServer, "ara-server", "http://127.0.0.1:8000", "ARA server url (ex: http://localhost:8000)")
startCmd.Flags().StringVar(&apiHost, "api-host", "0.0.0.0", "Trento web server API host")
startCmd.Flags().IntVar(&apiPort, "api-port", 8080, "Trento web server API port")
startCmd.Flags().IntVarP(&interval, "interval", "i", 5, "Interval in minutes to run the checks")
Expand Down
2 changes: 0 additions & 2 deletions cmd/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func NewWebCmd() *cobra.Command {
func addServeCmd(webCmd *cobra.Command) {
var host string
var port int
var araAddr string

var collectorPort int
var enablemTLS bool
Expand All @@ -68,7 +67,6 @@ func addServeCmd(webCmd *cobra.Command) {

serveCmd.Flags().StringVar(&host, "host", "0.0.0.0", "The host to bind the HTTP service to")
serveCmd.Flags().IntVarP(&port, "port", "p", 8080, "The port for the HTTP service to listen on")
serveCmd.Flags().StringVar(&araAddr, "ara-addr", "127.0.0.1:8000", "Address where ARA is running (ex: localhost:80)")

serveCmd.Flags().IntVar(&collectorPort, "collector-port", 8081, "The port for the data collector service to listen on")
serveCmd.Flags().BoolVar(&enablemTLS, "enable-mtls", false, "Enable mTLS authentication between server and agents")
Expand Down
7 changes: 2 additions & 5 deletions packaging/helm/trento-server/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ dependencies:
- name: trento-runner
repository: ""
version: '>0.0.0'
- name: ara
repository: ""
version: '>0.0.0'
- name: postgresql
repository: https://charts.bitnami.com/bitnami/
version: 10.1.4
digest: sha256:5cdbc1f203be1b601168ea486fa0fb95d76e7d3ee2210dcbb84f8ed2f0a90264
generated: "2021-12-10T22:17:58.374025204+01:00"
digest: sha256:4ca440f423831ceb17665407466664a3193b3c7cf251f15466e71be87676df20
generated: "2021-12-23T14:21:08.608734238+01:00"
9 changes: 3 additions & 6 deletions packaging/helm/trento-server/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!BuildTag: trento/trento-server:0.2.5
#!BuildTag: trento/trento-server:0.2.5-build%RELEASE%
#!BuildTag: trento/trento-server:0.2.6
#!BuildTag: trento/trento-server:0.2.6-build%RELEASE%
apiVersion: v2
name: trento-server
description: The trento server chart contains all the components necessary to run a Trento server.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates
version: 0.2.5
version: 0.2.6

dependencies:
- name: trento-web
Expand All @@ -15,9 +15,6 @@ dependencies:
- name: trento-runner
version: ">0.0.0"
condition: trento-runner.enabled
- name: ara
version: ">0.0.0"
condition: ara.enabled
- name: postgresql
version: ~10.1.4
repository: https://charts.bitnami.com/bitnami/
Expand Down
23 changes: 0 additions & 23 deletions packaging/helm/trento-server/charts/ara/.helmignore

This file was deleted.

24 changes: 0 additions & 24 deletions packaging/helm/trento-server/charts/ara/Chart.yaml

This file was deleted.

This file was deleted.

62 changes: 0 additions & 62 deletions packaging/helm/trento-server/charts/ara/templates/_helpers.tpl

This file was deleted.

12 changes: 0 additions & 12 deletions packaging/helm/trento-server/charts/ara/templates/datavolume.yaml

This file was deleted.

0 comments on commit 95a5970

Please sign in to comment.