Skip to content

Commit f36caf1

Browse files
author
Carme, Pamy
committed
init commit
0 parents  commit f36caf1

1 file changed

Lines changed: 104 additions & 0 deletions

File tree

README.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
Stack Config
2+
===============================
3+
4+
version number: 0.1.0
5+
author: ScienceLogic
6+
7+
Overview
8+
--------
9+
10+
Merge and compile jinja2 template compose files
11+
12+
Installation / Usage
13+
--------------------
14+
15+
To install use pip:
16+
17+
$ pip install stackconfig
18+
19+
20+
Or clone the repo:
21+
22+
$ git clone https://github.com/Sciencelogic/stackconfig.git
23+
$ python setup.py install
24+
25+
26+
Development
27+
-----------
28+
1. Fork
29+
2. Set Dev Environment
30+
```shell script
31+
pip install -r dev_requirements.txt
32+
pip install -r requirements.txt
33+
pip install -e .
34+
git checkout -b feature-more-cool-stuff
35+
```
36+
Test
37+
----
38+
```shell script
39+
# run tests using tox
40+
tox
41+
# run tests with pytest
42+
pytest
43+
```
44+
Version
45+
-------
46+
```
47+
bumpversion major # major release
48+
or
49+
bumpversion minor # minor release
50+
or
51+
bumpversion patch # hotfix release
52+
53+
git push origin release-n.n.0
54+
or
55+
git push origin hotfix-x.x.n
56+
```
57+
Contributing
58+
------------
59+
60+
TBD
61+
62+
63+
64+
Example
65+
-------
66+
67+
```shell
68+
$ stackconfig --help
69+
Usage: stackconfig [OPTIONS]
70+
71+
Options:
72+
-f, --file PATH docker-compose file to be merged. Accept multiple
73+
arguments.
74+
-o, --output PATH Output path for the final docker-compose file
75+
[default: /tmp/docker-compose-20220425-16-49-16.yml]
76+
-d, --j2data PATH Yaml file that contains variables to render the
77+
provided jinja2 template.
78+
-t, --j2template PATH Jinja2 template that needs to be a valid docker-
79+
compose file after being rendered.
80+
--version TEXT Set valid version for the final docker-compose file
81+
--help Show this message and exit.
82+
83+
```
84+
85+
```
86+
$ stackconfig -f docker-compose.yml -f docker-compose-verrideyml -t docker-compose-valid-template.yml.j2 -d data_file.yml --version 3.8 -o docker-compose.yml
87+
```
88+
89+
Example using python code
90+
-------------------------
91+
```python
92+
from stackconfig.stackconfig import StackConfigCompose, render_jijnja2_compose
93+
94+
jinja_env = {}
95+
yml_compiled_files = render_jijnja2_compose(['/tmp/docker-compose.yml.j2',
96+
'/tmp/docker-compose-override-yml.j2'],
97+
data_file='/tmp/data_file.yml',
98+
data_dict=jinja_env)
99+
# valid docker-compose files can be append, as all of them
100+
yml_compiled_files.append("/tmp/docker-copmose-override2.yml")
101+
stack_config = StackConfigCompose(yml_compiled_files, '/tmp/docker-compose-output.yml')
102+
stack_config.merge_stack_compose()
103+
104+
```

0 commit comments

Comments
 (0)