Compare commits
No commits in common. "6c0038b421f73c66281a0e486387d493f69d220f" and "43feec227c05c2cc5a6261a874d62c4c6e2c866e" have entirely different histories.
6c0038b421
...
43feec227c
3 changed files with 7 additions and 16 deletions
|
@ -1,10 +1,11 @@
|
||||||
export type { Base, BaseContext } from "./lib/create.ts";
|
export type { Base, BaseContext } from "./lib/create.ts";
|
||||||
|
|
||||||
import { toText } from "https://deno.land/std@0.208.0/streams/to_text.ts";
|
import { toText } from "https://deno.land/std@0.208.0/streams/to_text.ts";
|
||||||
import { lines, log_from, loop_process, LoopProcess, run } from "./lib/utils.ts";
|
import { lines, log_from, loop_process, run } from "./lib/utils.ts";
|
||||||
import { ContainerConfig } from "./lib/config.ts";
|
import { ContainerConfig } from "./lib/config.ts";
|
||||||
import { container_paths } from "./lib/paths.ts";
|
import { container_paths } from "./lib/paths.ts";
|
||||||
import { container_command, stop_container } from "./lib/nspawn.ts";
|
import { container_command } from "./lib/nspawn.ts";
|
||||||
|
import { LoopProcess } from "./lib/utils.ts";
|
||||||
import { NginxController } from "./lib/nginx.ts";
|
import { NginxController } from "./lib/nginx.ts";
|
||||||
|
|
||||||
const log = log_from("lib");
|
const log = log_from("lib");
|
||||||
|
@ -80,9 +81,8 @@ export class Runner {
|
||||||
this.loop = null as LoopProcess | null;
|
this.loop = null as LoopProcess | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
async start() {
|
start() {
|
||||||
await stop_container(this.name);
|
this.update_proxies();
|
||||||
await this.update_proxies();
|
|
||||||
this.start_process();
|
this.start_process();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { exists, run } from "./utils.ts";
|
import { run } from "./utils.ts";
|
||||||
import * as path from "https://deno.land/std@0.214.0/path/mod.ts";
|
import * as path from "https://deno.land/std@0.214.0/path/mod.ts";
|
||||||
|
|
||||||
export class NginxController {
|
export class NginxController {
|
||||||
|
@ -24,7 +24,6 @@ server {
|
||||||
const conf_file_path = path.join(conf_dir, domain + ".conf");
|
const conf_file_path = path.join(conf_dir, domain + ".conf");
|
||||||
const enabled_conf_file_path = path.join(this.enabled_conf_dir, domain + ".conf");
|
const enabled_conf_file_path = path.join(this.enabled_conf_dir, domain + ".conf");
|
||||||
await Deno.writeTextFile(conf_file_path, conf_file_content);
|
await Deno.writeTextFile(conf_file_path, conf_file_content);
|
||||||
if (await exists(enabled_conf_file_path)) await Deno.remove(enabled_conf_file_path);
|
|
||||||
await run("ln", "-s", await Deno.realPath(conf_file_path), enabled_conf_file_path);
|
await run("ln", "-s", await Deno.realPath(conf_file_path), enabled_conf_file_path);
|
||||||
await this.reload();
|
await this.reload();
|
||||||
return conf_file_path;
|
return conf_file_path;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// wrapper
|
// wrapper
|
||||||
|
|
||||||
import { log_from, run, sleep } from "./utils.ts";
|
import { log_from, sleep } from "./utils.ts";
|
||||||
import { ContainerConfigRedirection } from "./config.ts";
|
import { ContainerConfigRedirection } from "./config.ts";
|
||||||
|
|
||||||
const log = log_from("nspawn");
|
const log = log_from("nspawn");
|
||||||
|
@ -30,14 +30,6 @@ export function container_command(name: string, directory: string, opts?: {
|
||||||
return command;
|
return command;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function stop_container(name: string) {
|
|
||||||
try {
|
|
||||||
await run("machinectl", "stop", name);
|
|
||||||
} catch (_) {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function get_container_addresses(name: string) {
|
export async function get_container_addresses(name: string) {
|
||||||
const command = new Deno.Command("machinectl", { args: ["status", name], stdout: "piped" });
|
const command = new Deno.Command("machinectl", { args: ["status", name], stdout: "piped" });
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue