Advertisement
Guest User

Untitled

a guest
May 3rd, 2018
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. ?:php
  2.  
  3.  
  4.  
  5. //require __DIR__ .'/connect.php';
  6.  
  7.  
  8. /// ADAM
  9. //set callback/rpc connection for rabbitmq
  10.  
  11.  
  12.  
  13. /*
  14. -------------------------------------------------
  15. | |
  16. | |
  17. | DEPLOYMENT SERVER |
  18. | ................. |
  19. | |
  20. | |
  21. -------------------------------------------------
  22.  
  23. */
  24. //command line arguments
  25. //argv[0] is the script itself
  26.  
  27. //TO_DO
  28. //use Argument paramenters (argv[x])
  29.  
  30. $function=$argv[1]; //corresponds to
  31. $versionNumber = $argv[2];
  32.  
  33.  
  34. if(empty($function && $versionNumber)){
  35.  
  36. echo " DEPLOYMENT ACTIONS \n ";
  37. echo "Please Choose a Function followed by Version Number\n";
  38.  
  39. echo "----------------------------------------------------\n";
  40. echo " (1)-vpaks: (2)-automatedInstall: (3)-Rollback \n";
  41. echo "----------------------------------------------------\n";
  42. echo " 1.2 | 1.3 | 1.4 \n";
  43.  
  44.  
  45. //-------------------------------------------------
  46.  
  47. //-------------------------------------------------
  48.  
  49.  
  50. function returnVpackages() {
  51.  
  52. $servername = "localhost";
  53. $username = "root";
  54. $password = "chemistry";
  55. $dbname = "Versions";
  56.  
  57.  
  58. $conn = new mysqli($servername, $username, $password, $dbname);
  59.  
  60. if ($conn->connect_error) {
  61. die("Connection failed: " . $conn->connect_error);
  62. }
  63.  
  64. $sql = "SELECT versionNumber FROM Versions LIMIT 1";
  65. $result = $conn->query($sql);
  66.  
  67. if ($result->num_rows > 0) {
  68. while($row = $result->fetch_assoc()) {
  69. $rowVersion = $row["versionNumber"];
  70. print "Version Number: " . $rowVersion;
  71. return $rowVersion;
  72. }
  73. } else {
  74. echo "No Version Number\n";
  75. }
  76.  
  77.  
  78.  
  79.  
  80. function bundleDevPackage($mdev, $rowVersion){
  81. //currently this just
  82. //git clone Moises and Brandons files to send to new machine
  83.  
  84. echo "\nCreating Dev pack\n";
  85. echo "Syncing contents\n";
  86. echo "SCP'ing to <IP>\n";
  87.  
  88.  
  89. shell_exec("
  90. cd ~/
  91. mkdir '$mdev'-'$rowVersion
  92. rsync -av /var/www/lol.com/public_html/deployment ~/'$mdev'-'$rowVersion'
  93. tar -cvzf $mdev.$verNum.tar.gz $mdev'-'$rowVersion
  94. scp -r $mdev'-'$rowVersion.tar.gz blackout@192.168.1.24:
  95.  
  96. ");
  97. }
  98.  
  99. bundleDevPAckage($mdev,$rowVersion)
  100. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement