<!-- build 0 -->
# Oculus Toolchain

Oculus is a toolchain for monitoring and handling Docker container diffs. It includes three main components:
- **filter**: Filters the diff outputs based on ignore patterns.
- **api**: Provides an API to fetch container details and diffs.
- **main**: The main monitoring application that uses the API and filter components to manage container diffs.

## Installation

To install the Oculus toolchain, you can use the provided `install.sh` script. This script will download and install the appropriate binaries for your system.

### Prerequisites

- **curl**: Make sure `curl` is installed on your system.
- **sudo**: Required if you do not have write permission to `/usr/local/bin`.

### Installation Steps

1. **Download the Install Script**:
    ```sh
    curl -sSL https://git.nixc.us/colin/Oculus/raw/branch/main/install.sh -o install.sh
    ```

2. **Make the Script Executable**:
    ```sh
    chmod +x install.sh
    ```

3. **Run the Install Script**:
    ```sh
    ./install.sh
    ```

This will download and install the following components to `/usr/local/bin`:
- `oculus_filter`
- `oculus_api`
- `oculus_main`

## Usage

After installation, you can start using the Oculus toolchain. Below are the basic usage instructions for each component:

### Starting the API Server

To start the API server, run:
```sh
oculus_api
```
This will start the API server on port 8080.

### Running the Main Monitoring Application

Before running the main monitoring application, ensure that the API server is running and the environment variables are set:

```sh
export API_ADDRESS="http://localhost:8080"
export GLITCHTIP_DSN="your-glitchtip-dsn"

oculus_main
```

### Filtering Diff Outputs

To manually filter a diff output file, you can use the `filter` component:

```sh
oculus_filter /path/to/diff/file "ignore_pattern1" "ignore_pattern2"
```

## Docker Integration

You can integrate Oculus into your Docker setup by including the installation script in your Dockerfile. Below is an example Dockerfile:

```dockerfile
FROM ubuntu:latest

# Install dependencies
RUN apt-get update && apt-get install -y curl

# Download and run the Oculus install script
RUN curl -sSL https://git.nixc.us/colin/Oculus/raw/branch/main/install.sh -o install.sh && \
    chmod +x install.sh && \
    ./install.sh

# Set environment variables
ENV API_ADDRESS="http://localhost:8080"
ENV GLITCHTIP_DSN="your-glitchtip-dsn"

# Start the API server and the main application
CMD ["sh", "-c", "oculus_api & oculus_main"]
```

### Building the Docker Image

To build the Docker image, run:

```sh
docker build -t oculus-toolchain .
```

### Running the Docker Container

To run the Docker container, use:

```sh
docker run -d --name oculus-toolchain oculus-toolchain
```