Skip to content

Commit 40ba20b

Browse files
committed
feat: Add release tarball creation script and documentation
1 parent e2dc865 commit 40ba20b

File tree

2 files changed

+140
-3
lines changed

2 files changed

+140
-3
lines changed

README.md

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,38 @@ If enabled via the script, a cron job runs `./install-pulse.sh --update` Daily/W
417417
418418
</details>
419419
420+
### Running from Release Tarball
421+
422+
For users who prefer not to use Docker or the LXC script, pre-packaged release tarballs are available.
423+
424+
**Prerequisites:**
425+
- Node.js (Version 18.x or later recommended)
426+
- npm (comes with Node.js)
427+
- `tar` command (standard on Linux/macOS, available via tools like 7-Zip or WSL on Windows)
428+
429+
**Steps:**
430+
431+
1. **Download:** Go to the [Pulse GitHub Releases page](https://github.com/rcourtman/Pulse/releases/latest). Download the `pulse-vX.Y.Z.tar.gz` file for the desired release.
432+
2. **Extract:** Create a directory and extract the tarball:
433+
```bash
434+
mkdir pulse-app
435+
cd pulse-app
436+
tar -xzf /path/to/downloaded/pulse-vX.Y.Z.tar.gz
437+
# This creates a directory like pulse-vX.Y.Z/
438+
cd pulse-vX.Y.Z
439+
```
440+
3. **Configure:** Copy the environment file template and edit it with your details (see [Configuration](#️-configuration)):
441+
```bash
442+
cp .env.example .env
443+
nano .env # Or your preferred editor
444+
```
445+
4. **Run:** Start the application using npm:
446+
```bash
447+
npm start
448+
```
449+
*(Note: The tarball includes pre-installed production dependencies, so `npm install` is not typically required unless you encounter issues.)*
450+
5. **Access:** Open your browser to `http://<your-server-ip>:7655` (or the port configured in `.env`).
451+
420452
### ️ Running the Application (Node.js - Development)
421453
422454
For development purposes or running directly from source, see the **[DEVELOPMENT.md](DEVELOPMENT.md)** guide. This involves cloning the repository, installing dependencies using `npm install` in both the root and `server` directories, and running `npm run dev` or `npm run start`.
@@ -441,7 +473,7 @@ For development purposes or running directly from source, see the **[DEVELOPMENT
441473
- **Proxmox Backup Server:** Version 2.x or 3.x recommended (if monitored).
442474
- **Web Browser:** Modern evergreen browser.
443475
444-
## 👋 Contributing
476+
## Contributing
445477
446478
Contributions are welcome! Please read our [Contributing Guidelines](CONTRIBUTING.md).
447479
@@ -451,7 +483,7 @@ Contributions are welcome! Please read our [Contributing Guidelines](CONTRIBUTIN
451483
* **Local Communication:** Operates entirely between your environment and your Proxmox/PBS APIs.
452484
* **Credential Handling:** Credentials are used only for API authentication and are not logged or sent elsewhere.
453485
454-
## 📜 License
486+
## 📜 License
455487
456488
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file.
457489
@@ -473,4 +505,4 @@ Common connection issues:
473505
* **Pulse Application Logs:** Check container logs (`docker logs pulse_monitor`) or service logs (`sudo journalctl -u pulse-monitor.service -f`) for errors (401 Unauthorized, 403 Forbidden, connection refused, timeout).
474506
* **`.env` Configuration:** Verify `PROXMOX_HOST`, `PROXMOX_TOKEN_ID`, `PROXMOX_TOKEN_SECRET`, and `PROXMOX_ALLOW_SELF_SIGNED_CERTS`. For PBS, also check `PBS_HOST`, `PBS_TOKEN_ID`, `PBS_TOKEN_SECRET`, `PBS_ALLOW_SELF_SIGNED_CERTS`, and especially **`PBS_NODE_NAME`**. Ensure no placeholder values remain.
475507
* **Network Connectivity:** Can the machine running Pulse reach the PVE/PBS hostnames/IPs and ports (usually 8006 for PVE, 8007 for PBS)? Check firewalls.
476-
* **API Token Permissions:** Ensure the correct roles (`PVEAuditor` for PVE, `Audit` for PBS) are assigned at the root path (`/`) with `Propagate` enabled in the respective UIs.
508+
* **API Token Permissions:** Ensure the correct roles (`PVEAuditor` for PVE, `Audit` for PBS) are assigned at the root path (`/`) with `Propagate` enabled in the respective UIs.

scripts/create-release.sh

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#!/bin/bash
2+
set -e # Exit immediately if a command exits with a non-zero status.
3+
4+
# --- Configuration ---
5+
# Attempt to get version from package.json
6+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
7+
# Suggest a release version by stripping common pre-release suffixes like -dev.X or -alpha.X etc.
8+
SUGGESTED_RELEASE_VERSION=$(echo "$PACKAGE_VERSION" | sed -E 's/-(dev|alpha|beta|rc|pre)[-.0-9]*$//')
9+
10+
# --- User Input for Version ---
11+
echo "Current version in package.json: $PACKAGE_VERSION"
12+
read -p "Enter release version (default: $SUGGESTED_RELEASE_VERSION): " USER_VERSION
13+
RELEASE_VERSION=${USER_VERSION:-$SUGGESTED_RELEASE_VERSION}
14+
15+
if [[ -z "$RELEASE_VERSION" ]]; then
16+
echo "Error: Release version cannot be empty."
17+
exit 1
18+
fi
19+
echo "Creating release for version: v$RELEASE_VERSION"
20+
21+
# --- Definitions ---
22+
APP_NAME="pulse" # Or derive from package.json if preferred
23+
RELEASE_DIR_NAME="${APP_NAME}-v${RELEASE_VERSION}"
24+
STAGING_PARENT_DIR="pulse-release-staging" # Temporary parent for the release content
25+
STAGING_FULL_PATH="$STAGING_PARENT_DIR/$RELEASE_DIR_NAME"
26+
TARBALL_NAME="${RELEASE_DIR_NAME}.tar.gz"
27+
28+
# --- Cleanup Previous Attempts ---
29+
echo "Cleaning up previous attempts..."
30+
rm -rf "$STAGING_PARENT_DIR"
31+
rm -f "$TARBALL_NAME"
32+
mkdir -p "$STAGING_FULL_PATH"
33+
34+
# --- Build Step ---
35+
echo "Building CSS..."
36+
npm run build:css
37+
if [ ! -f "src/public/output.css" ]; then
38+
echo "Error: src/public/output.css not found after build. Aborting."
39+
exit 1
40+
fi
41+
42+
# --- Copy Application Files ---
43+
echo "Copying application files to $STAGING_FULL_PATH..."
44+
45+
# Server files (excluding tests)
46+
echo "Copying server files..."
47+
rsync -av --progress server/ "$STAGING_FULL_PATH/server/" --exclude 'tests/'
48+
49+
# Public files (including built CSS and other assets)
50+
echo "Copying public files..."
51+
mkdir -p "$STAGING_FULL_PATH/src" # Ensure parent directory exists
52+
rsync -av --progress src/public/ "$STAGING_FULL_PATH/src/public/"
53+
54+
# Root files
55+
echo "Copying root files..."
56+
cp package.json "$STAGING_FULL_PATH/"
57+
cp package-lock.json "$STAGING_FULL_PATH/"
58+
cp README.md "$STAGING_FULL_PATH/"
59+
cp LICENSE "$STAGING_FULL_PATH/"
60+
cp CHANGELOG.md "$STAGING_FULL_PATH/"
61+
cp .env.example "$STAGING_FULL_PATH/.env.example" # Essential for user configuration
62+
63+
# Scripts (e.g., install-pulse.sh, if intended for end-user)
64+
if [ -d "scripts" ]; then
65+
echo "Copying scripts..."
66+
mkdir -p "$STAGING_FULL_PATH/scripts/"
67+
if [ -f "scripts/install-pulse.sh" ]; then
68+
cp scripts/install-pulse.sh "$STAGING_FULL_PATH/scripts/"
69+
fi
70+
# Add other scripts if they are part of the release
71+
fi
72+
73+
# Docs
74+
if [ -d "docs" ]; then
75+
echo "Copying docs..."
76+
rsync -av --progress docs/ "$STAGING_FULL_PATH/docs/"
77+
fi
78+
79+
# --- Install Production Dependencies ---
80+
echo "Installing production dependencies in $STAGING_FULL_PATH..."
81+
(cd "$STAGING_FULL_PATH" && npm install --omit=dev --ignore-scripts)
82+
# --ignore-scripts prevents any package's own postinstall scripts from running during this build phase.
83+
# If your production dependencies have essential postinstall scripts, you might remove --ignore-scripts.
84+
85+
# --- Create Tarball ---
86+
echo "Creating tarball: $TARBALL_NAME..."
87+
# Go into the parent of the directory to be tarred to avoid leading paths in tarball
88+
(cd "$STAGING_PARENT_DIR" && tar -czf "../../$TARBALL_NAME" "$RELEASE_DIR_NAME")
89+
90+
# --- Cleanup ---
91+
echo "Cleaning up staging directory ($STAGING_PARENT_DIR)..."
92+
rm -rf "$STAGING_PARENT_DIR"
93+
94+
echo ""
95+
echo "----------------------------------------------------"
96+
echo "Release tarball created: $TARBALL_NAME"
97+
echo "----------------------------------------------------"
98+
echo "To use the tarball:"
99+
echo "1. Copy $TARBALL_NAME to the target server."
100+
echo "2. Extract: tar -xzf $TARBALL_NAME"
101+
echo "3. Navigate into the directory: cd $RELEASE_DIR_NAME"
102+
echo "4. Copy .env.example to .env and configure it: cp .env.example .env"
103+
echo "5. Start the application: npm start (or node server/index.js)"
104+
echo " (If scripts/install-pulse.sh is provided, consult it for specific setup steps)"
105+
echo "----------------------------------------------------"

0 commit comments

Comments
 (0)