add nginx wrapper and refactor
This commit is contained in:
parent
9216063aa0
commit
6f92727bb3
9 changed files with 530 additions and 92 deletions
|
@ -1,9 +1,10 @@
|
|||
#!/bin/env -S deno run -A --unstable
|
||||
|
||||
import { daemon_send, new_cmd_disable, new_cmd_enable, new_cmd_status, new_cmd_stop } from "./src/lib.ts";
|
||||
import { load_all_container_configs, new_container_config, save_container_config } from "./src/lib/config.ts";
|
||||
import { ContainerConfig } from "./src/lib/config.ts";
|
||||
import { load_base, new_container_context } from "./src/lib/create.ts";
|
||||
import { container_paths, socket_path } from "./src/lib/paths.ts";
|
||||
import { async_collect } from "./src/lib/utils.ts";
|
||||
import { log_from, run } from "./src/lib/utils.ts";
|
||||
|
||||
const log = log_from("control");
|
||||
|
@ -78,16 +79,16 @@ Commands:
|
|||
export async function create(name: string, base_name: string) {
|
||||
log("loading base", base_name);
|
||||
const base = await load_base(base_name);
|
||||
const known_containers = await load_all_container_configs();
|
||||
const known_containers = await async_collect(ContainerConfig.load_all());
|
||||
|
||||
const paths = container_paths(name);
|
||||
await Deno.mkdir(paths.base);
|
||||
const configuration = new_container_config(name);
|
||||
const configuration = ContainerConfig.new_default(name);
|
||||
|
||||
log("creating the container", name, "at", paths.base);
|
||||
const context = new_container_context(paths.root, configuration, known_containers);
|
||||
await Deno.mkdir(paths.root);
|
||||
await run("sudo", "chown", "root:root", paths.root);
|
||||
await base.build(context);
|
||||
await save_container_config(configuration);
|
||||
await configuration.save();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue