minideploy 0.1.0__tar.gz

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,13 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+
12
+ deploy.yml
13
+ .vscode
@@ -0,0 +1 @@
1
+ 3.11
@@ -0,0 +1,371 @@
1
+ Metadata-Version: 2.4
2
+ Name: minideploy
3
+ Version: 0.1.0
4
+ Summary: Simple deployment tool for your VPS
5
+ Requires-Python: >=3.11
6
+ Requires-Dist: click>=8.3.1
7
+ Requires-Dist: jinja2>=3.1.6
8
+ Requires-Dist: paramiko>=4.0.0
9
+ Requires-Dist: pydantic>=2.12.5
10
+ Requires-Dist: pyyaml>=6.0.3
11
+ Requires-Dist: rich>=14.3.2
12
+ Description-Content-Type: text/markdown
13
+
14
+ # minideploy
15
+
16
+ Simple deployment tool for your VPS. Deploy applications with rolling updates, health checks, and automatic rollbacks.
17
+
18
+ ## Features
19
+
20
+ - **Simple Configuration**: Single `deploy.yml` file per project
21
+ - **JSON Schema**: Full schema validation for IDE support
22
+ - **Multiple Service Managers**: Systemd, Docker Compose, PM2
23
+ - **Rolling Deployments**: Zero-downtime deployments with health checks
24
+ - **Release Management**: Automatic versioning with easy rollback
25
+ - **Built-in Health Checks**: Verify deployments before switching traffic
26
+ - **SSH-based**: No agents required on the server
27
+ - **Shell Completions**: Tab completion for bash, zsh, and fish
28
+
29
+ ## ⚠️ Service Manager Status
30
+
31
+ > **Systemd** ✅ Fully implemented and tested
32
+ > **Docker Compose** ⚠️ Implemented but not fully tested
33
+ > **PM2** ⚠️ Implemented but not fully tested
34
+ >
35
+ > While Docker Compose and PM2 are implemented, they have not been extensively tested. Please report any issues you encounter.
36
+
37
+ ## Installation
38
+
39
+ ```bash
40
+ uv tool install minideploy
41
+ ```
42
+
43
+ Or with pip:
44
+
45
+ ```bash
46
+ pip install minideploy
47
+ ```
48
+
49
+ ## Quick Start
50
+
51
+ ### 1. Initialize Configuration
52
+
53
+ ```bash
54
+ cd your-project
55
+ minideploy init
56
+ ```
57
+
58
+ This creates a `deploy.yml` file. Edit it for your project:
59
+
60
+ ```yaml
61
+ app:
62
+ name: "myapp"
63
+ type: "web"
64
+
65
+ build:
66
+ type: "custom"
67
+ command: "echo 'Replace with your build command'"
68
+ output_dir: "dist"
69
+
70
+ server:
71
+ host: "your-server.com"
72
+ user: "deploy"
73
+ deploy_dir: "/opt/myapp"
74
+
75
+ service:
76
+ type: "systemd"
77
+ instances:
78
+ - id: "1"
79
+ port: 8080
80
+ health_endpoint: "/health"
81
+ systemd_options:
82
+ user: "deploy"
83
+ restart: "always"
84
+ working_directory: "/opt/myapp/current"
85
+ exec_start: "/opt/myapp/current/myapp"
86
+
87
+ deploy:
88
+ strategy: "rolling"
89
+ keep_releases: 3
90
+ health_check:
91
+ timeout: 30
92
+ retries: 3
93
+ wait_between_instances: 5
94
+ ```
95
+
96
+ ### 2. Setup Server (run once)
97
+
98
+ ```bash
99
+ minideploy setup
100
+ ```
101
+
102
+ This creates the directory structure and sets up systemd services.
103
+
104
+ ### 3. Deploy
105
+
106
+ ```bash
107
+ minideploy deploy
108
+ ```
109
+
110
+ ## Commands
111
+
112
+ - `minideploy init` - Create a sample deploy.yml
113
+ - `minideploy setup` - Initial server setup
114
+ - `minideploy setup --regenerate` - Recreate service configuration
115
+ - `minideploy build` - Build the application locally
116
+ - `minideploy upload` - Upload build to server
117
+ - `minideploy deploy` - Full deployment (build + upload + deploy)
118
+ - `minideploy status` - Show deployment status
119
+ - `minideploy releases` - List all releases
120
+ - `minideploy rollback` - Rollback to previous release
121
+ - `minideploy health` - Run health checks
122
+ - `minideploy logs` - View service logs
123
+ - `minideploy service start|stop|restart|status` - Manage services
124
+ - `minideploy destroy` - Remove all server setup (services and directories)
125
+ - `minideploy ssh` - Open SSH session to server
126
+ - `minideploy completion <shell>` - Generate shell completions
127
+
128
+ ## Shell Completions
129
+
130
+ minideploy supports tab completion for **bash**, **zsh**, and **fish** shells.
131
+
132
+ ### Bash
133
+
134
+ Add to `~/.bashrc`:
135
+
136
+ ```bash
137
+ eval "$(_MINIDEPLOY_COMPLETE=bash_source minideploy)"
138
+ ```
139
+
140
+ Or use the built-in install command:
141
+
142
+ ```bash
143
+ minideploy completion bash --install
144
+ source ~/.bashrc
145
+ ```
146
+
147
+ ### Zsh
148
+
149
+ Add to `~/.zshrc`:
150
+
151
+ ```zsh
152
+ eval "$(_MINIDEPLOY_COMPLETE=zsh_source minideploy)"
153
+ ```
154
+
155
+ Or use the built-in install command:
156
+
157
+ ```bash
158
+ minideploy completion zsh --install
159
+ source ~/.zshrc
160
+ ```
161
+
162
+ ### Fish
163
+
164
+ Create file `~/.config/fish/completions/minideploy.fish`:
165
+
166
+ ```fish
167
+ _MINIDEPLOY_COMPLETE=fish_source minideploy | source
168
+ ```
169
+
170
+ Or use the built-in install command:
171
+
172
+ ```bash
173
+ minideploy completion fish --install
174
+ ```
175
+
176
+ ## Managing Server Setup
177
+
178
+ ### Regenerate Service Configuration
179
+
180
+ If you need to update the service configuration (e.g., change systemd options):
181
+
182
+ ```bash
183
+ # This removes existing services and recreates them
184
+ minideploy setup --regenerate
185
+ ```
186
+
187
+ ### Destroy Server Setup
188
+
189
+ To completely remove a project from the server (services and all files):
190
+
191
+ ```bash
192
+ # This will prompt for confirmation
193
+ minideploy destroy
194
+
195
+ # Force destroy without confirmation
196
+ minideploy destroy --force
197
+ ```
198
+
199
+ **Warning**: This permanently deletes:
200
+ - All systemd/docker/pm2 services for the app
201
+ - The entire deployment directory (`/opt/<app-name>/`)
202
+ - All releases and uploaded files
203
+
204
+ ## Options
205
+
206
+ - `-c, --config` - Path to configuration file (default: deploy.yml)
207
+ - `-v, --verbose` - Enable verbose output
208
+ - `--dry-run` - Show what would be done without executing
209
+
210
+ ## Directory Structure on Server
211
+
212
+ ```
213
+ /opt/<app-name>/
214
+ ├── current -> releases/<current-release> # Symlink to active release
215
+ ├── releases/ # Versioned releases
216
+ │ ├── release_20240213_143022/
217
+ │ ├── release_20240213_120000/
218
+ │ └── ...
219
+ └── uploads/ # Temporary upload directory
220
+ ```
221
+
222
+ ## Configuration Reference
223
+
224
+ ### App
225
+ - `name` - Application name
226
+ - `type` - Application type (for documentation)
227
+
228
+ ### Build
229
+ - `type` - Build type: `dotnet`, `npm`, `custom`, `docker`, etc.
230
+ - `command` - Build command to execute
231
+ - `output_dir` - Build output directory
232
+ - `env_file` - Environment file to upload (optional)
233
+ - `pre_build` - Command to run before build (optional)
234
+ - `post_build` - Command to run after build (optional)
235
+
236
+ ### Server
237
+ - `host` - Server hostname or IP
238
+ - `user` - SSH user (default: deploy)
239
+ - `port` - SSH port (default: 22)
240
+ - `ssh_key` - Path to SSH private key (optional)
241
+ - `deploy_dir` - Deployment directory on server
242
+
243
+ ### Service
244
+ - `type` - Service manager: `systemd`, `docker-compose`, `pm2`
245
+ - `instances` - List of service instances
246
+ - `id` - Instance identifier
247
+ - `port` - Port for health checks
248
+ - `health_endpoint` - Health check endpoint
249
+ - `template` - Custom service template file (optional)
250
+
251
+ #### Systemd Options
252
+ - `user` - User to run service as
253
+ - `group` - Group to run service as (optional)
254
+ - `restart` - Restart policy (default: always)
255
+ - `working_directory` - Working directory
256
+ - `exec_start` - Command to execute (use `%i` for instance id)
257
+ - `environment_file` - Path to environment file (optional)
258
+ - `environment` - Environment variables as key-value pairs (optional)
259
+ - `additional_options` - Additional [Service] section options
260
+
261
+ ### Deploy
262
+ - `strategy` - Deployment strategy: `rolling`, `blue-green`
263
+ - `keep_releases` - Number of releases to keep (default: 3)
264
+ - `health_check` - Health check configuration
265
+ - `timeout` - Timeout in seconds (default: 30)
266
+ - `retries` - Number of retries (default: 3)
267
+ - `wait_between_instances` - Wait time between deployments (default: 5)
268
+
269
+ ## Examples
270
+
271
+ ### .NET Application
272
+
273
+ ```yaml
274
+ app:
275
+ name: "myapi"
276
+ type: "dotnet"
277
+
278
+ build:
279
+ type: "dotnet"
280
+ command: "dotnet publish -c Release -r linux-x64 --self-contained -o publish"
281
+ output_dir: "publish"
282
+
283
+ server:
284
+ host: "myvps"
285
+ user: "deploy"
286
+ deploy_dir: "/opt/myapi"
287
+
288
+ service:
289
+ type: "systemd"
290
+ instances:
291
+ - id: "1"
292
+ port: 5001
293
+ health_endpoint: "/health"
294
+ - id: "2"
295
+ port: 5002
296
+ health_endpoint: "/health"
297
+ systemd_options:
298
+ user: "deploy"
299
+ restart: "always"
300
+ working_directory: "/opt/myapi/current"
301
+ exec_start: "/opt/myapi/current/MyApi --urls http://localhost:500%i"
302
+ ```
303
+
304
+ ### Node.js Application with PM2
305
+
306
+ ```yaml
307
+ app:
308
+ name: "myapp"
309
+ type: "node"
310
+
311
+ build:
312
+ type: "npm"
313
+ command: "npm ci && npm run build"
314
+ output_dir: "dist"
315
+
316
+ server:
317
+ host: "myvps"
318
+ user: "deploy"
319
+ deploy_dir: "/opt/myapp"
320
+
321
+ service:
322
+ type: "pm2"
323
+ instances:
324
+ - id: "1"
325
+ port: 3000
326
+ health_endpoint: "/health"
327
+ pm2_config: "ecosystem.config.js"
328
+ ```
329
+
330
+ ## JSON Schema
331
+
332
+ A JSON Schema is available for `deploy.yml` validation and IDE autocomplete support:
333
+
334
+ **schema.json**
335
+
336
+ Add the schema to your `deploy.yml` for IDE support:
337
+
338
+ ```yaml
339
+ # yaml-language-server: $schema=https://raw.githubusercontent.com/yourusername/minideploy/main/schema.json
340
+
341
+ app:
342
+ name: "myapp"
343
+ # ... rest of your config
344
+ ```
345
+
346
+ ### VS Code
347
+
348
+ Install the [YAML extension](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml) and add to your settings:
349
+
350
+ ```json
351
+ {
352
+ "yaml.schemas": {
353
+ "https://raw.githubusercontent.com/yourusername/minideploy/main/schema.json": "deploy.yml"
354
+ }
355
+ }
356
+ ```
357
+
358
+ ### PyCharm / IntelliJ
359
+
360
+ Go to **Settings → Languages & Frameworks → Schemas and DTDs → JSON Schema Mappings** and add:
361
+
362
+ - **Schema file or URL**: `https://raw.githubusercontent.com/yourusername/minideploy/main/schema.json`
363
+ - **File path pattern**: `deploy.yml`
364
+
365
+ ### Other Editors
366
+
367
+ Most modern editors support JSON Schema validation through the [YAML Language Server](https://github.com/redhat-developer/yaml-language-server).
368
+
369
+ ## License
370
+
371
+ MIT