{ "info": { "author": "Denis Ashcheulov", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: System Administrators", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4" ], "description": "============\nR10k webhook\n============\n\nOverview\n--------\n\nIt's the API to `r10k utility `_. With it you can get your puppet code automatically deployed to puppet server after pushing to git. Assumed that you use r10k for deployment puppet environments from git branches and want to get done it automatically after pushing.\n\nServer application works as a daemon, listens at requests and invokes local r10k utility. It's complete wrapper: generates config, launches r10k, controls and performs post-run actions. Client application is launched as VCS hook and calls server application informing about branch which has been pushed.\n\nFeatures\n--------\n\n- Allows **mapping of git branches to puppet environments** using regex. E.g. branch 'master' may be mapped to puppet environment 'production'.\n- Accepts **regex pattern by which name of branch is filtered**. A branch will be deployed only if matches regex.\n- Runs only **one instance of r10k simultaneously. Deduplicates and keeps all requests in a queue**, so that any request won't be missed.\n- **Launches 'generate types'** after r10k for `environment isolation `_.\n- Sends command **flushing cache** for an environment to api of puppet server after r10k has finished.\n- Depends on only one third-party package - pyaml.\n\nGetting started\n---------------\n\nInstallation at puppet server.\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nFirstly, install and set `r10k utility `_ to your repository. Ensure that following command works.\n\n.. code-block:: bash\n\n r10k deploy environment -v\n\n*env_name* has to be name of one of existent branches in your repo.\n\nIf you don't have errors, proceed with installation of r10k-webhook.\n\n.. code-block:: bash\n\n pip3 install r10k-webhook\n systemctl daemon-reload\n\nEnable and start service.\n\n.. code-block:: bash\n\n systemctl enable r10k-webhook\n systemctl start r10k-webhook\n\nCheck logs and status.\n\n.. code-block:: bash\n\n journalctl -xeu r10k-webhook\n curl localhost:8088/status\n\nIf daemon doesn't start, go on with `Configuration`_.\n\nInstallation at VCS.\n~~~~~~~~~~~~~~~~~~~~\n\nInstall the package to server with your repository of puppet code.\n\n.. code-block:: bash\n\n pip3 install r10k-webhook\n\nTrigger your puppet server with .\n\n.. code-block:: bash\n\n r10k_webhook -s -b \n\nTake and as you used at `Installation at puppet server.`_ You should see following output:\n\n.. code-block:: bash\n\n Deployed the branch to 1 servers out of 1.\n\nIt means that your have deployed content of the branch to the directory of environment at puppet server host.\n\nUse with gitolite.\n^^^^^^^^^^^^^^^^^^\n\nCreate list with servers in json file looks like\n\n.. code-block:: json\n\n [\n \"server1\",\n \"server2\"\n ]\n\nAdd a hook to your control repo consists of\n\n.. code-block:: bash\n\n #!/usr/bin/env bash\n r10k_webhook --servers_file \n\n\nConfiguration\n-------------\n\nCreate '/etc/r10k_webhook/config.json' and put there parameters.\n\n- **host** *default: '0.0.0.0'* - Ip-address or hostname, on which http-server listening.\n- **port** *default: 8088* - Port, on which http-server listening.\n- **branch_to_env_map** *default: {}* - Map of name of branch in VCS and associated name of puppet environment. It may be regexp. E.g. '^env_(.\\*)$': '\\\\g<1>' removes prefix `env_` from all branches having it.\n- **allowed_branches** *default: '.\\*'* - Regexp by which name of a branch is filtered. A branch will be deployed if matches regexp.\n- **flush_env_cache** *default: true* - Determines whether send command flushing an environment's cache via puppet api after r10k run.\n- **generate_types** *default: true* - Determines whether launch command '`puppet generate types `_' after r10k run.\n- **initial_deployment** *default: true* - Deployment all environments on start.\n- **override_environment_directories** *default: false* - Removes existent directory of environment before deployment.\n- **r10k_path**: *default: 'r10k'* - Path to r10k binary\n- **puppet_path**: *default: '/opt/puppetlabs/bin/puppet'* - Path to puppet binary\n- **r10k_tmpcfg**: *default: '/tmp/r10k.yaml'* - Path to modified configuration yaml file of r10k being created and used by wrapper.\n- **r10k_args**: *default: '-v'* - String with arguments are passed to r10k at every execution. Spaces are not allowed there.\n- **r10k_config_path**: *default: '/etc/puppetlabs/r10k/r10k.yaml'* - Path to configuration yaml file of r10k.\n- **puppet_api_uri** *default: 'https://localhost:8140/puppet-admin-api/v1'* - URI is called to flush cache of an environment.\n\nService r10k-webhook has to be restarted in order to apply changes of config::\n\n systemctl restart r10k-webhook\n\nExample of configuration file.\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code-block:: json\n\n {\n \"flush_env_cache\": false,\n \"branch_to_env_map\": {\n \"master\": \"production\",\n \"^env_(.*)$\": \"\\g<1>\"\n },\n \"allowed_branches\": \"^(env_[\\w]+|master)$\"\n }\n\nExample of configuration file of r10k.\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code-block:: yaml\n\n :cachedir: /opt/puppetlabs/puppet/cache/r10k\n :sources:\n puppet:\n basedir: /etc/puppetlabs/code/environments\n invalid_branches: error\n remote: git@git.example.net:puppet", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/dashcheulov/r10k-webhook", "keywords": "r10k puppet webhook gitolite git", "license": "GPL-3.0+", "maintainer": "", "maintainer_email": "", "name": "r10k-webhook", "package_url": "https://pypi.org/project/r10k-webhook/", "platform": "", "project_url": "https://pypi.org/project/r10k-webhook/", "project_urls": { "Homepage": "https://github.com/dashcheulov/r10k-webhook" }, "release_url": "https://pypi.org/project/r10k-webhook/0.1.1/", "requires_dist": null, "requires_python": "", "summary": "Wrapper for r10k", "version": "0.1.1" }, "last_serial": 5316131, "releases": { "0.0.6": [ { "comment_text": "", "digests": { "md5": "ecf8299542a9ec0237b11c018934910d", "sha256": "9b5fcba988504a356961352795e4cd728433945be8d6684d186a140a43db0f18" }, "downloads": -1, "filename": "r10k-webhook-0.0.6.tar.gz", "has_sig": false, "md5_digest": "ecf8299542a9ec0237b11c018934910d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9822, "upload_time": "2019-04-11T14:49:20", "url": "https://files.pythonhosted.org/packages/bb/91/0f747bbaf0f99fd094ba9af72d5ea619970b7f56eb963c3c529150578c36/r10k-webhook-0.0.6.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "1d0727bfa3b864f13edeaa6aded80ede", "sha256": "aa8aec872165791fed35cbab74515e1e2930a8a66287c16dae929aeacdfb4f16" }, "downloads": -1, "filename": "r10k-webhook-0.1.0.tar.gz", "has_sig": false, "md5_digest": "1d0727bfa3b864f13edeaa6aded80ede", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9959, "upload_time": "2019-05-23T15:43:14", "url": "https://files.pythonhosted.org/packages/a4/00/bb4e56110f8c4e5575cef2aeeffbca2e3e0cbb8946af01d89997c8320793/r10k-webhook-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "375d7b2bf4b7a25e7053ffd3ef1ddb50", "sha256": "860465c10169b97a2667ea4ea398cdb81dd37f0174bf2f0a4a17b9e19136e09b" }, "downloads": -1, "filename": "r10k-webhook-0.1.1.tar.gz", "has_sig": false, "md5_digest": "375d7b2bf4b7a25e7053ffd3ef1ddb50", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10052, "upload_time": "2019-05-25T11:07:35", "url": "https://files.pythonhosted.org/packages/b8/93/d5fb9afed5ce8818ea986037daea3c7fa8ca00304b92172ca0eb04756db6/r10k-webhook-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "375d7b2bf4b7a25e7053ffd3ef1ddb50", "sha256": "860465c10169b97a2667ea4ea398cdb81dd37f0174bf2f0a4a17b9e19136e09b" }, "downloads": -1, "filename": "r10k-webhook-0.1.1.tar.gz", "has_sig": false, "md5_digest": "375d7b2bf4b7a25e7053ffd3ef1ddb50", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10052, "upload_time": "2019-05-25T11:07:35", "url": "https://files.pythonhosted.org/packages/b8/93/d5fb9afed5ce8818ea986037daea3c7fa8ca00304b92172ca0eb04756db6/r10k-webhook-0.1.1.tar.gz" } ] }