Skip to content

Commit

Permalink
final command?
Browse files Browse the repository at this point in the history
  • Loading branch information
djcard committed May 2, 2019
1 parent c4cbe4b commit a21e922
Show file tree
Hide file tree
Showing 4 changed files with 140 additions and 45 deletions.
15 changes: 9 additions & 6 deletions commands/FakerCo/deploy/copyIndexFiles.cfc
Expand Up @@ -13,21 +13,24 @@ component {
"/build/newproduct/server.json"
],
webapp:[
"/build/newproduct/Application.cfc",
"/build/newproduct/index.cfm",
"/build/newproduct/server.json"
"/build/webapp/Application.cfc",
"/build/webapp/index.cfm",
"/build/webapp/server.json"
],
restservices:[
"/build/newproduct/Application.cfc",
"/build/newproduct/index.cfm",
"/build/newproduct/server.json"
"/build/restservices/Application.cfc",
"/build/restservices/index.cfm",
"/build/restservices/server.json"
]
};

function run(){
var configSettings=ConfigService.getconfigSettings();
for(var loc in fileList){
print.line("outside array each: " & loc );
arrayEach(fileList[loc],function(item){
print.line(loc);
print.line(item);
print.line("copy #item# from #configSettings.modules.fakerco.sitepaths.repo#/ITBFakerCoSites#item# to #configSettings.modules.fakerco.sitepaths[loc]# ");
filecopy("#configSettings.modules.fakerco.sitepaths.repo#/ITBFakerCoSites#item#",#configSettings.modules.fakerco.sitepaths[loc]#);
});
Expand Down
48 changes: 17 additions & 31 deletions commands/FakerCo/deploy/deployMainSiteSettings.cfc
Expand Up @@ -11,54 +11,40 @@ component {
command("cd #fakerCOsettings.sitepaths.mainSite#").run();


//Copy downloaded server config to live server config
//Copy downloaded server config to live server config
print.line("Copying Server configuration");
command("cfconfig import TestSiteSettingsLive.json --pauseTasks");
print.line("Setting robust exception on");
command(" cfconfig set robustExceptionEnabled=true").run();
sleep(250);
//disable all scheduled tasks
//Handled in the server.json
//disable all scheduled tasks
//Handled in the server.json

print.line("setting live host to fakerCo.local");
command("server set web.host=fakerCo.local").run();
command("server set web.host=fakerCo.local").run();


//Change Admin Password to local password
//Change Admin Password to local password
print.line("Changing admin passwords");
command("fakerCo deploy setAdminPassword mainsite #serverInfo.defaultname#").run();
sleep(250);

//Remove cfcfonig from server.json so it uses the cfconfigs we set instead of the ones from the repo
//Remove cfcfonig from server.json so it uses the cfconfigs we set instead of the ones from the repo
print.line("Removing cfconfig file from server.json");
try{command("server clear cfconfigfile").run();}catch(any err){};

addCustomTagPath();

sleep(250);
print.line("Adding Mappings and Aliases");
addMapping("sb",springboardSettings.sitepaths.repo & "/springboard/sb");
addMapping("ptkim",springboardSettings.sitepaths.repo & "/springboard/ptkim");
addMapping("pttests",springboardSettings.sitepaths.repo & "/springboard/pttests");
addAlias("sb",springboardSettings.sitepaths.repo & "/springboard/sb");
addAlias("driver",springboardSettings.sitepaths.repo & "/springboard/driver");
addAlias("drivers",springboardSettings.sitepaths.repo & "/springboard/drivers");
addAlias("css",springboardSettings.sitepaths.repo & "/springboard/css");
addAlias("bower_components",springboardSettings.sitepaths.repo & "/springboard/bower_components");
addAlias("icons",springboardSettings.sitepaths.repo & "/springboard/icons");
addAlias("img",springboardSettings.sitepaths.repo & "/springboard/img");
addAlias("includes",springboardSettings.sitepaths.repo & "/springboard/includes");
addAlias("posadmin",springboardSettings.sitepaths.repo & "/springboard/posadmin");
addAlias("ptkim",springboardSettings.sitepaths.repo & "/springboard/ptkim");
addAlias("pttests",springboardSettings.sitepaths.repo & "/springboard/pttests");
addAlias("reports",springboardSettings.sitepaths.repo & "/springboard/reports");
addAlias("sb",springboardSettings.sitepaths.repo & "/springboard/sb");
addAlias("support",springboardSettings.sitepaths.repo & "/springboard/support");
addAlias("wp-content",springboardSettings.sitepaths.repo & "/springboard/wp-content");
//addMapping("sb",springboardSettings.sitepaths.repo & "/springboard/sb");
//addAlias("driver",springboardSettings.sitepaths.repo & "/springboard/driver");
sleep(250);

addDatasource();

command("install").run();

var restartme=arguments.force ? arguments.force : confirm("The Server needs to restart. Restart now [y/n]?");
if(restartme) {
command("server restart").run();
Expand Down Expand Up @@ -96,7 +82,7 @@ component {
function addDatasource(){
var configSettings = ConfigService.getconfigSettings();
var fakerCOSettings = configSettings.modules.fakerCO.localdb;
command("cfconfig datasource save").params(name="fakerCO",
command("cfconfig datasource save").params(name="fakeDS",
dbdriver="mysql",
host=fakerCOSettings.dbaddress,
port=fakerCOSettings.port,
Expand All @@ -106,13 +92,13 @@ component {
custom="allowMultiQueries=true",
dsn="jdbc:mysql://#fakerCOSettings.dbaddress#:#fakerCOSettings.port#/#fakerCOSettings.SCHEMA#?tinyInt1isBit=false&allowMultiQueries=true").run();

command("cfconfig datasource save").params(name="packaging",
command("cfconfig datasource save").params(name="fakerCo",
dbdriver="mssql",
host="fakerCOpackage.cyqisqc1fx3i.us-west-2.rds.amazonaws.com",
port="1433",
database="springboardpackaging",
username="dancard",
password="dancard!").run();
host="#fakerCOSettings.dbaddress#",
port="#fakerCOSettings.port#",
database="#fakerCOSettings.SCHEMA#",
username="#fakerCOSettings.USERNAME#",
password="#fakerCOSettings.password#").run();
}

}
100 changes: 100 additions & 0 deletions commands/FakerCo/deploy/deployRestServicesSettings.cfc
@@ -0,0 +1,100 @@
component {
property name='ConfigService' inject='ConfigService';
property name="serverService" inject='ServerService';

function run(boolean force=false){
try {
var configSettings = ConfigService.getconfigSettings();
var fakerCOSettings = configSettings.modules.fakerCO;
var serverInfo=serverService.resolveServerDetails({directory:configSettings.modules.fakerCO.sitepaths.mainsite});
var currentDir=getcwd();
command("cd #fakerCOsettings.sitepaths.restservices#").run();


//Copy downloaded server config to live server config
print.line("Setting robust exception on");
command(" cfconfig set robustExceptionEnabled=true").run();
sleep(250);
//disable all scheduled tasks
//Handled in the server.json

print.line("setting live host to fakerCo.local");
command("server set web.host=restservices.fakerCo.local").run();


//Change Admin Password to local password
print.line("Changing admin passwords");
command("fakerCo deploy setAdminPassword restservices #serverInfo.defaultname#").run();
sleep(250);

//Remove cfcfonig from server.json so it uses the cfconfigs we set instead of the ones from the repo
print.line("Removing cfconfig file from server.json");
try{command("server clear cfconfigfile").run();}catch(any err){};

addCustomTagPath();

sleep(250);
print.line("Adding Mappings and Aliases");
addMapping("restservices",fakerCOSettings.sitepaths.repo & "/restservices");
//addAlias("driver",springboardSettings.sitepaths.repo & "/springboard/driver");
sleep(250);

addDatasource();

var restartme=arguments.force ? arguments.force : confirm("The Server needs to restart. Restart now [y/n]?");
if(restartme) {
command("server restart").run();
print.line("Server restarting");
}

print.line("************************************************");
command("cd #currentDir#").run();

}
catch(any err){
print.line(err.message);
}
}

function addMapping(name,physical)
{
print.line("Setting mapping for #arguments.name# to #arguments.physical#");
command("cfconfig cfmapping save virtual=/#arguments.name# physical=#arguments.physical#").run();
print.line("mapping set");
}

function addAlias(name,physical){
command("server set web.aliases./#arguments.name#=#arguments.physical#").run();
}

function addCustomTagPath(){
var configSettings = ConfigService.getconfigSettings();
var fakerCOSettings = configSettings.modules.fakerCO;

print.line("Adding customtag path");
command('cfconfig customtagpath save physical=#fakerCOSettings.sitepaths.repo#/fakerCO/customTags primary=Physical').run();
}

function addDatasource(){
var configSettings = ConfigService.getconfigSettings();
var fakerCOSettings = configSettings.modules.fakerCO.localdb;
command("cfconfig datasource save").params(name="fakeDS",
dbdriver="mysql",
host=fakerCOSettings.dbaddress,
port=fakerCOSettings.port,
database=fakerCOSettings.SCHEMA,
username=fakerCOSettings.USERNAME,
password=fakerCOSettings.PASSWORD,
custom="allowMultiQueries=true",
dsn="jdbc:mysql://#fakerCOSettings.dbaddress#:#fakerCOSettings.port#/#fakerCOSettings.SCHEMA#?tinyInt1isBit=false&allowMultiQueries=true").run();

command("cfconfig datasource save").params(name="fakerCo",
dbdriver="mssql",
host="#fakerCOSettings.dbaddress#",
port="#fakerCOSettings.port#",
database="#fakerCOSettings.SCHEMA#",
username="#fakerCOSettings.USERNAME#",
password="#fakerCOSettings.password#").run();
}

}
22 changes: 14 additions & 8 deletions commands/FakerCo/startHere.cfc
Expand Up @@ -10,20 +10,24 @@ component {
confirm(message="To Start press any key: ",defaultResponse="Y");
print.line("ok, let's get started");

//Install dependencies
installDependencies();

//Ask for the Settings and Create Folder Structure
askForSettings();

//Install dependencies
installDependencies();

sleep(2000);
print.line("The various sites will be set up here:");
print.line("");
command("config show modules.fakerco.sitepaths").run();


/*********************/
command("config show modules.fakerco.sitepaths").run();
print.line("");

makeFolders();


//Pull from repos
pullSite();

Expand All @@ -32,11 +36,13 @@ component {

//Run “install” to install dependencies
runInstall();
//Start/stop Servers
//Start/stop Servers

//Import settings
//Specific Settings

command("fakerCo deploy deployMainSiteSettings").run();
command("fakerCo deploy deployRestServicesSettings").run();
/* */
}


Expand Down Expand Up @@ -78,8 +84,8 @@ component {
var configSettings=ConfigService.getconfigSettings();
configSettings.modules=structKeyExists(configSettings,"modules") ? configSettings.modules : {};
configsettings.modules.FakerCo=structKeyExists(configSettings.modules,"FakerCo") ? configsettings.modules.FakerCo : emptyFakerCo();
configsettings.modules.FakerCo.sitepaths = structKeyExists(configSettings.modules.FakerCo,"sitepaths") ? configsettings.modules.FakerCo.sitepaths : {"root":"","repo":"","live":"","restservices":"","pos":"","bubbles":""} ;
configsettings.modules.FakerCo.adminpasswords = structKeyExists(configSettings.modules.FakerCo,"adminpasswords") ? configsettings.modules.FakerCo.adminpasswords : {"default:"",""live":"","restservices":"","pos":"","bubbles":""};
configsettings.modules.FakerCo.sitepaths = structKeyExists(configSettings.modules.FakerCo,"sitepaths") ? configsettings.modules.FakerCo.sitepaths : {"root":"","repo":"","mainsite":"","restservices":"","newapp":"","webapp":""} ;
configsettings.modules.FakerCo.adminpasswords = structKeyExists(configSettings.modules.FakerCo,"adminpasswords") ? configsettings.modules.FakerCo.adminpasswords : {"root":"","repo":"","mainsite":"","restservices":"","newapp":"","webapp":""};
configsettings.modules.FakerCo.LocalDB = structKeyExists(configSettings.modules.FakerCo,"LocalDB") ? configsettings.modules.FakerCo.localdb : {"DBADDRESS":"","PASSWORD":"","SCHEMA":"","PORT":"","USERNAME":""};
ConfigService.setConfigSettings(configSettings);
}
Expand Down

0 comments on commit a21e922

Please sign in to comment.