{"id":20487169,"url":"https://github.com/fdocr/martilla","last_synced_at":"2025-04-13T15:25:41.038Z","repository":{"id":38190935,"uuid":"214251028","full_name":"fdocr/martilla","owner":"fdocr","description":"Easy to configure DB backup tool for simple everyday use on UNIX based systems","archived":false,"fork":false,"pushed_at":"2022-06-09T15:52:26.000Z","size":99,"stargazers_count":10,"open_issues_count":4,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T11:12:38.783Z","etag":null,"topics":["backup","backup-utility","cli","database","ruby","ruby-gem"],"latest_commit_sha":null,"homepage":"https://visualcosita.com/martilla-tool-for-db-backups/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fdocr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-10T18:00:35.000Z","updated_at":"2022-07-13T02:02:37.000Z","dependencies_parsed_at":"2022-08-18T18:00:53.019Z","dependency_job_id":null,"html_url":"https://github.com/fdocr/martilla","commit_stats":null,"previous_names":["fdoxyz/martilla"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fdocr%2Fmartilla","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fdocr%2Fmartilla/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fdocr%2Fmartilla/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fdocr%2Fmartilla/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fdocr","download_url":"https://codeload.github.com/fdocr/martilla/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248734066,"owners_count":21153141,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backup","backup-utility","cli","database","ruby","ruby-gem"],"created_at":"2024-11-15T16:40:12.687Z","updated_at":"2025-04-13T15:25:41.012Z","avatar_url":"https://github.com/fdocr.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Martilla\n\nMartilla is a tool to automate your backups. With simple but flexible configuration options you can have a database backup configured to run (using cron jobs or similar). Receive a notification whenever a backup fails, choose multiple ways of getting notified (i.e. email + slack).\n\nThe name Martilla comes from a local name for the [Kinkajou](https://en.wikipedia.org/wiki/Kinkajou). This nocturnal animal goes fairly unnoticed, just like we hope database backups should remain.\n\n## Table of Contents\n\n1. [Installation](https://github.com/fdoxyz/martilla#installation)\n2. [Usage](https://github.com/fdoxyz/martilla#usage)\n   * [Databases](https://github.com/fdoxyz/martilla#databases)\n   * [Storages](https://github.com/fdoxyz/martilla#storages)\n   * [Notifiers](https://github.com/fdoxyz/martilla#notifiers)\n   * [Perform a backup](https://github.com/fdoxyz/martilla#perform-a-backup)\n3. [Contributing](https://github.com/fdoxyz/martilla#contributing)\n5. [License](https://github.com/fdoxyz/martilla#license)\n6. [Code of Conduct](https://github.com/fdoxyz/martilla#code-of-conduct)\n\n## Installation\n\nTo use as a CLI tool\n\n    $ gem install martilla\n\nOr add this line to your application's Gemfile:\n\n```ruby\ngem 'martilla'\n```\n\n## Usage\n\nMartilla uses a YAML configuration file that specifies the backup to be performed. The gem works by making three main concepts work together, they're listed out with details that should generally be specified in the config file:\n\n - **Database**\n   - What database are we going to backup\n   - How can we connect to the database\n - **Storage**\n   - Where is this backup going to be stored\n   - Credentials needed to persist the backup\n - **Notifiers**\n   - How will you get notified of the backup result\n   - Can be a list of multiple ways to get notified\n\nExecute `martilla setup backup-config.yml` and you'll have your first (default) config file that looks like the following:\n\n```yaml\n---\ndb:\n  type: postgres\n  options:\n    host: localhost\n    user: username\n    password: password\n    db: databasename\nstorage:\n  type: local\n  options:\n    filename: database-backup.sql\nnotifiers:\n- type: none\n```\n\nFrom here on you pick the building blocks that work for your specific case:\n\n### Databases\n\nCurrently available DB types to choose from are **postgres** \u0026 **mysql**. They both have the same available options:\n - `host`\n   - defaults to localhost\n   - can be set in ENV variable `PG_HOST` or `MYSQL_HOST`\n - `user`\n   - required\n   - can be set in ENV variable `PG_USER` or `MYSQL_USER`\n - `password`\n   - required\n   - can be set in ENV variable `PG_PASSWORD` or `MYSQL_PASSWORD`\n - `db`\n   - required\n   - can be set in ENV variable `PG_DATABASE` or `MYSQL_DATABASE`\n - `port`\n   - defaults to 5432 or 3306\n   - can be set in ENV variable `PG_USER` or `MYSQL_USER`\n\n### Storages\n\nThe available Storages types are **local**, **S3** \u0026 **SCP**. They each have different available options:\n - options for type: **local**\n   - `filename`\n     - The location to where the backup will be stored\n   - `retention`\n     - An integer that defines the max number of backups stored at the defined location\n - options for type: **s3**\n   - `filename`\n     - The location to where the backup will be stored within the S3 bucket\n   - `bucket`\n   - `region`\n   - `access_key_id`\n     - can be specified with the usual ENV variables or IAM roles\n   - `secret_access_key`\n     - can be specified with the usual ENV variables or IAM roles\n   - `retention`\n     - An integer that defines the max number of backups stored at the defined location\n     - **IMPORTANT NOTE:** Releases in `v0.3.x` added a bug where the s3 storage option **might delete other files when enforcing retention**. Make sure you're using `v0.4.x` or newer if you want to enforce a retention limit. More details [here](https://github.com/fdoxyz/martilla/issues/18)\n - options for type: **scp**\n   - `filename`\n     - The location to where the backup will be stored within remote server\n   - `host`\n   - `user`\n   - `identity_file`\n   - `retention`\n     - Not implemented for this storage ([see #12](https://github.com/fdoxyz/martilla/issues/12))\n\nAll storage types also accept 'suffix' as a boolean that enables or disables a timestamp to be added as a suffix to the backup 'filename', it defaults as `true`.\n\n### Notifiers\n\nThe available Notifiers are **ses**, **sendmail** \u0026 **smtp**. They each have different available options:\n  - options for type: **ses** (email notifier)\n    - `aws_region`\n    - `access_key_id`\n      - can be specified with the usual ENV variables or IAM role\n    - `secret_access_key`\n      - can be specified with the usual ENV variables or IAM roles\n  - options for type: **sendmail** (email notifier)\n    - no custom options\n  - options for type: **smtp** (email notifier)\n    - `address`\n    - `domain`\n    - `user_name`\n    - `password`\n  - options for type: **slack**\n    - `slack_webhook_url`\n      - required\n      - more info [here](https://api.slack.com/messaging/webhooks)\n    - `slack_channel`\n      - defaults to `#general`\n      - the channel to post the backup notifications\n    - `slack_username`\n      - defaults to `Martilla`\n      - the username which backup notifications will be posted with\n\nAll of the previous **email notifiers** also have the following options that can be customized:\n  - `to`\n    - a list of comma separated emails to be notified\n  - `from`\n    - defaults to 'martilla@no-reply.com'\n  - `success_subject`\n    - the subject of the success email\n  - `failure_subject`\n    - the subject of the failure email\n\nAlso **ALL** notifiers have the following two options\n  - `send_success`\n    - `Boolean` value that will disable notifications on success when set to false. Defaults to `true`\n  - `send_failure`\n    - `Boolean` value that will disable notifications on failure when set to false. Defaults to `true`\n\nIt's **HIGHLY RECOMMENDED** to test and make sure emails are being delivered correctly to each target inbox. Emails with standard messages like these automated backup notifications tend to be easily marked as spam.\n\n### Perform a backup\n\nAs simple as running the `backup` command on the martilla CLI and passing as argument the configuration file you want to use\n\n    $ martilla backup backup-config.yml\n\nHelp the help command help you\n\n    $ martilla help\n\n## Contributing\n\nCheck out our [contributing guide](https://github.com/fdoxyz/martilla/blob/master/CONTRIBUTING.md)\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the Martilla project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/fdoxyz/martilla/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffdocr%2Fmartilla","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffdocr%2Fmartilla","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffdocr%2Fmartilla/lists"}