{"id":14063088,"url":"https://github.com/nicferrier/docker-shell-deploy","last_synced_at":"2025-06-10T23:07:26.355Z","repository":{"id":19860342,"uuid":"23123567","full_name":"nicferrier/docker-shell-deploy","owner":"nicferrier","description":"a shell script to help with deploying dockers","archived":false,"fork":false,"pushed_at":"2014-10-21T21:22:17.000Z","size":344,"stargazers_count":25,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-03T18:44:37.142Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nicferrier.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-19T19:48:26.000Z","updated_at":"2024-09-20T19:54:36.000Z","dependencies_parsed_at":"2022-07-27T00:46:59.979Z","dependency_job_id":null,"html_url":"https://github.com/nicferrier/docker-shell-deploy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicferrier%2Fdocker-shell-deploy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicferrier%2Fdocker-shell-deploy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicferrier%2Fdocker-shell-deploy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicferrier%2Fdocker-shell-deploy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nicferrier","download_url":"https://codeload.github.com/nicferrier/docker-shell-deploy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicferrier%2Fdocker-shell-deploy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259166965,"owners_count":22815591,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-13T07:03:02.514Z","updated_at":"2025-06-10T23:07:26.328Z","avatar_url":"https://github.com/nicferrier.png","language":null,"readme":"# docker deployer\n\nThis is some tools for deploying docker containers to a host which is\nproviding access to the docker with nginx.\n\nI wanted something similar to heroku, rapid deployment of new things,\nbut without being bound to heroku and having to pay for an account to\nscale and all those things.\n\n\n## changelog\n\n*2014 September* - make the deployment start a daemon on the remote\nhost to continually ping the docker's HTTP and restart it. The daemon\nhas a fifo that it reads for commands, you can get a list of commands\nby sending it \"help\". Everything is stored in `/tmp/ddctrl/{name-of-image}`\n\n*2014 August* - handle nginx configs with upstreams instead of direct\nHTTP addresses in backend statements. The support isn't great but\nwithout parsing the nginx config totally (and the best placed thing to\ndo that would be nginx) there's not a lot we can do better.\n\n\n### requirements\n\nYou need:\n\n* `bash`\n* `curl`\n* `jq`\n* `docker` - duh\n* an app that has a `Dockerfile`\n* something that exports a port with Docker, probably a webapp because this uses nginx\n* a live host to host your container\n* an ssh key relationship with your remote host such that you can `ssh remotehost`\n* an account on the docker registry\n\n### how to\n\n```shell-session\n$ bash \u003c(curl -L https://raw.github.com/nicferrier/docker-shell-deploy/master/deploy-make)\n```\n\nwill download the script and ask a few questions:\n\n```\ndocker image: nicferrier/elnode-gnudoc\nnginx config: /etc/nginx/sites-enabled/gnudoc.conf\nremote host name: po5.ferrier.me.uk\n```\n\n* `docker image` - the name of the docker image you want to build, this will be pushed to the docker registry\n* `nginx config` - the nginx config on the live host which proxies the docker\n* `remote host name` - the host name of the live host for the docker, the docker will be pulled here from the docker registry\n\nIf you have VOLUME export statements in your `Dockerfile` it will also\nask you where thet are mapped.\n\nThe script then creates a minimal `deploy` script which you can run to\ndeploy your docker app to the host you specified:\n\n```ShellSession\n$ bash deploy\n```\n\nYou can safely check that into version control.\n\n### what does the deploy script do?\n\nHere's an example:\n\n```bash\n#!/bin/bash\n# Docker deploy script generated by deploy-make\n\n[ -f ./.deploy-test ] \u0026\u0026 source ./.deploy-test\n[ -f ./.deploy ]     || curl https://raw.githubusercontent.com/nicferrier/docker-shell-deploy/master/deploy-helpers -o ./.deploy     || { echo \"can't http the deployscript\" ; exit 1; }\n. ./.deploy\ndockerImage=nicferrier/elnode-linky\ndockerExPort=8005\nnginxConfig=/etc/nginx/sites-enabled/linky\nhostName=po5.ferrier.me.uk\ndockerVolumes=;/home/nferrier/linky/db:/home/emacs/elnode-linky/db\ndeploy ${1:-\"deploy\"} nicferrier/elnode-linky 8005 /etc/nginx/sites-enabled/linky.conf po5.ferrier.me.uk /home/nferrier/linky/db:/home/emacs/elnode-linky/db\n```\n\nSo what does it do?\n\n* builds the current Dockerfile to `docker image`\n* pushes the `docker image` to the [docker registry](https://registry.hub.docker.com/)\n* pushes a function to the `remote host name` with ssh and executes it to start a daemon to:\n * pull the new `docker image` from the docker registry\n * start the pulled `docker image` as a container\n * alter the `nginx config` to proxy the newly exported port\n * restart nginx\n * monitor the started docker for http\n * restart the docker when it fails (and update nginx)\n\n### other stuff the deploy script supports\n\nThe `deploy` script that gets created actually supports a few more\ntricks than just the deployment.\n\nYou can run just the build step of the deployment:\n\n```ShellSession\n$ bash deploy build\n```\n\nThis will not push to the docker registry.\n\nYou can also run the build and push to docker registry, without doing\nthe deploy:\n\n```ShellSession\n$ bash deploy push\n```\n\n### stuff the deploy doesn't take care of\n\n* creating your live environment outside the docker\n * no nginx setup\n * no creation of volume exported directories\n\n## thoughts\n\nThis is very imperfect. It has a lot of assumptions:\n\n* you're using a webapp\n* you're exporting one port\n* you're proxying with nginx\n* you're using the docker registry\n* ... and that's just for starters\n\nHowever, it's a start and it is repeatable.\n\n### is the download safe?\n\nPerhaps you've heard that doing:\n\n```ShellSession\n$ curl http://something | bash -\n```\n\nis unsafe. Is:\n\n```ShellSession\nbash \u003c(curl http://something)\n```\n\nany safer?\n\nNO! Never use a curl and a bash together if you don't know what\nthey're doing. It's completely mad.\n\nHowever, once you are confident of the script then you can do it.\n\nIf you're not confident of what the script does\nthen\n[go look at it](https://github.com/nicferrier/docker-shell-deploy/blob/master/deploy-make).\n\n### justification\n\nWhy not just use Heroku? or some other sexy PAAS?\n\nBecause this is just as usable and probably more scalable. By that I\nmean that I can persuade it do new things easier than I can get Heroku\nto do new things.\n\nWith Heroku I'm working with someone else's constraints. With this I'm\nworking with mine.\n","funding_links":[],"categories":["Others"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicferrier%2Fdocker-shell-deploy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicferrier%2Fdocker-shell-deploy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicferrier%2Fdocker-shell-deploy/lists"}