Add StagingManifest
This works both ways. Needs to fix clearing custom domains from livemain
parent
9646fc3511
commit
ee7681ce77
|
@ -0,0 +1,180 @@
|
|||
type: install
|
||||
name: Staging Environment
|
||||
description: Create staging environment from selected live environment
|
||||
logo: https://d33v4339jhl8k0.cloudfront.net/docs/assets/629d6154f38bfd3f4a4c3046/images/62ce4ffaeabe9a7235b3d220/white-300.png
|
||||
skipNodeEmails: false
|
||||
|
||||
settings:
|
||||
fields:
|
||||
- caption: Target Environment
|
||||
editable: true
|
||||
type: envlist
|
||||
name: sourceEnv
|
||||
valueField: shortdomain
|
||||
tooltip: Select the Target Environment
|
||||
- type: string
|
||||
name: nodeGroup
|
||||
caption: Node Group
|
||||
default: cp
|
||||
hideLabel: true
|
||||
hidden: true
|
||||
- caption: Display Name
|
||||
editable: true
|
||||
type: string
|
||||
name: displayName
|
||||
default: My Environment
|
||||
tooltip: Enter the desired display name for the environment
|
||||
- caption: Environment Name
|
||||
type: envname
|
||||
name: stagingEnv
|
||||
randomName: true
|
||||
showFullDomain: true
|
||||
hidden: false
|
||||
dependsOn: regionFieldName
|
||||
displayName: ${settings.displayName}
|
||||
|
||||
|
||||
|
||||
onInstall:
|
||||
- initNodes:
|
||||
envName: ${settings.sourceEnv}
|
||||
namespace: sourceEnv
|
||||
- cloneSource
|
||||
- remoteOperations:
|
||||
envName: ${settings.sourceEnv}
|
||||
nodeGroup: ${settings.nodeGroup}
|
||||
cmd: |-
|
||||
rm -r /var/www/webroot/ROOT/dbexport; mkdir /var/www/webroot/ROOT/dbexport
|
||||
touch /var/www/webroot/ROOT/dbexport/dbexport.sql
|
||||
wp db export /var/www/webroot/ROOT/dbexport/dbexport.sql --path=/var/www/webroot/ROOT/ --quiet
|
||||
wget --directory-prefix=/var/www/webroot/ROOT/ https://deploy-proxy.mightybox.io/kits/Staging_Environment/raw/branch/main/getlivedomain.sh
|
||||
chmod 701 /var/www/webroot/ROOT/getlivedomain.sh
|
||||
user: root
|
||||
sayYes: true
|
||||
- initNodes:
|
||||
envName: ${settings.stagingEnv}
|
||||
namespace: stagingEnv
|
||||
|
||||
- mountLive: NFS4
|
||||
- createLocalScript
|
||||
- installSyncAddon
|
||||
|
||||
|
||||
|
||||
|
||||
actions:
|
||||
initNodes:
|
||||
envName: ${this.envName}
|
||||
namespace: ${this.namespace}
|
||||
script: |
|
||||
let nodes = {}, resp = api.env.control.GetEnvInfo(envName, session)
|
||||
if (resp.result != 0) return resp
|
||||
resp.nodes.sort((node1, node2) => node1.id - node2.id)
|
||||
for (let node of resp.nodes) {
|
||||
nodes[node.nodeGroup] = nodes[node.nodeGroup] || []
|
||||
nodes[node.nodeGroup].push(node)
|
||||
}
|
||||
let globals = {}
|
||||
globals[namespace] = nodes
|
||||
return { result: 0, onAfterReturn: { setGlobals: globals } }
|
||||
|
||||
cloneSource:
|
||||
- env.control.CloneEnv:
|
||||
envName: ${settings.sourceEnv}
|
||||
srcEnvName: ${settings.sourceEnv}
|
||||
dstEnvName: ${settings.stagingEnv}
|
||||
useExternalMounts: false
|
||||
|
||||
remoteOperations:
|
||||
env.control.ExecCmdByGroup:
|
||||
envName: ${settings.sourceEnv}
|
||||
nodeGroup: ${this.nodeGroup}
|
||||
commandList:
|
||||
- command: ${this.cmd}
|
||||
|
||||
|
||||
|
||||
mountLive:
|
||||
- log: Mount Storage
|
||||
- env.file.AddMountPointById:
|
||||
envName: ${settings.stagingEnv}
|
||||
nodeId: ${globals.stagingEnv.cp[0].id}
|
||||
path: /var/www/webroot/sourcefiles
|
||||
protocol: nfs4
|
||||
sourcePath: /var/www/webroot/ROOT
|
||||
sourceNodeId: ${globals.sourceEnv.cp[0].id}
|
||||
name: LiveFilesMount
|
||||
readOnly: false
|
||||
|
||||
createLocalScript:
|
||||
- env.control.ExecCmdByGroup:
|
||||
envName: ${settings.stagingEnv}
|
||||
nodeGroup: cp
|
||||
commandList:
|
||||
- command: |-
|
||||
cd /var/www/webroot/ROOT/
|
||||
wp option get siteurl | sed -e 's/[^/]*\/\/\([^@]*@\)\?\([^:/]*\).*/\2/' > /var/www/webroot/ROOT/stagingdomain
|
||||
wget --directory-prefix=/var/www/webroot/ROOT/ https://deploy-proxy.mightybox.io/kits/Staging_Environment/raw/branch/main/syncfromlivetostaging.sh
|
||||
chmod 701 /var/www/webroot/ROOT/syncfromlivetostaging.sh
|
||||
|
||||
installSyncAddon:
|
||||
|
||||
install:
|
||||
envName: ${settings.stagingEnv}
|
||||
nodeGroup: cp
|
||||
jps:
|
||||
type: update
|
||||
name: Sync From Live
|
||||
description: Sync from live website
|
||||
|
||||
actions:
|
||||
LiveToStagingSync:
|
||||
- env.control.ExecCmdByGroup:
|
||||
envName: ${settings.sourceEnv}
|
||||
nodeGroup: cp
|
||||
commandList:
|
||||
- command: |-
|
||||
cd /var/www/webroot/ROOT/ && wp db export /var/www/webroot/ROOT/dbexport.sql --path=/var/www/webroot/ROOT/
|
||||
cd /var/www/webroot/ROOT/
|
||||
./getlivedomain.sh
|
||||
- env.control.ExecCmdByGroup:
|
||||
envName: ${settings.stagingEnv}
|
||||
nodeGroup: cp
|
||||
commandList:
|
||||
- command: |-
|
||||
cd /var/www/webroot/ROOT/
|
||||
./syncfromlivetostaging.sh
|
||||
|
||||
StagingToLiveSync:
|
||||
- cmd [cp] : |-
|
||||
cd /var/www/webroot/ROOT/ && wp db export /var/www/webroot/sourcefiles/dbexport-staging.sql --path=/var/www/webroot/ROOT/ && cp -R -u /var/www/webroot/ROOT/* /var/www/webroot/sourcefiles/
|
||||
- env.control.ExecCmdByGroup:
|
||||
envName: ${settings.sourceEnv}
|
||||
nodeGroup: cp
|
||||
commandList:
|
||||
- command: |-
|
||||
wget --directory-prefix=/var/www/webroot/ROOT/ https://deploy-proxy.mightybox.io/kits/Staging_Environment/raw/branch/main/importstaging.sh
|
||||
chmod 701 /var/www/webroot/ROOT/importstaging.sh
|
||||
cd /var/www/webroot/ROOT/
|
||||
./importstaging.sh
|
||||
|
||||
|
||||
buttons:
|
||||
- caption: Sync From Live
|
||||
action: LiveToStagingSync
|
||||
confirmText: Do you want to initiate sync process?
|
||||
loadingText: Syching from live...
|
||||
successText: The syching process has been finished successfully.
|
||||
logsPath: "/var/www/webroot/LiveToStagingSync.log"
|
||||
logsNodeGroup: cp
|
||||
|
||||
menu:
|
||||
confirmText: Do you really want to sync this staging environemnt to the Live site?
|
||||
loadingText: Syching from staging to live...
|
||||
action: StagingToLiveSync
|
||||
caption: Sync To Live
|
||||
successText: Staging site synched to Live succesfully
|
||||
title: Sync Staging To Live
|
||||
submitButtonText: Sync To Live
|
||||
logsPath: "/var/www/webroot/StagingToSyncSync.log"
|
||||
logsNodeGroup: cp
|
Loading…
Reference in New Issue