haoshoku 2.1.2 → 2.2.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.
- package/CHANGELOG.md +7 -0
- package/haoshoku.js +1 -1
- package/package.json +1 -1
- package/src/os_scripts/debian_server.js +0 -80
- package/services/dashy/README.md +0 -21
- package/services/dashy/conf.yml +0 -12
- package/services/dashy/docker-compose.yml +0 -12
package/CHANGELOG.md
ADDED
package/haoshoku.js
CHANGED
package/package.json
CHANGED
|
@@ -3,7 +3,6 @@ import prompts from "prompts";
|
|
|
3
3
|
import path from "path";
|
|
4
4
|
import fs from "fs";
|
|
5
5
|
import { homedir } from "os";
|
|
6
|
-
import net from "net";
|
|
7
6
|
import { fileURLToPath } from "url";
|
|
8
7
|
|
|
9
8
|
// --- Constants ---
|
|
@@ -152,90 +151,11 @@ async function setupFirewall() {
|
|
|
152
151
|
}
|
|
153
152
|
}
|
|
154
153
|
|
|
155
|
-
function checkPortAvailability(port) {
|
|
156
|
-
return new Promise((resolve) => {
|
|
157
|
-
const server = net.createServer();
|
|
158
|
-
server.once("error", (err) => {
|
|
159
|
-
resolve(false);
|
|
160
|
-
});
|
|
161
|
-
server.once("listening", () => {
|
|
162
|
-
server.close();
|
|
163
|
-
resolve(true);
|
|
164
|
-
});
|
|
165
|
-
server.listen(port);
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
async function installDashy() {
|
|
170
|
-
if (await promptUser("Install Dashy (Personal Dashboard)?", true)) {
|
|
171
|
-
const servicesDir = path.join(HOME, "services");
|
|
172
|
-
const dashyDir = path.join(servicesDir, "dashy");
|
|
173
|
-
const sourceDir = path.join(PROJECT_ROOT, "services", "dashy");
|
|
174
|
-
|
|
175
|
-
if (!fs.existsSync(sourceDir)) {
|
|
176
|
-
log.error(`Dashy source not found at ${sourceDir}`);
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// Port selection
|
|
181
|
-
let port = 8080;
|
|
182
|
-
let isAvailable = await checkPortAvailability(port);
|
|
183
|
-
|
|
184
|
-
if (!isAvailable) {
|
|
185
|
-
log.warning(`Port ${port} is already in use.`);
|
|
186
|
-
const response = await prompts({
|
|
187
|
-
type: "number",
|
|
188
|
-
name: "port",
|
|
189
|
-
message: "Enter a different port for Dashy:",
|
|
190
|
-
initial: 8081,
|
|
191
|
-
validate: async (p) => (await checkPortAvailability(p)) ? true : "Port is still in use",
|
|
192
|
-
});
|
|
193
|
-
port = response.port;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
log.info(`Installing Dashy on port ${port}...`);
|
|
197
|
-
|
|
198
|
-
// Copy files
|
|
199
|
-
if (!fs.existsSync(servicesDir)) {
|
|
200
|
-
fs.mkdirSync(servicesDir, { recursive: true });
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// Using cp -r for simplicity and preserving permissions
|
|
204
|
-
await runCommand(`cp -r ${sourceDir} ${servicesDir}`);
|
|
205
|
-
|
|
206
|
-
// Update port in docker-compose.yml if changed
|
|
207
|
-
if (port !== 8080) {
|
|
208
|
-
const composePath = path.join(dashyDir, "docker-compose.yml");
|
|
209
|
-
if (fs.existsSync(composePath)) {
|
|
210
|
-
let content = fs.readFileSync(composePath, "utf-8");
|
|
211
|
-
content = content.replace("8080:80", `${port}:80`);
|
|
212
|
-
fs.writeFileSync(composePath, content);
|
|
213
|
-
log.info(`Updated Dashy port to ${port} in docker-compose.yml`);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// Start service
|
|
218
|
-
log.info("Starting Dashy...");
|
|
219
|
-
// We need to run docker compose in the dashy directory
|
|
220
|
-
// runCommand doesn't support cwd option directly based on usage seen,
|
|
221
|
-
// so we construct the command to change dir or use -f and -p?
|
|
222
|
-
// Actually runCommand implementation in utils.js likely supports options or we can chain cd.
|
|
223
|
-
// Let's check utils.js or just chain.
|
|
224
|
-
// Assuming runCommand takes options based on standard exec wrappers, but looking at previous file view,
|
|
225
|
-
// I don't see the definition of runCommand.
|
|
226
|
-
// Let's assume `cd ... && ...` works for shell commands.
|
|
227
|
-
await runCommand(`cd ${dashyDir} && docker compose up -d`);
|
|
228
|
-
|
|
229
|
-
log.success(`Dashy installed! Access it at http://localhost:${port}`);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
154
|
export async function runDebianServerSetup() {
|
|
234
155
|
await installEssentials();
|
|
235
156
|
await setupSsh();
|
|
236
157
|
await configureFishShell();
|
|
237
158
|
await installDocker();
|
|
238
|
-
await installDashy();
|
|
239
159
|
await setupFirewall();
|
|
240
160
|
|
|
241
161
|
log.success("Debian Server setup finished.");
|
package/services/dashy/README.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# Dashy Service
|
|
2
|
-
|
|
3
|
-
This directory contains the Docker setup for [Dashy](https://dashy.to/), a self-hosted personal dashboard.
|
|
4
|
-
|
|
5
|
-
## Prerequisites
|
|
6
|
-
|
|
7
|
-
- Docker
|
|
8
|
-
- Docker Compose
|
|
9
|
-
|
|
10
|
-
## Usage
|
|
11
|
-
|
|
12
|
-
1. Start the service:
|
|
13
|
-
```bash
|
|
14
|
-
docker compose up -d
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
2. Access the dashboard at `http://localhost:8080`.
|
|
18
|
-
|
|
19
|
-
## Configuration
|
|
20
|
-
|
|
21
|
-
Edit `conf.yml` to customize your dashboard. See [Dashy Documentation](https://dashy.to/docs/configuring) for more details.
|
package/services/dashy/conf.yml
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
pageTitle: My Dashboard
|
|
2
|
-
sections:
|
|
3
|
-
- name: Getting Started
|
|
4
|
-
items:
|
|
5
|
-
- title: GitHub
|
|
6
|
-
description: Dashy source code
|
|
7
|
-
url: https://github.com/Lissy93/dashy
|
|
8
|
-
icon: fab fa-github
|
|
9
|
-
- title: Documentation
|
|
10
|
-
description: Dashy docs
|
|
11
|
-
url: https://dashy.to/docs
|
|
12
|
-
icon: fas fa-book
|