@provisioner/wordpress
Version:
CodeZero provisioner for wordpress
57 lines • 2.19 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createApplyMixin = void 0;
const buffer_1 = require("buffer");
exports.createApplyMixin = (base) => class extends base {
get wordpressPods() {
return {
kind: 'Pod',
metadata: {
namespace: this.serviceNamespace,
labels: {
app: 'wordpress'
}
}
};
}
async createApply() {
await this.installWordpress();
await this.ensureWordpressIsRunning();
}
async installWordpress() {
const namespace = this.serviceNamespace;
const { username, password, } = this.spec;
const user = buffer_1.Buffer.from(username).toString('base64');
const pass = buffer_1.Buffer.from(password).toString('base64');
await this.controller.cluster
.begin('Install MySql secrets')
.addOwner(this.controller.resource)
.upsertFile('../../k8s/latest/1-secret.yaml', { namespace, username: user, password: pass })
.end();
await this.controller.cluster
.begin('Install MySql deployment')
.addOwner(this.controller.resource)
.upsertFile('../../k8s/latest/2-mysql-deployment.yaml', { namespace })
.end();
await this.controller.cluster
.begin('Install Wordpress deployment')
.addOwner(this.controller.resource)
.upsertFile('../../k8s/latest/3-wordpress-deployment.yaml', { namespace })
.end();
await this.controller.cluster
.begin('Install NodePort')
.addOwner(this.controller.resource)
.upsertFile('../../k8s/latest/4-service.yaml', { namespace })
.end();
}
async ensureWordpressIsRunning() {
await this.controller.cluster.
begin('Ensure Wordpress services are running')
.beginWatch(this.wordpressPods)
.whenWatch(({ condition }) => condition.Ready === 'True', (processor) => {
processor.endWatch();
})
.end();
}
};
//# sourceMappingURL=createApply.js.map