Skip to content

Commit

Permalink
chore: refactor according to review
Browse files Browse the repository at this point in the history
  • Loading branch information
IronCore864 committed Jan 23, 2025
1 parent dc34b65 commit 7092a65
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions docs/how-to/manage-a-remote-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Pebble offers commands and an HTTP API over Unix socket for remote system manage

One common task in system administration is updating and installing packages. With Pebble, we can use the `pebble exec` command to achieve this.

> Note: Set the environment variable `PEBBLE_SOCKET` to override the Unix socket used for the API (defaults to `$PEBBLE/.pebble.socket`).
> Note: Set the environment variable `PEBBLE_SOCKET` to override the Unix socket used for the API (defaults to `$PEBBLE/.pebble.socket`, or to `/var/lib/pebble/default/.pebble.socket` if `PEBBLE` is not set).
For example, if Pebble is running as a user with root privileges, we can use this command to update and install packages in a remote system:

Expand Down Expand Up @@ -53,7 +53,7 @@ For more information, see {ref}`reference_pebble_exec_command`.

Another common task in a remote system is configuration management. For example, updating configuration files, pushing files to servers, pulling files generated by running services, and so on.

With Pebble, this can be done easily. For example, if we want to install Nginx, create our own website, and serve it on a newly created virtual host, we can first install Nginx:
With Pebble, this can be done using its file commands. For example, if we want to install Nginx, create our own website, and serve it on a newly created virtual host, we can first install Nginx:

```bash
pebble exec apt install nginx
Expand Down Expand Up @@ -120,23 +120,10 @@ For more information about related Pebble commands, see:

- {ref}`reference_pebble_ls_command`
- {ref}`reference_pebble_mkdir_command`
- {ref}`reference_pebble_rm_command`
- {ref}`reference_pebble_push_command`
- {ref}`reference_pebble_pull_command`

## Use the API

In the previous sections, we used Pebble commands to run commands and manage files. When automating these tasks, we can use the HTTP API that Pebble provides.

For example, to push a file to the remote system, we can POST to the `/v1/files` endpoint:

```bash
curl --unix-socket /path/to/.pebble.socket -XPOST http://_/v1/files -H "Content-Type: multipart/form-data" -F request='{"action": "write", "files": [{"path": "/var/www/pebble/index.html", "make-dirs": true, "permissions": "644"}]}' -F 'files=@/tmp/index.html;type=application/octet-stream;filename=/var/www/pebble/index.html'
```

We can also use the {ref}`api_python_client` and the {ref}`api_go_client` for API access.
- {ref}`reference_pebble_push_command`
- {ref}`reference_pebble_rm_command`

## See more

- [How to use the Pebble API to manage services](/how-to/use-the-pebble-api)
- [API](/reference/api)
You can also use the Pebble API to run command and manage files. This is normally done using the Go or Python client libraries. For more information, see [How to use the Pebble API](/how-to/use-the-pebble-api).

0 comments on commit 7092a65

Please sign in to comment.