Skip to content

Commit 433d812

Browse files
Fix TypeScript and ESLint errors (#31)
- Add proper type annotations for WebSocketMessage and ServerInfo types - Fix type imports to use type-only imports where appropriate - Replace logical OR operators with nullish coalescing operators - Fix floating promises by adding void operator - Add proper type assertions for database results - Fix useEffect dependencies in Terminal component - Remove unused variables and fix unescaped entities - Add JSDoc type annotations for database methods - Fix singleton instance type annotations
1 parent 2f1df95 commit 433d812

File tree

23 files changed

+2950
-169
lines changed

23 files changed

+2950
-169
lines changed

β€Ž.gitignoreβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/prisma/db.sqlite
1515
/prisma/db.sqlite-journal
1616
db.sqlite
17+
data/settings.db
1718

1819
# next.js
1920
/.next/

β€ŽREADME.mdβ€Ž

Lines changed: 229 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
A modern web-based management interface for Proxmox VE (PVE) helper scripts. This tool provides a user-friendly way to discover, download, and execute community-sourced Proxmox scripts locally with real-time terminal output streaming.
44

5+
## 🎯 Deployment Options
6+
7+
This application can be deployed in multiple ways to suit different environments:
8+
9+
- **🐧 Proxmox Host**: Run directly on your Proxmox VE host system
10+
- **πŸ“¦ Debian LXC Container**: Deploy inside a Debian LXC container for better isolation
11+
- **⚑ Quick Install**: Use the automated `install.sh` script for easy setup
12+
13+
All deployment methods provide the same functionality and web interface.
14+
515
## 🌟 Features
616

717
- **Web-based Interface**: Modern React/Next.js frontend with real-time terminal emulation
@@ -33,108 +43,278 @@ A modern web-based management interface for Proxmox VE (PVE) helper scripts. Thi
3343
- **Container Scripts**: Pre-configured LXC container setups
3444
- **Installation Scripts**: System setup and configuration tools
3545

46+
### Database
47+
- **SQLite Database**: Local database stored at `data/settings.db`
48+
- **Server Management**: Stores Proxmox server configurations and credentials
49+
- **Automatic Setup**: Database and tables are created automatically on first run
50+
- **Data Persistence**: Settings persist across application restarts
51+
3652
## πŸ“‹ Prerequisites
3753

54+
### For All Deployment Methods
3855
- **Node.js** 22+ and npm
3956
- **Git** for cloning the repository
40-
- **Proxmox VE environment**
41-
- **build-essentials** ```apt install build-essential```
57+
- **Proxmox VE environment** (host or access to Proxmox cluster)
58+
- **SQLite** (included with Node.js better-sqlite3 package)
59+
60+
### For Proxmox Host Installation
61+
- **build-essentials**: `apt install build-essential`
62+
- Direct access to Proxmox host system
63+
64+
### For Debian LXC Container Installation
65+
- **Debian LXC container** (Debian 11+ recommended)
66+
- **build-essentials**: `apt install build-essential`
67+
- Container with sufficient resources (2GB RAM, 4GB storage minimum)
68+
- Network access from container to Proxmox host
69+
- Optional: Privileged container for full Proxmox integration
70+
71+
### For Quick Install (install.sh)
72+
- **Proxmox VE host** (script automatically detects and configures)
73+
- Internet connectivity for downloading dependencies
4274

4375
## πŸš€ Installation
4476

45-
You can either install automatically via the provided installer script or do a manual setup.
77+
Choose the installation method that best fits your environment:
4678

47-
### Option 1: Install via Bash (Recommended)
79+
### Option 1: Quick Install with install.sh (Recommended for Proxmox Host)
4880

49-
Run this command directly on your Proxmox VE host:
81+
Run this command directly on your Proxmox VE host or on any Debian based lxc:
5082

5183
```bash
5284
bash -c "$(curl -fsSL https://raw.githubusercontent.com/michelroegl-brunner/PVESciptslocal/main/install.sh)"
5385
```
5486

55-
## The script will:
56-
- Verify that you are running on Proxmox VE
57-
- Check and install git and Node.js 24.x if missing
58-
- Clone the repository into /opt/PVESciptslocal (or your chosen path)
59-
- Run npm install and build the project
60-
- Set up .env from .env.example if missing
61-
- Create a systemd service (pvescriptslocal.service) for easy start/stop management
87+
**What the script does:**
88+
- βœ… Installs required dependencies (build-essential, git, Node.js 24.x)
89+
- βœ… Clones the repository into `/opt/PVESciptslocal` (or your chosen path)
90+
- βœ… Runs npm install and builds the project
91+
- βœ… Sets up `.env` from `.env.example` if missing
92+
- βœ… Creates database directory (`data/`) for SQLite storage
93+
- βœ… Creates a systemd service (`pvescriptslocal.service`) for easy management
94+
95+
**After installation:**
96+
- 🌐 Access the app at: `http://<YOUR_PVE_OR_LXC_IP>:3000`
97+
- πŸ”§ Manage the service with:
98+
```bash
99+
systemctl start pvescriptslocal
100+
systemctl stop pvescriptslocal
101+
systemctl status pvescriptslocal
102+
```
103+
104+
### Option 2: Debian LXC Container Installation
105+
106+
For better isolation and security, you can run PVE Scripts Local inside a Debian LXC container:
62107

63-
After installation, the app will be accessible at:
64-
πŸ‘‰ http://<YOUR_PVE_IP>:3000
108+
#### Step 1: Create Debian LXC Container
65109

66-
You can manage the service with:
67110
```bash
68-
systemctl start pvescriptslocal
69-
systemctl stop pvescriptslocal
70-
systemctl status pvescriptslocal
111+
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/debian.sh)"
112+
```
113+
Then run the installer:
114+
115+
```bash
116+
bash -c "$(curl -fsSL https://raw.githubusercontent.com/michelroegl-brunner/PVESciptslocal/main/install.sh)"
71117
```
72118

119+
#### Step 2: Install Dependencies in Container when installer is not used
120+
```bash
121+
# Enter the container
122+
pct enter 100
73123

74-
### Option 2: Manual Installation
124+
# Update and install dependencies
125+
apt update && apt install -y build-essential git curl
75126

76-
### 1. Clone the Repository
127+
# Install Node.js 24.x
128+
curl -fsSL https://deb.nodesource.com/setup_24.x | bash -
129+
apt install -y nodejs
130+
```
77131

132+
#### Step 3: Clone and Setup Application
133+
```bash
134+
# Clone the repository
135+
git clone https://github.com/michelroegl-brunner/PVESciptslocal.git /opt/PVESciptslocal
136+
cd /opt/PVESciptslocal
137+
138+
# Install dependencies and build
139+
npm install
140+
npm run build
141+
142+
# Setup environment
143+
cp .env.example .env
144+
145+
# Create database directory
146+
mkdir -p data
147+
chmod 755 data
148+
```
149+
150+
#### Step 4: Start the Application
151+
```bash
152+
# Start in production mode
153+
npm start
154+
155+
# Or create a systemd service (optional)
156+
# Follow the same systemd setup as the install.sh script
157+
```
158+
159+
**Access the application:**
160+
- 🌐 Container IP: `http://<CONTAINER_IP>:3000`
161+
- πŸ”§ Container management: `pct start 100`, `pct stop 100`, `pct status 100`
162+
163+
### Option 3: Manual Installation (Proxmox Host)
164+
165+
#### Step 1: Clone the Repository
78166
```bash
79167
git clone https://github.com/michelroegl-brunner/PVESciptslocal.git
80168
cd PVESciptslocal
81169
```
82170

83-
### 2. Install Dependencies
84-
171+
#### Step 2: Install Dependencies
85172
```bash
86173
npm install
87174
```
88175

89-
### 3. Environment Configuration
90-
91-
Copy the example environment file and configure your settings:
92-
176+
#### Step 3: Environment Configuration
93177
```bash
94178
cp .env.example .env
179+
# Edit .env file with your specific settings if needed
95180
```
96181

97-
### 4. Start the Application
182+
#### Step 4: Database Setup
183+
```bash
184+
# Create database directory
185+
mkdir -p data
186+
chmod 755 data
187+
```
98188

99-
#### Production Mode
189+
#### Step 5: Build and Start
100190
```bash
191+
# Production mode
101192
npm run build
102193
npm start
194+
195+
# Development mode
196+
npm run dev:server
103197
```
104198

105-
The application will be available at `http://IP:3000`
199+
**Access the application:**
200+
- 🌐 Available at: `http://<YOUR_IP>:3000`
201+
202+
## πŸ“ LXC Container Specific Notes
203+
204+
### Container Requirements
205+
- **OS**: Debian 11+ (Debian 12 recommended)
206+
- **Resources**: Minimum 2GB RAM, 4GB storage
207+
- **Network**: Bridge connection to Proxmox network
208+
- **Privileges**: Unprivileged containers work, but privileged containers provide better Proxmox integration
209+
210+
### Container Configuration Tips
211+
- **Privileged Container**: Use `--unprivileged 0` for full Proxmox API access
212+
- **Resource Allocation**: Allocate at least 2 CPU cores and 2GB RAM for optimal performance
213+
- **Storage**: Use at least 8GB for the container to accommodate Node.js and dependencies
214+
- **Network**: Ensure the container can reach the Proxmox host API
215+
216+
### Security Considerations
217+
- **Unprivileged Containers**: More secure but may have limited Proxmox functionality
218+
- **Privileged Containers**: Full Proxmox access but less secure isolation
219+
- **Network Access**: Ensure proper firewall rules for the container
220+
221+
### Troubleshooting LXC Installation
222+
- **Permission Issues**: Ensure the container has proper permissions for Proxmox API access
223+
- **Network Connectivity**: Verify the container can reach the Proxmox host
224+
- **Resource Limits**: Check if the container has sufficient resources allocated
106225

107226
## 🎯 Usage
108227

109228
### 1. Access the Web Interface
110229

111-
Open your browser and navigate to `http://IP:3000` (or your configured host/port).
230+
The web interface is accessible regardless of your deployment method:
231+
232+
- **Proxmox Host Installation**: `http://<PROXMOX_HOST_IP>:3000`
233+
- **LXC Container Installation**: `http://<CONTAINER_IP>:3000`
234+
- **Custom Installation**: `http://<YOUR_IP>:3000`
235+
236+
### 2. Service Management
237+
238+
#### For install.sh installations (systemd service):
239+
```bash
240+
# Start the service
241+
systemctl start pvescriptslocal
242+
243+
# Stop the service
244+
systemctl stop pvescriptslocal
245+
246+
# Check service status
247+
systemctl status pvescriptslocal
248+
249+
# Enable auto-start on boot
250+
systemctl enable pvescriptslocal
251+
252+
# View service logs
253+
journalctl -u pvescriptslocal -f
254+
```
255+
256+
#### For LXC container installations:
257+
```bash
258+
# Container management
259+
pct start <container_id> # Start container
260+
pct stop <container_id> # Stop container
261+
pct status <container_id> # Check container status
262+
263+
# Access container shell
264+
pct enter <container_id>
265+
266+
# Inside container - start application
267+
cd /opt/PVESciptslocal
268+
npm start
269+
```
270+
271+
#### For manual installations:
272+
```bash
273+
# Start application
274+
npm start
275+
276+
# Development mode
277+
npm run dev:server
112278

113-
### 2. Browse Available Scripts
279+
# Build for production
280+
npm run build
281+
```
282+
283+
### 3. Browse Available Scripts
114284

115285
- The main page displays a grid of available Proxmox scripts
116286
- Use the search functionality to find specific scripts
117287
- Scripts are categorized by type (containers, installations, etc.)
118288

119-
### 3. Download Scripts
289+
### 4. Download Scripts
120290

121291
- Click on any script card to view details
122292
- Use the "Download" button to fetch scripts from GitHub
123293
- Downloaded scripts are stored locally in the `scripts/` directory
124294

125-
### 4. Execute Scripts
295+
### 5. Execute Scripts
126296

127297
- Click "Run Script" on any downloaded script
128298
- A terminal window will open with real-time output
129299
- Interact with the script through the web terminal
130300
- Use the close button to stop execution
131301

132-
### 5. Script Management
302+
### 6. Script Management
133303

134304
- View script execution history
135305
- Update scripts to latest versions
136306
- Manage local script collections
137307

308+
### 7. Database Management
309+
310+
The application uses SQLite for storing server configurations:
311+
312+
- **Database Location**: `data/settings.db`
313+
- **Automatic Creation**: Database and tables are created on first run
314+
- **Server Storage**: Proxmox server credentials and configurations
315+
- **Backup**: Copy `data/settings.db` to backup your server configurations
316+
- **Reset**: Delete `data/settings.db` to reset all server configurations
317+
138318
## πŸ“ Project Structure
139319

140320
```
@@ -151,7 +331,10 @@ PVESciptslocal/
151331
β”‚ β”‚ β”œβ”€β”€ _components/ # React components
152332
β”‚ β”‚ └── page.tsx # Main page
153333
β”‚ └── server/ # Server-side code
334+
β”‚ β”œβ”€β”€ database.js # SQLite database service
154335
β”‚ └── services/ # Business logic services
336+
β”œβ”€β”€ data/ # Database storage
337+
β”‚ └── settings.db # SQLite database file
155338
β”œβ”€β”€ public/ # Static assets
156339
β”œβ”€β”€ server.js # Main server file
157340
└── package.json # Dependencies and scripts
@@ -201,6 +384,18 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
201384
- Server logs: Check console output or `server.log`
202385
- Script execution: View in web terminal
203386

387+
## 🎯 Quick Start Summary
388+
389+
Choose your preferred deployment method:
390+
391+
| Method | Best For | Command |
392+
|--------|----------|---------|
393+
| **Quick Install** | Proxmox hosts or Debian LXC, easy setup | `bash -c "$(curl -fsSL https://raw.githubusercontent.com/michelroegl-brunner/PVESciptslocal/main/install.sh)"` |
394+
| **LXC Container** | Better isolation, security | Create Debian LXC β†’ Install dependencies β†’ Clone repo β†’ `npm start` |
395+
| **Manual Install** | Custom setups, development | `git clone` β†’ `npm install` β†’ `npm run build` β†’ `npm start` |
396+
397+
All methods provide the same web interface at `http://<IP>:3000` with full Proxmox script management capabilities.
398+
204399
---
205400

206401
**Note**: This is alpha software. Use with caution in production environments and always backup your Proxmox configuration before running scripts.

0 commit comments

Comments
Β (0)