@webship.co/workspace-godaddy 0.0.0-stage → 1.0.0-beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -2
- package/commands/cmd-tools-godaddy.sh +22 -0
- package/config/plugin.godaddy.settings.yml +9 -0
- package/config/settings.labels.yml +10 -0
- package/dist/src/index.d.ts +16 -0
- package/dist/src/index.js +24 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib/link.d.ts +11 -0
- package/dist/src/lib/link.js +42 -0
- package/dist/src/lib/link.js.map +1 -0
- package/dist/src/lib/provider.d.ts +11 -0
- package/dist/src/lib/provider.js +85 -0
- package/dist/src/lib/provider.js.map +1 -0
- package/features/godaddy.feature +20 -0
- package/package.json +76 -4
- package/scripts/args/arg-godaddy.sh +47 -0
- package/scripts/functions/fun-godaddy-tool.sh +173 -0
- package/scripts/functions/fun-godaddy.sh +158 -0
- package/scripts/host-install.sh +20 -0
package/README.md
CHANGED
|
@@ -1,3 +1,61 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @webship.co/workspace-godaddy
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
GoDaddy for the [Webship Workspace](https://github.com/webship/workspace) dashboard: the **GODADDY**
|
|
4
|
+
menu on every site row, a live-site chip on the project card, "Link to GoDaddy" when a new folder is
|
|
5
|
+
made, and the `cmd-tools-godaddy.sh` command in every site workspace. A provider of
|
|
6
|
+
[`@webship.co/workspace-hosting`](https://github.com/webship/workspace-hosting), which draws the menu,
|
|
7
|
+
the environments modal, the get-database-and-files flow and the New-folder section for every host.
|
|
8
|
+
|
|
9
|
+
GoDaddy's API (developer.godaddy.com) answers for the domain and its DNS: the environments are the domain and the host names its A and CNAME records make live. The hosting account (Web Hosting, cPanel plans) is reached over SSH like any cPanel server, so the database, the files, the deploy and the log work the same way as `@webship.co/workspace-cpanel`. The link is `domain` for DNS only, or `domain,user@host:/remote/docroot` for the hosting too.
|
|
10
|
+
|
|
11
|
+
## Use it
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
cd ~/workspace
|
|
15
|
+
bash core/scripts/plugins.sh --require github:webship/workspace-godaddy
|
|
16
|
+
bash core/scripts/plugins.sh --activate godaddy
|
|
17
|
+
bash core/scripts/plugins.sh --install godaddy
|
|
18
|
+
bash core/scripts/plugins.sh --configure godaddy # core/config/plugin.godaddy.settings.yml
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The same four steps are buttons on the dashboard's **Settings → Plugins** page.
|
|
22
|
+
|
|
23
|
+
## The command
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
cd ~/workspace/dev
|
|
27
|
+
bash cmd-tools-godaddy.sh <project> [verb]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
| Verb | What it does |
|
|
31
|
+
| --- | --- |
|
|
32
|
+
| `--link` <value> | Link the project to a domain in the GoDaddy account, and its hosting over SSH: domain[,user@host:/remote/docroot]. The SSH part is needed for the pulls, the deploy and the log. |
|
|
33
|
+
| `--push` | Deploy: rsync the local docroot to the remote document root (excludes sites/default/files, settings.php, .git, .ddev; deletes what is gone locally). Outward-facing: asks before syncing. |
|
|
34
|
+
| `--environment` <value> | The domain for THIS run (the linked one, or one of its subdomains in DNS). Default: the one remembered by --select. |
|
|
35
|
+
| `--environments` | Show the domain (status, expiry, name servers) and its A/CNAME records, each a site. |
|
|
36
|
+
| `--select` <value> | Remember which host name this project works against (in .godaddy/workspace.yml, git-excluded). Checked against the DNS records. |
|
|
37
|
+
| `--dns` | List every DNS record of the domain. |
|
|
38
|
+
| `--pull-db` | Dump the site's database over SSH (drush sql:dump in the remote docroot) and import it into DDEV. REPLACES the local database — the current one is exported to backups/ first. Client data. |
|
|
39
|
+
| `--pull-files` | rsync the remote sites/default/files into the local docroot (adds and overwrites, never deletes). Client data. |
|
|
40
|
+
| `--logs` | Show the last 50 lines of the site's error_log over SSH. |
|
|
41
|
+
| `--no-safety-backup` | Skip exporting the local database before --pull-db replaces it. |
|
|
42
|
+
| `--force` | Allow --link to relink a project that already points at a different domain. |
|
|
43
|
+
|
|
44
|
+
The link lives in the project's `.godaddy/workspace.yml` (git-excluded); the dashboard reads it to know
|
|
45
|
+
the project is linked and which environment it works against.
|
|
46
|
+
|
|
47
|
+
## What the package holds
|
|
48
|
+
|
|
49
|
+
| Path | What it is |
|
|
50
|
+
| --- | --- |
|
|
51
|
+
| `src/index.ts` | `register(api)`: `registerHosting(api, godaddyProvider(api))` |
|
|
52
|
+
| `src/lib/provider.ts` | The GoDaddy provider: the credentials, the environments and their URLs, the verbs, the pulls, the console |
|
|
53
|
+
| `src/lib/link.ts` | The link file reader |
|
|
54
|
+
| `commands/cmd-tools-godaddy.sh` | The per-workspace command |
|
|
55
|
+
| `scripts/functions/fun-godaddy.sh` | The provider's bash hooks (its API) |
|
|
56
|
+
| `scripts/functions/fun-godaddy-tool.sh` | The family's dispatcher: link file, environment selection, safety export, status |
|
|
57
|
+
| `scripts/args/arg-godaddy.sh` | Its argparse |
|
|
58
|
+
| `scripts/host-install.sh` | The host side: the CLI and the credential check |
|
|
59
|
+
| `config/plugin.godaddy.settings.yml` | The settings template |
|
|
60
|
+
|
|
61
|
+
The `workspacePlugin` block in `package.json` is the manifest the installer reads.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# Installed by the GoDaddy plugin (plugins.sh --install godaddy); __WORKSPACE__ is the workspace it was installed into.
|
|
4
|
+
#
|
|
5
|
+
# The local ⇄ cloud bridge for one project on GoDaddy: show its link and environments, link it,
|
|
6
|
+
# bring a database and files down into DDEV, deploy, read logs.
|
|
7
|
+
|
|
8
|
+
# Bootstrap.
|
|
9
|
+
# Find the workspace tooling from this script, so a fresh clone needs no setup.
|
|
10
|
+
WORKSPACE_SCRIPTS="${WORKSPACE_SCRIPTS:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../core/scripts" && pwd)}";
|
|
11
|
+
source ${WORKSPACE_SCRIPTS}/bootstrap.sh || exit 1 ;
|
|
12
|
+
|
|
13
|
+
# Load workspace settings and extra lists.
|
|
14
|
+
eval $(parse_yaml ${WORKSPACE_CONFIG}/workspace.__WORKSPACE__.settings.yml);
|
|
15
|
+
|
|
16
|
+
ARGPARSE_DESCRIPTION="Show, link, pull from or deploy a __WORKSPACE__ project on GoDaddy"
|
|
17
|
+
# The args file comes with the plugin: core/scripts/plugins/godaddy/ is where plugins.sh --install puts it.
|
|
18
|
+
source ${WORKSPACE_SCRIPTS}/plugins/godaddy/args/arg-godaddy.sh || exit 1 ;
|
|
19
|
+
|
|
20
|
+
shift $#;
|
|
21
|
+
|
|
22
|
+
godaddy_project_tool ;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# GoDaddy — core/config/plugin.godaddy.settings.yml
|
|
2
|
+
#
|
|
3
|
+
# The GoDaddy API (developer.godaddy.com → API Keys, a production key and secret) for the domain and its DNS; the hosting account itself is reached over SSH with the key below (GoDaddy Web Hosting and cPanel plans allow SSH once enabled in the hosting dashboard).
|
|
4
|
+
# A production API key from developer.godaddy.com → API Keys. Sent as sso-key KEY:SECRET.
|
|
5
|
+
api_key: CHANGE_ME
|
|
6
|
+
# The secret of that key.
|
|
7
|
+
api_secret: CHANGE_ME
|
|
8
|
+
# The private key the pulls and deploys use to reach the hosting account over SSH. Default: ~/.ssh/id_ed25519.
|
|
9
|
+
ssh_key: ~/.ssh/id_ed25519
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Labels for core/config/plugin.godaddy.settings.yml, merged into the Settings page.
|
|
2
|
+
api_key:
|
|
3
|
+
label: GoDaddy API key
|
|
4
|
+
info: 'A production API key from developer.godaddy.com → API Keys. Sent as sso-key KEY:SECRET.'
|
|
5
|
+
api_secret:
|
|
6
|
+
label: GoDaddy API secret
|
|
7
|
+
info: 'The secret of that key.'
|
|
8
|
+
ssh_key:
|
|
9
|
+
label: SSH key for the hosting account
|
|
10
|
+
info: 'The private key the pulls and deploys use to reach the hosting account over SSH. Default: ~/.ssh/id_ed25519.'
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GoDaddy for Webship Workspace.
|
|
3
|
+
*
|
|
4
|
+
* The GODADDY menu on every site row, a live-site chip, the New-folder link option and the
|
|
5
|
+
* `/godaddy-site/<workspace>/<project>` jump: all of it is the hosting family's surface
|
|
6
|
+
* (@webship.co/workspace-hosting). This package is the GoDaddy provider plus what the installer places
|
|
7
|
+
* (the per-workspace command, its bash functions, the settings template, the host install).
|
|
8
|
+
*
|
|
9
|
+
* Everything the dashboard is asked for goes through `api`; this package requires nothing from
|
|
10
|
+
* the dashboard's own files.
|
|
11
|
+
*/
|
|
12
|
+
import type { PluginApi } from '@webship.co/workspace-plugin-api';
|
|
13
|
+
import { godaddyProvider } from './lib/provider';
|
|
14
|
+
export { godaddyProvider };
|
|
15
|
+
export { godaddyLinkOf } from './lib/link';
|
|
16
|
+
export declare function register(api: PluginApi): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* GoDaddy for Webship Workspace.
|
|
4
|
+
*
|
|
5
|
+
* The GODADDY menu on every site row, a live-site chip, the New-folder link option and the
|
|
6
|
+
* `/godaddy-site/<workspace>/<project>` jump: all of it is the hosting family's surface
|
|
7
|
+
* (@webship.co/workspace-hosting). This package is the GoDaddy provider plus what the installer places
|
|
8
|
+
* (the per-workspace command, its bash functions, the settings template, the host install).
|
|
9
|
+
*
|
|
10
|
+
* Everything the dashboard is asked for goes through `api`; this package requires nothing from
|
|
11
|
+
* the dashboard's own files.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.godaddyLinkOf = exports.godaddyProvider = void 0;
|
|
15
|
+
exports.register = register;
|
|
16
|
+
const workspace_hosting_1 = require("@webship.co/workspace-hosting");
|
|
17
|
+
const provider_1 = require("./lib/provider");
|
|
18
|
+
Object.defineProperty(exports, "godaddyProvider", { enumerable: true, get: function () { return provider_1.godaddyProvider; } });
|
|
19
|
+
var link_1 = require("./lib/link");
|
|
20
|
+
Object.defineProperty(exports, "godaddyLinkOf", { enumerable: true, get: function () { return link_1.godaddyLinkOf; } });
|
|
21
|
+
function register(api) {
|
|
22
|
+
(0, workspace_hosting_1.registerHosting)(api, (0, provider_1.godaddyProvider)(api));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAUH,4BAEC;AATD,qEAAgE;AAEhE,6CAAiD;AAExC,gGAFA,0BAAe,OAEA;AACxB,mCAA2C;AAAlC,qGAAA,aAAa,OAAA;AAEtB,SAAgB,QAAQ,CAAC,GAAc;IACrC,IAAA,mCAAe,EAAC,GAAG,EAAE,IAAA,0BAAe,EAAC,GAAG,CAAC,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a project is linked to GoDaddy, and to what: the `.godaddy/workspace.yml` file that
|
|
3
|
+
* `cmd-tools-godaddy.sh --link` writes (git-excluded), plus the branch the local code is on.
|
|
4
|
+
*/
|
|
5
|
+
import type { HostingLink } from '@webship.co/workspace-hosting';
|
|
6
|
+
export interface GoDaddyLink extends HostingLink {
|
|
7
|
+
/** Every key of the link file, for the provider's own needs (region, resource group, host…). */
|
|
8
|
+
fields: Record<string, string>;
|
|
9
|
+
}
|
|
10
|
+
export declare function readLinkFile(projectDir: string): Record<string, string> | null;
|
|
11
|
+
export declare function godaddyLinkOf(projectDir: string): GoDaddyLink | null;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Whether a project is linked to GoDaddy, and to what: the `.godaddy/workspace.yml` file that
|
|
4
|
+
* `cmd-tools-godaddy.sh --link` writes (git-excluded), plus the branch the local code is on.
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.readLinkFile = readLinkFile;
|
|
11
|
+
exports.godaddyLinkOf = godaddyLinkOf;
|
|
12
|
+
const fs_1 = __importDefault(require("fs"));
|
|
13
|
+
const path_1 = __importDefault(require("path"));
|
|
14
|
+
function readLinkFile(projectDir) {
|
|
15
|
+
let text;
|
|
16
|
+
try {
|
|
17
|
+
text = fs_1.default.readFileSync(path_1.default.join(projectDir, '.godaddy', 'workspace.yml'), 'utf8');
|
|
18
|
+
}
|
|
19
|
+
catch (_) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const fields = {};
|
|
23
|
+
for (const line of text.split('\n')) {
|
|
24
|
+
const m = line.match(/^([a-z_]+):\s*(.*?)\s*$/);
|
|
25
|
+
if (m)
|
|
26
|
+
fields[m[1]] = m[2].replace(/^["']|["']$/g, '');
|
|
27
|
+
}
|
|
28
|
+
return fields;
|
|
29
|
+
}
|
|
30
|
+
function godaddyLinkOf(projectDir) {
|
|
31
|
+
const fields = readLinkFile(projectDir);
|
|
32
|
+
if (!fields || !fields.id)
|
|
33
|
+
return null;
|
|
34
|
+
let branch = null;
|
|
35
|
+
try {
|
|
36
|
+
const head = fs_1.default.readFileSync(path_1.default.join(projectDir, '.git', 'HEAD'), 'utf8').trim();
|
|
37
|
+
branch = (head.match(/^ref: refs\/heads\/(.+)$/) || [])[1] || null;
|
|
38
|
+
}
|
|
39
|
+
catch (_) { /* not a git clone */ }
|
|
40
|
+
return { id: fields.id, env: fields.env || null, branch, fields };
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.js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,CAAC,CAAC,IAAI,IAAI,CAAC;IACrE,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC,CAAC,qBAAqB,CAAC,CAAC;IACrC,OAAO,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,IAAI,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GoDaddy, as a hosting provider.
|
|
3
|
+
*
|
|
4
|
+
* The link is `.godaddy/workspace.yml` (the domain, and the hosting account's SSH target when
|
|
5
|
+
* given); the domain and its DNS records come from the GoDaddy API with the key and secret from
|
|
6
|
+
* plugin.godaddy.settings.yml; the pulls, the deploy and the log go over SSH through
|
|
7
|
+
* cmd-tools-godaddy.sh in a screen session.
|
|
8
|
+
*/
|
|
9
|
+
import type { PluginApi } from '@webship.co/workspace-plugin-api';
|
|
10
|
+
import type { HostingProvider } from '@webship.co/workspace-hosting';
|
|
11
|
+
export declare function godaddyProvider(api: PluginApi): HostingProvider;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* GoDaddy, as a hosting provider.
|
|
4
|
+
*
|
|
5
|
+
* The link is `.godaddy/workspace.yml` (the domain, and the hosting account's SSH target when
|
|
6
|
+
* given); the domain and its DNS records come from the GoDaddy API with the key and secret from
|
|
7
|
+
* plugin.godaddy.settings.yml; the pulls, the deploy and the log go over SSH through
|
|
8
|
+
* cmd-tools-godaddy.sh in a screen session.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.godaddyProvider = godaddyProvider;
|
|
12
|
+
const workspace_hosting_1 = require("@webship.co/workspace-hosting");
|
|
13
|
+
const link_1 = require("./link");
|
|
14
|
+
function godaddyProvider(api) {
|
|
15
|
+
const settings = () => api.settings.read() || {};
|
|
16
|
+
const jobEnv = () => {
|
|
17
|
+
const key = (0, workspace_hosting_1.configured)(settings().api_key);
|
|
18
|
+
const secret = (0, workspace_hosting_1.configured)(settings().api_secret);
|
|
19
|
+
return key && secret ? { ...process.env, GODADDY_API_KEY: key, GODADDY_API_SECRET: secret, GODADDY_SSH_KEY: String(settings().ssh_key || '~/.ssh/id_ed25519') } : null;
|
|
20
|
+
};
|
|
21
|
+
async function environments(link, lib, env) {
|
|
22
|
+
const domain = link.id;
|
|
23
|
+
const auth = `Authorization: sso-key ${env.GODADDY_API_KEY}:${env.GODADDY_API_SECRET}`;
|
|
24
|
+
const info = await lib.run('curl', ['-sS', '-m', '30', '-H', auth, `https://api.godaddy.com/v1/domains/${encodeURIComponent(domain)}`], process.env.HOME, { timeoutMs: 40 * 1000, env });
|
|
25
|
+
if (!info.ok)
|
|
26
|
+
return { id: domain, rows: [], why: 'list failed' };
|
|
27
|
+
let d;
|
|
28
|
+
try {
|
|
29
|
+
d = JSON.parse(String(info.stdout));
|
|
30
|
+
}
|
|
31
|
+
catch (_) {
|
|
32
|
+
return { id: domain, rows: [], why: 'list failed' };
|
|
33
|
+
}
|
|
34
|
+
if (d.code)
|
|
35
|
+
return { id: domain, rows: [], why: String(d.message || d.code) };
|
|
36
|
+
const rows = [{ title: `${domain} (${String(d.status || '').toLowerCase()})`, envId: domain, status: /^active$/i.test(d.status) ? 'active' : String(d.status || 'unknown').toLowerCase(), url: `https://${domain}` }];
|
|
37
|
+
const recs = await lib.run('curl', ['-sS', '-m', '30', '-H', auth, `https://api.godaddy.com/v1/domains/${encodeURIComponent(domain)}/records`], process.env.HOME, { timeoutMs: 40 * 1000, env });
|
|
38
|
+
if (recs.ok) {
|
|
39
|
+
try {
|
|
40
|
+
for (const r of JSON.parse(String(recs.stdout))) {
|
|
41
|
+
if (!/^(A|CNAME)$/.test(r.type) || r.name === '@' || r.name === '*')
|
|
42
|
+
continue;
|
|
43
|
+
const host = `${r.name}.${domain}`;
|
|
44
|
+
rows.push({ title: `${host} (${r.type} → ${r.data})`, envId: host, status: 'active', url: `https://${host}` });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (_) { /* no records */ }
|
|
48
|
+
}
|
|
49
|
+
return { id: domain, rows };
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
id: 'godaddy',
|
|
53
|
+
label: 'GODADDY',
|
|
54
|
+
title: 'GoDaddy',
|
|
55
|
+
script: 'cmd-tools-godaddy.sh',
|
|
56
|
+
detect: (projectDir) => (0, link_1.godaddyLinkOf)(projectDir),
|
|
57
|
+
linkHint: (project) => `bash cmd-tools-godaddy.sh ${project} --link example.com,user@host:/home/user/public_html`,
|
|
58
|
+
consoleUrl: (link) => (link.id ? `https://dcc.godaddy.com/control/portfolio/${encodeURIComponent(link.id)}/settings` : null),
|
|
59
|
+
jobEnv,
|
|
60
|
+
tokenHint: 'api_key and api_secret in core/config/plugin.godaddy.settings.yml',
|
|
61
|
+
environments,
|
|
62
|
+
tools: {
|
|
63
|
+
status: { verb: 'godaddy', label: 'Link, domain and DNS', icon: 'info', args: [] },
|
|
64
|
+
dns: { verb: 'godaddy-dns', label: 'All DNS records', icon: 'list', args: ['--dns'] },
|
|
65
|
+
logs: { verb: 'godaddy-logs', label: 'Last 50 lines of error_log', icon: 'file-text', args: ['--logs'] },
|
|
66
|
+
deploy: { verb: 'godaddy-push', label: 'Deploy with rsync…', icon: 'push', args: ['--push'] },
|
|
67
|
+
},
|
|
68
|
+
pull: {
|
|
69
|
+
db: true, files: true,
|
|
70
|
+
dbArgs: (e) => ['--environment', e, '--pull-db'],
|
|
71
|
+
filesArgs: (e) => ['--environment', e, '--pull-files'],
|
|
72
|
+
noSafetyBackupArg: '--no-safety-backup',
|
|
73
|
+
},
|
|
74
|
+
errorHint: (msg) => (/UNABLE_TO_AUTHENTICATE|ACCESS_DENIED|401|403/i.test(msg)
|
|
75
|
+
? `${msg}\n\nThe dashboard reaches GoDaddy with api_key and api_secret in core/config/plugin.godaddy.settings.yml: a production key from developer.godaddy.com → API Keys.`
|
|
76
|
+
: msg),
|
|
77
|
+
folder: {
|
|
78
|
+
idPattern: /^[a-z0-9.-]+\.[a-z]{2,}(,[a-z0-9_.-]+@[a-z0-9.-]+:\/.+)?$/i,
|
|
79
|
+
idPlaceholder: 'example.com,user@host:/home/user/public_html',
|
|
80
|
+
idHelp: 'A GoDaddy link is the domain, optionally followed by a comma and the hosting account as user@host:/remote/docroot.',
|
|
81
|
+
},
|
|
82
|
+
menuNote: 'The domain and DNS come from the GoDaddy API; the pulls, the deploy and the log need the hosting account over SSH',
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/lib/provider.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAQH,0CA8DC;AAnED,qEAA2D;AAG3D,iCAAuC;AAEvC,SAAgB,eAAe,CAAC,GAAc;IAC5C,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;IAEjD,MAAM,MAAM,GAAG,GAA6B,EAAE;QAC5C,MAAM,GAAG,GAAG,IAAA,8BAAU,EAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC;QAAC,MAAM,MAAM,GAAG,IAAA,8BAAU,EAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,CAAC;QAC7F,OAAO,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,kBAAkB,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,OAAO,IAAI,mBAAmB,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACzK,CAAC,CAAC;IAEF,KAAK,UAAU,YAAY,CAAC,IAAiB,EAAE,GAAc,EAAE,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EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC,EAAE,cAAc,CAAC;YACtD,iBAAiB,EAAE,oBAAoB;SACxC;QACD,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,+CAA+C,CAAC,IAAI,CAAC,GAAG,CAAC;YAC5E,CAAC,CAAC,GAAG,GAAG,mKAAmK;YAC3K,CAAC,CAAC,GAAG,CAAC;QACR,MAAM,EAAE;YACN,SAAS,EAAE,4DAA4D;YACvE,aAAa,EAAE,8CAA8C;YAC7D,MAAM,EAAE,oHAAoH;SAC7H;QACD,QAAQ,EAAE,mHAAmH;KAC9H,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Feature: The GoDaddy plugin on a project row
|
|
2
|
+
Once the plugin is activated and installed, every site row carries the GODADDY menu, and the Plugins
|
|
3
|
+
page lists the plugin with its four steps.
|
|
4
|
+
|
|
5
|
+
Scenario: A site row offers the GODADDY menu, captioned with its link state
|
|
6
|
+
Given I am on "/dev"
|
|
7
|
+
Then the element ".act-menu-godaddy" should be displayed
|
|
8
|
+
And I should see "GODADDY"
|
|
9
|
+
And the element ".act-menu-godaddy + .act-status" should be displayed
|
|
10
|
+
|
|
11
|
+
Scenario: An unlinked project's menu opens and says how to link it
|
|
12
|
+
Given I am on "/dev"
|
|
13
|
+
And I click on the element ".project-row .act-menu-godaddy button"
|
|
14
|
+
Then ".uk-dropdown.uk-open" should be visible
|
|
15
|
+
And I should see "Not linked to GoDaddy"
|
|
16
|
+
|
|
17
|
+
Scenario: The plugin is listed on the Plugins page
|
|
18
|
+
Given I am on "/settings/plugins"
|
|
19
|
+
Then I should see "GoDaddy"
|
|
20
|
+
And I should see "@webship.co/workspace-godaddy"
|
package/package.json
CHANGED
|
@@ -1,6 +1,78 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webship.co/workspace-godaddy",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0-beta1",
|
|
4
|
+
"description": "GoDaddy for Webship Workspace: the GODADDY menu on every site row, the domain and its DNS from the GoDaddy API, the hosting account over SSH (get database and files, deploy with rsync, the error log), the GoDaddy console. A provider of @webship.co/workspace-hosting.",
|
|
5
|
+
"main": "dist/src/index.js",
|
|
6
|
+
"types": "dist/src/index.d.ts",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/webship/workspace-godaddy.git"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist/src",
|
|
14
|
+
"commands",
|
|
15
|
+
"config",
|
|
16
|
+
"features",
|
|
17
|
+
"scripts",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc -p tsconfig.json",
|
|
22
|
+
"prepare": "npm run build",
|
|
23
|
+
"test": "npm run build && node --test dist/tests/*.test.js",
|
|
24
|
+
"lint": "tsc -p tsconfig.json --noEmit"
|
|
25
|
+
},
|
|
26
|
+
"workspacePlugin": {
|
|
27
|
+
"name": "godaddy",
|
|
28
|
+
"label": "GoDaddy",
|
|
29
|
+
"settingsFile": "plugin.godaddy.settings.yml",
|
|
30
|
+
"settingsTemplate": "config/plugin.godaddy.settings.yml",
|
|
31
|
+
"labels": "config/settings.labels.yml",
|
|
32
|
+
"legacySettingsKey": "godaddy",
|
|
33
|
+
"typeActions": {
|
|
34
|
+
"godaddy": [
|
|
35
|
+
"sites"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
"commands": {
|
|
39
|
+
"types": [
|
|
40
|
+
"sites"
|
|
41
|
+
],
|
|
42
|
+
"workspaces": [
|
|
43
|
+
"dev",
|
|
44
|
+
"test",
|
|
45
|
+
"demos",
|
|
46
|
+
"sandboxes",
|
|
47
|
+
"projects"
|
|
48
|
+
],
|
|
49
|
+
"files": [
|
|
50
|
+
"commands/cmd-tools-godaddy.sh"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"functions": [
|
|
55
|
+
"scripts/functions/fun-godaddy.sh",
|
|
56
|
+
"scripts/functions/fun-godaddy-tool.sh"
|
|
57
|
+
],
|
|
58
|
+
"args": [
|
|
59
|
+
"scripts/args/arg-godaddy.sh"
|
|
60
|
+
],
|
|
61
|
+
"hostInstall": "scripts/host-install.sh"
|
|
62
|
+
},
|
|
63
|
+
"features": [
|
|
64
|
+
"features/godaddy.feature"
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
"dependencies": {
|
|
68
|
+
"@webship.co/workspace-hosting": "^1.0.0-beta1"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@types/node": "^24.0.0",
|
|
72
|
+
"@webship.co/workspace-plugin-api": "^1.0.0-beta1",
|
|
73
|
+
"typescript": "^5.9.0"
|
|
74
|
+
},
|
|
75
|
+
"publishConfig": {
|
|
76
|
+
"access": "public"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
argparse "$@" <<ARGEOF || exit 1
|
|
4
|
+
parser.add_argument('PROJECT_NAME',
|
|
5
|
+
help='The project directory in this workspace.')
|
|
6
|
+
parser.add_argument('-l', '--link',
|
|
7
|
+
default="_none_",
|
|
8
|
+
help='Link the project to a domain in the GoDaddy account, and its hosting over SSH: domain[,user@host:/remote/docroot]. The SSH part is needed for the pulls, the deploy and the log.')
|
|
9
|
+
parser.add_argument('-p', '--push',
|
|
10
|
+
action='store_true',
|
|
11
|
+
default=False,
|
|
12
|
+
help='Deploy: rsync the local docroot to the remote document root (excludes sites/default/files, settings.php, .git, .ddev; deletes what is gone locally). Outward-facing: asks before syncing.')
|
|
13
|
+
parser.add_argument('-e', '--environment',
|
|
14
|
+
default="_none_",
|
|
15
|
+
help='The domain for THIS run (the linked one, or one of its subdomains in DNS). Default: the one remembered by --select.')
|
|
16
|
+
parser.add_argument('-E', '--environments',
|
|
17
|
+
action='store_true',
|
|
18
|
+
default=False,
|
|
19
|
+
help='Show the domain (status, expiry, name servers) and its A/CNAME records, each a site.')
|
|
20
|
+
parser.add_argument('-s', '--select',
|
|
21
|
+
default="_none_",
|
|
22
|
+
help='Remember which host name this project works against (in .godaddy/workspace.yml, git-excluded). Checked against the DNS records.')
|
|
23
|
+
parser.add_argument('-n', '--dns',
|
|
24
|
+
action='store_true',
|
|
25
|
+
default=False,
|
|
26
|
+
help='List every DNS record of the domain.')
|
|
27
|
+
parser.add_argument('-D', '--pull-db',
|
|
28
|
+
action='store_true',
|
|
29
|
+
default=False,
|
|
30
|
+
help='Dump the site's database over SSH (drush sql:dump in the remote docroot) and import it into DDEV. REPLACES the local database — the current one is exported to backups/ first. Client data.')
|
|
31
|
+
parser.add_argument('-F', '--pull-files',
|
|
32
|
+
action='store_true',
|
|
33
|
+
default=False,
|
|
34
|
+
help='rsync the remote sites/default/files into the local docroot (adds and overwrites, never deletes). Client data.')
|
|
35
|
+
parser.add_argument('-g', '--logs',
|
|
36
|
+
action='store_true',
|
|
37
|
+
default=False,
|
|
38
|
+
help='Show the last 50 lines of the site's error_log over SSH.')
|
|
39
|
+
parser.add_argument('-B', '--no-safety-backup',
|
|
40
|
+
action='store_true',
|
|
41
|
+
default=False,
|
|
42
|
+
help='Skip exporting the local database before --pull-db replaces it.')
|
|
43
|
+
parser.add_argument('-f', '--force',
|
|
44
|
+
action='store_true',
|
|
45
|
+
default=False,
|
|
46
|
+
help='Allow --link to relink a project that already points at a different domain.')
|
|
47
|
+
ARGEOF
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# The GoDaddy tool's dispatcher: generated by the hosting family's scaffolder, the same for every
|
|
4
|
+
# provider. The provider's own hooks live in fun-godaddy.sh:
|
|
5
|
+
# ensure_godaddy the CLI and credentials are usable, or say how
|
|
6
|
+
# godaddy_do_link <project_path> <id> link the project (writes the link file through godaddy_link_set)
|
|
7
|
+
# godaddy_list_environments <id> one environment id per line (for --select's check)
|
|
8
|
+
# godaddy_do_environments <id> print the environments for a person
|
|
9
|
+
# godaddy_pull_db <project_path> <id> <env> dump the environment's database to stdout path given in $1… (see fun-godaddy.sh)
|
|
10
|
+
# godaddy_pull_files <project_path> <id> <env>
|
|
11
|
+
# godaddy_do_push <project_path> <id> <env> deploy
|
|
12
|
+
# godaddy_do_logs <project_path> <id> <env>
|
|
13
|
+
# godaddy_do_activities <project_path> <id>
|
|
14
|
+
# godaddy_status <project_path> <id> the closing status block
|
|
15
|
+
|
|
16
|
+
GODADDY_LINK_FILE=".godaddy/workspace.yml";
|
|
17
|
+
|
|
18
|
+
# One key of the link file, or nothing.
|
|
19
|
+
function godaddy_link_get() {
|
|
20
|
+
local project_path="$1" key="$2";
|
|
21
|
+
[ -f "${project_path}/${GODADDY_LINK_FILE}" ] || return 0 ;
|
|
22
|
+
grep -E "^${key}:" "${project_path}/${GODADDY_LINK_FILE}" | head -1 | sed -E 's/^[a-z_]+:[[:space:]]*//; s/^"//; s/"$//' ;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
# Set one key of the link file, creating it (git-excluded: it is this machine's, not the repo's).
|
|
26
|
+
function godaddy_link_set() {
|
|
27
|
+
local project_path="$1" key="$2" value="$3" file;
|
|
28
|
+
file="${project_path}/${GODADDY_LINK_FILE}";
|
|
29
|
+
mkdir -p "$(dirname "${file}")" ;
|
|
30
|
+
touch "${file}" ;
|
|
31
|
+
if grep -qE "^${key}:" "${file}" ; then
|
|
32
|
+
sed -i -E "s|^${key}:.*|${key}: ${value}|" "${file}" ;
|
|
33
|
+
else
|
|
34
|
+
printf '%s: %s\n' "${key}" "${value}" >> "${file}" ;
|
|
35
|
+
fi
|
|
36
|
+
if [ -d "${project_path}/.git" ] && ! grep -qx "/.godaddy/" "${project_path}/.git/info/exclude" 2>/dev/null ; then
|
|
37
|
+
mkdir -p "${project_path}/.git/info" && printf '/.godaddy/\n' >> "${project_path}/.git/info/exclude" ;
|
|
38
|
+
fi
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function godaddy_linked_id() { godaddy_link_get "$1" id ; }
|
|
42
|
+
function godaddy_selected_env() { godaddy_link_get "$1" env ; }
|
|
43
|
+
|
|
44
|
+
# Which environment a run acts on: --environment for this run, else the remembered selection, else
|
|
45
|
+
# nothing. Deliberately NOT defaulting to production: pulling live data because nobody said
|
|
46
|
+
# otherwise is exactly the accident worth preventing.
|
|
47
|
+
function godaddy_target_env() {
|
|
48
|
+
if [ ! "${ENVIRONMENT:-_none_}" == '_none_' ] ; then printf '%s' "${ENVIRONMENT}"; return 0 ; fi
|
|
49
|
+
godaddy_selected_env "$1";
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
# Where this project serves from: Drupal's two conventions, plus the flat case.
|
|
53
|
+
function godaddy_docroot() {
|
|
54
|
+
for candidate in web docroot ; do
|
|
55
|
+
[ -d "$1/${candidate}" ] && { printf '%s' "${candidate}"; return 0 ; }
|
|
56
|
+
done
|
|
57
|
+
printf '%s' "";
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
# The local database is replaced by a pull, so it is exported first unless --no-safety-backup.
|
|
61
|
+
function godaddy_safety_export() {
|
|
62
|
+
local project_path="$1" safety="$2";
|
|
63
|
+
if [ "${NO_SAFETY_BACKUP:-no}" == 'yes' ] ; then
|
|
64
|
+
echo "Skipping the local database export, as asked. The current local data will be lost.";
|
|
65
|
+
else
|
|
66
|
+
echo "Exporting the current local database first.";
|
|
67
|
+
(cd "${project_path}" && ddev export-db --file="${safety}") \
|
|
68
|
+
|| echo " (no local database to export yet — continuing)";
|
|
69
|
+
fi
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function godaddy_import_dump() {
|
|
73
|
+
local project_path="$1" dump="$2";
|
|
74
|
+
echo "Importing it into DDEV.";
|
|
75
|
+
(cd "${project_path}" && ddev start -y > /dev/null && ddev import-db --file="${dump}") || return 1 ;
|
|
76
|
+
echo " Drupal sites usually need: ddev drush updb -y && ddev drush cr";
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function godaddy_project_tool() {
|
|
80
|
+
local project_path="${WORKSPACE_ROOT}/${doc_name}/${PROJECT_NAME}";
|
|
81
|
+
local linked_id="";
|
|
82
|
+
|
|
83
|
+
if [ ! -d "${project_path}" ]; then
|
|
84
|
+
echo "No such project: ${project_path}";
|
|
85
|
+
return 1 ;
|
|
86
|
+
fi
|
|
87
|
+
cd "${project_path}" ;
|
|
88
|
+
linked_id="$(godaddy_linked_id "${project_path}")" ;
|
|
89
|
+
|
|
90
|
+
if [ ! "${LINK:-_none_}" == '_none_' ] ; then
|
|
91
|
+
ensure_godaddy || return 1 ;
|
|
92
|
+
if [ -n "${linked_id}" ] && [ ! "${linked_id}" == "${LINK}" ] && [ ! "${FORCE:-no}" == 'yes' ] ; then
|
|
93
|
+
echo "${doc_name}/${PROJECT_NAME} is already linked to GoDaddy ${linked_id}." ;
|
|
94
|
+
echo "Re-run with --force to relink it to ${LINK}." ;
|
|
95
|
+
return 1 ;
|
|
96
|
+
fi
|
|
97
|
+
godaddy_do_link "${project_path}" "${LINK}" || return 1 ;
|
|
98
|
+
linked_id="$(godaddy_linked_id "${project_path}")" ;
|
|
99
|
+
echo "Linked ${doc_name}/${PROJECT_NAME} → ${linked_id}." ;
|
|
100
|
+
fi
|
|
101
|
+
|
|
102
|
+
local needs_link="";
|
|
103
|
+
for flag in "${ENVIRONMENTS:-no}" "${PULL_DB:-no}" "${PULL_FILES:-no}" "${PUSH:-no}" "${LOGS:-no}" "${ACTIVITIES:-no}" ; do
|
|
104
|
+
[ "${flag}" == 'yes' ] && needs_link=yes ;
|
|
105
|
+
done
|
|
106
|
+
[ ! "${SELECT:-_none_}" == '_none_' ] && needs_link=yes ;
|
|
107
|
+
if [ -n "${needs_link}" ] ; then
|
|
108
|
+
if [ -z "${linked_id}" ] ; then
|
|
109
|
+
echo "Not linked to GoDaddy — run with --link <id> first." ;
|
|
110
|
+
return 1 ;
|
|
111
|
+
fi
|
|
112
|
+
ensure_godaddy || return 1 ;
|
|
113
|
+
fi
|
|
114
|
+
|
|
115
|
+
if [ "${ENVIRONMENTS:-no}" == 'yes' ] ; then
|
|
116
|
+
godaddy_do_environments "${project_path}" "${linked_id}" || return 1 ;
|
|
117
|
+
echo "";
|
|
118
|
+
echo " Select one: bash cmd-tools-godaddy.sh ${PROJECT_NAME} --select <environment>";
|
|
119
|
+
fi
|
|
120
|
+
|
|
121
|
+
if [ ! "${SELECT:-_none_}" == '_none_' ] ; then
|
|
122
|
+
# Checked against the real list rather than taken on trust: a typo would otherwise be
|
|
123
|
+
# discovered by a pull that dumps the wrong environment, or none.
|
|
124
|
+
if ! godaddy_list_environments "${project_path}" "${linked_id}" 2>/dev/null | grep -qx "${SELECT}" ; then
|
|
125
|
+
echo "GoDaddy ${linked_id} has no environment called '${SELECT}'." ;
|
|
126
|
+
echo " List them: bash cmd-tools-godaddy.sh ${PROJECT_NAME} --environments" ;
|
|
127
|
+
return 1 ;
|
|
128
|
+
fi
|
|
129
|
+
godaddy_link_set "${project_path}" env "${SELECT}" ;
|
|
130
|
+
echo "${doc_name}/${PROJECT_NAME} now works against the ${SELECT} environment." ;
|
|
131
|
+
fi
|
|
132
|
+
|
|
133
|
+
if [ "${PULL_DB:-no}" == 'yes' ] || [ "${PULL_FILES:-no}" == 'yes' ] || [ "${PUSH:-no}" == 'yes' ] ; then
|
|
134
|
+
local target_env;
|
|
135
|
+
target_env="$(godaddy_target_env "${project_path}")";
|
|
136
|
+
if [ -z "${target_env}" ] ; then
|
|
137
|
+
echo "No environment selected. Pick one first — a pull or a deploy must never guess which environment it targets:" ;
|
|
138
|
+
echo " bash cmd-tools-godaddy.sh ${PROJECT_NAME} --environments" ;
|
|
139
|
+
echo " bash cmd-tools-godaddy.sh ${PROJECT_NAME} --select <environment>" ;
|
|
140
|
+
echo " (or name it for this run: --environment <environment>)" ;
|
|
141
|
+
return 1 ;
|
|
142
|
+
fi
|
|
143
|
+
[ "${PULL_DB:-no}" == 'yes' ] && { godaddy_pull_db "${project_path}" "${linked_id}" "${target_env}" || return 1 ; }
|
|
144
|
+
[ "${PULL_FILES:-no}" == 'yes' ] && { godaddy_pull_files "${project_path}" "${linked_id}" "${target_env}" || return 1 ; }
|
|
145
|
+
[ "${PUSH:-no}" == 'yes' ] && { godaddy_do_push "${project_path}" "${linked_id}" "${target_env}" || return 1 ; }
|
|
146
|
+
fi
|
|
147
|
+
|
|
148
|
+
if [ "${LOGS:-no}" == 'yes' ] ; then
|
|
149
|
+
godaddy_do_logs "${project_path}" "${linked_id}" "$(godaddy_target_env "${project_path}")" || true ;
|
|
150
|
+
fi
|
|
151
|
+
if [ "${ACTIVITIES:-no}" == 'yes' ] ; then
|
|
152
|
+
godaddy_do_activities "${project_path}" "${linked_id}" || true ;
|
|
153
|
+
fi
|
|
154
|
+
|
|
155
|
+
# Default (and after any verb): status.
|
|
156
|
+
echo "";
|
|
157
|
+
echo "*---------------------------------------------------------------------*";
|
|
158
|
+
echo " ${doc_name}/${PROJECT_NAME} on GoDaddy";
|
|
159
|
+
if [ -z "${linked_id}" ]; then
|
|
160
|
+
echo " not linked. Link it with:";
|
|
161
|
+
echo " bash cmd-tools-godaddy.sh ${PROJECT_NAME} --link <id>";
|
|
162
|
+
godaddy_status "${project_path}" "" ;
|
|
163
|
+
else
|
|
164
|
+
echo " linked: ${linked_id}";
|
|
165
|
+
local selected;
|
|
166
|
+
selected="$(godaddy_selected_env "${project_path}")";
|
|
167
|
+
echo " env: ${selected:-none selected — --environments then --select <name>}";
|
|
168
|
+
godaddy_status "${project_path}" "${linked_id}" ;
|
|
169
|
+
fi
|
|
170
|
+
echo "*---------------------------------------------------------------------*";
|
|
171
|
+
|
|
172
|
+
cd "${WORKSPACE_ROOT}/${doc_name}";
|
|
173
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# GoDaddy: the GoDaddy API (developer.godaddy.com) for the domain and its DNS, SSH to the hosting
|
|
4
|
+
# account for everything that touches the site. The hooks the hosting dispatcher
|
|
5
|
+
# (fun-godaddy-tool.sh) calls for one project directory. Everything defaults to read-only;
|
|
6
|
+
# --link, --push, --pull-db and --pull-files each demand their flag, and nothing here ever changes
|
|
7
|
+
# a DNS record.
|
|
8
|
+
|
|
9
|
+
function godaddy_key() { printf '%s' "${GODADDY_API_KEY:-${api_key:-}}" ; }
|
|
10
|
+
function godaddy_secret() { printf '%s' "${GODADDY_API_SECRET:-${api_secret:-}}" ; }
|
|
11
|
+
function godaddy_ssh_key() { local k="${GODADDY_SSH_KEY:-${ssh_key:-~/.ssh/id_ed25519}}"; printf '%s' "${k/#\~/${HOME}}" ; }
|
|
12
|
+
|
|
13
|
+
function ensure_godaddy() {
|
|
14
|
+
for tool in curl python3 ; do
|
|
15
|
+
command -v "${tool}" > /dev/null 2>&1 || { echo "${tool} is not installed, and the GoDaddy tool needs it."; return 1; } ;
|
|
16
|
+
done
|
|
17
|
+
if [ -z "$(godaddy_key)" ] || [ "$(godaddy_key)" == 'CHANGE_ME' ] ; then
|
|
18
|
+
echo "No GoDaddy API key: set api_key and api_secret in core/config/plugin.godaddy.settings.yml (developer.godaddy.com → API Keys, production)." ;
|
|
19
|
+
return 1 ;
|
|
20
|
+
fi
|
|
21
|
+
return 0 ;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function godaddy_api() {
|
|
25
|
+
curl -sS -m 30 -H "Authorization: sso-key $(godaddy_key):$(godaddy_secret)" -H "Accept: application/json" "https://api.godaddy.com/v1/$1" ;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
# domain[,user@host:/remote/docroot]
|
|
29
|
+
function godaddy_do_link() {
|
|
30
|
+
local project_path="$1" spec="$2" domain ssh user host remote;
|
|
31
|
+
domain="${spec%%,*}"; ssh="${spec#*,}"; [ "${ssh}" == "${spec}" ] && ssh="";
|
|
32
|
+
godaddy_api "domains/${domain}" | python3 -c 'import json,sys; d=json.load(sys.stdin); sys.exit(1 if d.get("code") else 0)' \
|
|
33
|
+
|| { echo "The GoDaddy account does not have ${domain} (or the key cannot see it)."; return 1; } ;
|
|
34
|
+
godaddy_link_set "${project_path}" id "${domain}" ;
|
|
35
|
+
godaddy_link_set "${project_path}" env "${domain}" ;
|
|
36
|
+
if [ -n "${ssh}" ] ; then
|
|
37
|
+
[[ "${ssh}" =~ ^([^@]+)@([^:]+):(/.+)$ ]] || { echo "The hosting part is user@host:/remote/docroot, got: ${ssh}"; return 1; } ;
|
|
38
|
+
user="${BASH_REMATCH[1]}"; host="${BASH_REMATCH[2]}"; remote="${BASH_REMATCH[3]}";
|
|
39
|
+
godaddy_link_set "${project_path}" ssh "${user}@${host}" ;
|
|
40
|
+
godaddy_link_set "${project_path}" remote "${remote}" ;
|
|
41
|
+
if ssh -i "$(godaddy_ssh_key)" -o BatchMode=yes -o ConnectTimeout=10 "${user}@${host}" "test -d '${remote}'" 2>/dev/null ; then
|
|
42
|
+
echo " SSH reaches ${user}@${host} and ${remote} exists." ;
|
|
43
|
+
else
|
|
44
|
+
echo " SSH could not reach ${user}@${host} with $(godaddy_ssh_key): enable SSH in the hosting dashboard and authorize the key." ;
|
|
45
|
+
fi
|
|
46
|
+
else
|
|
47
|
+
echo " DNS only: add ,user@host:/remote/docroot to the link for the pulls, the deploy and the log." ;
|
|
48
|
+
fi
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function godaddy_list_environments() {
|
|
52
|
+
local domain="$2";
|
|
53
|
+
echo "${domain}";
|
|
54
|
+
godaddy_api "domains/${domain}/records" | python3 -c 'import json,sys
|
|
55
|
+
for r in json.load(sys.stdin):
|
|
56
|
+
if r.get("type") in ("A","CNAME") and r.get("name") not in ("@","*"): print("%s.%s" % (r["name"], sys.argv[1]))' "${domain}" 2>/dev/null ;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function godaddy_do_environments() {
|
|
60
|
+
local domain="$2";
|
|
61
|
+
godaddy_api "domains/${domain}" | python3 -c 'import json,sys
|
|
62
|
+
d=json.load(sys.stdin)
|
|
63
|
+
if d.get("code"): print(" " + str(d.get("message", d["code"]))); sys.exit(1)
|
|
64
|
+
print(" %-40s %-10s expires %s ns %s" % (d.get("domain",""), (d.get("status") or "").lower(), (d.get("expires") or "")[:10], ", ".join(d.get("nameServers") or [])))' || return 1 ;
|
|
65
|
+
godaddy_api "domains/${domain}/records" | python3 -c 'import json,sys
|
|
66
|
+
for r in json.load(sys.stdin):
|
|
67
|
+
if r.get("type") in ("A","CNAME"):
|
|
68
|
+
host = sys.argv[1] if r["name"]=="@" else "%s.%s" % (r["name"], sys.argv[1])
|
|
69
|
+
print(" %-40s %-6s %-30s https://%s" % (host, r["type"], r["data"], host))' "${domain}" 2>/dev/null ;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function godaddy_ssh() {
|
|
73
|
+
local project_path="$1" target; shift;
|
|
74
|
+
target="$(godaddy_link_get "${project_path}" ssh)";
|
|
75
|
+
[ -z "${target}" ] && { echo "No hosting account in the link: relink with --link <domain>,user@host:/remote/docroot --force" >&2; return 1; } ;
|
|
76
|
+
ssh -i "$(godaddy_ssh_key)" -o BatchMode=yes -o ConnectTimeout=15 "${target}" "$@" ;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function godaddy_pull_db() {
|
|
80
|
+
local project_path="$1" domain="$2" env="$3" stamp out dump safety remote;
|
|
81
|
+
remote="$(godaddy_link_get "${project_path}" remote)";
|
|
82
|
+
[ -z "${remote}" ] && { echo "No hosting account in the link: relink with --link ${domain},user@host:/remote/docroot --force"; return 1; } ;
|
|
83
|
+
stamp="$(date +%Y-%m-%d-%H%M%S)";
|
|
84
|
+
out="${backups}/${doc_name}/${PROJECT_NAME}";
|
|
85
|
+
mkdir -p "${out}" ;
|
|
86
|
+
dump="${out}/${PROJECT_NAME}-godaddy-${env}-${stamp}.sql.gz";
|
|
87
|
+
safety="${out}/${PROJECT_NAME}-before-godaddy-pull-${stamp}.sql.gz";
|
|
88
|
+
echo "";
|
|
89
|
+
echo "Pulling the database of ${env} (drush sql:dump in ${remote} over SSH).";
|
|
90
|
+
echo " This is client data: it lands on this machine and in ${out}.";
|
|
91
|
+
echo "";
|
|
92
|
+
godaddy_safety_export "${project_path}" "${safety}" ;
|
|
93
|
+
godaddy_ssh "${project_path}" "cd '${remote}' && (command -v drush >/dev/null 2>&1 && drush sql:dump --gzip || ../vendor/bin/drush sql:dump --gzip)" > "${dump}" || return 1 ;
|
|
94
|
+
[ -s "${dump}" ] || { echo "The dump is empty — is drush on the server (vendor/bin/drush beside the docroot)?"; return 1; } ;
|
|
95
|
+
godaddy_import_dump "${project_path}" "${dump}" || return 1 ;
|
|
96
|
+
echo "";
|
|
97
|
+
echo " Imported ${env} into ${doc_name}/${PROJECT_NAME}.";
|
|
98
|
+
echo " pulled dump: ${dump}";
|
|
99
|
+
echo " local backup: ${safety}";
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function godaddy_pull_files() {
|
|
103
|
+
local project_path="$1" domain="$2" env="$3" docroot remote target;
|
|
104
|
+
remote="$(godaddy_link_get "${project_path}" remote)"; target="$(godaddy_link_get "${project_path}" ssh)";
|
|
105
|
+
[ -z "${remote}" ] && { echo "No hosting account in the link: relink with --link ${domain},user@host:/remote/docroot --force"; return 1; } ;
|
|
106
|
+
docroot="$(godaddy_docroot "${project_path}")";
|
|
107
|
+
[ -z "${docroot}" ] && { echo "No web/ or docroot/ in ${doc_name}/${PROJECT_NAME} — nothing to pull files into."; return 1; } ;
|
|
108
|
+
echo "";
|
|
109
|
+
echo "rsync ${target}:${remote}/sites/default/files → ${docroot}/sites/default/files (adds and overwrites, never deletes).";
|
|
110
|
+
mkdir -p "${project_path}/${docroot}/sites/default/files" ;
|
|
111
|
+
rsync -az --info=progress2 -e "ssh -i $(godaddy_ssh_key) -o BatchMode=yes" "${target}:${remote}/sites/default/files/" "${project_path}/${docroot}/sites/default/files/" || return 1 ;
|
|
112
|
+
echo " If Drupal still shows broken images: ddev drush cr";
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function godaddy_do_push() {
|
|
116
|
+
local project_path="$1" domain="$2" env="$3" docroot remote target a;
|
|
117
|
+
remote="$(godaddy_link_get "${project_path}" remote)"; target="$(godaddy_link_get "${project_path}" ssh)";
|
|
118
|
+
[ -z "${remote}" ] && { echo "No hosting account in the link: relink with --link ${domain},user@host:/remote/docroot --force"; return 1; } ;
|
|
119
|
+
docroot="$(godaddy_docroot "${project_path}")";
|
|
120
|
+
[ -z "${docroot}" ] && { echo "No web/ or docroot/ in ${doc_name}/${PROJECT_NAME} — nothing to deploy."; return 1; } ;
|
|
121
|
+
echo "Deploy ${docroot}/ of ${doc_name}/${PROJECT_NAME} → ${target}:${remote}/ (${env})";
|
|
122
|
+
echo " rsync --delete, excluding sites/default/files, sites/*/settings*.php, .git, .ddev. The live site changes.";
|
|
123
|
+
read -r -p " Continue? [y/N] " a < /dev/tty || return 1 ;
|
|
124
|
+
[[ "${a}" =~ ^[Yy] ]] || { echo "Not deployed."; return 1; } ;
|
|
125
|
+
rsync -az --delete --info=progress2 -e "ssh -i $(godaddy_ssh_key) -o BatchMode=yes" \
|
|
126
|
+
--exclude 'sites/default/files' --exclude 'sites/*/settings*.php' --exclude '.git' --exclude '.ddev' \
|
|
127
|
+
"${project_path}/${docroot}/" "${target}:${remote}/" || return 1 ;
|
|
128
|
+
if [ -d "${project_path}/vendor" ] ; then
|
|
129
|
+
rsync -az --delete -e "ssh -i $(godaddy_ssh_key) -o BatchMode=yes" "${project_path}/vendor/" "${target}:$(dirname "${remote}")/vendor/" || return 1 ;
|
|
130
|
+
fi
|
|
131
|
+
echo " Deployed. Clear caches on the server: ssh ${target} 'cd ${remote} && drush cr'";
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function godaddy_do_logs() {
|
|
135
|
+
local project_path="$1" remote;
|
|
136
|
+
remote="$(godaddy_link_get "${project_path}" remote)";
|
|
137
|
+
godaddy_ssh "${project_path}" "for f in '${remote}/error_log' \"\$HOME/logs/\"*error_log \"\$HOME/\"*error_log; do [ -f \"\$f\" ] && { echo \"— \$f —\"; tail -50 \"\$f\"; }; done" ;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function godaddy_do_dns() {
|
|
141
|
+
godaddy_api "domains/$2/records" | python3 -c 'import json,sys
|
|
142
|
+
for r in json.load(sys.stdin): print(" %-6s %-30s %-40s ttl %s" % (r.get("type",""), r.get("name",""), r.get("data",""), r.get("ttl","")))' ;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function godaddy_status() {
|
|
146
|
+
local project_path="$1" domain="$2";
|
|
147
|
+
if [ -z "${domain}" ] ; then
|
|
148
|
+
echo " (the link is the domain, optionally ,user@host:/remote/docroot for the hosting)";
|
|
149
|
+
return 0 ;
|
|
150
|
+
fi
|
|
151
|
+
echo " hosting: $(godaddy_link_get "${project_path}" ssh):$(godaddy_link_get "${project_path}" remote)";
|
|
152
|
+
echo "";
|
|
153
|
+
godaddy_do_environments "${project_path}" "${domain}" ;
|
|
154
|
+
if [ "${DNS:-no}" == 'yes' ] ; then echo ""; godaddy_do_dns "${project_path}" "${domain}" ; fi
|
|
155
|
+
echo "";
|
|
156
|
+
echo " Console: https://dcc.godaddy.com/control/portfolio/${domain}/settings";
|
|
157
|
+
echo " Data: --pull-db and --pull-files bring the site down into DDEV over SSH; --push deploys with rsync.";
|
|
158
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
## The host side of the GoDaddy plugin: the CLI on this machine and the dashboard's credentials.
|
|
3
|
+
## Run by core/scripts/plugins.sh --install godaddy, and by core/scripts/install.sh for every installed
|
|
4
|
+
## plugin that ships one. Idempotent: whatever is already there is reported, not redone. Offered,
|
|
5
|
+
## never automatic: a hosting CLI carries cloud credentials for real environments.
|
|
6
|
+
set -u
|
|
7
|
+
WORKSPACE_ROOT="${WORKSPACE_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../../.." && pwd)}";
|
|
8
|
+
|
|
9
|
+
STATE="$(grep -E '^api_key:' "${WORKSPACE_ROOT}/core/config/plugin.godaddy.settings.yml" 2>/dev/null | head -1 | sed -E 's/^[a-z_]+:[[:space:]]*//')";
|
|
10
|
+
case "${STATE}" in
|
|
11
|
+
''|CHANGE_ME|"''"|'""') printf ' ✗ %-16s %s\n' "api_key" "not set in plugin.godaddy.settings.yml — the dashboard cannot reach GoDaddy" ;;
|
|
12
|
+
*) printf ' ✓ %-16s %s\n' "api_key" "set (plugin.godaddy.settings.yml)" ;;
|
|
13
|
+
esac
|
|
14
|
+
|
|
15
|
+
STATE="$(grep -E '^api_secret:' "${WORKSPACE_ROOT}/core/config/plugin.godaddy.settings.yml" 2>/dev/null | head -1 | sed -E 's/^[a-z_]+:[[:space:]]*//')";
|
|
16
|
+
case "${STATE}" in
|
|
17
|
+
''|CHANGE_ME|"''"|'""') printf ' ✗ %-16s %s\n' "api_secret" "not set in plugin.godaddy.settings.yml — the dashboard cannot reach GoDaddy" ;;
|
|
18
|
+
*) printf ' ✓ %-16s %s\n' "api_secret" "set (plugin.godaddy.settings.yml)" ;;
|
|
19
|
+
esac
|
|
20
|
+
|