stackconfig


Namestackconfig JSON
Version 1.0.2 PyPI version JSON
download
home_pagehttps://github.com/Sciencelogic/stackconfig
SummaryRender, merge and validate docker_compose files for deploying a stack
upload_time2024-11-06 20:27:06
maintainerNone
docs_urlNone
authorSciencelogic
requires_pythonNone
licenseBSD
keywords stackconfig docker-compose-config compose-jinja2 docker-compose-jinja2
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Stack Config
===============================

version number: 0.1.0
author: ScienceLogic

Overview
--------

Render, merge and validate docker_compose files for deploying a stack.

This library is using docker-compose merging process, but at the end
it does a final verification to let users know whether this is a valid
docker-compose for deploying a stack or not, as docker-compose doesn't validate that.

Additionally, this library will compile valid yaml jinja2 templates, so they can
be merged along with the other docker-compose files.

Installation
------------

To install use pip:

    $ pip install stackconfig


Or clone the repo:

    $ git clone https://github.com/Sciencelogic/stackconfig.git
    $ python setup.py install


Development
-----------
1. Fork
2. Set Dev Environment
```shell script
pip install -r dev_requirements.txt
pip install -r requirements.txt
pip install -e .
git checkout -b feature-more-cool-stuff
```
Test
----
```shell script
# run tests using tox
tox
# run tests with pytest
pytest
```
Version
-------
```
bumpversion major  # major release
or
bumpversion minor  # minor release
or
bumpversion patch  # hotfix release

git push origin release-n.n.0
or
git push origin hotfix-x.x.n
```

Usage example as cli tool 
-------------------------

```shell
$ stackconfig --help
Usage: stackconfig [OPTIONS]

Options:
  -f, --file PATH        docker-compose file to be merged. Accept multiple
                         arguments.
  -o, --output PATH      Output path for the final docker-compose file
                         [default: /tmp/docker-compose-20220425-16-49-16.yml]
  -d, --j2data PATH      Yaml file that contains variables to render the
                         provided jinja2 template.
  -t, --j2template PATH  Jinja2 template that needs to be a valid docker-
                         compose file after being rendered.
  --version TEXT         Set valid version for the final docker-compose file
  --help                 Show this message and exit.

```

```
$ stackconfig -f docker-compose.yml -f compose-override.yml -t docker-compose-template.yml.j2 -d data_file.yml --version 3.8 -o docker-compose-final.yml
```

Usage example using Python
--------------------------
```python
from stackconfig.stackconfig import StackConfigCompose
from stackconfig.utils.jinja2_utils import render_jijnja2_compose

jinja_env = {}
yml_compiled_files = render_jijnja2_compose(['/tmp/docker-compose.yml.j2',
                                             '/tmp/docker-compose-override-yml.j2'],
                                            data_file='/tmp/data_file.yml',
                                            data_dict=jinja_env)
# valid docker-compose files can be appended, all of them are going to be merged using the docker-compose library
yml_compiled_files.append("/tmp/docker-copmose-override2.yml")
stack_config = StackConfigCompose(yml_compiled_files, '/tmp/docker-compose-output.yml')
stack_config.merge_stack_compose()

```

Not Exactly What You Want?
----------------------------

Options that may be a good fit for you:

