depops 0.0.0-stage → 0.3.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.
- package/LICENSE +21 -0
- package/README.md +142 -2
- package/bin/depops.js +4 -0
- package/package.json +39 -4
- package/src/cli.js +932 -0
- package/src/compose.js +121 -0
- package/src/presets.js +39 -0
- package/src/ssh.js +188 -0
- package/src/update.js +142 -0
- package/src/vault.js +121 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 depops 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.
|
package/README.md
CHANGED
|
@@ -1,3 +1,143 @@
|
|
|
1
|
-
#
|
|
1
|
+
# depops
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Deploy to any VPS from your own machine over SSH, with **zero server details in plain text**.
|
|
4
|
+
|
|
5
|
+
Everything (IP, port, user, SSH key, sudo password, registry login, server folders, steps, `.env` files)
|
|
6
|
+
is stored in a single encrypted file, `.depops.vault`, that you commit to the repo. Clone on any computer,
|
|
7
|
+
type the master password, deploy.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx depops init # one time: server + projects + master password
|
|
11
|
+
git add .depops.vault && git commit -m "Add deploy vault"
|
|
12
|
+
|
|
13
|
+
# any computer, any time
|
|
14
|
+
npx depops deploy # deploy every project
|
|
15
|
+
npx depops deploy backend # deploy one project
|
|
16
|
+
npx depops deploy backend admin # deploy several
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Works on macOS, Linux and Windows (pure JavaScript SSH, no `ssh`/`sshpass`/`expect` needed).
|
|
20
|
+
|
|
21
|
+
## How it works (recommended Docker flow)
|
|
22
|
+
|
|
23
|
+
1. **Build here:** every service in your compose file that has `build:` + `image:` is built with
|
|
24
|
+
`docker buildx` and pushed to your registry.
|
|
25
|
+
2. **Server gets only two files:** `docker-compose.yml` (with `build:` removed) and `.env` (`chmod 600`).
|
|
26
|
+
No source code ever lands on the server.
|
|
27
|
+
3. **Server pulls and restarts:** `docker compose pull && docker compose up -d --no-build`.
|
|
28
|
+
|
|
29
|
+
On first setup, `init` creates the server folders and copies `docker-compose.yml` + `.env` there.
|
|
30
|
+
|
|
31
|
+
## One project or many
|
|
32
|
+
|
|
33
|
+
`init` scans the repo (root and up to two folder levels, e.g. `backend/`, `apps/web/`) for
|
|
34
|
+
`docker-compose.yml` / `compose.yaml`. Every folder with its own compose file becomes a project:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
repo/
|
|
38
|
+
├─ backend/ docker-compose.yml, .env → project "backend" → /var/www/backend
|
|
39
|
+
├─ frontend/ docker-compose.yml, .env → project "frontend" → /var/www/frontend
|
|
40
|
+
├─ admin/ docker-compose.yml, .env → project "admin" → /var/www/admin
|
|
41
|
+
└─ worker/ docker-compose.yml → project "worker" → /var/www/worker
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Names and server folders default to the folder name and can be changed. A single project with a compose
|
|
45
|
+
file in the repo root works the same way. Projects without Docker can be added by hand.
|
|
46
|
+
|
|
47
|
+
`depops deploy` builds **all** selected projects first; if any build fails, no server is touched.
|
|
48
|
+
|
|
49
|
+
### Compose file requirements
|
|
50
|
+
|
|
51
|
+
- Every service with `build:` needs an `image:` (e.g. `image: youruser/backend:latest`), otherwise the
|
|
52
|
+
server cannot pull it. `init`/`deploy` tell you if one is missing.
|
|
53
|
+
- Use `env_file: .env` (the server only gets `.env`).
|
|
54
|
+
- Build-time variables (e.g. `NEXT_PUBLIC_*`) go in `build.args`; their values come from the project's
|
|
55
|
+
vault env:
|
|
56
|
+
|
|
57
|
+
```yaml
|
|
58
|
+
build:
|
|
59
|
+
context: .
|
|
60
|
+
args:
|
|
61
|
+
- NEXT_PUBLIC_API_URL
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Other deploy types
|
|
65
|
+
|
|
66
|
+
| Type | What happens |
|
|
67
|
+
|------|--------------|
|
|
68
|
+
| Docker – build on server | `git pull` → `docker compose up -d --build` |
|
|
69
|
+
| Node.js + PM2 | `git pull` → `npm ci` → `npm run build` → `pm2 startOrReload` |
|
|
70
|
+
| Static site | local build → upload folder (e.g. `dist`) |
|
|
71
|
+
| Custom | your own local + server commands (Python, PHP, Go, systemd, …) |
|
|
72
|
+
|
|
73
|
+
All steps are editable later with `depops edit`.
|
|
74
|
+
|
|
75
|
+
## Commands
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
depops init create the vault
|
|
79
|
+
depops deploy [name…] [--skip-local] [--skip-remote]
|
|
80
|
+
depops test check SSH + sudo
|
|
81
|
+
depops run "<cmd>" [--target=name] [--no-sudo]
|
|
82
|
+
depops edit add/remove projects, steps, server, sudo, registry
|
|
83
|
+
depops env list|set KEY|rm KEY|import [file] [--target=name]
|
|
84
|
+
depops show [--reveal] summary (server details hidden unless --reveal)
|
|
85
|
+
depops passwd change master password
|
|
86
|
+
depops update update to the newest version
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
For scripts, set `DEPOPS_PASSWORD` in the environment instead of typing it.
|
|
90
|
+
|
|
91
|
+
## Login options
|
|
92
|
+
|
|
93
|
+
- **Password → auto SSH key (recommended):** logs in once with the password, creates an ed25519 key,
|
|
94
|
+
installs it on the server, and stores only the key.
|
|
95
|
+
- Generate a new key, add the public key to the server yourself (e.g. VPS provider panel)
|
|
96
|
+
- Existing private key file (with or without passphrase)
|
|
97
|
+
- Password only
|
|
98
|
+
- SSH agent (key never leaves this computer, so not portable)
|
|
99
|
+
|
|
100
|
+
Every option is verified by actually connecting; on failure you can retry or change the details.
|
|
101
|
+
|
|
102
|
+
## Docker registry login
|
|
103
|
+
|
|
104
|
+
For Docker projects, `init` asks for registry credentials (Docker Hub, ghcr.io or any other registry).
|
|
105
|
+
Use an access token instead of your account password. The login is verified on this computer and on the
|
|
106
|
+
server. During deploy the server logs in, pulls, and **logs out again**, so credentials don't stay on the server.
|
|
107
|
+
|
|
108
|
+
## Security
|
|
109
|
+
|
|
110
|
+
- **Encryption:** scrypt (N=2^17, r=8, p=1, 128 MiB per guess) → AES-256-GCM. The header is authenticated,
|
|
111
|
+
so any change to the file is detected. Node built-in crypto only.
|
|
112
|
+
- **Master password** is never stored; minimum 12 characters with strength checks.
|
|
113
|
+
- **Host key pinning:** the server fingerprint is confirmed on first connect and stored in the vault.
|
|
114
|
+
A changed key aborts the deploy (man-in-the-middle protection).
|
|
115
|
+
- **No secrets on command lines:** the sudo password is passed via stdin and the deploy script goes to a
|
|
116
|
+
0600 temp file that is always deleted. Commands cannot read the sudo password from stdin.
|
|
117
|
+
- **No server details in output:** host, user, port and server folders are not printed; errors are scrubbed.
|
|
118
|
+
- `.env` on the server is `chmod 600`.
|
|
119
|
+
- `init` warns if other project files contain your server address or passwords in plain text.
|
|
120
|
+
|
|
121
|
+
**The vault is only as strong as the master password.** Use a long, unique one and share it through a
|
|
122
|
+
password manager. Anyone with the repo *and* the password can deploy.
|
|
123
|
+
|
|
124
|
+
## Updates
|
|
125
|
+
|
|
126
|
+
depops checks npm for a new version at most every 12 hours (1.5s timeout, never blocks when offline):
|
|
127
|
+
|
|
128
|
+
- **npx:** runs the newest version automatically.
|
|
129
|
+
- **Global install** (`npm i -g depops`): updates itself, then re-runs your command.
|
|
130
|
+
- **Project install** (`node_modules`): shows the update command, never edits your `package.json`.
|
|
131
|
+
|
|
132
|
+
`depops update` updates on demand; `depops --version` shows the installed version.
|
|
133
|
+
Turn it off with `--no-update` or `DEPOPS_NO_UPDATE=1`. It is always off in CI.
|
|
134
|
+
|
|
135
|
+
## Requirements
|
|
136
|
+
|
|
137
|
+
- Node.js 18.17+
|
|
138
|
+
- Docker with buildx on your computer (for the Docker flow)
|
|
139
|
+
- Server: Linux with `bash` and Docker (and `sudo` if you enable it)
|
|
140
|
+
|
|
141
|
+
## License
|
|
142
|
+
|
|
143
|
+
MIT
|
package/bin/depops.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "depops",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Deploy to any VPS from your machine over SSH. All server details live in one encrypted vault file you can safely commit.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"depops": "bin/depops.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin",
|
|
11
|
+
"src",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=18.17"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@clack/prompts": "^1.9.0",
|
|
19
|
+
"ssh2": "^1.17.0",
|
|
20
|
+
"yaml": "^2.9.1"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"deploy",
|
|
24
|
+
"vps",
|
|
25
|
+
"ssh",
|
|
26
|
+
"devops",
|
|
27
|
+
"vault",
|
|
28
|
+
"encryption",
|
|
29
|
+
"docker",
|
|
30
|
+
"pm2"
|
|
31
|
+
],
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/arifbiswas/depops.git"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://github.com/arifbiswas/depops#readme",
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/arifbiswas/depops/issues"
|
|
40
|
+
}
|
|
41
|
+
}
|