https://github.com/fernandes/caco
Caco, The Frog 🐸
https://github.com/fernandes/caco
Last synced: 17 days ago
JSON representation
Caco, The Frog 🐸
- Host: GitHub
- URL: https://github.com/fernandes/caco
- Owner: fernandes
- License: mit
- Created: 2019-11-19T14:30:40.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-09T14:00:17.000Z (8 months ago)
- Last Synced: 2025-03-27T00:33:50.903Z (about 1 month ago)
- Language: Ruby
- Homepage:
- Size: 1.1 MB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Caco
Configure your machines like you develop your web apps
## Usage aka Control Repo
To start using `Caco`, you need a control repo, that is where you add your node config files, keys, certs, whatever makes sense to you.
Create a new `Gemfile` with `bundle init` and add to it:
```ruby
gem 'caco'
```After you can add your config files under `nodes` folder, with each file being the hostname of your machines:
```
nodes/
web.example.com.rb
db.example.com.rb
```This is the minimum you need to start using Caco, a hello world example would be, in `nodes/.rb` add
```ruby
Caco.file "/root/hello.txt",
content: "Hello World From Caco :)"
```Sync your control repo to your remote machine and run `./bin/caco` inside its folder, it will create the `/root/hello.txt` file with `Hello World From Caco :)` content
## Data
It's useful to share data between your nodes, you can do this on the `data` folder, you can add yaml files and access inside your config files.
It also has a hierarchy, most specific values overwrite more generic value, files from common to specific are:
- data/common.yaml
- data/.yaml
- data//.yaml
- data/nodes/.yamlYou can also encrypt values with your keys, for the first time you can create them with `eyaml createkeys` command, you add the files:
- keys/private_key.pkcs7.pem
- keys/public_key.pkcs7.pemAfter that you can edit your yaml files with the command `eyaml edit path/to/file.yaml`
It's safe to commit your encrypted yaml files, but remember to never commit your keys, the `keys` folder is also on gitignore.
On your server you also need to sync the `keys` folder to be able to read the values when configuring the nodes.
To read the values, as they are organized as yaml files, considering the structure:
```yaml
# common.yaml
---
prefix:
name: Common
``````yaml
# nodes/hostname.yaml
---
prefix:
name: Hostname
```(as node file is more specific it overwrites the common.yaml value)
```ruby
Caco::Facter.("prefix", "name")
# => 'Hostname'
```## Configuration
Caco configuration can be set using environment variables, all variables should have the prefix `CACO_`, eg. to change the `LOG_FILE` value, use `CACO_LOG_FILE=/path/to/caco.log`
See a better description to each config option after the list
- `INTERACTIVE_WRITES` : Ask what action should take when changing an existing file
- `LOG_FILE` : Path to log file### INTERACTIVE_WRITES
This is useful to understand how Caco is executing, on the images we have an example when file is being changed. The second one if after is confirmed to change the file

### LOG_FILE
By default we log to `/var/log/caco.log`, but sometimes you maybe want to log to a different location, so here is the place to point to your destination
## Roadmap
- [ ] Bootstrap control repo via CLI
- [ ] Sync remote control repo
- [ ] Run automatically from developer machine
- [ ] Add operations to run as a _health check_ after the config process to ensure it's working as expected (that can also be used as acceptance test in development environment)## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
## Code of Conduct
Everyone interacting in the Caco project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/fernandes/caco/blob/master/CODE_OF_CONDUCT.md).