Skip to content

Commit 72fa94b

Browse files
committed
Working basic features
1 parent 317c06f commit 72fa94b

31 files changed

+845
-185
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ __pycache__/
88

99
*~
1010
.idea/
11+
docs/ecs_files_*.rst
1112

1213
# Distribution / packaging
1314
.Python

CONTRIBUTING.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Types of Contributions
1515
Report Bugs
1616
~~~~~~~~~~~
1717

18-
Report bugs at https://github.com/compose-x/ecs_config_composer/issues.
18+
Report bugs at https://github.com/compose-x/ecs_files_composer/issues.
1919

2020
If you are reporting a bug, please include:
2121

@@ -45,7 +45,7 @@ articles, and such.
4545
Submit Feedback
4646
~~~~~~~~~~~~~~~
4747

48-
The best way to send feedback is to file an issue at https://github.com/compose-x/ecs_config_composer/issues.
48+
The best way to send feedback is to file an issue at https://github.com/compose-x/ecs_files_composer/issues.
4949

5050
If you are proposing a feature:
5151

@@ -57,17 +57,17 @@ If you are proposing a feature:
5757
Get Started!
5858
------------
5959

60-
Ready to contribute? Here's how to set up `ecs_config_composer` for local development.
60+
Ready to contribute? Here's how to set up `ecs_files_composer` for local development.
6161

62-
1. Fork the `ecs_config_composer` repo on GitHub.
62+
1. Fork the `ecs_files_composer` repo on GitHub.
6363
2. Clone your fork locally::
6464

65-
$ git clone [email protected]:your_name_here/ecs_config_composer.git
65+
$ git clone [email protected]:your_name_here/ecs_files_composer.git
6666

6767
3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development::
6868

69-
$ mkvirtualenv ecs_config_composer
70-
$ cd ecs_config_composer/
69+
$ mkvirtualenv ecs_files_composer
70+
$ cd ecs_files_composer/
7171
$ python setup.py develop
7272

7373
4. Create a branch for local development::
@@ -79,7 +79,7 @@ Ready to contribute? Here's how to set up `ecs_config_composer` for local develo
7979
5. When you're done making changes, check that your changes pass flake8 and the
8080
tests, including testing other Python versions with tox::
8181

82-
$ flake8 ecs_config_composer tests
82+
$ flake8 ecs_files_composer tests
8383
$ python setup.py test or pytest
8484
$ tox
8585

@@ -103,15 +103,15 @@ Before you submit a pull request, check that it meets these guidelines:
103103
your new functionality into a function with a docstring, and add the
104104
feature to the list in README.rst.
105105
3. The pull request should work for Python 3.5, 3.6, 3.7 and 3.8, and for PyPy. Check
106-
https://travis-ci.com/compose-x/ecs_config_composer/pull_requests
106+
https://travis-ci.com/compose-x/ecs_files_composer/pull_requests
107107
and make sure that the tests pass for all supported Python versions.
108108

109109
Tips
110110
----
111111

112112
To run a subset of tests::
113113

114-
$ pytest tests.test_ecs_config_composer
114+
$ pytest tests.test_ecs_files_composer
115115

116116

117117
Deploying

Dockerfile

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1+
ARG ARCH=
12
ARG PY_VERSION=3.8
23
ARG BASE_IMAGE=public.ecr.aws/ews-network/python:${PY_VERSION}
3-
FROM $BASE_IMAGE
4+
ARG LAMBDA_IMAGE=public.ecr.aws/lambda/python:latest
5+
FROM $BASE_IMAGE as builder
46

5-
RUN yum upgrade -y ; \
6-
yum install -y shadow-utils ; \
7-
groupadd -r app -g 1042 && \
8-
useradd -u 1042 -r -g app -m -d /app -s /sbin/nologin -c "App user" app && \
9-
chown -R app: /app && \
10-
yum erase shadow-utils -y && yum clean all && rm -rfv /var/cache/yum
7+
WORKDIR /opt
8+
COPY ecs_config_composer /opt/ecs_config_composer
9+
COPY setup.py requirements.txt MANIFEST.in README.rst LICENSE /opt/
10+
RUN python -m venv venv ; source venv/bin/activate ; pip install wheel; python setup.py sdist bdist_wheel; ls -l dist/
1111

12+
FROM $BASE_IMAGE
1213