- https://github.com/sinzlab/jinja-compose
- https://github.com/Aisbergg/python-docker-compose-templer
- https://github.com/docker/compose

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Sciencelogic/stackconfig",
    "name": "stackconfig",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "stackconfig, docker-compose-config, compose-jinja2, docker-compose-jinja2",
    "author": "Sciencelogic",
    "author_email": null,
    "download_url": "https://github.com/Sciencelogic/stackconfig/tarball/",
    "platform": null,
    "description": "Stack Config\n===============================\n\nversion number: 0.1.0\nauthor: ScienceLogic\n\nOverview\n--------\n\nRender, merge and validate docker_compose files for deploying a stack.\n\nThis library is using docker-compose merging process, but at the end\nit does a final verification to let users know whether this is a valid\ndocker-compose for deploying a stack or not, as docker-compose doesn't validate that.\n\nAdditionally, this library will compile valid yaml jinja2 templates, so they can\nbe merged along with the other docker-compose files.\n\nInstallation\n------------\n\nTo install use pip:\n\n    $ pip install stackconfig\n\n\nOr clone the repo:\n\n    $ git clone https://github.com/Sciencelogic/stackconfig.git\n    $ python setup.py install\n\n\nDevelopment\n-----------\n1. Fork\n2. Set Dev Environment\n```shell script\npip install -r dev_requirements.txt\npip install -r requirements.txt\npip install -e .\ngit checkout -b feature-more-cool-stuff\n```\nTest\n----\n```shell script\n# run tests using tox\ntox\n# run tests with pytest\npytest\n```\nVersion\n-------\n```\nbumpversion major  # major release\nor\nbumpversion minor  # minor release\nor\nbumpversion patch  # hotfix release\n\ngit push origin release-n.n.0\nor\ngit push origin hotfix-x.x.n\n```\n\nUsage example as cli tool \n-------------------------\n\n```shell\n$ stackconfig --help\nUsage: stackconfig [OPTIONS]\n\nOptions:\n  -f, --file PATH        docker-compose file to be merged. Accept multiple\n                         arguments.\n  -o, --output PATH      Output path for the final docker-compose file\n                         [default: /tmp/docker-compose-20220425-16-49-16.yml]\n  -d, --j2data PATH      Yaml file that contains variables to render the\n                         provided jinja2 template.\n  -t, --j2template PATH  Jinja2 template that needs to be a valid docker-\n                         compose file after being rendered.\n  --version TEXT         Set valid version for the final docker-compose file\n  --help                 Show this message and exit.\n\n```\n\n```\n$ stackconfig -f docker-compose.yml -f compose-override.yml -t docker-compose-template.yml.j2 -d data_file.yml --version 3.8 -o docker-compose-final.yml\n```\n\nUsage example using Python\n--------------------------\n```python\nfrom stackconfig.stackconfig import StackConfigCompose\nfrom stackconfig.utils.jinja2_utils import render_jijnja2_compose\n\njinja_env = {}\nyml_compiled_files = render_jijnja2_compose(['/tmp/docker-compose.yml.j2',\n                                             '/tmp/docker-compose-override-yml.j2'],\n                                            data_file='/tmp/data_file.yml',\n                                            data_dict=jinja_env)\n# valid docker-compose files can be appended, all of them are going to be merged using the docker-compose library\nyml_compiled_files.append(\"/tmp/docker-copmose-override2.yml\")\nstack_config = StackConfigCompose(yml_compiled_files, '/tmp/docker-compose-output.yml')\nstack_config.merge_stack_compose()\n\n```\n\nNot Exactly What You Want?\n----------------------------\n\nOptions that may be a good fit for you:\n\n- https://github.com/sinzlab/jinja-compose\n- https://github.com/Aisbergg/python-docker-compose-templer\n- https://github.com/docker/compose\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Render, merge and validate docker_compose files for deploying a stack",
    "version": "1.0.2",
    "project_urls": {
        "Download": "https://github.com/Sciencelogic/stackconfig/tarball/",
        "Homepage": "https://github.com/Sciencelogic/stackconfig"
    },
    "split_keywords": [
        "stackconfig",
        " docker-compose-config",
        " compose-jinja2",
        " docker-compose-jinja2"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "45b62c37b0717cd398cf0f1614452436b336f1c118b4ed9188fb0cca881e0810",
                "md5": "b9113a6736072acbdf70d0832f6342b2",
                "sha256": "0ac6c8454411bbf4241016e1fb92da1a9de22a98aed300bedfb75ac70bed2742"
            },
            "downloads": -1,
            "filename": "stackconfig-1.0.2-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b9113a6736072acbdf70d0832f6342b2",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 7279,
            "upload_time": "2024-11-06T20:27:06",
            "upload_time_iso_8601": "2024-11-06T20:27:06.475488Z",
            "url": "https://files.pythonhosted.org/packages/45/b6/2c37b0717cd398cf0f1614452436b336f1c118b4ed9188fb0cca881e0810/stackconfig-1.0.2-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-06 20:27:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Sciencelogic",
    "github_project": "stackconfig",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "stackconfig"
}
        
Elapsed time: 0.36223s