Deploy WordPress
End-to-end sample from the SDK repository. JavaScript only today.
deployWordpress.js
1
import { StackMachine } from "../../dist/index.js";
2
3
console.log("Creating build...");
4
5
const deployment = await client.deployments.create({
6
appName: "wp-app-xas1",
7
repoUrl: "https://github.com/wordpress/wordpress",
8
branch: "6.8.3",
9
enableDatabase: true,
10
extraData: {
11
wordpress: {
12
adminEmail: "[email protected]",
13
adminPassword: "%L7:D3Sd{![r",
14
adminUsername: "admin",
15
language: "en_US",
16
siteName: "Gallant Goldberg",
17
},
18
},
19
// "region": "fr-pari1"
20
// env: {
21
// "WP_ADMIN_USERNAME": "myadmin",
22
// }
23
});
24
25
console.log("Deploying app...");
26
let startTime = new Date();
27
console.log("Waiting for the app to be built...");
28
const app = await deployment.wait({
29
onProgress: ({ kind, message, datetime, stream }) => {
30
console.log(datetime, stream, kind, message);
31
},
32
});
33
console.log("App built!", app);
34
console.log(app.kind);
35
console.log("Time taken:", new Date().getTime() - startTime.getTime(), "ms");
Source: stackmachine/sdks examples.