Skip to content

Commit

Permalink
Diff state
Browse files Browse the repository at this point in the history
willnode committed Sep 9, 2024
1 parent c73ddd8 commit 3699a36
Showing 5 changed files with 25 additions and 3 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/domcloud.yml
Original file line number Diff line number Diff line change
@@ -56,3 +56,11 @@ jobs:
webhook_auth: ${{ secrets.WEBHOOK_AUTH_SAO }}
data: >-
{"commands":["git pull","npm i","npm test","sudo systemctl restart bridge"]}
- name: Invoke SGP deployment hook
uses: distributhor/workflow-webhook@v3
env:
webhook_url: https://my.domcloud.co/api/githubdeploy
webhook_secret: ${{ secrets.WEBHOOK_SECRET_SGP }}
webhook_auth: ${{ secrets.WEBHOOK_AUTH_SGP }}
data: >-
{"commands":["git pull","npm i","npm test","sudo systemctl restart bridge"]}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "domcloud-bridge",
"version": "0.56.1",
"version": "0.57.0",
"description": "Deployment runner for DOM Cloud",
"main": "app.js",
"engines": {
5 changes: 5 additions & 0 deletions src/executor/runner.js
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ import {
} from "./virtualmin.js";
import { runConfigCodeFeatures } from "./runnercode.js";
import { runConfigSubdomain } from "./runnersub.js";
import path from "path";

// TODO: Need to able to customize this
const maxExecutionTime = 900000;
@@ -213,6 +214,7 @@ export default async function runConfig(config, domain, writer, sandbox = false)
domaindata = await virtualminExec.getDomainInfo(domain);
break;
case 'disable':
await sshExec(`mkdir -p ${domaindata['Home directory']}`);
await writeLog("$> virtualmin disable-domain");
await virtExec("disable-domain", value, {
domain,
@@ -223,6 +225,9 @@ export default async function runConfig(config, domain, writer, sandbox = false)
await virtExec("enable-domain", value, {
domain,
});
await spawnSudoUtil("SHELL_SUDO", ["root",
"rm", "-f", path.join(domaindata['Home directory'], `disabled_by_virtualmin.html`)
]);
break;
case 'backup':
await writeLog("$> virtualmin backup-domain");
9 changes: 9 additions & 0 deletions src/executor/runnersub.js
Original file line number Diff line number Diff line change
@@ -62,6 +62,7 @@ export async function runConfigSubdomain(config, domaindata, subdomain, sshExec,
domain: subdomain,
mysql: true,
});
subdomaindata['Features'] = subdomaindata['Features'].replace(/ ?mysql/, '');
} else {
await writeLog("Already disabled");
}
@@ -74,6 +75,7 @@ export async function runConfigSubdomain(config, domaindata, subdomain, sshExec,
mysql: true,
});
dbneedcreate = true;
subdomaindata['Features'] += ' ' + key;
}
if (value.startsWith("create ")) {
let newdb = value.substr("create ".length).trim();
@@ -101,6 +103,7 @@ export async function runConfigSubdomain(config, domaindata, subdomain, sshExec,
domain: subdomain,
postgres: true,
});
subdomaindata['Features'] = subdomaindata['Features'].replace(/ ?postgres/, '');
} else {
await writeLog("Already disabled");
}
@@ -112,6 +115,7 @@ export async function runConfigSubdomain(config, domaindata, subdomain, sshExec,
domain: subdomain,
postgres: true,
});
subdomaindata['Features'] += ' ' + key;
dbneedcreate = true;
}
if (value.startsWith("create ")) {
@@ -141,6 +145,7 @@ export async function runConfigSubdomain(config, domaindata, subdomain, sshExec,
domain: subdomain,
dns: true,
});
subdomaindata['Features'] = subdomaindata['Features'].replace(/ ?dns/, '');
} else {
await writeLog("Already disabled");
}
@@ -152,6 +157,7 @@ export async function runConfigSubdomain(config, domaindata, subdomain, sshExec,
domain: subdomain,
dns: true,
});
subdomaindata['Features'] += ' ' + key;
}
if (!Array.isArray(value)) {
break;
@@ -271,6 +277,7 @@ export async function runConfigSubdomain(config, domaindata, subdomain, sshExec,
'web': true,
'skip-dns-check': true,
});
subdomaindata['SSL cert expiry'] = new Date().toISOString()
}
// if LE ON AND force self-sign / shared on, must turn off
// if it was shared or ssl path don't match, just assume that's also LE ON
@@ -280,6 +287,8 @@ export async function runConfigSubdomain(config, domaindata, subdomain, sshExec,
domain: subdomain,
'self': true,
});
delete subdomaindata['Lets Encrypt renewal'];
delete subdomaindata['SSL shared with'];
} else if (!changed) {
await writeLog("$> SSL config seems OK, nothing changed");
break;

0 comments on commit 3699a36

Please sign in to comment.