odoo-resource-assessor 0.2.0
A tool to calculate Odoo configuration based on system resources.
License: MIT

# Odoo Resource Assessor

This tool calculates the Odoo configuration based on the available system resources. It is designed to automate the configuration process by calculating the optimal number of worker processes and memory limits for Odoo based on the server's specifications.

## Output example

```bash
$ resource-assessor

Enter the number of CPUs: 4
Enter the amount of RAM in GB: 34
Do you want to customize the time limits? (current: cpu=600, real=1200) [y/N]: N


#####################################################
# Odoo configuration generated by resource-assessor #
# Paste it into your odoo.conf file under [options] #
#####################################################


; Odoo configuration generated by resource-assessor
workers = 3
cron_workers = 1

; Customize the Odoo timeouts
limit_time_cpu = 600
limit_time_real = 1200

; Customize the Odoo memory limits
limit_memory_hard = 5637144576
limit_memory_soft = 4563402752

; End of configuration generated by resource-assessor
```

## Installation

To install the Odoo Resource Assessor, run the following command:

```bash
pip install odoo-resource-assessor
```

## Usage

### Interactive mode

To assess the resources and get a recommended Odoo configuration, simply execute the tool. It will prompt you to enter the number of CPUs and the amount of RAM in GB:

```bash
resource-assessor
```

### Automatic mode

For assessing the current system automatically, use the `--self` flag to have the script determine the available system resources:

```bash
resource-assessor --self
```

In `--self` mode, you can pass extra flags to output specific values:

```bash
$ resource-assessor --self --workers

9
```

Valid flags are `--workers`, `--soft`, and `--hard`.

### Output to file

To write the entire generated configuration to a file, use the `--output` flag:

```bash
resource-assessor --output odoo.conf
```

### Help

You can check all the features by passing `--help` flag:

```bash
$ resource-assessor --help

usage: resource-assessor [options]

A tool to calculate Odoo configuration based on system resources.

Default values can be set using environment variables:
- LIMIT_TIME_CPU_DEFAULT
- LIMIT_TIME_REAL_DEFAULT
- CRON_WORKERS_DEFAULT


optional arguments:
  -h, --help            show this help message and exit
  --cpu CPU             Number of CPUs (will prompt if not provided)
  --ram RAM             Amount of RAM in GB (will prompt if not provided)
  -o OUTPUT, --output OUTPUT
                        Output file path to write the configuration
  -s, --self            Run using the current machine's resources without prompting
  -w, --workers         Output the number of workers based on current machine's CPUs (only with --self)
  --soft                Output the calculated limit_memory_soft value (only with --self)
  --hard                Output the calculated limit_memory_hard value (only with --self)
  --limit-time-cpu <seconds>
                        Limit time CPU (default: 600)
  --limit-time-real <seconds>
                        Limit time real (default: 1200)
  --version             show program's version number and exit

Example: resource-assessor --self
```

## Features

- Automatically calculates the number of HTTP workers for Odoo.
- Determines optimal memory limits based on system's RAM.
- Can use the current system's resources with the `--self` flag for convenience.
- Can output the calculated values for workers and memory limits.

## Contributing

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.

If you have a suggestion that would make this better, please fork the repository and create a pull request. You can also simply open an issue with the tag "enhancement".

Don't forget to give the project a star! Thanks again!

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Acknowledgments

- Thanks to the Odoo community for continuous support and inspiration.
- Special thanks to all contributors who help maintain and improve this project.
- Inspired by [Host your Odoo server on the public Internet: do's and don'ts](https://www.odoo.com/es_ES/event/odoo-experience-2023-3735/track/host-your-odoo-server-on-the-public-internet-do-s-and-don-ts-5813) talk by Nicolas Martinelli at Odoo Experience '23