git-deploy-ng 0.8.0 → 0.9.0
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.
- checksums.yaml +4 -4
- data/AGENTS.md +46 -0
- data/CHANGELOG.md +37 -0
- data/CONTRIBUTING.md +41 -3
- data/README.md +335 -0
- data/ROADMAP.md +15 -3
- data/bin/update-changelog +47 -0
- data/lib/git_deploy/changelog.rb +125 -0
- data/lib/git_deploy/configuration.rb +20 -5
- data/lib/git_deploy/generator.rb +39 -2
- data/lib/git_deploy/remote_path.rb +28 -0
- data/lib/git_deploy/ssh_methods.rb +15 -0
- data/lib/git_deploy/templates/generic/after_push.sh +15 -0
- data/lib/git_deploy/templates/generic/before_restart.sh +3 -0
- data/lib/git_deploy/templates/generic/restart.sh +2 -0
- data/lib/git_deploy/templates/php-composer/after_push.sh +15 -0
- data/lib/git_deploy/templates/php-composer/before_restart.sh +12 -0
- data/lib/git_deploy/templates/php-composer/restart.sh +13 -0
- data/lib/git_deploy/templates/rails-puma/after_push.sh +17 -0
- data/lib/git_deploy/templates/rails-puma/before_restart.rb +38 -0
- data/lib/git_deploy/templates/rails-puma/restart.sh +9 -0
- data/lib/git_deploy.rb +43 -5
- data/spec/changelog_spec.rb +110 -0
- data/spec/cli_spec.rb +9 -1
- data/spec/commands_spec.rb +22 -0
- data/spec/configuration_spec.rb +10 -0
- data/spec/documentation_spec.rb +15 -0
- data/spec/generator_spec.rb +75 -0
- data/spec/hooks_spec.rb +15 -0
- data/spec/remote_path_spec.rb +45 -0
- data/spec/setup_spec.rb +48 -1
- data/spec/workflows_spec.rb +57 -0
- metadata +25 -6
- data/README.markdown +0 -172
- /data/lib/git_deploy/templates/{after_push.sh → rails-passenger/after_push.sh} +0 -0
- /data/lib/git_deploy/templates/{before_restart.rb → rails-passenger/before_restart.rb} +0 -0
- /data/lib/git_deploy/templates/{restart.sh → rails-passenger/restart.sh} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0b64c184c2caea92356620a38fe3f61b1127a57db6f07c685e0fdd7e631013aa
|
|
4
|
+
data.tar.gz: 352f0a909af1721966f5205be7fab6cb884e7dad8f5673f4242232bcd351ca26
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b358f7015854510c0fd1d17fc65f7faa2b9564fc5fccc7a3dd7ce160cf28193b4c510e40a9f0e68650f83fe95e7e7542e859d4859b4bac6b028165708b92d85
|
|
7
|
+
data.tar.gz: fed8047e5dc0ca7df1594139515bf1a06d39ae1663fe740b0882eb01c0c3c1676c55754884051a69fe25e1fff211ab147a93619274700092fdbd2fc4180ed329
|
data/AGENTS.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Terse context for AI coding agents working in this repo.
|
|
4
|
+
|
|
5
|
+
## Project
|
|
6
|
+
|
|
7
|
+
**git-deploy-ng** — Ruby gem, CLI `git deploy`. Push-based deploy over SSH (Thor + net-ssh). Community fork of mislav/git-deploy. v0.8.x stayed compatible with upstream 0.7.0; **v0.9.0** has minor CLI changes (see `CONTRIBUTING.md`). Servers only need bash/git.
|
|
8
|
+
|
|
9
|
+
## Layout
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
bin/git-deploy # CLI entry
|
|
13
|
+
lib/git_deploy.rb # Thor commands
|
|
14
|
+
lib/git_deploy/ # configuration, SSH, generator
|
|
15
|
+
lib/hooks/post-receive.sh # installed on server at setup
|
|
16
|
+
lib/git_deploy/templates/ # init callback templates (per stack)
|
|
17
|
+
spec/ # RSpec — integration-style, public interfaces
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Conventions
|
|
21
|
+
|
|
22
|
+
- **Tests:** `bundle exec rspec`. Add/update specs for behaviour changes. Prefer integration tests through CLI/generator/public APIs, not implementation details.
|
|
23
|
+
- **Compat:** Don't break existing `deploy/` callbacks or CLI without explicit issue discussion. Hook behaviour changes are opt-in via `git deploy hooks`.
|
|
24
|
+
- **Scope:** Minimal diffs. Match existing style (Thor options, module mixins, shell hooks).
|
|
25
|
+
- **Commits:** Conventional commits (`feat:`, `fix:`, `docs:`, `ci:`). Don't commit unless asked.
|
|
26
|
+
- **Git:** No force push, no destructive git ops without explicit user request.
|
|
27
|
+
|
|
28
|
+
## Key behaviour
|
|
29
|
+
|
|
30
|
+
- Remote commands require `-r <remote>` (v0.9+).
|
|
31
|
+
- `deploy_to` parsed from git remote URL; relative scp paths resolve against remote `$HOME`.
|
|
32
|
+
- `Generator` (Thor::Group) writes `deploy/*` from template dir on `git deploy init`.
|
|
33
|
+
- SSH via `Net::SSH` / `Net::SCP`; ed25519 needs optional `ed25519` + `bcrypt_pbkdf` gems.
|
|
34
|
+
|
|
35
|
+
## Release
|
|
36
|
+
|
|
37
|
+
- Gem: `git-deploy-ng` (not `git-deploy`).
|
|
38
|
+
- Version in `git-deploy-ng.gemspec`. Update `CHANGELOG.md` with `bin/update-changelog` before tagging.
|
|
39
|
+
- Tag `vX.Y.Z` triggers RubyGems publish (needs `RUBYGEMS_API_KEY` secret).
|
|
40
|
+
- CI: `.github/workflows/ci.yml` (matrix test + gem build), `release.yml` (tag publish + GitHub Release).
|
|
41
|
+
|
|
42
|
+
## Docs
|
|
43
|
+
|
|
44
|
+
- User-facing: `README.md`
|
|
45
|
+
- Contributors: `CONTRIBUTING.md`
|
|
46
|
+
- Planning: `ROADMAP.md`, local `tmp/` (gitignored)
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.9.0] - 2026-07-04
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Add framework templates for init including PHP/composer
|
|
14
|
+
- Add git deploy download for pulling files from the server
|
|
15
|
+
- Auto-update CHANGELOG on release
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- Add README.md and AGENTS.md, retire README.markdown
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
- Require remote and guard setup against destructive overwrites
|
|
22
|
+
- Resolve relative scp-style remote paths against remote $HOME
|
|
23
|
+
- Warn on init when deploy path collides with existing files
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## [0.8.0] - 2026-06-10
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- Ruby 3.x and 4.x compatibility; dynamic default branch detection
|
|
31
|
+
- Publish as `git-deploy-ng` on RubyGems
|
|
32
|
+
- GitHub Actions CI (Ruby 2.7–4.0) and gem build verification
|
|
33
|
+
- Clear error when ed25519 SSH gems are missing
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- Dependency upgrades (Thor, net-ssh, net-scp)
|
data/CONTRIBUTING.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Contributing
|
|
2
2
|
|
|
3
|
-
Thank you for contributing to git-deploy-ng. This project
|
|
3
|
+
Thank you for contributing to git-deploy-ng. This project continues [mislav/git-deploy](https://github.com/mislav/git-deploy) — v0.8.x preserved upstream compatibility; v0.9.0 introduces minor CLI changes (see [Backwards compatibility](#backwards-compatibility)).
|
|
4
4
|
|
|
5
5
|
## Getting started
|
|
6
6
|
|
|
@@ -20,15 +20,53 @@ bundle exec rspec
|
|
|
20
20
|
|
|
21
21
|
## Backwards compatibility
|
|
22
22
|
|
|
23
|
-
v0.8.x
|
|
23
|
+
### v0.8.x
|
|
24
|
+
|
|
25
|
+
Must not break existing users migrating from upstream 0.7.0:
|
|
24
26
|
|
|
25
27
|
- Same `git deploy` subcommands and flags
|
|
26
28
|
- Same default `post-receive` hook behaviour (improvements are opt-in via `git deploy hooks`)
|
|
27
29
|
- Existing `deploy/` callback scripts in deployed apps should keep working unchanged
|
|
28
30
|
|
|
31
|
+
### v0.9.0
|
|
32
|
+
|
|
33
|
+
Minor intentional compatibility changes — called out in release notes. **Existing `deploy/*` callbacks in deployed apps stay unchanged.**
|
|
34
|
+
|
|
35
|
+
| Change | Notes |
|
|
36
|
+
|--------|-------|
|
|
37
|
+
| Required `-r` on remote commands | No default remote (was `origin` in older docs) |
|
|
38
|
+
| Setup safety | `setup` requires explicit remote; `--force` to overwrite hooks |
|
|
39
|
+
| Init collision guard | Warn when `deploy/` non-empty; abort if `deploy` is a file |
|
|
40
|
+
| Relative remote paths | SCP-style paths without leading `/` resolve against remote `$HOME` |
|
|
41
|
+
| New commands / flags | `download`, `init --template` |
|
|
42
|
+
|
|
43
|
+
See [ROADMAP.md](ROADMAP.md#v090-in-progress) for scope.
|
|
44
|
+
|
|
29
45
|
## Releases
|
|
30
46
|
|
|
31
|
-
Releases are
|
|
47
|
+
Releases are published to [RubyGems](https://rubygems.org/gems/git-deploy-ng) as `git-deploy-ng` via GitHub Actions when a version tag is pushed.
|
|
48
|
+
|
|
49
|
+
### Cutting a release
|
|
50
|
+
|
|
51
|
+
1. Bump `gem.version` in `git-deploy-ng.gemspec` on `master` and merge.
|
|
52
|
+
2. Update the changelog from conventional commits since the last tag:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
ruby bin/update-changelog
|
|
56
|
+
git add CHANGELOG.md git-deploy-ng.gemspec
|
|
57
|
+
git commit -m "chore: prepare release X.Y.Z"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
3. Ensure CI is green on `master`.
|
|
61
|
+
4. Tag the release commit (tag must match the gemspec version):
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
git tag v0.9.0
|
|
65
|
+
git push origin master
|
|
66
|
+
git push origin v0.9.0
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
5. The **Release** workflow verifies the changelog, creates a GitHub Release, and publishes to RubyGems.
|
|
32
70
|
|
|
33
71
|
## Internal planning
|
|
34
72
|
|
data/README.md
ADDED
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
# git-deploy-ng
|
|
2
|
+
|
|
3
|
+
Push-based deployment over SSH — a community continuation of [mislav/git-deploy](https://github.com/mislav/git-deploy), published on RubyGems as **git-deploy-ng**.
|
|
4
|
+
|
|
5
|
+
Deploy with a single git push:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
git push production main
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Only the person setting up deployment needs the gem on their machine. Production servers need **bash and git only** — no Ruby on the server.
|
|
12
|
+
|
|
13
|
+
- **CLI:** Same commands as upstream; **v0.9.0** introduces minor compatibility changes — see [Backwards compatibility](CONTRIBUTING.md#backwards-compatibility) and [ROADMAP.md](ROADMAP.md#v090-in-progress)
|
|
14
|
+
- **Ruby:** 2.7+ on the setup machine (including 4.x)
|
|
15
|
+
- **Auth:** SSH public keys (password auth not supported)
|
|
16
|
+
|
|
17
|
+
See also: [ROADMAP.md](ROADMAP.md) · [CONTRIBUTING.md](CONTRIBUTING.md) · [AGENTS.md](AGENTS.md)
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Table of contents
|
|
22
|
+
|
|
23
|
+
- [How it works](#how-it-works)
|
|
24
|
+
- [Installation](#installation)
|
|
25
|
+
- [Initial setup](#initial-setup)
|
|
26
|
+
- [Everyday deployments](#everyday-deployments)
|
|
27
|
+
- [Init templates](#init-templates)
|
|
28
|
+
- [Deploy callbacks](#deploy-callbacks)
|
|
29
|
+
- [CLI reference](#cli-reference)
|
|
30
|
+
- [Remote URL formats](#remote-url-formats)
|
|
31
|
+
- [Restart recipes](#restart-recipes)
|
|
32
|
+
- [Multiple environments](#multiple-environments)
|
|
33
|
+
- [Migrating from mislav/git-deploy](#migrating-from-mislavgit-deploy)
|
|
34
|
+
- [Which git-deploy?](#which-git-deploy)
|
|
35
|
+
- [Troubleshooting](#troubleshooting)
|
|
36
|
+
- [Development](#development)
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## How it works
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
Developer machine Production server
|
|
44
|
+
───────────────── ─────────────────
|
|
45
|
+
git remote add production user@host:/app
|
|
46
|
+
git deploy setup -r production ──SSH──► mkdir /app, git init, install post-receive hook
|
|
47
|
+
git deploy init ──local► generate deploy/* callbacks in your repo
|
|
48
|
+
git push production main ──git──► post-receive hook runs deploy/after_push
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
1. **`git deploy setup`** creates (or reuses) a git repository on the server and installs a `post-receive` hook.
|
|
52
|
+
2. **`git deploy init`** generates `deploy/` callback scripts in your application repo — commit these.
|
|
53
|
+
3. **`git push production <branch>`** updates the server working copy and runs callbacks.
|
|
54
|
+
|
|
55
|
+
The hook checks out the pushed branch, then executes scripts in `deploy/`. Output is appended to `log/deploy.log` on the server.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Installation
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
gem install git-deploy-ng
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Do **not** add it to your app's Gemfile. One developer runs setup once per project/host.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Initial setup
|
|
70
|
+
|
|
71
|
+
### 1. Add a deploy remote
|
|
72
|
+
|
|
73
|
+
The remote name is arbitrary (`production`, `staging`, `online`, …):
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
git remote add production "user@example.com:/apps/mynewapp"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Use an **absolute** path (`/apps/...`) or a **home-relative** path (`apps/mynewapp` → `$HOME/apps/mynewapp`). See [Remote URL formats](#remote-url-formats).
|
|
80
|
+
|
|
81
|
+
### 2. Set up the server repository
|
|
82
|
+
|
|
83
|
+
```sh
|
|
84
|
+
git deploy setup -r production
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
This will:
|
|
88
|
+
|
|
89
|
+
- Create the deploy directory if missing
|
|
90
|
+
- Run `git init` (skipped if `.git` already exists)
|
|
91
|
+
- Install `post-receive` from `lib/hooks/post-receive.sh`
|
|
92
|
+
- Configure the remote HEAD to match your **current local branch** (`main` or `master`)
|
|
93
|
+
|
|
94
|
+
Options:
|
|
95
|
+
|
|
96
|
+
| Flag | Purpose |
|
|
97
|
+
|------|---------|
|
|
98
|
+
| `-r production` | **Required** — git remote name (no default) |
|
|
99
|
+
| `--force` / `-f` | Overwrite an existing `post-receive` hook |
|
|
100
|
+
| `--shared` / `-g` | Shared repository (`git init --shared`) |
|
|
101
|
+
| `--sudo` / `-s` | Create deploy dir with sudo |
|
|
102
|
+
|
|
103
|
+
### 3. Generate deploy callbacks
|
|
104
|
+
|
|
105
|
+
```sh
|
|
106
|
+
git deploy init --template rails-passenger
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Commit the generated `deploy/` directory. Scripts run on the server during each deploy.
|
|
110
|
+
|
|
111
|
+
### 4. Push
|
|
112
|
+
|
|
113
|
+
```sh
|
|
114
|
+
git push production main
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 5. One-time server admin
|
|
118
|
+
|
|
119
|
+
On the server, configure your web server (nginx/Apache), database, environment variables, etc.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Everyday deployments
|
|
124
|
+
|
|
125
|
+
```sh
|
|
126
|
+
git push production main
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Push the branch that is checked out on the remote (configured during `setup`). Teammates deploy with plain `git push` — they do not need the gem installed.
|
|
130
|
+
|
|
131
|
+
### What the default Rails template does
|
|
132
|
+
|
|
133
|
+
On each deploy, `deploy/after_push` typically:
|
|
134
|
+
|
|
135
|
+
1. Syncs git submodules
|
|
136
|
+
2. Runs `deploy/before_restart` (bundle install, migrations, asset precompile)
|
|
137
|
+
3. Runs `deploy/restart` (app server restart)
|
|
138
|
+
4. Runs `deploy/after_restart` (if present)
|
|
139
|
+
|
|
140
|
+
Customize everything by editing `deploy/*` in your repo.
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Init templates
|
|
145
|
+
|
|
146
|
+
```sh
|
|
147
|
+
git deploy init --template <name>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
| Template | Stack | Generated restart |
|
|
151
|
+
|----------|-------|-------------------|
|
|
152
|
+
| `rails-passenger` | Rails + Passenger | `touch tmp/restart.txt` |
|
|
153
|
+
| `rails-puma` | Rails + Puma | `pumactl restart` (with Passenger fallback) |
|
|
154
|
+
| `php-composer` | PHP + Composer | PHP-FPM reload via systemd |
|
|
155
|
+
| `generic` | Any | No-op — edit manually |
|
|
156
|
+
|
|
157
|
+
`rails-passenger` is the default. Templates only affect **new** `git deploy init` runs; existing `deploy/` scripts are never overwritten unless files are missing.
|
|
158
|
+
|
|
159
|
+
If `./deploy` exists as a **file** (not a directory), `init` aborts with an error. If `deploy/` is non-empty, existing files are preserved.
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Deploy callbacks
|
|
164
|
+
|
|
165
|
+
All scripts live in `deploy/` at the repo root. They are ordinary executables (shell, Ruby, anything). All are optional.
|
|
166
|
+
|
|
167
|
+
| Script | When it runs |
|
|
168
|
+
|--------|--------------|
|
|
169
|
+
| `deploy/setup` | First push to a new branch |
|
|
170
|
+
| `deploy/after_push` | Every subsequent push |
|
|
171
|
+
| `deploy/before_restart` | Called from `after_push` |
|
|
172
|
+
| `deploy/restart` | Called from `after_push` |
|
|
173
|
+
| `deploy/after_restart` | Called from `after_push` |
|
|
174
|
+
| `deploy/rollback` | `git deploy rollback` (instead of `after_push`) |
|
|
175
|
+
|
|
176
|
+
Hook entry point: `lib/hooks/post-receive.sh` (installed to `.git/hooks/post-receive` on the server).
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## CLI reference
|
|
181
|
+
|
|
182
|
+
All commands that connect to a server **require** `-r <remote>`. There is no default remote.
|
|
183
|
+
|
|
184
|
+
Global options:
|
|
185
|
+
|
|
186
|
+
| Option | Description |
|
|
187
|
+
|--------|-------------|
|
|
188
|
+
| `-r`, `--remote` | Git remote name (**required** for remote commands) |
|
|
189
|
+
| `-n`, `--noop` | Print commands without executing |
|
|
190
|
+
|
|
191
|
+
| Command | Description |
|
|
192
|
+
|---------|-------------|
|
|
193
|
+
| `git deploy init [--template NAME]` | Generate `deploy/` callbacks locally |
|
|
194
|
+
| `git deploy setup -r REMOTE [--force]` | Create remote repo + install hook |
|
|
195
|
+
| `git deploy hooks -r REMOTE [--force]` | Refresh remote hook only |
|
|
196
|
+
| `git deploy log -r REMOTE [-l N] [-t]` | Tail deploy log (`-t` to follow) |
|
|
197
|
+
| `git deploy rerun -r REMOTE` | Re-run `after_push` on server |
|
|
198
|
+
| `git deploy restart -r REMOTE` | Run `deploy/restart` on server |
|
|
199
|
+
| `git deploy rollback -r REMOTE` | Reset to previous revision + callback |
|
|
200
|
+
| `git deploy upload -r REMOTE <files…>` | SCP local → server app dir |
|
|
201
|
+
| `git deploy download -r REMOTE <paths…>` | SCP server app dir → local |
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Remote URL formats
|
|
206
|
+
|
|
207
|
+
| Remote | Deploy path |
|
|
208
|
+
|--------|-------------|
|
|
209
|
+
| `user@host:/var/www/app` | `/var/www/app` (absolute) |
|
|
210
|
+
| `user@host:~/apps/app` | `~/apps/app` (home-relative) |
|
|
211
|
+
| `user@host:apps/app` | `$HOME/apps/app` (relative to remote `$HOME`) |
|
|
212
|
+
| `ssh://user@host:2222/path` | `/path` on port 2222 |
|
|
213
|
+
|
|
214
|
+
GitHub remotes are rejected — you cannot deploy to github.com.
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Restart recipes
|
|
219
|
+
|
|
220
|
+
Match `deploy/restart` to your app server:
|
|
221
|
+
|
|
222
|
+
**Passenger** (default template):
|
|
223
|
+
|
|
224
|
+
```sh
|
|
225
|
+
touch tmp/restart.txt
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
**Unicorn:**
|
|
229
|
+
|
|
230
|
+
```sh
|
|
231
|
+
kill -USR2 $(cat tmp/pids/unicorn.pid)
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
**Puma** — use `--template rails-puma`, or:
|
|
235
|
+
|
|
236
|
+
```sh
|
|
237
|
+
bundle exec pumactl -P tmp/pids/puma.pid restart
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
**PHP-FPM** — use `--template php-composer`, or:
|
|
241
|
+
|
|
242
|
+
```sh
|
|
243
|
+
sudo systemctl reload php-fpm
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Multiple environments
|
|
249
|
+
|
|
250
|
+
Use separate git remotes pointing at separate directories on the same (or different) host:
|
|
251
|
+
|
|
252
|
+
```sh
|
|
253
|
+
git remote add staging user@server:~/apps/myapp-staging
|
|
254
|
+
git remote add production user@server:~/apps/myapp-production
|
|
255
|
+
|
|
256
|
+
git deploy setup -r staging
|
|
257
|
+
git deploy setup -r production
|
|
258
|
+
|
|
259
|
+
git push staging develop
|
|
260
|
+
git push production main
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Same `deploy/` scripts usually work for both; set `RAILS_ENV` or equivalent in server environment or in the scripts.
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Migrating from mislav/git-deploy
|
|
268
|
+
|
|
269
|
+
1. `gem uninstall git-deploy` (optional)
|
|
270
|
+
2. `gem install git-deploy-ng`
|
|
271
|
+
3. `git deploy hooks -r production` on each host
|
|
272
|
+
|
|
273
|
+
Existing `deploy/` scripts in your apps do not need to change. After upgrading, refresh hooks on each host to pick up improvements.
|
|
274
|
+
|
|
275
|
+
**v0.9.0 compatibility changes:** Minor CLI changes (notably `-r` required on all remote commands). Full list: [CONTRIBUTING.md § Backwards compatibility](CONTRIBUTING.md#backwards-compatibility), [ROADMAP.md § v0.9.0](ROADMAP.md#v090-in-progress).
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## Which git-deploy?
|
|
280
|
+
|
|
281
|
+
| Project | Model | Use when |
|
|
282
|
+
|---------|-------|----------|
|
|
283
|
+
| **git-deploy-ng** (this repo) | Push-based: `git push production main` | Heroku-style simplicity, modern Ruby |
|
|
284
|
+
| [mislav/git-deploy](https://github.com/mislav/git-deploy) | Original gem (archived ~0.7.0) | Legacy reference |
|
|
285
|
+
| [git-deploy/git-deploy](https://github.com/git-deploy/git-deploy) | Pull-based: `git deploy start/sync/finish` on a deploy host | Locking, deploy tags, multi-server sync from a staging machine |
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## Troubleshooting
|
|
290
|
+
|
|
291
|
+
### `bundle` or `ruby` not found on push (but `git deploy rerun` works)
|
|
292
|
+
|
|
293
|
+
`git push` runs hooks in a non-interactive shell that may not load `.bashrc`. This is usually a **server environment** issue:
|
|
294
|
+
|
|
295
|
+
1. Initialize rbenv/rvm/nvm in `~/.profile` or `~/.bash_profile`, not only `.bashrc`.
|
|
296
|
+
2. Or add `deploy/env` on the server with PATH exports (sourced by the hook when present).
|
|
297
|
+
|
|
298
|
+
### SSH key authentication
|
|
299
|
+
|
|
300
|
+
Set up key auth with `ssh-copy-id` before running setup. Password auth is not supported.
|
|
301
|
+
|
|
302
|
+
### `unsupported key type ssh-ed25519`
|
|
303
|
+
|
|
304
|
+
```sh
|
|
305
|
+
gem install ed25519 bcrypt_pbkdf
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
git-deploy-ng prints this hint automatically when the gems are missing.
|
|
309
|
+
|
|
310
|
+
### Setup refuses to overwrite hooks
|
|
311
|
+
|
|
312
|
+
Use `--force` when re-running setup or hooks on an existing deployment:
|
|
313
|
+
|
|
314
|
+
```sh
|
|
315
|
+
git deploy setup -r production --force
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## Development
|
|
321
|
+
|
|
322
|
+
```sh
|
|
323
|
+
git clone https://github.com/npfedwards/git-deploy.git
|
|
324
|
+
cd git-deploy
|
|
325
|
+
bundle install
|
|
326
|
+
bundle exec rspec
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
CI runs on Ubuntu and macOS against Ruby 2.7–4.0. Releases publish to RubyGems when a `v*` tag is pushed — see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## License
|
|
334
|
+
|
|
335
|
+
MIT — see [LICENSE](LICENSE). Originally by [Mislav Marohnić](https://github.com/mislav); maintained by [Nathan Edwards](https://github.com/npfedwards).
|
data/ROADMAP.md
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Tracking for git-deploy-ng. **Nothing listed here is a commitment** — items may be reprioritised, dropped, or implemented differently. Any change that affects default behaviour will be called out explicitly in release notes.
|
|
4
4
|
|
|
5
|
-
## v0.8.0 (
|
|
6
|
-
|
|
7
|
-
Scoped fixes for this release:
|
|
5
|
+
## v0.8.0 (released)
|
|
8
6
|
|
|
9
7
|
| Fix | Upstream context |
|
|
10
8
|
|-----|------------------|
|
|
@@ -14,6 +12,20 @@ Scoped fixes for this release:
|
|
|
14
12
|
| Modern CI (GitHub Actions, Ruby 2.7–4.0) | Travis CI retired |
|
|
15
13
|
| Publish as `git-deploy-ng` on RubyGems | Avoids namespace conflict with upstream gem |
|
|
16
14
|
|
|
15
|
+
## v0.9.0 (in progress)
|
|
16
|
+
|
|
17
|
+
Minor CLI compatibility changes from v0.8.x. **Deployed `deploy/*` callbacks are unchanged** — see [CONTRIBUTING.md § Backwards compatibility](CONTRIBUTING.md#backwards-compatibility).
|
|
18
|
+
|
|
19
|
+
| Change | Issue / PR |
|
|
20
|
+
|--------|------------|
|
|
21
|
+
| Required `-r` on remote commands | [#78](https://github.com/mislav/git-deploy/issues/78) |
|
|
22
|
+
| Setup safety (`--force` for hook overwrite) | [#78](https://github.com/mislav/git-deploy/issues/78) |
|
|
23
|
+
| Init collision warning | [#56](https://github.com/mislav/git-deploy/issues/56) |
|
|
24
|
+
| Relative remote path resolution | [#57](https://github.com/mislav/git-deploy/issues/57) |
|
|
25
|
+
| Framework init templates (`--template`) | [#4](https://github.com/npfedwards/git-deploy/issues/4), [#92](https://github.com/mislav/git-deploy/issues/92) |
|
|
26
|
+
| `git deploy download` | [#83](https://github.com/mislav/git-deploy/issues/83) |
|
|
27
|
+
| README + AGENTS docs | [#53](https://github.com/mislav/git-deploy/issues/53) |
|
|
28
|
+
|
|
17
29
|
## Ideas under consideration (post-v0.8.0)
|
|
18
30
|
|
|
19
31
|
Sourced from upstream open issues and community discussion. If something here interests you, open an issue — priorities are not fixed.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# encoding: utf-8
|
|
3
|
+
require_relative '../lib/git_deploy/changelog'
|
|
4
|
+
|
|
5
|
+
def usage
|
|
6
|
+
warn <<~USAGE
|
|
7
|
+
Usage: update-changelog [VERSION] [options]
|
|
8
|
+
|
|
9
|
+
Append a version section to CHANGELOG.md from conventional commits since the
|
|
10
|
+
latest tag. VERSION defaults to git-deploy-ng.gemspec.
|
|
11
|
+
|
|
12
|
+
Options:
|
|
13
|
+
--date YYYY-MM-DD Release date (default: today)
|
|
14
|
+
--since REF Git ref to start from (default: latest tag)
|
|
15
|
+
--check Verify CHANGELOG.md documents VERSION and exit
|
|
16
|
+
USAGE
|
|
17
|
+
exit 1
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
args = ARGV.dup
|
|
21
|
+
version = args.shift if args.first&.match?(/\A\d+\.\d+\.\d+\z/)
|
|
22
|
+
|
|
23
|
+
date = Date.today.iso8601
|
|
24
|
+
since_ref = GitDeploy::Changelog.latest_tag
|
|
25
|
+
check = false
|
|
26
|
+
path = 'CHANGELOG.md'
|
|
27
|
+
|
|
28
|
+
while (arg = args.shift)
|
|
29
|
+
case arg
|
|
30
|
+
when '--help', '-h' then usage
|
|
31
|
+
when '--check' then check = true
|
|
32
|
+
when '--date' then date = args.shift || usage
|
|
33
|
+
when '--since' then since_ref = args.shift || usage
|
|
34
|
+
else usage
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
version ||= GitDeploy::Changelog.gemspec_version
|
|
39
|
+
|
|
40
|
+
if check
|
|
41
|
+
content = File.read(path)
|
|
42
|
+
GitDeploy::Changelog.verify_version!(content, version)
|
|
43
|
+
puts "CHANGELOG.md documents version #{version}"
|
|
44
|
+
else
|
|
45
|
+
GitDeploy::Changelog.update_file(path, version, date: date, since_ref: since_ref)
|
|
46
|
+
puts "Updated #{path} for version #{version}"
|
|
47
|
+
end
|