Skip to content

Commit

Permalink
updated README file with deployment commands
Browse files Browse the repository at this point in the history
  • Loading branch information
raftmsohani committed Sep 19, 2023
1 parent d7a9bee commit b005aa0
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions tdrs-backend/clamav-router/README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,49 @@
# CLAMAV

In order to have one CLAMAV instance (existing in prod), the Nginx router
for CLAMAV forwards the traffic from 'dev' and 'staging' spaces into
for CLAMAV has to forward the traffic from 'dev' and 'staging' spaces into
prod space, where the CLAMAV service exists.

## Deploy Nginx instance
To route the clamav traffic to clamav in prod, each space needs to have one instance of _Nginx Router_ which routes traffic to clamav.

In order to deploy the nginx router instance, change your directory to `tdrs-backend/clamav-router/` and run thefollowing command:
In order to deploy the nginx router instance, change your directory to `tdrs-backend/clamav-router/` and run the following command while logged into the target space:

```
cf push {nginx_instance_name} -f manifest.yml
cf push {nginx_instance_name} -f manifest.yml --no-route
```
, where _nginx_instance_name_ can be : _tdp-clamav-nginx-test_.
, where _nginx_instance_name_ can be : _tdp-clamav-nginx_.

The instance name then will be set as an environment variable to redirect each instance traffic.
The instance name then will be set as an environment variable to redirect each instance traffic. This will deploy the nginx instance to the target environment.

## Further communication configurations

## Setup Individual Instances
### Setup Individual Instances

First, set the environment variable __AV_SCAN_URL__ as follows:
```
Environment variable name: AV_SCAN_URL
Environment variable value: http://{nginx_instance_name}.apps.internal:9000/scan
Environment variable value: http://{nginx_instance}.apps.internal:9000/scan
```

### Add network policy from _{tdp-clamav-nginx}_ to clamav in prod
To enable traffic between the "__nginx instance__" and "__clamav instance in production__", we need to add the network policiy and route between the two:

#### Add network policy from _{backend_instance}_ to _tdp-clamav-nginx_
```
cf add-network-policy {backend_instance} tdp-clamav-nginx --protocol tcp --port 9000
cf add-network-policy {nginx_instance} "clamav-rest" -s "tanf-prod" --protocol tcp --port 9000
```
e.g: `{nginx_instance_name} = tdp-clamav-nginx-dev`

### Add network policy from _{backend_instance}_ to _tdp-clamav-nginx_
```
cf add-network-policy {backend_instance} {nginx_instance} --protocol tcp --port 9000
```
where e.g: `backend_instance = tdp-backend-develop`

#### Add route from _{backend_instance}_ to _tdp-clamav-nginx_
### Add route for _tdp-clamav-nginx_

Note: Make sure to delete (if existing) routes that are not being used. In some rare cases, a mal-assigned network policy can interfere with outgoing traffic. As an example, a policy like `cf delete-route app.cloud.gov --hostname tdp-frontend-staging`

Note: Make sure to delete routes that are not being used. In some rare cases, a mal-assigned network policy can interfere with outgoing traffic. As an example, a policy like `cf delete-route app.cloud.gov --hostname tdp-frontend-staging`
```
cf map-route {nginx_instance} apps.internal --hostname {nginx_instance}
```

0 comments on commit b005aa0

Please sign in to comment.