Skip to main content

A tool to manage config files across machines.

Project description

# configfiles

A system to synchronize configuration files across multiple machines, the smart way.

## Installation

```
$ pip install configfiles

or

$ pip install -r requirements.txt
$ python setup.py install
```

## Design

`configfiles` works on a model of storing and incrementally updating config files, or more accurately scripts to update config files.
These scripts are usually autogenerated from file changes, but can be customized to do things like install dependencies or fill-in system
specific information.

Unlike git, the updates to these files are stored as a sequence of scripts, as opposed to a graph of diffs. This makes for less powerful
branching, but a much simpler internal model. In future versions this may be amended, but it works better for something based around scripts.

The scripts in question are not actually shell scripts, rather small pieces of python for better interoperability. Most of the time they are
auto-generated.

---
Be aware that when using configfiles you open yourself to running arbitrary python code at the same privilege as your account, and
be sure to only `sync` to trusted repos

---

## Usage

There are a few main operations in configfiles, the first being `sync`, which updates a system to the latest version of a config repo.

---
Do note that once `sync`-ed to a repo, one must `desync` to use another one

---

```
$ configfiles sync config.someserver.url:repo/path
```

The server path may be omitted to use the last `sync`-ed server.

To update a configfiles repo, one may use the `update` operation, which takes the diff of a file and adds it as a script. The net result
is that the file is "checked-in" to the repo.

```
$ configfiles update .zshrc
```

---
Do note that configfiles paths operate relative to the current user folder by default, and `update` will warn against adding files below the home directory.

---

To use a custom python script as an update method, use `add`.

```
$ configfiles add my_updater.py modifies_file.rc
```

Scripts are ran in the home directory, with full access guaranteed to the configfiles public API.

To revert a change made by `sync`, use `rollback`.

```
$ configfiles rollback <number of changes>

or (with caution)

$ configfiles rollback --remote <number of changes>
```

---
Do note that rollback only cares about files, and there is currently no way to create transactional scripts (i.e. a custom rollback script)
The main purpose of the scripting functionality is to customize files for machine-specific things, which is why it is designed this way.

---

Before using any of the above, a configfiles repo must be `init`-ed.

`init` creates a new repo with no additional scripts.

```
$ configfiles init config.someserver.url:repo/path
$ configfiles sync config.someserver.url:repo/path
$ configfiles update .zshrc <etc>
```

## Further documentation

TODO, refer to code comments for more information

## Server requirements

A server hosting a configfiles repo must support sftp, and that is it. There is no "configfiles server", the entire system's code is client-only


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

configfiles-0.2.0.linux-x86_64.tar.gz (20.8 kB view hashes)

Uploaded Source

Built Distribution

configfiles-0.2.0-py3-none-any.whl (15.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page