cancel
Showing results for 
Search instead for 
Did you mean: 

Command line deployments?

pconnors
Champ in-the-making
Champ in-the-making
I'm looking for a way to automate my deployments of my entire web application.  Currently, I'm using the standard deploy feature, but this means that I have to actually "press the button".  I'm attempting to setup automated "nightly builds" with full blown deployment of both application and web content to our development servers.  I don't see a means of doing this in an automated way.  Any suggestions, or maybe I'm missing something!?
3 REPLIES 3

scottf
Champ on-the-rise
Champ on-the-rise
There is a way to do this through the client, no need for command line scripts.

Have you seen the auto deploy checkbox when submitting content?
You also need to include the specific FSR/ASR in auto deployment, there's a checkbox for that too.
See here for more:
http://wiki.alfresco.com/wiki/WCM_Deployment_Features#Deployment

Also, you can set a launch date and time for content (and a corresponding expiry time if necessary).

See here for more:
http://wiki.alfresco.com/wiki/Content_Launch

Hope that helps.

jack_jin
Champ in-the-making
Champ in-the-making
I'm sure there's a better service function you can probably expose, but I wrote this a while back


function deployToLive(versionToDeploy, deployWebsiteName, deployType, deployServerName)
{

    var WCMAPP_MODEL_1_0_URI = "{http://www.alfresco.org/model/wcmappmodel/1.0}";

    var stgRootNode = avmversion.lookup(deployWebsiteName + ":/www/avm_webapps", versionToDeploy, true);
    var liveStoreNode = avm.lookupStoreRoot(deployWebsiteName + "live");
    var webproj = webprojects.getWebProject(deployWebsiteName);
    var webprojNode = companyhome.childByNamePath("Web Projects/" + deployWebsiteName);
    var webprojChildren = webprojNode.children;
    var deploymentServerNode = null;
    for(wpcIndex in webprojChildren)
    {
        var curWpc = webprojChildren[wpcIndex];
        if(curWpc.properties[WCMAPP_MODEL_1_0_URI + "deploytype"] == deployType)
        {
            deploymentServerNode = curWpc;
            break;
        }

    }
//    deploymentServerNode = companyhome.childByNamePath("Web Projects/hae/c7edaceb-99cf-477e-9611-5c0a9b04a49c");
    var attemptType = WCMAPP_MODEL_1_0_URI + "deploymentattempt";
    var attemptAssocType = WCMAPP_MODEL_1_0_URI + "deploymentattempt";
    var attemptAssocName = WCMAPP_MODEL_1_0_URI + "deploymentattempt";
    var attemptProps = new Array();
//    attemptProps[WCMAPP_MODEL_1_0_URI + "deploymentattempt"] = "newName";
    attemptProps[WCMAPP_MODEL_1_0_URI + "deployattempttype"] = "live";
//    attemptProps[WCMAPP_MODEL_1_0_URI + "deployattemptstore"] = "localhost";
    attemptProps[WCMAPP_MODEL_1_0_URI + "deployattemptstore"] = deployWebsiteName;
    attemptProps[WCMAPP_MODEL_1_0_URI + "deployattemptversion"] = versionToDeploy;
    attemptProps[WCMAPP_MODEL_1_0_URI + "deployattemptservers"] = new Array(deployServerName);
    attemptProps[WCMAPP_MODEL_1_0_URI + "deployattemptid"] = avmversion.getNewGUID();
    attemptProps[WCMAPP_MODEL_1_0_URI + "deployattempttime"] = Date.now();

    var attempt = webprojNode.createNode("newName", attemptType, attemptProps,attemptAssocType, attemptAssocName);

    //Renaming it to the UUID
    attempt.name = attempt.properties["{http://www.alfresco.org/model/system/1.0}node-uuid"];
//    attempt.properties[WCMAPP_MODEL_1_0_URI + "deploymentattempt"] = attempt.properties["{http://www.alfresco.org/model/system/1.0}node-uuid"];
    //This really should be an randomly geneated GUID
//    attempt.properties[WCMAPP_MODEL_1_0_URI + "deployattemptid"] = attempt.properties["{http://www.alfresco.org/model/system/1.0}node-uuid"];
    attempt.save();


    if(stgRootNode == null || liveStoreNode == null || webproj == null || deploymentServerNode == null)
    {
        logger.log("ERROR IN deployToLive() - stgRootNode: " + stgRootNode + " liveStoreNode: " + liveStoreNode +
                " webproj: " + webproj + " deploymentServerNode: " + deploymentServerNode);
    }
    else
    {
        var workflowb = actions.create("avm-deploy-website");
        workflowb.parameters["webproject"] = webproj.nodeRef;
        workflowb.parameters["server"] = deploymentServerNode.nodeRef;
        workflowb.parameters["attempt"] = attempt.nodeRef;
        workflowb.execute(stgRootNode.nodeRef);
    }
}

Hopefully it helps

jack_jin
Champ in-the-making
Champ in-the-making
As a disclaimer, a lot of the code above wasn't originally by me - they were copied from java functions controller-ish classes in alfresco.

Just wanted to clearify 😉