Skip to content

Commit 4c0ff3b

Browse files
author
benoit-cty
committed
Documentation
1 parent 61699d8 commit 4c0ff3b

4 files changed

Lines changed: 71 additions & 71 deletions

File tree

File renamed without changes.

docs/advanced/ansible.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Deploy CodeCarbon CLI as a Service using Ansible
2+
3+
This section describes how to deploy CodeCarbon as a system service
4+
using Ansible automation.
5+
6+
It automate the manual installation done in the previous chapter.
7+
8+
## What the Playbook Does
9+
10+
The Ansible playbook automates the following tasks:
11+
12+
- Creates a dedicated system user and group for CodeCarbon
13+
- Sets up a Python virtual environment
14+
- Installs CodeCarbon package
15+
- Configures RAPL permissions for power measurements
16+
- Creates and configures the systemd service
17+
- Sets up the CodeCarbon configuration file
18+
- Starts and enables the service
19+
20+
## Prerequisites
21+
22+
- Ansible installed on your machine
23+
- Debian-based target system(s)
24+
- SSH access to target system(s)
25+
- CodeCarbon API credentials from the dashboard
26+
27+
## Directory Structure
28+
29+
``` text
30+
codecarbon/deploy/ansible/codecarbon_cli_as_a_service/
31+
├── hosts
32+
├── tasks
33+
│ ├── install_codecarbon.yml
34+
│ ├── main.yml
35+
│ ├── rapl.yml
36+
│ └── systemd_service.yml
37+
├── templates
38+
│ ├── codecarbon.config.j2
39+
│ └── systemd_service.j2
40+
└── vars
41+
└── main.yml
42+
```
43+
44+
## Quick Start
45+
46+
1. Set the the target to install in `hosts`:
47+
48+
``` text
49+
yourservername.yourdomain.com hostname=yourservername ansible_user=root ansible_ssh_private_key_file=~/.ssh/id_ed25519
50+
```
51+
52+
2. Update the variables in `vars/main.yml` with your configuration:
53+
54+
``` yaml
55+
organization_id: your_org_id
56+
project_id: your_project_id
57+
experiment_id: your_experiment_id
58+
api_key: your_api_key
59+
```
60+
61+
3. Run the playbook:
62+
63+
``` bash
64+
ansible-playbook -i hosts tasks/main.yml
65+
```

docs/getting-started/advanced_installation.md renamed to docs/advanced/linux_service.md

Lines changed: 2 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Advanced Installation
2-
3-
## Install CodeCarbon as a Linux service
1+
# Install CodeCarbon as a Linux service
42

53
To install CodeCarbon as a Linux service, follow the instructions below.
64
It works on Ubuntu or other Debian-based systems using systemd.
@@ -112,70 +110,4 @@ journalctl -u codecarbon
112110
You are done, CodeCarbon is now running as a service on your machine.
113111

114112
Wait 5 minutes for the first measure to be send to the dashboard at
115-
<https://dashboard.codecarbon.io/>.
116-
117-
## Deploy CodeCarbon CLI as a Service using Ansible
118-
119-
This section describes how to deploy CodeCarbon as a system service
120-
using Ansible automation.
121-
122-
It automate the manual installation done in the previous chapter.
123-
124-
### What the Playbook Does
125-
126-
The Ansible playbook automates the following tasks:
127-
128-
- Creates a dedicated system user and group for CodeCarbon
129-
- Sets up a Python virtual environment
130-
- Installs CodeCarbon package
131-
- Configures RAPL permissions for power measurements
132-
- Creates and configures the systemd service
133-
- Sets up the CodeCarbon configuration file
134-
- Starts and enables the service
135-
136-
### Prerequisites
137-
138-
- Ansible installed on your machine
139-
- Debian-based target system(s)
140-
- SSH access to target system(s)
141-
- CodeCarbon API credentials from the dashboard
142-
143-
### Directory Structure
144-
145-
``` text
146-
codecarbon/deploy/ansible/codecarbon_cli_as_a_service/
147-
├── hosts
148-
├── tasks
149-
│ ├── install_codecarbon.yml
150-
│ ├── main.yml
151-
│ ├── rapl.yml
152-
│ └── systemd_service.yml
153-
├── templates
154-
│ ├── codecarbon.config.j2
155-
│ └── systemd_service.j2
156-
└── vars
157-
└── main.yml
158-
```
159-
160-
### Quick Start
161-
162-
1. Set the the target to install in `hosts`:
163-
164-
``` text
165-
yourservername.yourdomain.com hostname=yourservername ansible_user=root ansible_ssh_private_key_file=~/.ssh/id_ed25519
166-
```
167-
168-
2. Update the variables in `vars/main.yml` with your configuration:
169-
170-
``` yaml
171-
organization_id: your_org_id
172-
project_id: your_project_id
173-
experiment_id: your_experiment_id
174-
api_key: your_api_key
175-
```
176-
177-
3. Run the playbook:
178-
179-
``` bash
180-
ansible-playbook -i hosts tasks/main.yml
181-
```
113+
<https://dashboard.codecarbon.io/>.

mkdocs.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,11 @@ nav:
122122
- Parameters: getting-started/parameters.md
123123
- Examples: getting-started/examples.md
124124
- Comet Integration: getting-started/comet.md
125-
- Advanced Installation: getting-started/advanced_installation.md
126125
- Test on Scaleway: getting-started/test_on_scaleway.md
126+
- Advanced Usage:
127+
- Linux service: advanced/advanced_installation.md
128+
- Deploy with Ansible: advanced/ansible.md
129+
- ROCm and PyTorch on SLURM SuperComputer: advanced/adastra.md
127130
- Logging:
128131
- Output: logging/output.md
129132
- Collecting emissions to a logger: logging/to_logger.md

0 commit comments

Comments
 (0)