deploy self

This commit is contained in:
2025-11-29 15:46:07 -05:00
parent 0bfab0bdc8
commit 85b1953b46
7 changed files with 30 additions and 16 deletions

13
src/buildSelf.ts Normal file
View File

@@ -0,0 +1,13 @@
import fs from "fs";
import { indexedConfig } from "./config";
const Caddyfile = Object.values(indexedConfig)
.map(
({ host, port }) => `
${host}.drm.dev {
reverse_proxy localhost:${port}
}`
)
.join("\n");
fs.writeFileSync("Caddyfile", Caddyfile);

View File

@@ -1,24 +1,17 @@
import hash from "object-hash";
import { $ } from "bun";
import path from "path";
import { config } from "./config";
import { config, indexedConfig } from "./config";
type DeployInstance = {
host: string;
user: string;
repo: string;
branch: string;
commitHash: string;
port: number;
};
export const deploy = async ({
host,
user,
repo,
branch,
port,
commitHash,
}: DeployInstance) => {
export const deploy = async ({ host, commitHash }: DeployInstance) => {
const service = config.services[host];
const { user, repo, branch, port } = indexedConfig[hash(service)];
const deploymentId = new Date().toISOString();
const serviceDir = path.join(config.directory, host);

6
src/deploySelf.ts Normal file
View File

@@ -0,0 +1,6 @@
import { deploy } from "./deploy";
await deploy({
host: "deployer2",
commitHash: "",
});

View File

@@ -34,7 +34,7 @@ new Elysia()
return;
}
void deploy({ ...service, commitHash });
void deploy({ host: service.host, commitHash });
return "deploying";
})
.listen(port);