root when it should be
This commit is contained in:
@@ -6,7 +6,7 @@ After=network.target
|
|||||||
Type=simple
|
Type=simple
|
||||||
Environment="PORT=$port"
|
Environment="PORT=$port"
|
||||||
ExecStart=make start
|
ExecStart=make start
|
||||||
User=drm
|
User=$user
|
||||||
WorkingDirectory=$serviceDir/src
|
WorkingDirectory=$serviceDir/src
|
||||||
Restart=yes
|
Restart=yes
|
||||||
StandardOutput=file:$logsDir/start.log
|
StandardOutput=file:$logsDir/start.log
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import { indexedConfig, config } from "./config";
|
import { indexedConfig, config, isSelf } from "./config";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { $ } from "bun";
|
import { $ } from "bun";
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ export const rebuildCaddyfile = async () => {
|
|||||||
await $`rm ${caddyfilePath("deployer2")}`.nothrow();
|
await $`rm ${caddyfilePath("deployer2")}`.nothrow();
|
||||||
|
|
||||||
const Caddyfile = Object.values(indexedConfig)
|
const Caddyfile = Object.values(indexedConfig)
|
||||||
.filter(({ user, repo }) => `${user}/${repo}` != "drm/deployer2")
|
.filter((s) => !isSelf(s))
|
||||||
.map(
|
.map(
|
||||||
({ host, port }) => `
|
({ host, port }) => `
|
||||||
${host}.drm.dev {
|
${host}.drm.dev {
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import userConfig from "../config";
|
import userConfig from "../config";
|
||||||
import hash from "object-hash";
|
import hash from "object-hash";
|
||||||
|
|
||||||
export type DeployerConfig = {
|
export type DeployerService = {
|
||||||
services: {
|
|
||||||
[host: string]: {
|
|
||||||
user: string;
|
user: string;
|
||||||
repo: string;
|
repo: string;
|
||||||
branch: string;
|
branch: string;
|
||||||
};
|
};
|
||||||
};
|
export type DeployerConfig = {
|
||||||
|
services: { [host: string]: DeployerService };
|
||||||
giteaUrl: string;
|
giteaUrl: string;
|
||||||
directory: string;
|
directory: string;
|
||||||
basePort: number;
|
basePort: number;
|
||||||
@@ -27,3 +26,6 @@ export const indexedConfig = Object.fromEntries(
|
|||||||
},
|
},
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const isSelf = ({ user, repo }: DeployerService) =>
|
||||||
|
`${user}/${repo}` == "drm/deployer2";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import hash from "object-hash";
|
import hash from "object-hash";
|
||||||
import { $ } from "bun";
|
import { $ } from "bun";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { config, indexedConfig } from "./config";
|
import { config, indexedConfig, isSelf } from "./config";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import { rebuildCaddyfile } from "./caddy";
|
import { rebuildCaddyfile } from "./caddy";
|
||||||
|
|
||||||
@@ -47,6 +47,7 @@ export const deploy = async ({ host, commitHash }: DeployInstance) => {
|
|||||||
deploymentId,
|
deploymentId,
|
||||||
logsDir: path.join(serviceDir, "logs"),
|
logsDir: path.join(serviceDir, "logs"),
|
||||||
serviceDir,
|
serviceDir,
|
||||||
|
user: isSelf(service) ? "root" : "drm",
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
await $`ln -sf ${serviceDir}/${systemdServiceName} ${config.systemServicesDir}/${systemdServiceName}`;
|
await $`ln -sf ${serviceDir}/${systemdServiceName} ${config.systemServicesDir}/${systemdServiceName}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user