shipit-deploy 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,174 @@
1
+ Metadata-Version: 2.4
2
+ Name: shipit-deploy
3
+ Version: 0.2.0
4
+ Summary: Self-hosted, language-agnostic auto deploy: git push -> build -> health check -> rollback
5
+ License: MIT
6
+ Project-URL: Homepage, https://github.com/desnarong/shipit
7
+ Project-URL: Issues, https://github.com/desnarong/shipit/issues
8
+ Project-URL: Changelog, https://github.com/desnarong/shipit/blob/main/CHANGELOG.md
9
+ Keywords: deploy,auto-deploy,docker,ci-cd,self-hosted,webhook,devops
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: System Administrators
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Software Development :: Build Tools
19
+ Classifier: Topic :: System :: Software Distribution
20
+ Requires-Python: >=3.11
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Dynamic: license-file
24
+
25
+ # 🚢 shipit
26
+
27
+ [![CI](https://github.com/desnarong/shipit/actions/workflows/ci.yml/badge.svg)](https://github.com/desnarong/shipit/actions/workflows/ci.yml)
28
+ [![PyPI](https://img.shields.io/pypi/v/shipit-deploy)](https://pypi.org/project/shipit-deploy/)
29
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
30
+
31
+ Self-hosted, open-source auto deploy that works with **any language**.
32
+ `git push` → webhook → clone → build (Docker) → run → health check → **auto rollback** on failure.
33
+
34
+ - Zero dependencies (Python 3.11+ stdlib only) + Docker + git
35
+ - Auto-detects Node, Python, Go, Rust, Java (Maven/Gradle), PHP, Ruby, .NET, Elixir, static sites
36
+ - Python start command is inferred for Django (gunicorn), FastAPI (uvicorn) and Flask (gunicorn)
37
+ - **Any other language:** put a `Dockerfile` in your repo – it always takes priority
38
+ - GitHub / Gitea / Forgejo (HMAC) and GitLab (token) webhooks
39
+ - Private repos via token from an env var (never written to disk)
40
+ - **Safe deploys:** the new version starts beside the live one and must pass its health check *before* the swap; a bad release never touches production
41
+ - Automatic rollback if it fails right after the swap, or manually with `shipit rollback <app>`
42
+ - Slack / Discord / Mattermost notifications, deploy history, automatic pruning of old images
43
+ - `shipit status <app>` and `shipit logs <app> -f`
44
+
45
+ ## Install on a Linux server (one command)
46
+
47
+ ```bash
48
+ curl -fsSL https://raw.githubusercontent.com/desnarong/shipit/main/install.sh | sudo bash
49
+ ```
50
+
51
+ Installs git, Python and Docker if missing, puts shipit in `/opt/shipit`, creates a `shipit` user and a
52
+ systemd service that listens for webhooks on port 9000. Read the script first if you like - it is short.
53
+ Options: `--dry-run`, `--no-docker`, `--no-service`, `--from-git`.
54
+
55
+ Then deploy and enable auto deploy:
56
+
57
+ ```bash
58
+ sudo -u shipit SHIPIT_CONFIG=/var/lib/shipit/shipit.toml shipit up https://github.com/you/your-app.git
59
+ shipit hook your-app --url http://YOUR-SERVER-IP:9000 # registers the GitHub webhook for you (needs `gh`)
60
+ ```
61
+
62
+ ## Quick start (any machine with Docker)
63
+
64
+ ```bash
65
+ pip install shipit-deploy # the command is `shipit`
66
+ # or the latest from GitHub: pip install git+https://github.com/desnarong/shipit.git
67
+ shipit up https://github.com/you/your-app.git
68
+ ```
69
+
70
+ That's it. `shipit up` picks the default branch, a free port and the right Dockerfile (or writes one),
71
+ builds, starts the app, health-checks it and prints the URL. No config file to write -
72
+ it creates `shipit.toml` for you. Add `--domain app.example.com` for HTTPS + zero-downtime releases (needs Caddy).
73
+
74
+ **Turn on auto deploy** (every push redeploys): run `shipit serve`, then register the webhook:
75
+ `shipit hook myapp --url http://YOUR-SERVER:9000` (GitHub, uses the `gh` CLI), or add the URL and secret
76
+ that `shipit up` printed to your repo by hand (Settings -> Webhooks). Apps added with `shipit up`
77
+ are picked up by a running `shipit serve` automatically - no restart.
78
+
79
+ Other commands:
80
+
81
+ ```bash
82
+ shipit list # apps, status, URLs
83
+ shipit hook myapp --url URL # register the GitHub push webhook
84
+ shipit deploy myapp # redeploy now
85
+ shipit rollback myapp # back to the previous release
86
+ shipit logs myapp -f # follow logs
87
+ shipit status myapp # current release + history
88
+ shipit doctor # check docker / git / caddy / secrets
89
+ shipit detect ./my-project # preview the generated Dockerfile
90
+ ```
91
+
92
+ The webhook secret is generated for you (kept in `.shipit/webhook-secret`); set `SHIPIT_SECRET` to use your own.
93
+ If your Dockerfile has a single `EXPOSE`, shipit uses that port automatically.
94
+
95
+ Add a webhook in your repo: URL `http://your-server:9000/hook/myapp`, content type
96
+ `application/json`, secret = `SHIPIT_SECRET` (GitLab: put it in "Secret token").
97
+ Only pushes to the configured `branch` deploy.
98
+
99
+ ## Config (`shipit.toml`)
100
+
101
+ | key | meaning |
102
+ |---|---|
103
+ | `name` | app name (`a-z 0-9 _ . -`), also the container name |
104
+ | `repo`, `branch` | git source |
105
+ | `port` / `host_port` | container port / published port |
106
+ | `health_path` | HTTP path polled after start (`""` = only check it stays running) |
107
+ | `start` | start command for generated Dockerfiles |
108
+ | `dockerfile` | custom Dockerfile path inside the repo |
109
+ | `pre_deploy` | command run once in the new image before release (e.g. `python manage.py migrate`); failure aborts and the live version stays |
110
+ | `env_file` | host env file passed to the container |
111
+ | `token_env` | env var holding a git token (private https repos) |
112
+ | `secret_env` | env var with this app's webhook secret |
113
+ | `notify_env` | env var holding a Slack/Discord/Mattermost webhook URL |
114
+ | `keep_images` | old images to keep (default 5; current + previous always kept) |
115
+ | `build_args` | table of Docker build args |
116
+
117
+ ## Zero-downtime with Caddy
118
+
119
+ Set `domain` on an app and shipit switches to **blue/green** deploys behind [Caddy](https://caddyserver.com):
120
+
121
+ ```toml
122
+ [server]
123
+ caddy_admin = "http://127.0.0.1:2019" # default
124
+
125
+ [[app]]
126
+ name = "myapp"
127
+ domain = "app.example.com" # DNS must point at this server
128
+ host_port = 9000 # slots use 127.0.0.1:9000 (blue) and :9001 (green)
129
+ ```
130
+
131
+ A release starts the idle slot, waits for its health check, flips the Caddy route, waits
132
+ `drain_seconds`, then removes the old slot - no gap, and HTTPS certificates come from Caddy automatically.
133
+ If the health check or the Caddy update fails, the live version is untouched.
134
+
135
+ Requirements: Caddy running with its admin API enabled (the default). **shipit owns the Caddy config** -
136
+ it pushes a full config on every release and on `shipit serve` start, so don't hand-edit that Caddy instance.
137
+ Apps without `domain` keep the simple mode (brief swap gap).
138
+
139
+ ## Run it as a service (systemd)
140
+
141
+ ```ini
142
+ [Service]
143
+ Environment=SHIPIT_SECRET=change-me
144
+ WorkingDirectory=/opt/shipit
145
+ ExecStart=/usr/local/bin/shipit serve
146
+ Restart=always
147
+ ```
148
+
149
+ Put nginx/Caddy in front for HTTPS and for routing domains to each app's `host_port`.
150
+
151
+ ## Security notes
152
+
153
+ - The webhook endpoint rejects anything without a valid signature/token.
154
+ - Deploying runs `docker build` on code from your repo – only point it at repos you trust.
155
+ - Run `shipit serve` behind HTTPS; the host running it controls Docker, so keep it locked down.
156
+
157
+ ## Limitations (v0.1)
158
+
159
+ Single server, single container per app. Without `domain` there is a brief gap while the port is handed over.
160
+ PRs welcome – ideas: multi-server, PR preview deploys, web UI, Traefik/nginx backends.
161
+
162
+ ## Develop
163
+
164
+ ```bash
165
+ python -m unittest discover -s tests
166
+ ```
167
+
168
+ End-to-end tests deploy real sample apps with Docker (needs Docker + git, takes a few minutes):
169
+
170
+ ```bash
171
+ SHIPIT_E2E=1 python -m unittest tests.test_e2e -v
172
+ ```
173
+
174
+ Contributions welcome - see [CONTRIBUTING.md](CONTRIBUTING.md). Security issues: [SECURITY.md](SECURITY.md). MIT licensed.
@@ -0,0 +1,17 @@
1
+ shipit/__init__.py,sha256=Zn1KFblwuFHiDRdRAiRnDBRkbPttWh44jKa5zG2ov0E,22
2
+ shipit/__main__.py,sha256=E6Gls0DNz8GQK2K-kOUIx8cYhgANW_CH54VKrfCfs14,52
3
+ shipit/cli.py,sha256=9rUSM_m96tRauuY2tF03DzNyXpXRGi2SoEJwSsiqwXs,8211
4
+ shipit/config.py,sha256=gSPHh2syF5VRahPKO4QttoA3DusSa_2KNVp_-rgislE,3617
5
+ shipit/deploy.py,sha256=zaeNiN2yiNIM5FnOcb6yOYVEFtScukqqk41EJjwHnJE,14173
6
+ shipit/detect.py,sha256=IBMc-UYlvD4xMbsPkrNDvz7aANAeTiu4YVkJwLjBaRk,7482
7
+ shipit/doctor.py,sha256=U89z3bQnOjjEDARgWiyFoj3Ib7xvP6yNz5UigegC4Rk,2543
8
+ shipit/easy.py,sha256=foESAEFuuhDUJlrIgX4_3WloxRvObt5Zig9PxK7bgqI,2765
9
+ shipit/hooks.py,sha256=kHugZfSq9SSjX7cxNz5Jan7UwzO4lL1D-U6Sj01ehgE,1951
10
+ shipit/proxy.py,sha256=cm2eDY5JzCprb1kvuGU5Xe0YUQLmtsv5UX-gH1r7ySM,1713
11
+ shipit/webhook.py,sha256=r4vYHqrjooQ0vubnT1MSMUOoj9SVxND82EOup8vV7Qw,3558
12
+ shipit_deploy-0.2.0.dist-info/licenses/LICENSE,sha256=kqYgct8phWcZDR_CfKNUOkD_v-nBtahn_O3X8QBy2JU,1076
13
+ shipit_deploy-0.2.0.dist-info/METADATA,sha256=-Gqo51O9t-UyneHgum26D3GGYKch-PPChBp5aTCVzbs,7900
14
+ shipit_deploy-0.2.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
15
+ shipit_deploy-0.2.0.dist-info/entry_points.txt,sha256=NFwFn-PpVRChP5H0TO60J3pVq82DO4Pg3kjihPOrfI4,43
16
+ shipit_deploy-0.2.0.dist-info/top_level.txt,sha256=8UZ40ChoKBbwjUOhNx8ParKw-i36Qw2ggasYwpeVafs,7
17
+ shipit_deploy-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ shipit = shipit.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 shipit contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ shipit