easy-devops 0.1.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.
Files changed (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +325 -0
  3. package/cli/index.js +91 -0
  4. package/cli/managers/domain-manager.js +451 -0
  5. package/cli/managers/nginx-manager.js +329 -0
  6. package/cli/managers/node-manager.js +275 -0
  7. package/cli/managers/ssl-manager.js +397 -0
  8. package/cli/menus/.gitkeep +0 -0
  9. package/cli/menus/dashboard.js +223 -0
  10. package/cli/menus/domains.js +5 -0
  11. package/cli/menus/nginx.js +5 -0
  12. package/cli/menus/nodejs.js +5 -0
  13. package/cli/menus/settings.js +83 -0
  14. package/cli/menus/ssl.js +5 -0
  15. package/core/config.js +37 -0
  16. package/core/db.js +30 -0
  17. package/core/detector.js +257 -0
  18. package/core/nginx-conf-generator.js +309 -0
  19. package/core/shell.js +151 -0
  20. package/dashboard/lib/.gitkeep +0 -0
  21. package/dashboard/lib/cert-reader.js +59 -0
  22. package/dashboard/lib/domains-db.js +51 -0
  23. package/dashboard/lib/nginx-conf-generator.js +16 -0
  24. package/dashboard/lib/nginx-service.js +282 -0
  25. package/dashboard/public/js/app.js +486 -0
  26. package/dashboard/routes/.gitkeep +0 -0
  27. package/dashboard/routes/auth.js +30 -0
  28. package/dashboard/routes/domains.js +300 -0
  29. package/dashboard/routes/nginx.js +151 -0
  30. package/dashboard/routes/settings.js +78 -0
  31. package/dashboard/routes/ssl.js +105 -0
  32. package/dashboard/server.js +79 -0
  33. package/dashboard/views/index.ejs +327 -0
  34. package/dashboard/views/partials/domain-form.ejs +229 -0
  35. package/dashboard/views/partials/domains-panel.ejs +66 -0
  36. package/dashboard/views/partials/login.ejs +50 -0
  37. package/dashboard/views/partials/nginx-panel.ejs +90 -0
  38. package/dashboard/views/partials/overview.ejs +67 -0
  39. package/dashboard/views/partials/settings-panel.ejs +37 -0
  40. package/dashboard/views/partials/sidebar.ejs +45 -0
  41. package/dashboard/views/partials/ssl-panel.ejs +53 -0
  42. package/data/.gitkeep +0 -0
  43. package/install.bat +41 -0
  44. package/install.ps1 +653 -0
  45. package/install.sh +452 -0
  46. package/lib/installer/.gitkeep +0 -0
  47. package/lib/installer/detect.sh +88 -0
  48. package/lib/installer/node-versions.sh +109 -0
  49. package/lib/installer/nvm-bootstrap.sh +77 -0
  50. package/lib/installer/picker.sh +163 -0
  51. package/lib/installer/progress.sh +25 -0
  52. package/package.json +67 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Omar Farghaly
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 ADDED
@@ -0,0 +1,325 @@
1
+ # Easy DevOps
2
+
3
+ [![npm version](https://badge.fury.io/js/easy-devops.svg)](https://badge.fury.io/js/easy-devops)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg)](https://nodejs.org/)
6
+
7
+ A unified DevOps management tool with interactive CLI and web dashboard for managing **Nginx**, **SSL certificates**, and **Node.js** on Linux and Windows servers.
8
+
9
+ ## Features
10
+
11
+ - **πŸ–₯️ Interactive CLI** β€” Arrow-key menus with real-time status indicators
12
+ - **πŸ“Š Web Dashboard** β€” Modern Vue 3 interface with dark/light themes
13
+ - **🌐 Nginx Management** β€” Start/stop/reload, config editor, error logs
14
+ - **πŸ”’ SSL Certificate Management** β€” Let's Encrypt via Certbot, expiry tracking
15
+ - **πŸ”— Domain Management** β€” Reverse proxy configurations with SSL, WebSocket, gzip, rate limiting
16
+ - **πŸ“¦ Node.js Manager** β€” Version switching via nvm, global package management
17
+ - **πŸ”„ Real-time Updates** β€” Socket.io powered status updates in dashboard
18
+ - **πŸ’Ώ SQLite Storage** β€” Persistent configuration via `good.db`
19
+
20
+ ## Requirements
21
+
22
+ - **Node.js 18+** (with npm)
23
+ - **Linux** (Debian/Ubuntu) or **Windows**
24
+ - Optional: Nginx, Certbot, nvm (installed separately or via the tool)
25
+
26
+ ## Installation
27
+
28
+ ### Quick Install (One-Line)
29
+
30
+ If you have **Node.js 18+** installed, run:
31
+
32
+ ```bash
33
+ npm install -g easy-devops && easy-devops
34
+ ```
35
+
36
+ If you **don't have Node.js** yet, use the bootstrap installer:
37
+
38
+ #### Linux / macOS
39
+
40
+ ```bash
41
+ curl -fsSL https://raw.githubusercontent.com/omar00050/Easy-DevOps/main/install.sh | bash
42
+ ```
43
+
44
+ Or with wget:
45
+
46
+ ```bash
47
+ wget -qO- https://raw.githubusercontent.com/omar00050/Easy-DevOps/main/install.sh | bash
48
+ ```
49
+
50
+ #### Windows (PowerShell)
51
+
52
+ ```powershell
53
+ Invoke-WebRequest -Uri "https://raw.githubusercontent.com/omar00050/Easy-DevOps/main/install.ps1" -OutFile "install.ps1"; ./install.ps1
54
+ ```
55
+
56
+ Or from Command Prompt:
57
+
58
+ ```cmd
59
+ powershell -ExecutionPolicy Bypass -Command "Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/omar00050/Easy-DevOps/main/install.ps1' -OutFile 'install.ps1'; ./install.ps1"
60
+ ```
61
+
62
+ > **What the installer does:**
63
+ > 1. Checks for Node.js 18+ (installs via nvm if missing)
64
+ > 2. Installs Easy DevOps globally via npm
65
+ > 3. Launches the interactive CLI
66
+
67
+ ### Via npm (Recommended)
68
+
69
+ ```bash
70
+ npm install -g easy-devops
71
+ easy-devops
72
+ ```
73
+
74
+ ### From Source
75
+
76
+ ```bash
77
+ git clone https://github.com/omar00050/Easy-DevOps.git
78
+ cd Easy-DevOps
79
+ npm install
80
+ npm start
81
+ ```
82
+
83
+ ## Quick Start
84
+
85
+ ```bash
86
+ # Start the interactive CLI
87
+ easy-devops
88
+
89
+ # Or run directly
90
+ npx easy-devops
91
+ ```
92
+
93
+ ## Usage
94
+
95
+ ### CLI Overview
96
+
97
+ ```
98
+ ╔══════════════════════════════╗
99
+ β•‘ Easy DevOps v0.1.0 β•‘
100
+ β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
101
+
102
+ nginx: βœ… v1.26.2 | certbot: βœ… v2.9.0 | node: v22.21.1
103
+
104
+ ? Select an option:
105
+ πŸ“¦ Node.js Manager
106
+ 🌐 Nginx Manager
107
+ πŸ”’ SSL Manager
108
+ πŸ”— Domain Manager
109
+ πŸŽ›οΈ Open Dashboard
110
+ βš™οΈ Settings
111
+ βœ– Exit
112
+ ```
113
+
114
+ Press **Ctrl+C** at any prompt to exit cleanly.
115
+
116
+ ---
117
+
118
+ ### Node.js Manager
119
+
120
+ Manage your Node.js runtime using `nvm` (Unix) or `nvm-windows` (Windows).
121
+
122
+ | Option | Description |
123
+ |--------|-------------|
124
+ | Switch Node version | Lists available LTS versions and switches to the selected one |
125
+ | Manage global packages | Install, uninstall, or list globally installed npm packages |
126
+ | Update npm | Updates npm to the latest version |
127
+
128
+ ---
129
+
130
+ ### Nginx Manager
131
+
132
+ Control the Nginx web server from the CLI.
133
+
134
+ | Option | Description |
135
+ |--------|-------------|
136
+ | Reload nginx | Tests the config then sends a graceful reload signal |
137
+ | Restart nginx | Tests the config then performs a full stop/start |
138
+ | Test config | Runs `nginx -t` and displays the result |
139
+ | View error log | Shows the last 50 lines of the Nginx error log |
140
+ | Install nginx | Installs Nginx via `apt-get` (Linux) or `winget` (Windows) |
141
+
142
+ ---
143
+
144
+ ### Domain Manager
145
+
146
+ Manage Nginx reverse proxy configurations from CLI or dashboard.
147
+
148
+ | Option | Description |
149
+ |--------|-------------|
150
+ | List Domains | Show all configured domains in a table |
151
+ | Add Domain | Interactive prompts for domain configuration |
152
+ | Edit Domain | Modify existing domain settings |
153
+ | Delete Domain | Remove domain with confirmation |
154
+
155
+ **Domain Configuration Options:**
156
+ - SSL/HTTPS with auto-renewal tracking
157
+ - WebSocket support (`ws` upstream type)
158
+ - Gzip compression
159
+ - Rate limiting (requests/second + burst)
160
+ - Security headers (X-Frame-Options, etc.)
161
+ - Custom timeout and body size limits
162
+ - Domain-specific access logs
163
+
164
+ ---
165
+
166
+ ### SSL Manager
167
+
168
+ Manage Let's Encrypt SSL certificates using Certbot.
169
+
170
+ | Status | Meaning |
171
+ |--------|---------|
172
+ | βœ… green | Valid, expires in > 30 days |
173
+ | ⚠️ yellow | Expiring soon (10–30 days) |
174
+ | ❌ red | Critical (< 10 days) |
175
+
176
+ > **Note:** Renewing a certificate temporarily stops Nginx to free port 80, then restarts it automatically.
177
+
178
+ ---
179
+
180
+ ### Web Dashboard
181
+
182
+ Start the web dashboard:
183
+
184
+ ```bash
185
+ # From CLI menu: Select "πŸŽ›οΈ Open Dashboard" β†’ "Start dashboard"
186
+ # Or directly:
187
+ npm run dashboard
188
+ ```
189
+
190
+ Access at `http://localhost:3000` (or configured port).
191
+
192
+ #### Dashboard Pages
193
+
194
+ | Page | Features |
195
+ |------|----------|
196
+ | **Overview** | System status cards for Nginx, SSL, Domains |
197
+ | **Nginx** | Start/stop controls, config editor, error logs |
198
+ | **SSL** | Certificate list, renewal actions, expiry badges |
199
+ | **Domains** | Add/edit form with collapsible sections, table view |
200
+ | **Settings** | Port, password, directory configuration |
201
+
202
+ ---
203
+
204
+ ## API Endpoints
205
+
206
+ The dashboard exposes RESTful API endpoints:
207
+
208
+ | Endpoint | Method | Description |
209
+ |----------|--------|-------------|
210
+ | `/api/nginx/status` | GET | Get nginx running status |
211
+ | `/api/nginx/start` | POST | Start nginx |
212
+ | `/api/nginx/stop` | POST | Stop nginx |
213
+ | `/api/nginx/reload` | POST | Graceful reload |
214
+ | `/api/nginx/configs` | GET | List config files |
215
+ | `/api/nginx/config/:file` | GET/POST | Read/write config file |
216
+ | `/api/domains` | GET/POST | List/create domains |
217
+ | `/api/domains/:name` | GET/PUT/DELETE | Domain CRUD |
218
+ | `/api/ssl` | GET | List certificates |
219
+ | `/api/ssl/renew/:domain` | POST | Renew certificate |
220
+ | `/api/settings` | GET/POST | Dashboard settings |
221
+
222
+ ---
223
+
224
+ ## Configuration
225
+
226
+ All configuration is stored in `data/easy-devops.sqlite`:
227
+
228
+ | Key | Contents |
229
+ |-----|----------|
230
+ | `config` | Dashboard port, password, Nginx/Certbot directories |
231
+ | `system-detection` | Cached system info (OS, Node, nginx, certbot) |
232
+ | `domains` | Array of domain configurations |
233
+
234
+ ---
235
+
236
+ ## Project Structure
237
+
238
+ ```
239
+ easy-devops/
240
+ β”œβ”€β”€ cli/
241
+ β”‚ β”œβ”€β”€ index.js # CLI entry point
242
+ β”‚ β”œβ”€β”€ managers/ # Business logic modules
243
+ β”‚ └── menus/ # Menu dispatcher stubs
244
+ β”œβ”€β”€ core/
245
+ β”‚ β”œβ”€β”€ config.js # Configuration loader
246
+ β”‚ β”œβ”€β”€ db.js # SQLite database (good.db)
247
+ β”‚ β”œβ”€β”€ detector.js # System environment detection
248
+ β”‚ └── shell.js # Cross-platform shell executor
249
+ β”œβ”€β”€ dashboard/
250
+ β”‚ β”œβ”€β”€ server.js # Express + Socket.io server
251
+ β”‚ β”œβ”€β”€ routes/ # API endpoints
252
+ β”‚ β”œβ”€β”€ lib/ # Service helpers
253
+ β”‚ β”œβ”€β”€ views/ # EJS templates
254
+ β”‚ └── public/ # Static assets (Vue app)
255
+ β”œβ”€β”€ data/
256
+ β”‚ └── easy-devops.sqlite
257
+ └── lib/
258
+ └── installer/ # Bootstrap scripts
259
+ ```
260
+
261
+ ---
262
+
263
+ ## Platform Support
264
+
265
+ | Feature | Linux | Windows |
266
+ |---------|-------|---------|
267
+ | CLI Interface | βœ… | βœ… |
268
+ | Web Dashboard | βœ… | βœ… |
269
+ | Nginx Management | βœ… | βœ… |
270
+ | SSL (Certbot) | βœ… | βœ… |
271
+ | Node.js (nvm) | βœ… | βœ… (nvm-windows) |
272
+ | System Service | systemd | Task Scheduler |
273
+
274
+ ---
275
+
276
+ ## Development
277
+
278
+ ```bash
279
+ # Clone and install
280
+ git clone https://github.com/omar00050/Easy-DevOps.git
281
+ cd Easy-DevOps
282
+ npm install
283
+
284
+ # Run CLI
285
+ npm start
286
+
287
+ # Run dashboard
288
+ npm run dashboard
289
+
290
+ # System info only
291
+ npm run system-info
292
+ ```
293
+
294
+ ---
295
+
296
+ ## Contributing
297
+
298
+ Contributions are welcome! Please feel free to submit a Pull Request.
299
+
300
+ 1. Fork the repository
301
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
302
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
303
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
304
+ 5. Open a Pull Request
305
+
306
+ ---
307
+
308
+ ## License
309
+
310
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
311
+
312
+ ---
313
+
314
+ ## Author
315
+
316
+ **Omar Farghaly**
317
+
318
+ - GitHub: [@omar00050](https://github.com/omar00050)
319
+ - npm: [abo_farghaly](https://www.npmjs.com/~abo_farghaly)
320
+
321
+ ---
322
+
323
+ ## Support
324
+
325
+ If you encounter any issues or have questions, please [open an issue](https://github.com/omar00050/Easy-DevOps/issues) on GitHub.
package/cli/index.js ADDED
@@ -0,0 +1,91 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'module';
3
+ import chalk from 'chalk';
4
+ import ora from 'ora';
5
+ import inquirer from 'inquirer';
6
+ import { runDetection, showSystemStatus, formatStatusLine } from '../core/detector.js';
7
+
8
+ import nodejsMenu from './menus/nodejs.js';
9
+ import nginxMenu from './menus/nginx.js';
10
+ import sslMenu from './menus/ssl.js';
11
+ import domainsMenu from './menus/domains.js';
12
+ import dashboardMenu from './menus/dashboard.js';
13
+ import settingsMenu from './menus/settings.js';
14
+
15
+ const require = createRequire(import.meta.url);
16
+ const { version } = require('../package.json');
17
+
18
+ process.on('SIGINT', () => process.exit(0));
19
+
20
+ if (process.argv[2] === 'system-info') {
21
+ await runDetection();
22
+ showSystemStatus();
23
+ process.exit(0);
24
+ }
25
+
26
+ function renderBanner() {
27
+ const title = ` Easy DevOps v${version}`;
28
+ const paddedTitle = title.padEnd(30);
29
+ console.log(chalk.cyan('╔══════════════════════════════╗'));
30
+ console.log(chalk.cyan('β•‘') + chalk.bold(paddedTitle) + chalk.cyan('β•‘'));
31
+ console.log(chalk.cyan('β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•'));
32
+ console.log();
33
+ }
34
+
35
+ async function showMainMenu() {
36
+ const answers = await inquirer.prompt([{
37
+ type: 'list',
38
+ name: 'choice',
39
+ message: 'Select an option:',
40
+ choices: [
41
+ 'πŸ“¦ Node.js Manager',
42
+ '🌐 Nginx Manager',
43
+ 'πŸ”’ SSL Manager',
44
+ 'πŸ”— Domain Manager',
45
+ 'πŸŽ›οΈ Open Dashboard',
46
+ 'βš™οΈ Settings',
47
+ 'βœ– Exit',
48
+ ],
49
+ }]);
50
+ return answers.choice;
51
+ }
52
+
53
+ async function dispatch(choice) {
54
+ switch (choice) {
55
+ case 'πŸ“¦ Node.js Manager': await nodejsMenu(); break;
56
+ case '🌐 Nginx Manager': await nginxMenu(); break;
57
+ case 'πŸ”’ SSL Manager': await sslMenu(); break;
58
+ case 'πŸ”— Domain Manager': await domainsMenu(); break;
59
+ case 'πŸŽ›οΈ Open Dashboard': await dashboardMenu(); break;
60
+ case 'βš™οΈ Settings': await settingsMenu(); break;
61
+ case 'βœ– Exit': process.exit(0);
62
+ }
63
+ }
64
+
65
+ async function main() {
66
+ while (true) {
67
+ const spinner = ora('Checking system…').start();
68
+ await runDetection();
69
+ spinner.stop();
70
+
71
+ try {
72
+ renderBanner();
73
+ console.log(' ' + formatStatusLine());
74
+ console.log();
75
+ } catch {
76
+ console.log(`\n=== Easy DevOps v${version} ===\n`);
77
+ }
78
+
79
+ try {
80
+ const choice = await showMainMenu();
81
+ await dispatch(choice);
82
+ } catch (err) {
83
+ if (err.name === 'ExitPromptError') {
84
+ process.exit(0);
85
+ }
86
+ throw err;
87
+ }
88
+ }
89
+ }
90
+
91
+ await main();