{"id":21357694,"url":"https://github.com/rcbops/sync-formula","last_synced_at":"2025-03-16T06:15:09.301Z","repository":{"id":22685293,"uuid":"26029009","full_name":"rcbops/sync-formula","owner":"rcbops","description":null,"archived":false,"fork":false,"pushed_at":"2014-10-31T19:03:35.000Z","size":125,"stargazers_count":1,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-22T18:30:04.825Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rcbops.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-31T18:52:39.000Z","updated_at":"2014-12-03T19:45:49.000Z","dependencies_parsed_at":"2022-08-17T16:30:26.774Z","dependency_job_id":null,"html_url":"https://github.com/rcbops/sync-formula","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcbops%2Fsync-formula","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcbops%2Fsync-formula/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcbops%2Fsync-formula/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcbops%2Fsync-formula/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rcbops","download_url":"https://codeload.github.com/rcbops/sync-formula/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243830955,"owners_count":20354856,"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":[],"created_at":"2024-11-22T05:10:41.966Z","updated_at":"2025-03-16T06:15:09.273Z","avatar_url":"https://github.com/rcbops.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A salt formula for syncing web files across multiple web servers.\n\nThis formula utilizes lsyncd, csync2, and xinetd.\n\nThese states are very, very version specific.\nOnly tested so far on Ubuntu 12.04, Lsyncd 2.0.4. The lua for the lsyncd\nconfiguration will need to change if using other versions of lsyncd. This\nformula may be altered in the future to provide different lsyncd\nconfigurations for the different versions of lsyncd.\n\n#### Salt-Mine\nThis formula requires the salt-mine in order to function. Each host that is to\nbe synced will need to contribute the ip address of the preferred interface as\nwell as the hostname to the salt mine.\n\nExample salt-mine pillar(should be available for every host that should sync)\n```yaml\nmine_functions:\n  network.ip_addrs: [eth0]\n  grains.get: ['host']\n```\n\n#### Pillar\nThe following example pillar will describe how to customize this formula.\n```yaml\nsync:\n  # Need to indicate how to determine what other minions to sync with.\n  # This will translate to salt['mine.get'](target, some_func, expr_form)\n  # inside of settings.jinja.\n\n  # Default: roles:web\n  target: roles:web\n\n  # Default: grains\n  expr_type: grains\n\n  # Name of the sync group\n  # Default: default\n  group: default\n\n  # List of directories/files to include\n  # Default: []\n  includes:\n    - /var/www/dir1\n    - /var/www/dir2\n\n  # List of directories/files to exclude\n  # Default: []\n  excludes:\n    - /var/www/*log\n\n  # How to resolve conflicts (older, newer, or none)\n  # Default: none\n  conflict: none\n\n# The 'private' interface determines what xinetd binds to.\ninterfaces:\n  # Default: eth0\n  private: eth0\n```\n\n#### How to use\nCreate the csync2 key before running any of the states.\n\n```shell\ncd sync/files/csync2\nsudo bash generate_key.sh\n```\n\nNote: the above method will install csync2 and rng-tools. rng-tools is used\nto create entropy.\n\nIf applying from a top file:\n```shell\nsalt \u003csync-targets\u003e state.highstate\n```\nOr if applying explicitly:\n```shell\nsalt \u003csync-targets\u003e state.sls sync-formula\n```\n\nAlso, minions in the above command will finish at different times and some minions may fail to keep the lsyncd service going (only because the others aren't available yet). You just need to make sure to apply the sync state a second time or run the following:\n```shell\nsalt \u003csync-targets\u003e service.start lsyncd\n```\n\n#### Helpful links\n* [csync2](http://oss.linbit.com/csync2/)\n* [lsyncd](https://code.google.com/p/lsyncd/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frcbops%2Fsync-formula","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frcbops%2Fsync-formula","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frcbops%2Fsync-formula/lists"}