uhdeploy 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.
- uhdeploy-0.1.0/LICENSE +22 -0
- uhdeploy-0.1.0/PKG-INFO +298 -0
- uhdeploy-0.1.0/README.md +264 -0
- uhdeploy-0.1.0/pyproject.toml +48 -0
- uhdeploy-0.1.0/setup.cfg +4 -0
- uhdeploy-0.1.0/setup.py +42 -0
- uhdeploy-0.1.0/uhdeploy/__init__.py +15 -0
- uhdeploy-0.1.0/uhdeploy/__main__.py +8 -0
- uhdeploy-0.1.0/uhdeploy/cli.py +1300 -0
- uhdeploy-0.1.0/uhdeploy.egg-info/PKG-INFO +298 -0
- uhdeploy-0.1.0/uhdeploy.egg-info/SOURCES.txt +13 -0
- uhdeploy-0.1.0/uhdeploy.egg-info/dependency_links.txt +1 -0
- uhdeploy-0.1.0/uhdeploy.egg-info/entry_points.txt +2 -0
- uhdeploy-0.1.0/uhdeploy.egg-info/requires.txt +3 -0
- uhdeploy-0.1.0/uhdeploy.egg-info/top_level.txt +1 -0
uhdeploy-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Abdullah Ahmad
|
|
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.
|
|
22
|
+
|
uhdeploy-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: uhdeploy
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Universal Local-to-VPS automated deployment CLI (SSH/SFTP, FTP, Docker, Local Build Pipelines)
|
|
5
|
+
Home-page: https://github.com/AbdullahAhmad-0/Universal-Deployer
|
|
6
|
+
Author: Abdullah Ahmad
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/AbdullahAhmad-0/Universal-Deployer
|
|
9
|
+
Project-URL: Repository, https://github.com/AbdullahAhmad-0/Universal-Deployer
|
|
10
|
+
Project-URL: Issues, https://github.com/AbdullahAhmad-0/Universal-Deployer/issues
|
|
11
|
+
Keywords: deployment,vps,docker,ssh,sftp,ftp,devops,automation,cli
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: System :: Installation/Setup
|
|
24
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
25
|
+
Requires-Python: >=3.8
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: pyyaml>=6.0
|
|
29
|
+
Requires-Dist: paramiko>=2.11.0
|
|
30
|
+
Requires-Dist: colorama>=0.4.6
|
|
31
|
+
Dynamic: home-page
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
Dynamic: requires-python
|
|
34
|
+
|
|
35
|
+
# 🚀 uhdeploy - Universal Deployer CLI
|
|
36
|
+
|
|
37
|
+
A modern, declarative, and color-rich deployment CLI tool for web applications, Docker containers, and static sites. Deploy seamlessly from your local machine to any Linux VPS or hosting server using **SSH/SFTP** or **FTP**.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 📦 Installation
|
|
42
|
+
|
|
43
|
+
Install `uhdeploy` directly via pip:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install uhdeploy
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Or install from source for development:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
git clone https://github.com/AbdullahAhmad-0/Universal-Deployer.git
|
|
53
|
+
cd Universal-Deployer
|
|
54
|
+
pip install -e .
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## ✨ Features
|
|
60
|
+
|
|
61
|
+
- **Global CLI Command**: Run `uhdeploy` anywhere in your terminal.
|
|
62
|
+
- **YAML + Dockerfile-Style Syntax**: Configure complex builds and deployments using intuitive directives like `RUN`, `COPY`, `CMD`, `WORKDIR`, and `ENV`.
|
|
63
|
+
- **Interactive File Discovery**: If `deploy.yml` is not found in the current folder, `uhdeploy` prompts you to enter your project directory or file path automatically.
|
|
64
|
+
- **Dual Protocol Support**:
|
|
65
|
+
- **SSH / SFTP**: Full remote terminal execution (`paramiko`), automated directory sync, and Docker container orchestration.
|
|
66
|
+
- **FTP**: Built-in FTP transfer (`ftplib`) for static/shared hosting environments (with graceful warnings for unsupported remote commands).
|
|
67
|
+
- **Flexible Docker Workflows**:
|
|
68
|
+
- **Local Build & Tar Transfer (Default)**: Builds the Docker image locally, exports it to a `.tar` archive, transfers it via SFTP, and loads it into the remote Docker daemon. This saves RAM and CPU on low-spec VPS servers!
|
|
69
|
+
- **Remote Build**: Syncs files and triggers `docker compose build` directly on the VPS.
|
|
70
|
+
- **Auto Environment Sync**: Automatically detects and syncs environment files (e.g. `.env.production`) referenced in your `docker-compose.yml`.
|
|
71
|
+
- **Traditional (No Docker) Deployments**: Perfect for static frontends (React, Vue, Next.js static exports, Vite) or traditional Node/Python/PHP apps with local builds and Nginx reloading.
|
|
72
|
+
- **Dynamic Variable Substitution**: Seamlessly interpolate `${VPS_IP}`, `${SSH_KEY_PATH}`, or custom environment variables from `.env` or `.env.deploy` files.
|
|
73
|
+
- **Rich Terminal UI**: Full ANSI color formatting with `colorama`, interactive numbered selection menus, step badges (`[Docker]`, `[SSH]`, `[FTP]`), and upload progress bars.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## ⚡ Quick Start
|
|
78
|
+
|
|
79
|
+
### 1. Initialize Configuration
|
|
80
|
+
Generate a starter `deploy.yml` file in your project directory:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
uhdeploy --init
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Or view a commented example in your terminal:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
uhdeploy --example
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 2. Configure Environment Variables (`.env`)
|
|
93
|
+
Create a `.env` file in your project root with your server credentials:
|
|
94
|
+
|
|
95
|
+
```dotenv
|
|
96
|
+
VPS_IP=123.45.67.89
|
|
97
|
+
VPS_USER=root
|
|
98
|
+
SSH_KEY_PATH=~/.ssh/id_rsa
|
|
99
|
+
SSH_PORT=22
|
|
100
|
+
# Optional:
|
|
101
|
+
SSH_PASSPHRASE=
|
|
102
|
+
VPS_PASSWORD=
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### 3. Run Deployer
|
|
106
|
+
Launch the deployer:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Interactive service selection menu
|
|
110
|
+
uhdeploy
|
|
111
|
+
|
|
112
|
+
# Or deploy a specific service directly
|
|
113
|
+
uhdeploy frontend
|
|
114
|
+
|
|
115
|
+
# Or deploy all services in order
|
|
116
|
+
uhdeploy all
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
*(You can also run it via `python -m uhdeploy` or `python deploy.py`)*
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## 🛠️ Configuration Guide (`deploy.yml`)
|
|
124
|
+
|
|
125
|
+
The configuration file defines global server credentials and individual service deployment pipelines.
|
|
126
|
+
|
|
127
|
+
```yaml
|
|
128
|
+
# =============================================================================
|
|
129
|
+
# 🌐 GLOBAL SERVER SETTINGS (Inherited by all services)
|
|
130
|
+
# =============================================================================
|
|
131
|
+
server:
|
|
132
|
+
type: ssh # "ssh" (SFTP + Shell) or "ftp" (File transfer only)
|
|
133
|
+
host: ${VPS_IP} # VPS Hostname or IP (from .env)
|
|
134
|
+
user: ${VPS_USER:-root} # SSH/FTP Username (defaults to root)
|
|
135
|
+
port: 22 # Port: 22 for SSH, 21 for FTP
|
|
136
|
+
key_path: ${SSH_KEY_PATH} # Path to private key file
|
|
137
|
+
passphrase: ${SSH_PASSPHRASE}# (Optional) Private key passphrase
|
|
138
|
+
password: ${VPS_PASSWORD} # (Optional) SSH or FTP password
|
|
139
|
+
remote_dir: /opt/my-app # Remote base directory on VPS
|
|
140
|
+
|
|
141
|
+
# Optional custom env file to load (default: .env or .env.deploy)
|
|
142
|
+
env_file: .env
|
|
143
|
+
|
|
144
|
+
# =============================================================================
|
|
145
|
+
# 📦 SERVICES DEFINITION
|
|
146
|
+
# =============================================================================
|
|
147
|
+
services:
|
|
148
|
+
|
|
149
|
+
# ---------------------------------------------------------------------------
|
|
150
|
+
# 1. Frontend Service (WITHOUT DOCKER)
|
|
151
|
+
# ---------------------------------------------------------------------------
|
|
152
|
+
frontend:
|
|
153
|
+
description: "Build Next.js / React frontend and sync static files"
|
|
154
|
+
docker: false # Disable docker for this service
|
|
155
|
+
work_dir: ./frontend # Working directory relative to project root
|
|
156
|
+
|
|
157
|
+
# Local build steps (Dockerfile-style string commands):
|
|
158
|
+
build:
|
|
159
|
+
- RUN npm install
|
|
160
|
+
- RUN npm run build
|
|
161
|
+
- COPY package.json dist/package.json
|
|
162
|
+
|
|
163
|
+
# Upload files or directories to the VPS:
|
|
164
|
+
upload:
|
|
165
|
+
- dist/ -> ${remote_dir}/frontend/dist
|
|
166
|
+
- public/ -> ${remote_dir}/frontend/public
|
|
167
|
+
|
|
168
|
+
# Commands executed on VPS after uploading (SSH only):
|
|
169
|
+
run_in_vps:
|
|
170
|
+
- RUN systemctl reload nginx
|
|
171
|
+
- RUN echo "Frontend updated and Nginx reloaded!"
|
|
172
|
+
|
|
173
|
+
# ---------------------------------------------------------------------------
|
|
174
|
+
# 2. Backend Service (WITH DOCKER)
|
|
175
|
+
# ---------------------------------------------------------------------------
|
|
176
|
+
backend:
|
|
177
|
+
description: "FastAPI / Node API running in Docker Compose"
|
|
178
|
+
work_dir: ./backend
|
|
179
|
+
|
|
180
|
+
docker:
|
|
181
|
+
enabled: true
|
|
182
|
+
compose_file: docker-compose.yml # Compose file (defaults to docker-compose.yml)
|
|
183
|
+
# (Optional: .env.production referenced in compose is auto-synced!)
|
|
184
|
+
service_name: backend # Name of service inside docker-compose.yml
|
|
185
|
+
build_mode: local # "local" (build tarball & upload) or "remote"
|
|
186
|
+
image: my-backend:latest
|
|
187
|
+
context: ./backend
|
|
188
|
+
dockerfile: ./backend/Dockerfile # (Optional)
|
|
189
|
+
|
|
190
|
+
# Remote steps executed on VPS BEFORE starting Docker:
|
|
191
|
+
before_deploy:
|
|
192
|
+
- RUN mkdir -p ${remote_dir}/backend/data
|
|
193
|
+
|
|
194
|
+
# Remote steps executed on VPS AFTER starting Docker:
|
|
195
|
+
# (Note: 'docker compose up -d <service>' is already executed automatically!)
|
|
196
|
+
run_in_vps:
|
|
197
|
+
- RUN docker compose ps
|
|
198
|
+
- RUN docker compose logs --tail=25 backend
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## 🧩 Step Directives Reference
|
|
204
|
+
|
|
205
|
+
Within `build`, `before_deploy`, and `run_in_vps`, you can write steps as clean strings or structured objects:
|
|
206
|
+
|
|
207
|
+
| Directive | Example | Description |
|
|
208
|
+
|-----------|---------|-------------|
|
|
209
|
+
| `RUN <cmd>` | `- RUN npm run build` | Runs a shell command (locally in `build`, or on the VPS in `before_deploy` / `run_in_vps`). |
|
|
210
|
+
| `CMD <cmd>` | `- CMD python manage.py migrate` | Alias for `RUN`. |
|
|
211
|
+
| `COPY <src> <dst>` | `- COPY ./dist -> ${remote_dir}/dist` | Copies local files/folders locally or uploads them to the remote server. |
|
|
212
|
+
| `WORKDIR <dir>` | `- WORKDIR ./subfolder` | Changes current working directory for subsequent steps. |
|
|
213
|
+
| `ENV <k>=<v>` | `- ENV NODE_ENV=production` | Sets an environment variable for subsequent steps. |
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## 🔒 SSH vs. 📡 FTP Differences
|
|
218
|
+
|
|
219
|
+
| Feature | SSH / SFTP | FTP (`ftplib`) |
|
|
220
|
+
|---------|:----------:|:--------------:|
|
|
221
|
+
| File & Directory Sync | ✅ Yes | ✅ Yes |
|
|
222
|
+
| Progress Indicator | ✅ Yes | ✅ Yes |
|
|
223
|
+
| Remote Shell Execution (`RUN`) | ✅ Yes | ❌ Not supported by FTP |
|
|
224
|
+
| Docker Container Management | ✅ Yes | ❌ Not supported by FTP |
|
|
225
|
+
| Authentication | Key file, Passphrase, or Password | Username & Password |
|
|
226
|
+
|
|
227
|
+
> [!NOTE]
|
|
228
|
+
> When `type: ftp` is selected, any remote command steps (e.g. `run_in_vps`) are safely skipped with a helpful warning notice instead of breaking your deployment.
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## 🖥️ Command-Line Interface (CLI)
|
|
233
|
+
|
|
234
|
+
```
|
|
235
|
+
Usage:
|
|
236
|
+
uhdeploy [OPTIONS] [SERVICE_NAME]
|
|
237
|
+
(or python -m uhdeploy [OPTIONS] [SERVICE_NAME])
|
|
238
|
+
|
|
239
|
+
Options:
|
|
240
|
+
-h, --help Show full colorful help screen and exit.
|
|
241
|
+
-e, --example Display a syntax-highlighted example deploy.yml.
|
|
242
|
+
--init Generate a starter deploy.yml in the current directory.
|
|
243
|
+
-f, --file PATH Specify path to deploy configuration file.
|
|
244
|
+
-p, --project DIR Specify project directory containing deploy configuration.
|
|
245
|
+
-s, --service NAME Name of service to deploy (or 'all').
|
|
246
|
+
-l, --list List all services available in the configuration file.
|
|
247
|
+
--dry-run Validate configuration and simulate steps without connecting.
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### CLI Examples
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
# Preview build and deployment steps without making server changes:
|
|
254
|
+
uhdeploy backend --dry-run
|
|
255
|
+
|
|
256
|
+
# List configured services in a custom deploy file:
|
|
257
|
+
uhdeploy -f ./custom-deploy.yml --list
|
|
258
|
+
|
|
259
|
+
# Deploy a specific service from an external project directory:
|
|
260
|
+
uhdeploy -p D:/Projects/my-app frontend
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## 🚢 Publishing to PyPI
|
|
266
|
+
|
|
267
|
+
To build and publish `uhdeploy` to PyPI:
|
|
268
|
+
|
|
269
|
+
1. **Install build tools**:
|
|
270
|
+
```bash
|
|
271
|
+
pip install --upgrade build twine
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
2. **Build distribution packages (tar.gz and .whl)**:
|
|
275
|
+
```bash
|
|
276
|
+
python -m build
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
3. **Check distribution packages**:
|
|
280
|
+
```bash
|
|
281
|
+
twine check dist/*
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
4. **Upload to PyPI**:
|
|
285
|
+
```bash
|
|
286
|
+
twine upload dist/*
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
Once published, anyone can install your package with:
|
|
290
|
+
```bash
|
|
291
|
+
pip install uhdeploy
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## 📄 License
|
|
297
|
+
|
|
298
|
+
MIT License. Created by Abdullah Ahmad. Feel free to customize and extend for your deployment pipelines!
|
uhdeploy-0.1.0/README.md
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
# 🚀 uhdeploy - Universal Deployer CLI
|
|
2
|
+
|
|
3
|
+
A modern, declarative, and color-rich deployment CLI tool for web applications, Docker containers, and static sites. Deploy seamlessly from your local machine to any Linux VPS or hosting server using **SSH/SFTP** or **FTP**.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 📦 Installation
|
|
8
|
+
|
|
9
|
+
Install `uhdeploy` directly via pip:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install uhdeploy
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Or install from source for development:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
git clone https://github.com/AbdullahAhmad-0/Universal-Deployer.git
|
|
19
|
+
cd Universal-Deployer
|
|
20
|
+
pip install -e .
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## ✨ Features
|
|
26
|
+
|
|
27
|
+
- **Global CLI Command**: Run `uhdeploy` anywhere in your terminal.
|
|
28
|
+
- **YAML + Dockerfile-Style Syntax**: Configure complex builds and deployments using intuitive directives like `RUN`, `COPY`, `CMD`, `WORKDIR`, and `ENV`.
|
|
29
|
+
- **Interactive File Discovery**: If `deploy.yml` is not found in the current folder, `uhdeploy` prompts you to enter your project directory or file path automatically.
|
|
30
|
+
- **Dual Protocol Support**:
|
|
31
|
+
- **SSH / SFTP**: Full remote terminal execution (`paramiko`), automated directory sync, and Docker container orchestration.
|
|
32
|
+
- **FTP**: Built-in FTP transfer (`ftplib`) for static/shared hosting environments (with graceful warnings for unsupported remote commands).
|
|
33
|
+
- **Flexible Docker Workflows**:
|
|
34
|
+
- **Local Build & Tar Transfer (Default)**: Builds the Docker image locally, exports it to a `.tar` archive, transfers it via SFTP, and loads it into the remote Docker daemon. This saves RAM and CPU on low-spec VPS servers!
|
|
35
|
+
- **Remote Build**: Syncs files and triggers `docker compose build` directly on the VPS.
|
|
36
|
+
- **Auto Environment Sync**: Automatically detects and syncs environment files (e.g. `.env.production`) referenced in your `docker-compose.yml`.
|
|
37
|
+
- **Traditional (No Docker) Deployments**: Perfect for static frontends (React, Vue, Next.js static exports, Vite) or traditional Node/Python/PHP apps with local builds and Nginx reloading.
|
|
38
|
+
- **Dynamic Variable Substitution**: Seamlessly interpolate `${VPS_IP}`, `${SSH_KEY_PATH}`, or custom environment variables from `.env` or `.env.deploy` files.
|
|
39
|
+
- **Rich Terminal UI**: Full ANSI color formatting with `colorama`, interactive numbered selection menus, step badges (`[Docker]`, `[SSH]`, `[FTP]`), and upload progress bars.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## ⚡ Quick Start
|
|
44
|
+
|
|
45
|
+
### 1. Initialize Configuration
|
|
46
|
+
Generate a starter `deploy.yml` file in your project directory:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
uhdeploy --init
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Or view a commented example in your terminal:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
uhdeploy --example
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 2. Configure Environment Variables (`.env`)
|
|
59
|
+
Create a `.env` file in your project root with your server credentials:
|
|
60
|
+
|
|
61
|
+
```dotenv
|
|
62
|
+
VPS_IP=123.45.67.89
|
|
63
|
+
VPS_USER=root
|
|
64
|
+
SSH_KEY_PATH=~/.ssh/id_rsa
|
|
65
|
+
SSH_PORT=22
|
|
66
|
+
# Optional:
|
|
67
|
+
SSH_PASSPHRASE=
|
|
68
|
+
VPS_PASSWORD=
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 3. Run Deployer
|
|
72
|
+
Launch the deployer:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Interactive service selection menu
|
|
76
|
+
uhdeploy
|
|
77
|
+
|
|
78
|
+
# Or deploy a specific service directly
|
|
79
|
+
uhdeploy frontend
|
|
80
|
+
|
|
81
|
+
# Or deploy all services in order
|
|
82
|
+
uhdeploy all
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
*(You can also run it via `python -m uhdeploy` or `python deploy.py`)*
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 🛠️ Configuration Guide (`deploy.yml`)
|
|
90
|
+
|
|
91
|
+
The configuration file defines global server credentials and individual service deployment pipelines.
|
|
92
|
+
|
|
93
|
+
```yaml
|
|
94
|
+
# =============================================================================
|
|
95
|
+
# 🌐 GLOBAL SERVER SETTINGS (Inherited by all services)
|
|
96
|
+
# =============================================================================
|
|
97
|
+
server:
|
|
98
|
+
type: ssh # "ssh" (SFTP + Shell) or "ftp" (File transfer only)
|
|
99
|
+
host: ${VPS_IP} # VPS Hostname or IP (from .env)
|
|
100
|
+
user: ${VPS_USER:-root} # SSH/FTP Username (defaults to root)
|
|
101
|
+
port: 22 # Port: 22 for SSH, 21 for FTP
|
|
102
|
+
key_path: ${SSH_KEY_PATH} # Path to private key file
|
|
103
|
+
passphrase: ${SSH_PASSPHRASE}# (Optional) Private key passphrase
|
|
104
|
+
password: ${VPS_PASSWORD} # (Optional) SSH or FTP password
|
|
105
|
+
remote_dir: /opt/my-app # Remote base directory on VPS
|
|
106
|
+
|
|
107
|
+
# Optional custom env file to load (default: .env or .env.deploy)
|
|
108
|
+
env_file: .env
|
|
109
|
+
|
|
110
|
+
# =============================================================================
|
|
111
|
+
# 📦 SERVICES DEFINITION
|
|
112
|
+
# =============================================================================
|
|
113
|
+
services:
|
|
114
|
+
|
|
115
|
+
# ---------------------------------------------------------------------------
|
|
116
|
+
# 1. Frontend Service (WITHOUT DOCKER)
|
|
117
|
+
# ---------------------------------------------------------------------------
|
|
118
|
+
frontend:
|
|
119
|
+
description: "Build Next.js / React frontend and sync static files"
|
|
120
|
+
docker: false # Disable docker for this service
|
|
121
|
+
work_dir: ./frontend # Working directory relative to project root
|
|
122
|
+
|
|
123
|
+
# Local build steps (Dockerfile-style string commands):
|
|
124
|
+
build:
|
|
125
|
+
- RUN npm install
|
|
126
|
+
- RUN npm run build
|
|
127
|
+
- COPY package.json dist/package.json
|
|
128
|
+
|
|
129
|
+
# Upload files or directories to the VPS:
|
|
130
|
+
upload:
|
|
131
|
+
- dist/ -> ${remote_dir}/frontend/dist
|
|
132
|
+
- public/ -> ${remote_dir}/frontend/public
|
|
133
|
+
|
|
134
|
+
# Commands executed on VPS after uploading (SSH only):
|
|
135
|
+
run_in_vps:
|
|
136
|
+
- RUN systemctl reload nginx
|
|
137
|
+
- RUN echo "Frontend updated and Nginx reloaded!"
|
|
138
|
+
|
|
139
|
+
# ---------------------------------------------------------------------------
|
|
140
|
+
# 2. Backend Service (WITH DOCKER)
|
|
141
|
+
# ---------------------------------------------------------------------------
|
|
142
|
+
backend:
|
|
143
|
+
description: "FastAPI / Node API running in Docker Compose"
|
|
144
|
+
work_dir: ./backend
|
|
145
|
+
|
|
146
|
+
docker:
|
|
147
|
+
enabled: true
|
|
148
|
+
compose_file: docker-compose.yml # Compose file (defaults to docker-compose.yml)
|
|
149
|
+
# (Optional: .env.production referenced in compose is auto-synced!)
|
|
150
|
+
service_name: backend # Name of service inside docker-compose.yml
|
|
151
|
+
build_mode: local # "local" (build tarball & upload) or "remote"
|
|
152
|
+
image: my-backend:latest
|
|
153
|
+
context: ./backend
|
|
154
|
+
dockerfile: ./backend/Dockerfile # (Optional)
|
|
155
|
+
|
|
156
|
+
# Remote steps executed on VPS BEFORE starting Docker:
|
|
157
|
+
before_deploy:
|
|
158
|
+
- RUN mkdir -p ${remote_dir}/backend/data
|
|
159
|
+
|
|
160
|
+
# Remote steps executed on VPS AFTER starting Docker:
|
|
161
|
+
# (Note: 'docker compose up -d <service>' is already executed automatically!)
|
|
162
|
+
run_in_vps:
|
|
163
|
+
- RUN docker compose ps
|
|
164
|
+
- RUN docker compose logs --tail=25 backend
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## 🧩 Step Directives Reference
|
|
170
|
+
|
|
171
|
+
Within `build`, `before_deploy`, and `run_in_vps`, you can write steps as clean strings or structured objects:
|
|
172
|
+
|
|
173
|
+
| Directive | Example | Description |
|
|
174
|
+
|-----------|---------|-------------|
|
|
175
|
+
| `RUN <cmd>` | `- RUN npm run build` | Runs a shell command (locally in `build`, or on the VPS in `before_deploy` / `run_in_vps`). |
|
|
176
|
+
| `CMD <cmd>` | `- CMD python manage.py migrate` | Alias for `RUN`. |
|
|
177
|
+
| `COPY <src> <dst>` | `- COPY ./dist -> ${remote_dir}/dist` | Copies local files/folders locally or uploads them to the remote server. |
|
|
178
|
+
| `WORKDIR <dir>` | `- WORKDIR ./subfolder` | Changes current working directory for subsequent steps. |
|
|
179
|
+
| `ENV <k>=<v>` | `- ENV NODE_ENV=production` | Sets an environment variable for subsequent steps. |
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## 🔒 SSH vs. 📡 FTP Differences
|
|
184
|
+
|
|
185
|
+
| Feature | SSH / SFTP | FTP (`ftplib`) |
|
|
186
|
+
|---------|:----------:|:--------------:|
|
|
187
|
+
| File & Directory Sync | ✅ Yes | ✅ Yes |
|
|
188
|
+
| Progress Indicator | ✅ Yes | ✅ Yes |
|
|
189
|
+
| Remote Shell Execution (`RUN`) | ✅ Yes | ❌ Not supported by FTP |
|
|
190
|
+
| Docker Container Management | ✅ Yes | ❌ Not supported by FTP |
|
|
191
|
+
| Authentication | Key file, Passphrase, or Password | Username & Password |
|
|
192
|
+
|
|
193
|
+
> [!NOTE]
|
|
194
|
+
> When `type: ftp` is selected, any remote command steps (e.g. `run_in_vps`) are safely skipped with a helpful warning notice instead of breaking your deployment.
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## 🖥️ Command-Line Interface (CLI)
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
Usage:
|
|
202
|
+
uhdeploy [OPTIONS] [SERVICE_NAME]
|
|
203
|
+
(or python -m uhdeploy [OPTIONS] [SERVICE_NAME])
|
|
204
|
+
|
|
205
|
+
Options:
|
|
206
|
+
-h, --help Show full colorful help screen and exit.
|
|
207
|
+
-e, --example Display a syntax-highlighted example deploy.yml.
|
|
208
|
+
--init Generate a starter deploy.yml in the current directory.
|
|
209
|
+
-f, --file PATH Specify path to deploy configuration file.
|
|
210
|
+
-p, --project DIR Specify project directory containing deploy configuration.
|
|
211
|
+
-s, --service NAME Name of service to deploy (or 'all').
|
|
212
|
+
-l, --list List all services available in the configuration file.
|
|
213
|
+
--dry-run Validate configuration and simulate steps without connecting.
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### CLI Examples
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
# Preview build and deployment steps without making server changes:
|
|
220
|
+
uhdeploy backend --dry-run
|
|
221
|
+
|
|
222
|
+
# List configured services in a custom deploy file:
|
|
223
|
+
uhdeploy -f ./custom-deploy.yml --list
|
|
224
|
+
|
|
225
|
+
# Deploy a specific service from an external project directory:
|
|
226
|
+
uhdeploy -p D:/Projects/my-app frontend
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## 🚢 Publishing to PyPI
|
|
232
|
+
|
|
233
|
+
To build and publish `uhdeploy` to PyPI:
|
|
234
|
+
|
|
235
|
+
1. **Install build tools**:
|
|
236
|
+
```bash
|
|
237
|
+
pip install --upgrade build twine
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
2. **Build distribution packages (tar.gz and .whl)**:
|
|
241
|
+
```bash
|
|
242
|
+
python -m build
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
3. **Check distribution packages**:
|
|
246
|
+
```bash
|
|
247
|
+
twine check dist/*
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
4. **Upload to PyPI**:
|
|
251
|
+
```bash
|
|
252
|
+
twine upload dist/*
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Once published, anyone can install your package with:
|
|
256
|
+
```bash
|
|
257
|
+
pip install uhdeploy
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## 📄 License
|
|
263
|
+
|
|
264
|
+
MIT License. Created by Abdullah Ahmad. Feel free to customize and extend for your deployment pipelines!
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "uhdeploy"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Universal Local-to-VPS automated deployment CLI (SSH/SFTP, FTP, Docker, Local Build Pipelines)"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Abdullah Ahmad" }
|
|
14
|
+
]
|
|
15
|
+
keywords = ["deployment", "vps", "docker", "ssh", "sftp", "ftp", "devops", "automation", "cli"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Environment :: Console",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"License :: OSI Approved :: MIT License",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.8",
|
|
23
|
+
"Programming Language :: Python :: 3.9",
|
|
24
|
+
"Programming Language :: Python :: 3.10",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Programming Language :: Python :: 3.13",
|
|
28
|
+
"Topic :: System :: Installation/Setup",
|
|
29
|
+
"Topic :: Software Development :: Build Tools",
|
|
30
|
+
]
|
|
31
|
+
dependencies = [
|
|
32
|
+
"pyyaml>=6.0",
|
|
33
|
+
"paramiko>=2.11.0",
|
|
34
|
+
"colorama>=0.4.6",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
Homepage = "https://github.com/AbdullahAhmad-0/Universal-Deployer"
|
|
39
|
+
Repository = "https://github.com/AbdullahAhmad-0/Universal-Deployer"
|
|
40
|
+
Issues = "https://github.com/AbdullahAhmad-0/Universal-Deployer/issues"
|
|
41
|
+
|
|
42
|
+
[project.scripts]
|
|
43
|
+
uhdeploy = "uhdeploy.cli:main"
|
|
44
|
+
|
|
45
|
+
[tool.setuptools.packages.find]
|
|
46
|
+
where = ["."]
|
|
47
|
+
include = ["uhdeploy*"]
|
|
48
|
+
|
uhdeploy-0.1.0/setup.cfg
ADDED
uhdeploy-0.1.0/setup.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
from setuptools import setup, find_packages
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
with open("README.md", "r", encoding="utf-8") as f:
|
|
6
|
+
long_description = f.read()
|
|
7
|
+
|
|
8
|
+
setup(
|
|
9
|
+
name="uhdeploy",
|
|
10
|
+
version="0.1.0",
|
|
11
|
+
author="Abdullah Ahmad",
|
|
12
|
+
url="https://github.com/AbdullahAhmad-0/Universal-Deployer",
|
|
13
|
+
project_urls={
|
|
14
|
+
"Bug Tracker": "https://github.com/AbdullahAhmad-0/Universal-Deployer/issues",
|
|
15
|
+
"Source Code": "https://github.com/AbdullahAhmad-0/Universal-Deployer",
|
|
16
|
+
},
|
|
17
|
+
description="Universal Local-to-VPS automated deployment CLI (SSH/SFTP, FTP, Docker, Local Build Pipelines)",
|
|
18
|
+
long_description=long_description,
|
|
19
|
+
long_description_content_type="text/markdown",
|
|
20
|
+
packages=find_packages(),
|
|
21
|
+
python_requires=">=3.8",
|
|
22
|
+
install_requires=[
|
|
23
|
+
"pyyaml>=6.0",
|
|
24
|
+
"paramiko>=2.11.0",
|
|
25
|
+
"colorama>=0.4.6",
|
|
26
|
+
],
|
|
27
|
+
entry_points={
|
|
28
|
+
"console_scripts": [
|
|
29
|
+
"uhdeploy=uhdeploy.cli:main",
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
classifiers=[
|
|
33
|
+
"Development Status :: 4 - Beta",
|
|
34
|
+
"Environment :: Console",
|
|
35
|
+
"Intended Audience :: Developers",
|
|
36
|
+
"License :: OSI Approved :: MIT License",
|
|
37
|
+
"Programming Language :: Python :: 3",
|
|
38
|
+
"Topic :: System :: Installation/Setup",
|
|
39
|
+
"Topic :: Software Development :: Build Tools",
|
|
40
|
+
],
|
|
41
|
+
)
|
|
42
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""
|
|
2
|
+
uhdeploy - Universal Local-to-VPS Deployment CLI
|
|
3
|
+
=================================================
|
|
4
|
+
Automated deployment tool for Docker containers, web applications,
|
|
5
|
+
and static websites using SSH/SFTP or FTP.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
__version__ = "0.1.0"
|
|
9
|
+
__author__ = "Abdullah Ahmad"
|
|
10
|
+
__license__ = "MIT"
|
|
11
|
+
|
|
12
|
+
from .cli import main
|
|
13
|
+
|
|
14
|
+
__all__ = ["main", "__version__"]
|
|
15
|
+
|