xynginc 1.0.82 → 1.0.83
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.
- package/README.md +52 -20
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6 -6
- package/dist/{requirements.d.ts → mods/requirements.d.ts} +1 -1
- package/dist/{validateConfig.d.ts → mods/validateConfig.d.ts} +1 -1
- package/dist/startPlugin.d.ts +2 -1
- package/dist/startPlugin.js +8 -4
- package/package.json +1 -1
- package/xypriss.plugin.xsig +4 -4
- /package/dist/{constant.d.ts → mods/constant.d.ts} +0 -0
- /package/dist/{constant.js → mods/constant.js} +0 -0
- /package/dist/{downloadBinary.d.ts → mods/downloadBinary.d.ts} +0 -0
- /package/dist/{downloadBinary.js → mods/downloadBinary.js} +0 -0
- /package/dist/{ensureBinary.d.ts → mods/ensureBinary.d.ts} +0 -0
- /package/dist/{ensureBinary.js → mods/ensureBinary.js} +0 -0
- /package/dist/{execAsync.d.ts → mods/execAsync.d.ts} +0 -0
- /package/dist/{execAsync.js → mods/execAsync.js} +0 -0
- /package/dist/{logger.d.ts → mods/logger.d.ts} +0 -0
- /package/dist/{logger.js → mods/logger.js} +0 -0
- /package/dist/{requirements.js → mods/requirements.js} +0 -0
- /package/dist/{validateConfig.js → mods/validateConfig.js} +0 -0
package/README.md
CHANGED
|
@@ -4,13 +4,19 @@ This project uses code developed by NEHONIX (www.nehonix.com) under the NEHONIX
|
|
|
4
4
|
|
|
5
5
|
XyPriss Nginx Controller - Simplifie la gestion de Nginx et SSL.
|
|
6
6
|
|
|
7
|
-
[](https://www.npmjs.com/package/xynginc)
|
|
8
8
|
[](https://dll.nehonix.com/licenses/NOSL)
|
|
9
9
|
|
|
10
10
|
## Overview
|
|
11
11
|
|
|
12
12
|
XyNginC (XyPriss Nginx Controller) automates Nginx reverse proxy configuration, SSL certificate management, and provides optimized, production-ready configs for security, performance, and best practices. It eliminates manual Nginx editing, simplifying XyPriss deployment to just a few lines of TypeScript. Check out the [demo project on GitHub](https://github.com/iDevo-ll/XYNC-Demo).
|
|
13
13
|
|
|
14
|
+
> [!IMPORTANT]
|
|
15
|
+
> XyNginC is a plugin **exclusively designed for XyPriss projects**. It is not intended for use outside the XyPriss ecosystem, in development environments, or on non-Linux systems. For the best integration experience, **XFPM** (XyPriss Fast Package Manager) is required — see [Installation](#installation).
|
|
16
|
+
|
|
17
|
+
> [!CAUTION]
|
|
18
|
+
> XyNginC only runs on **Linux production servers** (VPS or Dedicated). Supported architectures: **x64**, **arm64**, and **ia32**. Windows and macOS are not supported.
|
|
19
|
+
|
|
14
20
|
## Key Features
|
|
15
21
|
|
|
16
22
|
- **Automated Reverse Proxy**: Maps domains to local ports seamlessly.
|
|
@@ -26,7 +32,28 @@ XyNginC (XyPriss Nginx Controller) automates Nginx reverse proxy configuration,
|
|
|
26
32
|
For detailed installation instructions, please refer to the [Installation Guide](docs/INSTALLATION.md).
|
|
27
33
|
For building from source (custom architectures), see the [Build Guide](docs/BUILD_FROM_SOURCE.md).
|
|
28
34
|
|
|
29
|
-
XyNginC is designed for
|
|
35
|
+
XyNginC is exclusively designed for **XyPriss projects running in production on Linux**. We strongly recommend using Ubuntu on a Virtual Private Server (VPS) for the best security and stability.
|
|
36
|
+
|
|
37
|
+
### Prerequisites
|
|
38
|
+
|
|
39
|
+
Before installing XyNginC, you need **XFPM** — the official package manager for the XyPriss ecosystem.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
curl -fsSL https://raw.githubusercontent.com/Nehonix-Team/XFPM/master/scripts/install.sh | sudo bash
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
xfpm --version
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Install XyNginC
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
xfpm install xynginc
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
> [!NOTE]
|
|
56
|
+
> The installation requires `sudo` privileges to place the binary in `/usr/local/bin` and configure system permissions.
|
|
30
57
|
|
|
31
58
|
## Quick Start
|
|
32
59
|
|
|
@@ -92,7 +119,7 @@ XNCP({
|
|
|
92
119
|
Manage domains programmatically at runtime:
|
|
93
120
|
|
|
94
121
|
```typescript
|
|
95
|
-
app.start(
|
|
122
|
+
app.start(async () => {
|
|
96
123
|
// Add a new domain
|
|
97
124
|
await app.xynginc.addDomain(
|
|
98
125
|
"new.example.com",
|
|
@@ -181,7 +208,7 @@ await server.xynginc.status(): Promise<string>
|
|
|
181
208
|
|
|
182
209
|
## CLI Usage
|
|
183
210
|
|
|
184
|
-
The `xynginc` command-line interface allows for direct management without the
|
|
211
|
+
The `xynginc` command-line interface allows for direct management without the XyPriss application context.
|
|
185
212
|
|
|
186
213
|
```bash
|
|
187
214
|
# Check prerequisites
|
|
@@ -230,9 +257,9 @@ sudo xynginc status
|
|
|
230
257
|
|
|
231
258
|
The system operates through a three-tier architecture:
|
|
232
259
|
|
|
233
|
-
1.
|
|
234
|
-
2.
|
|
235
|
-
3.
|
|
260
|
+
1. **XyPriss Application**: The XyPriss application running the server.
|
|
261
|
+
2. **XyNginC Plugin**: A TypeScript wrapper that interfaces with the application and executes the underlying Go binary.
|
|
262
|
+
3. **XyNginC Go Binary**: A high-performance Go-based CLI tool that performs system-level operations (Nginx configuration, Certbot execution). It dynamically fetches the latest config templates from GitHub (`Nehonix-Team/xynginc`) to guarantee up-to-date and optimized Nginx setups.
|
|
236
263
|
|
|
237
264
|
## Security Considerations
|
|
238
265
|
|
|
@@ -243,7 +270,8 @@ XyNginC requires elevated privileges to perform the following actions:
|
|
|
243
270
|
- Executing `certbot` for SSL certificate generation
|
|
244
271
|
- Reloading the Nginx service
|
|
245
272
|
|
|
246
|
-
|
|
273
|
+
> [!WARNING]
|
|
274
|
+
> XyNginC requires elevated privileges to manage Nginx and firewall rules. Always review the commands being executed and restrict sudo access to only what is necessary.
|
|
247
275
|
|
|
248
276
|
- **Sudoers**: We recommend configuring `sudoers` to allow specific commands for the user.
|
|
249
277
|
- **Sudo Password**: If your application runs in the background (e.g. using PM2), you can use the `sudoPassword` option or the `SUDO_PASSWORD` environment variable.
|
|
@@ -257,8 +285,8 @@ XyNginC requires elevated privileges to perform the following actions:
|
|
|
257
285
|
If the binary fails to download automatically:
|
|
258
286
|
|
|
259
287
|
```bash
|
|
260
|
-
# Manually trigger
|
|
261
|
-
|
|
288
|
+
# Manually trigger with XFPM
|
|
289
|
+
xfpm run postinstall
|
|
262
290
|
|
|
263
291
|
# Or specify the path manually in options
|
|
264
292
|
XNCP({
|
|
@@ -280,21 +308,25 @@ sudo node server.js
|
|
|
280
308
|
|
|
281
309
|
If SSL generation fails:
|
|
282
310
|
|
|
283
|
-
1.
|
|
284
|
-
2.
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
311
|
+
1. Verify DNS propagation: `dig api.example.com`
|
|
312
|
+
2. Ensure firewall allows traffic on ports 80 and 443:
|
|
313
|
+
|
|
314
|
+
```bash
|
|
315
|
+
sudo ufw allow 80
|
|
316
|
+
sudo ufw allow 443
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
> [!NOTE]
|
|
320
|
+
> Certbot requires ports 80 and 443 to be publicly accessible for domain validation. Make sure your cloud provider's security groups also allow this traffic, not just UFW.
|
|
289
321
|
|
|
290
322
|
## Contributing
|
|
291
323
|
|
|
292
324
|
Contributions are welcome. Please follow the standard pull request process.
|
|
293
325
|
|
|
294
|
-
1.
|
|
295
|
-
2.
|
|
296
|
-
3.
|
|
297
|
-
4.
|
|
326
|
+
1. Clone the repository
|
|
327
|
+
2. Install dependencies
|
|
328
|
+
3. Build the Go CLI and TypeScript package (`xfpm run build:all`)
|
|
329
|
+
4. Run tests
|
|
298
330
|
|
|
299
331
|
## License
|
|
300
332
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { Plugin } from "xypriss";
|
|
1
2
|
import { XyNginCConfig, XyNginCDomainConfig, XyNginCPluginOptions } from "./types";
|
|
3
|
+
export type PlC = Parameters<typeof Plugin.create>[0];
|
|
4
|
+
export type PluginServer = Parameters<NonNullable<PlC["onServerStart"]>>[0];
|
|
2
5
|
/**
|
|
3
6
|
* XyNginC Plugin for XyPriss.
|
|
4
7
|
* Automates Nginx and SSL management for your server.
|
package/dist/index.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Licensed under NEHONIX Open Source License (NOSL) v1.0
|
|
5
5
|
*/
|
|
6
6
|
import { Plugin } from "xypriss";
|
|
7
|
-
import { Logger } from "./logger";
|
|
8
|
-
import { validateConfig } from "./validateConfig";
|
|
7
|
+
import { Logger } from "./mods/logger";
|
|
8
|
+
import { validateConfig } from "./mods/validateConfig";
|
|
9
9
|
import { startXNCPlugin } from "./startPlugin";
|
|
10
10
|
/**
|
|
11
11
|
* XyNginC Plugin for XyPriss.
|
|
@@ -16,11 +16,11 @@ import { startXNCPlugin } from "./startPlugin";
|
|
|
16
16
|
*/
|
|
17
17
|
export default function XNCP(options) {
|
|
18
18
|
const { domains, autoReload = true, autoFixFirewall = false, binaryPath, autoDownload = true, version = "latest", installRequirements = true, sudoPassword, } = options;
|
|
19
|
-
const
|
|
19
|
+
const pkg = Plugin.manifest(__sys__);
|
|
20
20
|
return Plugin.create({
|
|
21
|
-
name:
|
|
22
|
-
version:
|
|
23
|
-
description:
|
|
21
|
+
name: pkg.name,
|
|
22
|
+
version: pkg.version,
|
|
23
|
+
description: pkg.description,
|
|
24
24
|
onRegister: async (_server) => {
|
|
25
25
|
Logger.info("[XyNginC] Registering plugin...");
|
|
26
26
|
validateConfig({ domains, autoReload, autoFixFirewall });
|
package/dist/startPlugin.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { PluginServer } from ".";
|
|
1
2
|
import { XyNginCDomainConfig } from "./types";
|
|
2
|
-
export declare function startXNCPlugin(server:
|
|
3
|
+
export declare function startXNCPlugin(server: PluginServer, options: {
|
|
3
4
|
binaryPath?: string;
|
|
4
5
|
autoDownload: boolean;
|
|
5
6
|
version: string;
|
package/dist/startPlugin.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ensureBinary } from "./ensureBinary";
|
|
2
|
-
import { Logger } from "./logger";
|
|
3
|
-
import { addDomain, applyConfig, checkRequirements, getStatus, installRequirementsHandler, listDomains, reloadNginx, removeDomain, testNginx, } from "./requirements";
|
|
1
|
+
import { ensureBinary } from "./mods/ensureBinary";
|
|
2
|
+
import { Logger } from "./mods/logger";
|
|
3
|
+
import { addDomain, applyConfig, checkRequirements, getStatus, installRequirementsHandler, listDomains, reloadNginx, removeDomain, testNginx, } from "./mods/requirements";
|
|
4
4
|
const getSudo = (sudoPassword) => {
|
|
5
5
|
// Attempt multiple ways to get the password, including XyPriss internal env if somehow exposed
|
|
6
|
-
const envPwd =
|
|
6
|
+
const envPwd = __sys__.__env__.get("SUDO_PASSWORD");
|
|
7
7
|
// || (global as any).__sys__?.$env?.("SUDO_PASSWORD");
|
|
8
8
|
const pwd = sudoPassword || envPwd;
|
|
9
9
|
if (pwd) {
|
|
@@ -23,6 +23,10 @@ const getSudo = (sudoPassword) => {
|
|
|
23
23
|
export async function startXNCPlugin(server, options) {
|
|
24
24
|
const { binaryPath, autoDownload, version, domains, autoReload, autoFixFirewall, installRequirements, sudoPassword, } = options;
|
|
25
25
|
Logger.info("[XyNginC] Initializing Nginx Controller...");
|
|
26
|
+
if (!sudoPassword) {
|
|
27
|
+
Logger.warn("[XyNginC] To ensure optimal performance and prevent potential issues, it is recommended to provide your system sudo password.");
|
|
28
|
+
Logger.info("[XyNginC] Security notice: The password is used solely for privileged communication with your operating system. It is never stored, logged, or transmitted externally.");
|
|
29
|
+
}
|
|
26
30
|
try {
|
|
27
31
|
// 1. Ensure binary exists
|
|
28
32
|
const binary = await ensureBinary(binaryPath, autoDownload, version);
|
package/package.json
CHANGED
package/xypriss.plugin.xsig
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
--- XYPRISS SIGNATURE (G3) ---
|
|
2
|
-
Manifest: xynginc@1.0.
|
|
2
|
+
Manifest: xynginc@1.0.83
|
|
3
3
|
Min-Engine: 1.0.81
|
|
4
|
-
Fingerprint: sha256:
|
|
4
|
+
Fingerprint: sha256:2e05c6c4adffc16ce7cc1e172e212f7a0ef1c08545612ce7170d7c96ac36d8f1
|
|
5
5
|
Identity: ed25519:a58b17a3e46302dd3ae5538bc9b8b991c57f4c5fe2e7d8ac41803de818d947f4
|
|
6
6
|
Privileges: XHS.HOOK.HTTP.REQUEST,XHS.HOOK.LIFECYCLE.SERVER_READY
|
|
7
|
-
Expires: 2027-04-
|
|
7
|
+
Expires: 2027-04-28T09:43:22Z
|
|
8
8
|
Revision: sha256:none
|
|
9
9
|
--- BEGIN CRYPTOGRAPHIC PROOF ---
|
|
10
|
-
base64
|
|
10
|
+
base64:htZVWcVTy/7PLFvF+PQf7S5TZttaVNj2cjs292cawK/QC/bz1xDMtURQCH+nKHh3GnMsspmUWtLFPeZolg8yDA==
|
|
11
11
|
--- END XYPRISS SIGNATURE ---
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|