{ "info": { "author": "msm, psrok1", "author_email": "info@cert.pl", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# deploy\n\nBuild, push and deploy k8s services with single deploy.json file to provide common convention for\nmultiple production services.\n\n```\npip install python-deploy\n```\n\n### Make your Docker setup deploy-enabled\n\nFirst of all, create a file under `deploy/deploy.json` path pointing at your Dockerfile. \n\n> It's recommended to place your Dockerfile in a `deploy/docker` subdirectory.\n\n```json\n{\n \"fancy-service\": {\n \"docker\": {\n \"image\": \"certpl/fancy-service\",\n \"dockerfile\": \"deploy/docker/Dockerfile\",\n \"dir\": \".\"\n }\n }\n}\n```\n\nThen you can use `deploy build` to build your Docker image. Your image will be tagged using Git commit hash.\n\n```\n$ deploy build\n[INFO] Building image certpl/fancy-service:a2f3d45a4ccfcee03a8a3941ec7177e394626cf2\n```\n\nIf you want to provide alternative version tag, use `--version`. You can provide any tag you want, but few of them are special:\n- `date` uses current timestamp (e.g. `v20200302170007`)\n- `commit` is default\n- other strings are used \"as is\"\n\nUse `deploy push` if you want to push (and build) image to Docker Registry or Docker Hub with all provided tags:\n\n```\n$ deploy push\n[INFO] Building image certpl/fancy-service:a2f3d45a4ccfcee03a8a3941ec7177e394626cf2\n[INFO] Pushing image certpl/fancy-service:a2f3d45a4ccfcee03a8a3941ec7177e394626cf2\n```\n\n### Make your k8s deployment deploy-enabled\n\nEnhance your `deploy/deploy.json` with configuration of k8s deployment. \n\nDeploy supports two environments: `k8s` (production) and `k8s-staging` (staging).\n\nA complete example of a `deploy.json` file is presented below:\n\n```\n{\n \"fancy-service\": {\n \"docker\": {\n \"image\": \"certpl/fancy-service\",\n \"dockerfile\": \"deploy/docker/Dockerfile\",\n \"dir\": \".\"\n },\n \"k8s\": {\n \"namespace\": \"service-prod\",\n \"deployment\": \"deployment-fancy-service\",\n \"container\": \"container-fancy-service\"\n },\n \"k8s-staging\": {\n \"namespace\": \"service-st\",\n \"deployment\": \"deployment-fancy-service\",\n \"container\": \"container-fancy-service\"\n }\n }\n}\n```\n\n> It's recommended to place your Kubernetes configuration files in the `deploy/k8s` and `deploy/k8s-staging` subdirectories.\n\nThis enables you to use `deploy staging` and `deploy production` commands.\n\n- `deploy staging` builds and pushes Docker image with version tag and `latest` tag. After all, updates the image name used by staging container \nto new version.\n\n- `deploy production` does the same thing, but images are additionally tagged as `master`. Then it updates the production container.\n\n```\n$ deploy production\n[INFO] Building image certpl/fancy-service:7f6dd7010dba1ffdaeb32875e0f71c30c9810df7\n[INFO] Pushing image certpl/fancy-service:7f6dd7010dba1ffdaeb32875e0f71c30c9810df7\n[INFO] Tagging image certpl/fancy-service:7f6dd7010dba1ffdaeb32875e0f71c30c9810df7 as certpl/fancy-service:master\n[INFO] Tagging image certpl/fancy-service:7f6dd7010dba1ffdaeb32875e0f71c30c9810df7 as certpl/fancy-service:latest\n[INFO] Setting image certpl/fancy-service:7f6dd7010dba1ffdaeb32875e0f71c30c9810df7 for k8s environment\n```\n\nIf you don't want to rebuild your Docker images and need just to pull them from the Docker Registry, you can use\n`deploy pull` and `deploy production --deploy-only` switch\n\n```\n$ docker pull\n[INFO] Pulling image certpl/fancy-service:7f6dd7010dba1ffdaeb32875e0f71c30c9810df7\n$ deploy production --deploy-only\n[INFO] Tagging image certpl/fancy-service:7f6dd7010dba1ffdaeb32875e0f71c30c9810df7 as certpl/fancy-service:master\n[INFO] Tagging image certpl/fancy-service:7f6dd7010dba1ffdaeb32875e0f71c30c9810df7 as certpl/fancy-service:latest\n[INFO] Setting image certpl/fancy-service:7f6dd7010dba1ffdaeb32875e0f71c30c9810df7 for k8s environment\n```\n\n### Support for multiple services\n\nIf your app is built using multiple containers, just specify more services as top-level keys of `deploy.json`.\n\n```json\n{\n \"fancy-service\": {\n ...\n },\n \"fancy-service-web\": {\n ...\n }\n}\n```\n\nDeploy will build, push and deploy them all (unless you explicitly select services using `--service/-s` option).\n\n### Make your Gitlab CI deploy-enabled\n\nYou can automate all these steps with CI/CD. Example `.gitlab-ci.yml` file is presented below:\n\n```yaml\nimage: certpl/deploy\n\nservices:\n - docker:dind\n\nstages:\n - build\n - test\n - deploy\n\nbuild:\n stage: build\n script:\n - git submodule init\n - git submodule update --recursive\n # Build and push images to Docker Registry\n - deploy push\n\ntest:\n stage: test\n script:\n # Pull images and run unit tests\n - deploy pull\n - deploy run -- python -m unittest discover\n\ndeploy:\n stage: deploy\n only:\n - master\n script:\n # Set default token, pull images and deploy them\n - kubernetes_use_token https://kapi.example.com \"$KUBE_TOKEN\"\n - deploy pull\n - deploy production --deploy-only\n```\n\nIf you don't have tests and you just want to build and deploy everything in one step: invoke `deploy production`\n\n### Full usage\n\nKeep in mind that some optional arguments are only relevant for some commands\n\n```\nusage: deploy [-h] {build,push,pull,staging,production,image,run} ...\n\nDeploy the application.\n\npositional arguments:\n {build,push,pull,staging,production,image,run}\n Deploy commands\n build Only build images\n push Build and push images\n pull Pull images from registry\n staging Build, push and deploy images to the staging\n environment\n production Build, push and deploy images to the PRODUCTION\n environment\n image Show image names\n run Run interactive command for service images\n\noptional arguments:\n -h, --help show this help message and exit\n\n --tag TAG, -t TAG Alternative tags for image\n --no-cache Pass --no-cache to docker build\n --service SERVICE, -s SERVICE\n Specify services to perform action (default: all)\n --force, -f Don't perform check-ups, force deploy (not\n recommended)\n --verbose, -v Print spawned subcommands and their outputs\n --version {commit,date,latest}\n Alternative version tag\n```\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/CERT-Polska/python-deploy", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "python-deploy", "package_url": "https://pypi.org/project/python-deploy/", "platform": "", "project_url": "https://pypi.org/project/python-deploy/", "project_urls": { "Homepage": "https://github.com/CERT-Polska/python-deploy" }, "release_url": "https://pypi.org/project/python-deploy/3.0.2/", "requires_dist": [ "PyYAML (==5.4.1)" ], "requires_python": "", "summary": "Build, push and deploy k8s services with single deploy.json file to provide common convention for multiple production services.", "version": "3.0.2", "yanked": false, "yanked_reason": null }, "last_serial": 10888927, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "2514278bd3963e40fdfe578ed017afd9", "sha256": "cda5f095d66aac92435e50a1171a4dbbd2a9daa247dfb7ad96a8a55e65d31efb" }, "downloads": -1, "filename": "python_deploy-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "2514278bd3963e40fdfe578ed017afd9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4590, "upload_time": "2019-07-16T16:28:22", "upload_time_iso_8601": "2019-07-16T16:28:22.788675Z", "url": "https://files.pythonhosted.org/packages/04/aa/df6b79a0d9ec84b6329ca60dc427f7b42f59894952684c59493ea0b65216/python_deploy-1.0-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "f0af7f979cea67b9e932f92ceb08b10e", "sha256": "9dfd61b8b795152ac1a1bc426c63ec496f55111423e5d9b2b5d7a6a24d89b15d" }, "downloads": -1, "filename": "python-deploy-1.0.tar.gz", "has_sig": false, "md5_digest": "f0af7f979cea67b9e932f92ceb08b10e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3225, "upload_time": "2019-07-16T16:28:24", "upload_time_iso_8601": "2019-07-16T16:28:24.817561Z", "url": "https://files.pythonhosted.org/packages/5e/e6/8ef5c0f9db4b4cf86c4d4662cab81ee985f49205adce56ab1e8172403746/python-deploy-1.0.tar.gz", "yanked": false, "yanked_reason": null } ], "1.1": [ { "comment_text": "", "digests": { "md5": "b0cc32dcebccca604d989b471bd051a5", "sha256": "d5a785d729b60204580c9294d78d8c45597e3f39a8acd3e89ff637e2473cc1d9" }, "downloads": -1, "filename": "python_deploy-1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "b0cc32dcebccca604d989b471bd051a5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5349, "upload_time": "2019-09-03T15:34:42", "upload_time_iso_8601": "2019-09-03T15:34:42.031967Z", "url": "https://files.pythonhosted.org/packages/70/6c/d86d8d6481713c5e595ae84d7ec0e79de5d072f9ea48b7a452237d8c456a/python_deploy-1.1-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "e3dd34e0a1e320fd2a97f0d0ec73ba0d", "sha256": "e0826095b41bc8a054716d0d13ccd89dacb6912ee2f3c2f7458b3720236cc3bc" }, "downloads": -1, "filename": "python-deploy-1.1.tar.gz", "has_sig": false, "md5_digest": "e3dd34e0a1e320fd2a97f0d0ec73ba0d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3979, "upload_time": "2019-09-03T15:34:43", "upload_time_iso_8601": "2019-09-03T15:34:43.544579Z", "url": "https://files.pythonhosted.org/packages/61/9d/d7af94806736933d60ebd1904dfe65dba9f5e272bb84becffa9de66146e7/python-deploy-1.1.tar.gz", "yanked": false, "yanked_reason": null } ], "1.2": [ { "comment_text": "", "digests": { "md5": "5cb5096a98acf232056b77997c5042ef", "sha256": "3c533b6d23378d1835cfff342f434fd148df7585c74bbb514988e6eb8cb7486d" }, "downloads": -1, "filename": "python_deploy-1.2-py2-none-any.whl", "has_sig": false, "md5_digest": "5cb5096a98acf232056b77997c5042ef", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 4715, "upload_time": "2019-10-25T17:45:43", "upload_time_iso_8601": "2019-10-25T17:45:43.769943Z", "url": "https://files.pythonhosted.org/packages/72/2b/f293c1f87e629c81b9c6c1414ae75085151a07127d7269d8a33c5bce1149/python_deploy-1.2-py2-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "76fdcfb121f2bda52d649a747290a168", "sha256": "5def2928598d35b1da1cc20749c7d21573b89627dd5f9f78628517cb0b68fa3d" }, "downloads": -1, "filename": "python-deploy-1.2.tar.gz", "has_sig": false, "md5_digest": "76fdcfb121f2bda52d649a747290a168", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4078, "upload_time": "2019-10-25T17:45:45", "upload_time_iso_8601": "2019-10-25T17:45:45.317161Z", "url": "https://files.pythonhosted.org/packages/d4/4b/a8de6dae6cbf87587c942b91e8d851334a8dde841f21706ee848c563104c/python-deploy-1.2.tar.gz", "yanked": false, "yanked_reason": null } ], "2.0.1": [ { "comment_text": "", "digests": { "md5": "3031bb7d05ef279191efc0fa24def86b", "sha256": "55eaa69785c12dd9b89b6810e8dc1a8589cded3e8ba35069cb934d0517d71745" }, "downloads": -1, "filename": "python_deploy-2.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "3031bb7d05ef279191efc0fa24def86b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4813, "upload_time": "2020-02-12T17:00:12", "upload_time_iso_8601": "2020-02-12T17:00:12.485734Z", "url": "https://files.pythonhosted.org/packages/72/2f/48e61f03b9bd32a8494a52bf56ef14f0955df920d4cf9c3c7b5279f0674a/python_deploy-2.0.1-py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "2.0.2": [ { "comment_text": "", "digests": { "md5": "5c1491fdd241c27ac797f055874ef130", "sha256": "421909afd8def4898a6c57f764eb6f6116825ec504bcb707fc83f2b107c41a57" }, "downloads": -1, "filename": "python_deploy-2.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "5c1491fdd241c27ac797f055874ef130", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4812, "upload_time": "2020-03-02T09:20:49", "upload_time_iso_8601": "2020-03-02T09:20:49.085002Z", "url": "https://files.pythonhosted.org/packages/37/9f/5937cdd0b498993d10d0bdd5d20dc0598764ed7a893490df1e51b579780d/python_deploy-2.0.2-py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "2.1.1": [ { "comment_text": "", "digests": { "md5": "c5900a0cfd0258f86e0a5d14ddfc7522", "sha256": "2206ea2775759add781199750170cdd71634fe7c17c835aff3ffe011ae4e20e5" }, "downloads": -1, "filename": "python_deploy-2.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "c5900a0cfd0258f86e0a5d14ddfc7522", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6137, "upload_time": "2020-03-09T13:46:19", "upload_time_iso_8601": "2020-03-09T13:46:19.894083Z", "url": "https://files.pythonhosted.org/packages/13/60/890b25461347e0bf6013850c7bd24753e5a1b1f9279daef76ed51171cd49/python_deploy-2.1.1-py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "3.0.0": [ { "comment_text": "", "digests": { "md5": "26048aed8e6dfcf1156ad1bdb9a32684", "sha256": "b7f4dd4a5e8e8c502da1472170e7ff1c23034202f8e7a4f5f32aa5bdcc9e721b" }, "downloads": -1, "filename": "python_deploy-3.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "26048aed8e6dfcf1156ad1bdb9a32684", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7377, "upload_time": "2020-04-23T12:59:50", "upload_time_iso_8601": "2020-04-23T12:59:50.100039Z", "url": "https://files.pythonhosted.org/packages/26/d1/8e27f866d43fc9fb21a85f54bfb0c900aa9659f101fd3bc3244e330c0197/python_deploy-3.0.0-py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "3.0.1": [ { "comment_text": "", "digests": { "md5": "a86e0efd08a74a5f1629a74095d0542e", "sha256": "7013e144842ef173e897150a7c878b89a345b09946977262b61c09f82e4645c7" }, "downloads": -1, "filename": "python_deploy-3.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "a86e0efd08a74a5f1629a74095d0542e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9374, "upload_time": "2021-07-01T12:02:22", "upload_time_iso_8601": "2021-07-01T12:02:22.963017Z", "url": "https://files.pythonhosted.org/packages/e7/b5/8f4e5aa6d83955cfe93d87fe8fb6db8de851ffec256024052b4a579edb81/python_deploy-3.0.1-py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "3.0.2": [ { "comment_text": "", "digests": { "md5": "e796a96f04e0b553b764ca491102df29", "sha256": "122be9867d9f02fb5b6c45e8c42571f43d9e1c7188389a78ad8061f2fd4b1b24" }, "downloads": -1, "filename": "python_deploy-3.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "e796a96f04e0b553b764ca491102df29", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9342, "upload_time": "2021-07-12T19:12:11", "upload_time_iso_8601": "2021-07-12T19:12:11.776209Z", "url": "https://files.pythonhosted.org/packages/9f/65/b6637b51d69fd659d9f05a944d340d3caad9d6d6831c2d6056788e1d143d/python_deploy-3.0.2-py3-none-any.whl", "yanked": false, "yanked_reason": null } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e796a96f04e0b553b764ca491102df29", "sha256": "122be9867d9f02fb5b6c45e8c42571f43d9e1c7188389a78ad8061f2fd4b1b24" }, "downloads": -1, "filename": "python_deploy-3.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "e796a96f04e0b553b764ca491102df29", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9342, "upload_time": "2021-07-12T19:12:11", "upload_time_iso_8601": "2021-07-12T19:12:11.776209Z", "url": "https://files.pythonhosted.org/packages/9f/65/b6637b51d69fd659d9f05a944d340d3caad9d6d6831c2d6056788e1d143d/python_deploy-3.0.2-py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "vulnerabilities": [] }