From 6846b27585bd1b86fe9fc8974c63d1799a498149 Mon Sep 17 00:00:00 2001 From: Artur Barseghyan Date: Wed, 21 Aug 2019 22:45:53 +0200 Subject: [PATCH 01/10] Python packaging --- .gitignore | 1 + README.md | 49 +++++++++++++++-------- podman-compose.py => podman_compose.py | 0 scripts/clean_up.sh | 11 ++++++ scripts/make_release.sh | 5 +++ scripts/uninstall.sh | 3 ++ setup.cfg | 2 + setup.py | 54 ++++++++++++++++++++++++++ 8 files changed, 109 insertions(+), 16 deletions(-) rename podman-compose.py => podman_compose.py (100%) create mode 100755 scripts/clean_up.sh create mode 100755 scripts/make_release.sh create mode 100755 scripts/uninstall.sh create mode 100644 setup.cfg create mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 894a44c..6621793 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ parts/ sdist/ var/ wheels/ +.idea/ *.egg-info/ .installed.cfg *.egg diff --git a/README.md b/README.md index 22705d2..fcecc16 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,38 @@ -# PodMan-Compose +# podman-compose A script to run `docker-compose.yml` using [podman](https://podman.io/), doing necessary mapping to make it work rootless. -## NOTE + Note, that it's still under development and might not work well yet. -it's still underdevelopment and does not work yet. +## Installation + +Install latest stable version from PyPI: + +``` +pip install podman-compose +``` + +Or latest stable version from GitHub: + +``` +pip install https://github.com/muayyad-alsadi/podman-compose/archive/master.tar.gz +``` + +Or latest development version from GitHub: + +``` +pip install https://github.com/muayyad-alsadi/podman-compose/archive/devel.tar.gz +``` ## Mappings -* `1podfw` - create all containers in one pod (inter-container communication is done via `localhost`), doing port mapping in that pod -* `1pod` - create all containers in one pod, doing port mapping in each container -* `identity` - no mapping -* `hostnet` - use host network, and inter-container communication is done via host gateway and published ports -* `cntnet` - create a container and use it via `--network container:name` (inter-container communication via `localhost`) -* `publishall` - publish all ports to host (using `-P`) and communicate via gateway +* `1podfw` - create all containers in one pod (inter-container communication is done via `localhost`), doing port mapping in that pod. +* `1pod` - create all containers in one pod, doing port mapping in each container. +* `identity` - no mapping. +* `hostnet` - use host network, and inter-container communication is done via host gateway and published ports. +* `cntnet` - create a container and use it via `--network container:name` (inter-container communication via `localhost`). +* `publishall` - publish all ports to host (using `-P`) and communicate via gateway. ## Examples @@ -22,30 +40,29 @@ When testing the `AWX`, if you got errors just wait for db migrations to end. ### Working Example -Tested on latest podman (commit `349e69..` on 2019-03-11) +*Tested on latest ``podman`` (commit `349e69..` on 2019-03-11).* -By using many containers on a single pod that shares the network (services talk via localhost) +By using many containers on a single pod that shares the network (services talk +via localhost): ``` ./podman-compose.py -t 1podfw -f examples/awx3/docker-compose.yml up ``` -Or by reusing a container network and `--add-host` +Or by reusing a container network and `--add-host`: ``` $ ./podman-compose.py -t cntnet -f examples/awx3/docker-compose.yml up ``` -Or by using host network and localhost works as in +Or by using host network and localhost works as follows: ``` $ ./podman-compose.py -t hostnet -f examples/awx3-hostnet-localhost/docker-compose.yml up ``` -### in progress work - +### Work in progress ``` ./podman-compose.py -t 1pod -f examples/awx3/docker-compose.yml up ``` - diff --git a/podman-compose.py b/podman_compose.py similarity index 100% rename from podman-compose.py rename to podman_compose.py diff --git a/scripts/clean_up.sh b/scripts/clean_up.sh new file mode 100755 index 0000000..c83b831 --- /dev/null +++ b/scripts/clean_up.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +find . -name "*.pyc" -exec rm -rf {} \; +find . -name "__pycache__" -exec rm -rf {} \; +find . -name "*.orig" -exec rm -rf {} \; +rm -rf .cache/ +rm -rf build/ +rm -rf builddocs/ +rm -rf dist/ +rm -rf deb_dist/ +rm src/podman-compose.egg-info -rf +rm builddocs.zip diff --git a/scripts/make_release.sh b/scripts/make_release.sh new file mode 100755 index 0000000..0ec6595 --- /dev/null +++ b/scripts/make_release.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +./scripts/uninstall.sh +./scripts/clean_up.sh +python setup.py register +python setup.py sdist bdist_wheel upload diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh new file mode 100755 index 0000000..613747b --- /dev/null +++ b/scripts/uninstall.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +pip uninstall podman-compose -y +./scripts/clean_up.sh diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..2a9acf1 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal = 1 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..e408068 --- /dev/null +++ b/setup.py @@ -0,0 +1,54 @@ +import os +from setuptools import setup, find_packages + +try: + readme = open(os.path.join(os.path.dirname(__file__), 'README.md')).read() +except: + readme = '' + +version = '0.1' + +setup( + name='podman-compose', + version=version, + description="A script to run docker-compose.yml using podman", + long_description=readme, + classifiers=[ + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Intended Audience :: Developers", + "Operating System :: OS Independent", + "Development Status :: 3 - Alpha", + "Topic :: Software Development :: Build Tools", + "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", + ], + keywords='podman, podman-compose', + author='Artur Barseghyan', + author_email='artur.barseghyan@gmail.com', + url='https://github.com/barseghyanartur/tld', + package_dir={'': '.'}, + py_modules=['podman_compose'], + packages=find_packages(where='./src'), + entry_points={ + 'console_scripts': [ + 'podman-compose = podman_compose:main' + ] + }, + include_package_data=True, + license='GPL-2.0-only', + install_requires=[ + 'pyyaml' + ], + # test_suite='tests', + # tests_require=[ + # 'coverage', + # 'pytest-cov', + # 'pytest', + # 'tox', + # ] +) From 8c226b04c6c0e34340cd1879af8812da73fc9eab Mon Sep 17 00:00:00 2001 From: Artur Barseghyan Date: Wed, 21 Aug 2019 22:54:16 +0200 Subject: [PATCH 02/10] author update --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index e408068..b8b201e 100644 --- a/setup.py +++ b/setup.py @@ -28,9 +28,9 @@ setup( "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", ], keywords='podman, podman-compose', - author='Artur Barseghyan', - author_email='artur.barseghyan@gmail.com', - url='https://github.com/barseghyanartur/tld', + author='Muayyad Alsadi', + author_email='alsadi@gmail.com', + url='https://github.com/muayyad-alsadi/podman-compose', package_dir={'': '.'}, py_modules=['podman_compose'], packages=find_packages(where='./src'), From e0fae78c05445429289dc71b0cc4587d832a8c35 Mon Sep 17 00:00:00 2001 From: Artur Barseghyan Date: Wed, 21 Aug 2019 23:39:48 +0200 Subject: [PATCH 03/10] Fix PyPI long description --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b8b201e..a3d40d3 100644 --- a/setup.py +++ b/setup.py @@ -6,13 +6,14 @@ try: except: readme = '' -version = '0.1' +version = '0.1.1' setup( name='podman-compose', version=version, description="A script to run docker-compose.yml using podman", long_description=readme, + long_description_content_type='text/markdown', classifiers=[ "Programming Language :: Python", "Programming Language :: Python :: 2", From 5b1e0f1737f27cbdff8f1118b1317c9043012923 Mon Sep 17 00:00:00 2001 From: Artur Barseghyan Date: Thu, 22 Aug 2019 00:01:51 +0200 Subject: [PATCH 04/10] Fix wrong path to find packages --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a3d40d3..52b27c1 100644 --- a/setup.py +++ b/setup.py @@ -34,7 +34,7 @@ setup( url='https://github.com/muayyad-alsadi/podman-compose', package_dir={'': '.'}, py_modules=['podman_compose'], - packages=find_packages(where='./src'), + packages=find_packages(where='.'), entry_points={ 'console_scripts': [ 'podman-compose = podman_compose:main' From b327f19e885cd7eb1a180fa16295817919eb0291 Mon Sep 17 00:00:00 2001 From: Artur Barseghyan Date: Thu, 22 Aug 2019 00:03:19 +0200 Subject: [PATCH 05/10] Remove note on things that do not work --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index fcecc16..a408fbd 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,6 @@ A script to run `docker-compose.yml` using [podman](https://podman.io/), doing necessary mapping to make it work rootless. - Note, that it's still under development and might not work well yet. - ## Installation Install latest stable version from PyPI: From ea166f1da3257c4a277b8ec842f9bdfd024be6ef Mon Sep 17 00:00:00 2001 From: Artur Barseghyan Date: Thu, 22 Aug 2019 00:04:45 +0200 Subject: [PATCH 06/10] Update readme. Replace podman-compose.py with podman-compose --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a408fbd..9089af7 100644 --- a/README.md +++ b/README.md @@ -44,23 +44,23 @@ By using many containers on a single pod that shares the network (services talk via localhost): ``` -./podman-compose.py -t 1podfw -f examples/awx3/docker-compose.yml up +podman-compose -t 1podfw -f examples/awx3/docker-compose.yml up ``` Or by reusing a container network and `--add-host`: ``` -$ ./podman-compose.py -t cntnet -f examples/awx3/docker-compose.yml up +podman-compose -t cntnet -f examples/awx3/docker-compose.yml up ``` Or by using host network and localhost works as follows: ``` -$ ./podman-compose.py -t hostnet -f examples/awx3-hostnet-localhost/docker-compose.yml up +podman-compose -t hostnet -f examples/awx3-hostnet-localhost/docker-compose.yml up ``` ### Work in progress ``` -./podman-compose.py -t 1pod -f examples/awx3/docker-compose.yml up +podman-compose -t 1pod -f examples/awx3/docker-compose.yml up ``` From 0501ea60844bf203738aa229e8c10bb0c9e1db15 Mon Sep 17 00:00:00 2001 From: Artur Barseghyan Date: Thu, 22 Aug 2019 00:15:59 +0200 Subject: [PATCH 07/10] Use twine for uploads --- scripts/make_release.sh | 3 ++- setup.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/make_release.sh b/scripts/make_release.sh index 0ec6595..abc6e12 100755 --- a/scripts/make_release.sh +++ b/scripts/make_release.sh @@ -2,4 +2,5 @@ ./scripts/uninstall.sh ./scripts/clean_up.sh python setup.py register -python setup.py sdist bdist_wheel upload +python setup.py sdist bdist_wheel +twine upload dist/* diff --git a/setup.py b/setup.py index 52b27c1..10afae6 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ try: except: readme = '' -version = '0.1.1' +version = '0.1.2' setup( name='podman-compose', From cd1114d68e920e45fd09a647348a25145ab3582e Mon Sep 17 00:00:00 2001 From: Artur Barseghyan Date: Thu, 22 Aug 2019 00:18:55 +0200 Subject: [PATCH 08/10] Fixes in clean_up script --- scripts/clean_up.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/clean_up.sh b/scripts/clean_up.sh index c83b831..e909bb9 100755 --- a/scripts/clean_up.sh +++ b/scripts/clean_up.sh @@ -7,5 +7,5 @@ rm -rf build/ rm -rf builddocs/ rm -rf dist/ rm -rf deb_dist/ -rm src/podman-compose.egg-info -rf +rm src/podman_compose.egg-info -rf rm builddocs.zip From f7eb91ec997e89ee7e8b427dd1c7e96316ddf523 Mon Sep 17 00:00:00 2001 From: Artur Barseghyan Date: Thu, 22 Aug 2019 00:31:36 +0200 Subject: [PATCH 09/10] Remove unnecessary parts from setup.py --- setup.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/setup.py b/setup.py index 10afae6..e81b5a1 100644 --- a/setup.py +++ b/setup.py @@ -32,9 +32,7 @@ setup( author='Muayyad Alsadi', author_email='alsadi@gmail.com', url='https://github.com/muayyad-alsadi/podman-compose', - package_dir={'': '.'}, py_modules=['podman_compose'], - packages=find_packages(where='.'), entry_points={ 'console_scripts': [ 'podman-compose = podman_compose:main' From 3ae85b54a203534ce82f5620fac0fad791ab27b3 Mon Sep 17 00:00:00 2001 From: Artur Barseghyan Date: Thu, 22 Aug 2019 00:31:53 +0200 Subject: [PATCH 10/10] Version up --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e81b5a1..1da77c8 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ try: except: readme = '' -version = '0.1.2' +version = '0.1.3' setup( name='podman-compose',