{ "info": { "author": "techhazard", "author_email": "techhazard@codeforyouand.me", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Programming Language :: Python :: 3.6" ], "description": "# Multidocker\nrun multiple compose files as one.\n\n## Why? When? How? Whaaaat?\nI'm using a reverse proxy container to make several containers available over HTTPS.\nBecause of this, the containers need to be in the same compose file.\nAfter a while, the file started to grow out of control, so I wrote this tool to make it more manageable.\n\n\n## Setup\n### 0. Requirements\n * `docker`\n * `docker-compose`\n * `python 3.6+`\n\n### 1. Install multidocker\n```sh\n$ pip3 install multidocker\n```\n### 2. Setup directory\nYou will need the following setup:\n```sh\n$ tree\nmultidocker/\n\u251c\u2500\u2500 some_app/\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 docker-compose.yml\n\u2514\u2500\u2500 other_app/\n \u2514\u2500\u2500 docker-compose.yml\n```\n\n## Example\n```sh\n$ tree\nmultidocker/\n\u251c\u2500\u2500 nextcloud/\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 docker-compose.yml\n\u2514\u2500\u2500 proxy/\n \u251c\u2500\u2500 docker-compose.yml\n \u251c\u2500\u2500 htpasswd\n \u251c\u2500\u2500 nginx-extra-options.conf\n \u2514\u2500\u2500 vhost.d/\n```\n\n`nextcloud/docker-compose.yml`:\n```yml\n---\nversion: '3.6'\n\n# these two containers share the nextcloud\n# network over which they will communicate\nservices:\n nextcloud:\n restart: unless-stopped\n image: nextcloud\n environment:\n VIRTUAL_HOST: \"my_hostname.example.com\"\n VIRTUAL_PORT: 80\n LETSENCRYPT_HOST: \"my_hostname.example.com\"\n volumes:\n - nextcloud_data:/var/www/html:rw\n # this adds the 'multidocker' network that allows\n # communication between compose files\n external: true\n networks:\n - nextcloud\n depends_on:\n - nextcloud_db\n\n nextcloud_db:\n restart: unless-stopped\n image: postgres:10.4\n environment:\n POSTGRES_PASSWORD: \"secret\"\n POSTGRES_USER: \"nextcloud\"\n volumes:\n - nextcloud_db:/var/lib/postgresql/data:rw\n networks:\n - nextcloud\n...\n```\n\n`proxy/docker-compose.yml`:\n```yml\n---\nversion: '3.6'\nservices:\n\n nginx:\n image: jwilder/nginx-proxy:alpine\n ports:\n - \"80:80\"\n - \"443:443\"\n volumes:\n - nginx_conf:/etc/nginx/conf.d:rw\n - ./nginx-extra-options.conf:/etc/nginx/conf.d/extra.conf:ro\n - ./htpasswd:/etc/nginx/htpasswd_default:ro\n - ./vhost.d:/etc/nginx/vhost.d:ro\n - nginx_html:/usr/share/nginx/html:ro\n - nginx_dhparam:/etc/nginx/dhparam:rw\n - certificates:/etc/nginx/certs:ro\n - /var/run/docker.sock:/tmp/docker.sock:ro\n # this adds the 'multidocker' network that allows\n # communication between compose files\n external: true\n labels:\n - \"com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy\"\n\n\n letsencrypt:\n image: jrcs/letsencrypt-nginx-proxy-companion\n volumes:\n - nginx_conf:/etc/nginx/conf.d:rw\n - nginx_vhost:/etc/nginx/vhost.d:rw\n - nginx_html:/usr/share/nginx/html:rw\n - certificates:/etc/nginx/certs:rw\n - /var/run/docker.sock:/var/run/docker.sock:ro\n depends_on:\n - nginx\n...\n```\n(The other files are there for demonstration)\n\n## Usage\nYou can use all the `docker-compose` commands: ps, up, down, logs etc.\n\n### Single use\n```sh\n$ multidocker up -d\nCreating network \"multidocker_nextcloud_nextcloud\" with the default driver\nCreating network \"multidocker_multidocker\" with the default driver\nCreating volume \"multidocker_nextcloud_nextcloud_data\" with default driver\nCreating volume \"multidocker_nextcloud_nextcloud_db\" with default driver\nCreating volume \"multidocker_proxy_certificates\" with default driver\nCreating volume \"multidocker_proxy_nginx_conf\" with default driver\nCreating volume \"multidocker_proxy_nginx_dhparam\" with default driver\nCreating volume \"multidocker_proxy_nginx_html\" with default driver\nCreating nextcloud_nextcloud_db ... done\nCreating proxy_nginx ... done\nCreating nextcloud_nextcloud ... done\n```\n\n### Interactive Mode\nI've also added an interactive mode. You can start it by running `multidocker` without any arguments:\n```sh\n$ multidocker\nInteractive Mode\n\nYou can run docker subcommands here, like so:\n ------------------------------------------\n | multidocker> ps |\n | Name Command State Ports |\n | ---------------------------------------|\n | container_name /init Up |\n | multidocker> |\n ------------------------------------------\n\nCommands:\n build Build or rebuild services\n bundle Generate a Docker bundle from the Compose file\n config Validate and view the Compose file\n create Create services\n down Stop and remove containers, networks, images, and volumes\n events Receive real time events from containers\n exec Execute a command in a running container\n help Get help on a command\n images List images\n kill Kill containers\n logs View output from containers\n pause Pause services\n port Print the public port for a port binding\n ps List containers\n pull Pull service images\n push Push service images\n restart Restart services\n rm Remove stopped containers\n run Run a one-off command\n scale Set number of containers for a service\n start Start services\n stop Stop services\n top Display the running processes\n unpause Unpause services\n up Create and start containers\n version Show the Docker-Compose version information\n\nMultidocker Commands:\n cat Output combined compose file to disk\n help Show this help text\n reload Reload the compose files from disk\n write Write the combined compsose file to disk\n quit, exit Exit interactive mode (ctrl+d also works)\n```\nYou can run all the docker-compose command from within this prompt. It saves you from having to type `multidocker` before each command.\nIt also saves time because it keeps the combined compose file in memory. If you changed one of the compose files, you should run the `reload`command.\n\n\n## Improvements:\n- [ ] Auto reload on file change\n- [ ] Use readline in interactive mode\n- [ ] Shell-like history in interactive mode\n- [ ] Upgrade to python 3.7 to use the improved `subprocess.run`\n- [ ] Check if example actually works\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/techhazard/multidocker", "keywords": "docker docker-compose repl", "license": "", "maintainer": "", "maintainer_email": "", "name": "multidocker", "package_url": "https://pypi.org/project/multidocker/", "platform": "", "project_url": "https://pypi.org/project/multidocker/", "project_urls": { "Bug Reports": "https://github.com/techhazard/multidocker/issues", "Funding": "https://donate.pypi.org", "Homepage": "https://github.com/techhazard/multidocker", "Source": "https://github.com/techhazard/multidocker" }, "release_url": "https://pypi.org/project/multidocker/1.0.4/", "requires_dist": [ "ruamel.yaml", "check-manifest; extra == 'dev'", "coverage; extra == 'test'" ], "requires_python": "", "summary": "Run multiple docker-compose files together", "version": "1.0.4" }, "last_serial": 4304130, "releases": { "1.0.4": [ { "comment_text": "", "digests": { "md5": "58ed535cf04455303869c35933aa0399", "sha256": "cc31bdaf24ed1614d9afbbc31aa1a6788b2300b0e6f815bc8240f1cf3ec73695" }, "downloads": -1, "filename": "multidocker-1.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "58ed535cf04455303869c35933aa0399", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 23534, "upload_time": "2018-09-24T09:59:32", "url": "https://files.pythonhosted.org/packages/57/20/cb7ea7adf8a60c624ebcaf424b44bbf18d41b7e8e87fc1235b7701f8868f/multidocker-1.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1204aeee1ba4bcf511e7c61a20cebd1c", "sha256": "d97a851f445d8b2715f8b43b1f20871d4ddc9f06b3a7a05c54c2dbf81c349e76" }, "downloads": -1, "filename": "multidocker-1.0.4.tar.gz", "has_sig": false, "md5_digest": "1204aeee1ba4bcf511e7c61a20cebd1c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24319, "upload_time": "2018-09-24T09:59:33", "url": "https://files.pythonhosted.org/packages/11/f3/6306c75a02d9eb69ed72f48ebb102b4044557f6d3bfa7bdd77549bc7d40d/multidocker-1.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "58ed535cf04455303869c35933aa0399", "sha256": "cc31bdaf24ed1614d9afbbc31aa1a6788b2300b0e6f815bc8240f1cf3ec73695" }, "downloads": -1, "filename": "multidocker-1.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "58ed535cf04455303869c35933aa0399", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 23534, "upload_time": "2018-09-24T09:59:32", "url": "https://files.pythonhosted.org/packages/57/20/cb7ea7adf8a60c624ebcaf424b44bbf18d41b7e8e87fc1235b7701f8868f/multidocker-1.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1204aeee1ba4bcf511e7c61a20cebd1c", "sha256": "d97a851f445d8b2715f8b43b1f20871d4ddc9f06b3a7a05c54c2dbf81c349e76" }, "downloads": -1, "filename": "multidocker-1.0.4.tar.gz", "has_sig": false, "md5_digest": "1204aeee1ba4bcf511e7c61a20cebd1c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24319, "upload_time": "2018-09-24T09:59:33", "url": "https://files.pythonhosted.org/packages/11/f3/6306c75a02d9eb69ed72f48ebb102b4044557f6d3bfa7bdd77549bc7d40d/multidocker-1.0.4.tar.gz" } ] }