14+
RUN yum upgrade -y
15+
ENV PATH=/app/.local/bin:${PATH}
16+
COPY --from=builder /opt/dist/ecs_config_composer-*.whl ${LAMBDA_TASK_ROOT:-/app/}/
1317
WORKDIR /app
14-
USER app
15-
ENTRYPOINT ["ecs-config-composer"]
18+
RUN echo $PATH ; pip install pip -U --no-cache-dir && pip install wheel --no-cache-dir && pip install *.whl --no-cache-dir
19+
WORKDIR /
20+
ENTRYPOINT ["ecs_config_composer"]
1621
CMD ["--env", "CONFIG"]

HISTORY.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
History
33
=======
44

5-
0.0.1 (2021-07-12)
5+
0.0.1 (2021-07-15)
66
------------------
77

88
* First release on PyPI.

MANIFEST.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ include CONTRIBUTING.rst
33
include HISTORY.rst
44
include LICENSE
55
include README.rst
6-
include ecs-config-input.json
6+
include USAGE.rst
7+
include NOTICES.rst
8+
include requirements*.txt
9+
include ecs-files-input.json
710

811
recursive-include tests *
912
recursive-exclude * __pycache__

Makefile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ clean-test: ## remove test and coverage artifacts
4848
rm -fr .pytest_cache
4949

5050
lint: ## check style with flake8
51-
flake8 ecs_config_composer tests
51+
flake8 ecs_files_composer tests
5252

5353
test: ## run tests quickly with the default Python
5454
pytest
@@ -57,15 +57,15 @@ test-all: ## run tests on every Python version with tox
5757
tox
5858

5959
coverage: ## check code coverage quickly with the default Python
60-
coverage run --source ecs_config_composer -m pytest
60+
coverage run --source ecs_files_composer -m pytest
6161
coverage report -m
6262
coverage html
6363
$(BROWSER) htmlcov/index.html
6464

6565
docs: ## generate Sphinx HTML documentation, including API docs
66-
rm -f docs/ecs_config_composer.rst
66+
rm -f docs/ecs_files_composer.rst
6767
rm -f docs/modules.rst
68-
sphinx-apidoc -o docs/ ecs_config_composer
68+
sphinx-apidoc -o docs/ ecs_files_composer
6969
$(MAKE) -C docs clean
7070
$(MAKE) -C docs html
7171
$(BROWSER) docs/_build/html/index.html
@@ -89,12 +89,12 @@ install: clean ## install the package to the active Python's site-packages
8989
python setup.py install
9090

9191
conform : ## Conform to a standard of coding syntax
92-
isort --profile black ecs_config_composer
93-
black ecs_config_composer tests setup.py
94-
find ecs_config_composer -name "*.json" -type f -exec sed -i '1s/^\xEF\xBB\xBF//' {} +
92+
isort --profile black ecs_files_composer
93+
black ecs_files_composer tests setup.py
94+
find ecs_files_composer -name "*.json" -type f -exec sed -i '1s/^\xEF\xBB\xBF//' {} +
9595

9696
data-model:
97-
datamodel-codegen --input ecs-config-input.json \
97+
datamodel-codegen --input ecs-files-input.json \
9898
--input-file-type jsonschema \
99-
--output ecs_config_composer/input.py
99+
--output ecs_files_composer/input.py
100100
# --enum-field-as-literal all

README.rst

Lines changed: 61 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
===================
2-
ECS Config Composer
2+
ECS Files Composer
33
===================
44

55

@@ -15,12 +15,67 @@ ECS Config Composer
1515
Files and configuration handler to inject configuration files into volumes for ECS containers.
1616
------------------------------------------------------------------------------------------------------
1717

18-
* Free software: MPL2.0
19-
* Documentation: https://ecs-config-composer.compose-x.io.
18+
Usage
19+
=======
2020

21+
.. code-block:: bash
22+
23+
24+
usage: ecs_files_composer [-h] [-f FILE_PATH | -e ENV_VAR | --from-ssm SSM_CONFIG | --from-s3 S3_CONFIG] [--role-arn ROLE_ARN] [_ ...]
25+
26+
positional arguments:
27+
_
28+
29+
optional arguments:
30+
-h, --help show this help message and exit
31+
-f FILE_PATH, --from-file FILE_PATH
32+
Configuration for execution from a file
33+
-e ENV_VAR, --from-env-var ENV_VAR
34+
Configuration for execution is in an environment variable
35+
--from-ssm SSM_CONFIG
36+
Configuration for execution is in an SSM Parameter
37+
--from-s3 S3_CONFIG Configuration for execution is in an S3
38+
--role-arn ROLE_ARN The Role ARN to use for the configuration initialization
39+
40+
41+
Example inputs
42+
===============
43+
44+
.. code-block:: yaml
45+
46+
files:
47+
/opt/app/test.txt:
48+
content: >-
49+
test from a yaml raw content
50+
owner: john
51+
group: root
52+
mode: 600
53+
/opt/app/aws.template:
54+
source:
55+
S3:
56+
BucketName: ${BUCKET_NAME:-sacrificial-lamb}
57+
Key: aws.yml
58+
59+
/opt/app/ssm.txt:
60+
source:
61+
Ssm:
62+
ParameterName: /cicd/shared/kms/arn
63+
commands:
64+
post:
65+
- file /opt/app/ssm.txt
66+
67+
/opt/app/secret.txt:
68+
source:
69+
Secret:
70+
SecretId: GHToken
71+
72+
.. attention::
73+
74+
The default user is root to avoid running into issues when using chmod/chown and other commands.
75+
Change behaviour at your own risks.
2176
2277
Features
23-
--------
78+
=========
2479
25-
* Pulls configuration files from S3 and inject into volumes
26-
* Pulls template files and render based on configuration or environment variables
80+
* Pulls configuration files from SSM | S3 | Secrets Manager | and inject into volumes
81+
* Allows to use environment variables for your YAML values. Limited operations.

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# You can set these variables from the command line.
55
SPHINXOPTS =
66
SPHINXBUILD = python -msphinx
7-
SPHINXPROJ = ecs_config_composer
7+
SPHINXPROJ = ecs_files_composer
88
SOURCEDIR = .
99
BUILDDIR = _build
1010

docs/conf.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python
22
#
3-
# ecs_config_composer documentation build configuration file, created by
3+
# ecs_files_composer documentation build configuration file, created by
44
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
55
#
66
# This file is execfile()d with the current directory set to its
@@ -22,7 +22,7 @@
2222

2323
sys.path.insert(0, os.path.abspath('..'))
2424

25-
import ecs_config_composer
25+
import ecs_files_composer
2626

2727
# -- General configuration ---------------------------------------------
2828

@@ -56,9 +56,9 @@
5656
# the built documents.
5757
#
5858
# The short X.Y version.
59-
version = ecs_config_composer.__version__
59+
version = ecs_files_composer.__version__
6060
# The full version, including alpha/beta/rc tags.
61-
release = ecs_config_composer.__version__
61+
release = ecs_files_composer.__version__
6262

6363
# The language for content autogenerated by Sphinx. Refer to documentation
6464
# for a list of supported languages.
@@ -125,8 +125,8 @@
125125
"color_primary": "blue",
126126
"color_accent": "light-blue",
127127
# Set the repo location to get a badge with stats
128-
"repo_url": "https://github.com/compose-x/ecs_config_composer/",
129-
"repo_name": "compose-x/ecs_config_composer",
128+
"repo_url": "https://github.com/compose-x/ecs_files_composer/",
129+
"repo_name": "compose-x/ecs_files_composer",
130130
"repo_type": "github",
131131
# Visible levels of the global TOC; -1 means unlimited
132132
"globaltoc_depth": 2,
@@ -146,7 +146,7 @@
146146
# -- Options for HTMLHelp output ---------------------------------------
147147

148148
# Output file base name for HTML help builder.
149-
htmlhelp_basename = 'ecs_config_composerdoc'
149+
htmlhelp_basename = 'ecs_files_composerdoc'
150150

151151

152152
# -- Options for LaTeX output ------------------------------------------
@@ -170,14 +170,14 @@
170170
# (source start file, target name, title, author, documentclass
171171
# [howto, manual, or own class]).
172172
latex_documents = [
173-
(master_doc, 'ecs_config_composer.tex', 'ECS Config Composer Documentation', 'John Preston', 'manual'),
173+
(master_doc, 'ecs_files_composer.tex', 'ECS Config Composer Documentation', 'John Preston', 'manual'),
174174
]
175175

176176
# -- Options for manual page output ------------------------------------
177177

178178
# One entry per manual page. List of tuples
179179
# (source start file, name, description, authors, manual section).
180-
man_pages = [(master_doc, 'ecs_config_composer', 'ECS Config Composer Documentation', [author], 1)]
180+
man_pages = [(master_doc, 'ecs_files_composer', 'ECS Config Composer Documentation', [author], 1)]
181181

182182
# -- Options for Texinfo output ----------------------------------------
183183

@@ -187,10 +187,10 @@
187187
texinfo_documents = [
188188
(
189189
master_doc,
190-
'ecs_config_composer',
190+
'ecs_files_composer',
191191
'ECS Config Composer Documentation',
192192
author,
193-
'ecs_config_composer',
193+
'ecs_files_composer',
194194
'One line description of project.',
195195
'Miscellaneous',
196196
),

docs/ecs_config_composer.rst

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)