Skip to content

Commit

Permalink
Installer links update and performance improvements
Browse files Browse the repository at this point in the history
Two install threads at the same time
- vbox, ssh-rsync, vagrant, cdk
- jdk, jbds

Cygwin replaced to mingw based distribution with ssh and rsync

If files that expected to be downloaded are next to installer exe download
is skipped and that file used instead.

Links to required binaries are updated to latest ones where possible
  • Loading branch information
dgolovin committed Mar 3, 2016
1 parent e254d05 commit 5c3a89c
Show file tree
Hide file tree
Showing 13 changed files with 271 additions and 141 deletions.
Binary file added 7zS.sfx
Binary file not shown.
45 changes: 21 additions & 24 deletions browser/main.js
Expand Up @@ -66,31 +66,35 @@ let mainModule =
}])
.run( ['$rootScope', '$location', '$timeout', 'installerDataSvc', ($rootScope, $location, $timeout, installerDataSvc) => {
installerDataSvc.addItemToInstall(
CDKInstall.key(),
new CDKInstall(installerDataSvc,
$timeout,
'http://cdk-builds.usersys.redhat.com/builds/11-Dec-2015/cdk-2.0.0-beta3.zip',
'http://cdk-builds.usersys.redhat.com/builds/11-Dec-2015/rhel-7.2-server-kubernetes-vagrant-scratch-7.2-1.x86_64.vagrant-virtualbox.box',
'https://ci.openshift.redhat.com/jenkins/job/devenv_ami/lastSuccessfulBuild/artifact/origin/artifacts/release/',
'https://github.com/redhat-developer-tooling/openshift-vagrant/archive/master.zip',
'http://the.earth.li/~sgtatham/putty/latest/x86/pscp.exe',
null)
VirtualBoxInstall.key(),
new VirtualBoxInstall('5.0.8',
'103449',
installerDataSvc,
'http://download.virtualbox.org/virtualbox/${version}/VirtualBox-${version}-${revision}-Win.exe',
null)
);
installerDataSvc.addItemToInstall(
CygwinInstall.key(),
new CygwinInstall(installerDataSvc,
'https://drive.google.com/file/d/0B4pPomemPHeuNndtNE1LaUZZQzA/view?usp=sharing',
null)
);

installerDataSvc.addItemToInstall(
VagrantInstall.key(),
new VagrantInstall(installerDataSvc,
'https://github.com/redhat-developer-tooling/vagrant-distribution/archive/1.7.4.zip',
null)
);

installerDataSvc.addItemToInstall(
VirtualBoxInstall.key(),
new VirtualBoxInstall('5.0.8',
'103449',
installerDataSvc,
'http://download.virtualbox.org/virtualbox/${version}/VirtualBox-${version}-${revision}-Win.exe',
null)
CDKInstall.key(),
new CDKInstall(installerDataSvc,
$timeout,
'http://cdk-builds.usersys.redhat.com/builds/22-Feb-2016-cdk2.0beta4-rebuild/cdk-2.0.0-beta4.zip',
'http://cdk-builds.usersys.redhat.com/builds/22-Feb-2016-cdk2.0beta4-rebuild/rhel-cdk-kubernetes-7.2-18.x86_64.vagrant-virtualbox.box',
'https://ci.openshift.redhat.com/jenkins/job/devenv_ami/lastSuccessfulBuild/artifact/origin/artifacts/release/',
'https://github.com/redhat-developer-tooling/openshift-vagrant/archive/f3cd9f8859b65cf9257b3f886ab999dcfd0aac0b.zip',
'http://the.earth.li/~sgtatham/putty/latest/x86/pscp.exe',
null)
);

installerDataSvc.addItemToInstall(
Expand All @@ -106,13 +110,6 @@ let mainModule =
'https://devstudio.redhat.com/9.0/snapshots/builds/devstudio.product_9.0.mars/latest/all/jboss-devstudio-9.1.0.latest-installer-standalone.jar',
null)
);

installerDataSvc.addItemToInstall(
CygwinInstall.key(),
new CygwinInstall(installerDataSvc,
'https://cygwin.com/setup-x86_64.exe',
null)
);
}]);

export default mainModule;
121 changes: 86 additions & 35 deletions browser/model/cdk.js
Expand Up @@ -22,14 +22,24 @@ class CDKInstall extends InstallableItem {
this.vagrantFileUrl = vagrantFileUrl;
this.pscpUrl = pscpUrl;

this.boxName = 'rhel-cdk-kubernetes-7.2-6.x86_64.vagrant-virtualbox.box';
this.cdkFileName = 'cdk.zip';
this.cdkDownloadedFile = path.join(this.installerDataSvc.tempDir(), this.cdkFileName);

this.cdkDownloadedFile = path.join(this.installerDataSvc.tempDir(), 'cdk.zip');
this.boxName = 'rhel-cdk-kubernetes-7.2-18.x86_64.vagrant-virtualbox.box';
this.cdkBoxDownloadedFile = path.join(this.installerDataSvc.tempDir(), this.boxName);
this.ocDownloadedFile = path.join(this.installerDataSvc.tempDir(), 'oc.zip');
this.vagrantDownloadedFile = path.join(this.installerDataSvc.tempDir(), 'vagrantfile.zip');
this.pscpDownloadedFile = path.join(this.installerDataSvc.tempDir(), 'pscp.exe');

this.ocFileName = 'oc.zip';
this.ocDownloadedFile = path.join(this.installerDataSvc.tempDir(), this.ocFileName);

this.vagrantFileName = 'vagrantfile.zip';
this.vagrantDownloadedFile = path.join(this.installerDataSvc.tempDir(), this.vagrantFileName);

this.pscpFileName = 'pscp.exe';
this.pscpDownloadedFile = path.join(this.installerDataSvc.tempDir(), this.pscpFileName);

this.pscpPathScript = path.join(this.installerDataSvc.tempDir(), 'set-pscp-path.ps1');

this.downloads = path.normalize(path.join(__dirname,"../../.."));
}

static key() {
Expand All @@ -42,54 +52,94 @@ class CDKInstall extends InstallableItem {
downloadInstaller(progress, success, failure) {
progress.setStatus('Downloading');

let cdkBoxWriteStream = fs.createWriteStream(this.cdkBoxDownloadedFile);
let cdkWriteStream = fs.createWriteStream(this.cdkDownloadedFile);
let ocWriteStream = fs.createWriteStream(this.ocDownloadedFile);
let vagrantFileWriteStream = fs.createWriteStream(this.vagrantDownloadedFile);
let pscpWriteStream = fs.createWriteStream(this.pscpDownloadedFile);
let downloadSize = 869598013;

let totalDownloads = 5;

let downloader = new Downloader(progress, success, failure, downloadSize, totalDownloads);
let username = this.installerDataSvc.getUsername(),
password = this.installerDataSvc.getPassword();

downloader.setWriteStream(cdkBoxWriteStream);
downloader.download(this.cdkBoxUrl);
// TODO Switch back to auth download when CDK latest is in Customer Portal
// downloader.downloadAuth
// ({
// url: this.cdkBoxUrl,
// rejectUnauthorized: false
// }, username, password);

downloader.setWriteStream(cdkWriteStream);
downloader.downloadAuth
if(!fs.existsSync(path.join(this.downloads, this.boxName))) {
let cdkBoxWriteStream = fs.createWriteStream(this.cdkBoxDownloadedFile);
downloader.setWriteStream(cdkBoxWriteStream);
downloader.download(this.cdkBoxUrl);
} else {
this.cdkBoxDownloadedFile = path.join(this.downloads, this.boxName);
downloader.closeHandler();
}

if(!fs.existsSync(path.join(this.downloads, this.cdkFileName))) {
// TODO Switch back to auth download when CDK latest is in Customer Portal
// downloader.downloadAuth
// ({
// url: this.cdkBoxUrl,
// rejectUnauthorized: false
// }, username, password);
let cdkWriteStream = fs.createWriteStream(this.cdkDownloadedFile);
downloader.setWriteStream(cdkWriteStream);
downloader.downloadAuth
({
url: this.getDownloadUrl(),
rejectUnauthorized: false
}, username, password);
} else {
this.cdkDownloadedFile = path.join(this.downloads, this.cdkFileName);
downloader.closeHandler();
}

if(!fs.existsSync(path.join(this.downloads, this.vagrantFileName))) {
let vagrantFileWriteStream = fs.createWriteStream(this.vagrantDownloadedFile);
downloader.setWriteStream(vagrantFileWriteStream);
downloader.download(this.vagrantFileUrl);
} else {
this.vagrantDownloadedFile = path.join(this.downloads, this.vagrantFileName);
downloader.closeHandler();
}

downloader.setWriteStream(vagrantFileWriteStream);
downloader.download(this.vagrantFileUrl);
if(!fs.existsSync(path.join(this.downloads, this.pscpFileName))) {
let pscpWriteStream = fs.createWriteStream(this.pscpDownloadedFile);
downloader.setWriteStream(pscpWriteStream);
downloader.download(this.pscpUrl);
} else {
this.pscpDownloadedFile = path.join(this.downloads, this.pscpFileName);
downloader.closeHandler();
}

downloader.setWriteStream(pscpWriteStream);
downloader.download(this.pscpUrl);

if(!this.ocUrl.endsWith('.zip')) {
request(this.ocUrl,(err,rsp,body) => {
var fname = body.match(/openshift-origin-client-tools-v\w(\.\w){1,2}-\w{1,3}-\w{8}-\w{7}-windows\.zip/)[0];
if(!fs.existsSync(path.join(this.downloads, this.ocFileName))) {
let ocWriteStream = fs.createWriteStream(this.ocDownloadedFile);
if(!this.ocUrl.endsWith('.zip')) {
request(this.ocUrl,(err,rsp,body) => {
var fname = body.match(/openshift-origin-client-tools-v\w(\.\w){1,2}-\w{1,3}-\w{8}-\w{7}-windows\.zip/)[0];
downloader.setWriteStream(ocWriteStream);
this.ocUrl=this.ocUrl.concat(fname);
downloader.download(this.ocUrl);
});
} else {
downloader.setWriteStream(ocWriteStream);
this.ocUrl=this.ocUrl.concat(fname);
downloader.download(this.ocUrl);
});
}
} else {
downloader.setWriteStream(ocWriteStream);
downloader.download(this.ocUrl);
this.ocDownloadedFile = path.join(this.downloads, this.ocFileName);
downloader.closeHandler();
}
}

install(progress, success, failure) {
let vagrantInstall = this.installerDataSvc.getInstallable(VagrantInstall.key());
if( vagrantInstall !== undefined && vagrantInstall.isInstalled() ) {
this.postVagrantInstall(progress, success, failure);
} else {
progress.setStatus('Waiting for Vagrant to finish installation');
ipcRenderer.on('installComplete', (event, arg) => {
if (arg == 'vagrant') {
this.postVagrantInstall(progress, success, failure);
}
});
}
}

postVagrantInstall(progress, success, failure) {
progress.setStatus('Installing');
let installer = new Installer(CDKInstall.key(), progress, success, failure);

Expand Down Expand Up @@ -169,9 +219,10 @@ class CDKInstall extends InstallableItem {
env: env
};

let res = installer.exec('vagrant plugin install ' + path.join(this.installerDataSvc.cdkDir(), 'plugins', 'vagrant-registration-1.0.0.gem'), opts, promise)
let res = installer.exec('vagrant plugin install ' + path.join(this.installerDataSvc.cdkDir(), 'plugins', 'vagrant-registration-1.1.0.cdk.gem'), opts, promise)
.then((result) => { return installer.exec('vagrant box add --name cdk_v2 ' + path.join(this.installerDataSvc.cdkBoxDir(), this.boxName), opts, result); })
.then((result) => { return installer.exec('vagrant plugin install ' + path.join(this.installerDataSvc.cdkDir(), 'plugins', 'vagrant-adbinfo-0.0.5.gem'), opts, result); });
.then((result) => { return installer.exec('vagrant plugin install ' + path.join(this.installerDataSvc.cdkDir(), 'plugins', 'vagrant-adbinfo-0.1.0.gem'), opts, result); })
.then((result) => { return installer.exec('vagrant plugin install ' + path.join(this.installerDataSvc.cdkDir(), 'plugins', 'landrush-0.18.0.cdk.gem'), opts, result); });

return res;
}
Expand Down
42 changes: 32 additions & 10 deletions browser/model/cygwin.js
Expand Up @@ -3,19 +3,22 @@
let fs = require('fs');
let request = require('request');
let path = require('path');
let ipcRenderer = require('electron').ipcRenderer;

import InstallableItem from './installable-item';
import Downloader from './helpers/downloader';
import Logger from '../services/logger';
import Installer from './helpers/installer';
import VirtualBoxInstall from './virtualbox';


class CygwinInstall extends InstallableItem {
constructor(installerDataSvc, downloadUrl, installFile) {
super('Cygwin', 720, downloadUrl, installFile);

this.installerDataSvc = installerDataSvc;

this.downloadedFile = path.join(this.installerDataSvc.tempDir(), 'cygwin.exe');
this.downloadedFileName = 'ssh-rsync.zip';
this.downloadedFile = path.join(this.installerDataSvc.tempDir(), this.downloadedFileName);
this.cygwinPathScript = path.join(this.installerDataSvc.tempDir(), 'set-cygwin-path.ps1');
}

Expand All @@ -29,15 +32,34 @@ class CygwinInstall extends InstallableItem {
downloadInstaller(progress, success, failure) {
progress.setStatus('Downloading');

// Need to download the file
let writeStream = fs.createWriteStream(this.downloadedFile);

let downloader = new Downloader(progress, success, failure);
downloader.setWriteStream(writeStream);
downloader.download(this.downloadUrl);
var downloads = path.normalize(path.join(__dirname,"../../.."));
if(! fs.existsSync(path.join(downloads, this.downloadedFileName))) {
// Need to download the file
let writeStream = fs.createWriteStream(this.downloadedFile);
let downloader = new Downloader(progress, success, failure);
downloader.setWriteStream(writeStream);
downloader.download(this.downloadUrl);
} else {
this.downloadedFile = path.join(downloads, this.downloadedFileName);
success();
}
}

install(progress, success, failure) {
let vboxInstall = this.installerDataSvc.getInstallable(VirtualBoxInstall.key());
if( vboxInstall !== undefined && vboxInstall.isInstalled() ) {
this.postVirtualboxInstall(progress, success, failure);
} else {
progress.setStatus('Waiting for VirtualBox to finish installation');
ipcRenderer.on('installComplete', (event, arg) => {
if (arg == 'virtualbox') {
this.postVirtualboxInstall(progress, success, failure);
}
});
}
}

postVirtualboxInstall(progress, success, failure) {
progress.setStatus('Installing');
let installer = new Installer(CygwinInstall.key(), progress, success, failure);

Expand All @@ -46,7 +68,7 @@ class CygwinInstall extends InstallableItem {
'--quiet-mode',
'--only-site',
'--site',
'http://mirrors.kernel.org/sourceware/cygwin',
'http://mirrors.xmission.com/cygwin',
'--root',
this.installerDataSvc.cygwinDir(),
'--categories',
Expand All @@ -61,7 +83,7 @@ class CygwinInstall extends InstallableItem {
'[Environment]::Exit(0)'
].join('\r\n');

installer.execFile(this.downloadedFile, opts)
installer.unzip(this.downloadedFile, this.installerDataSvc.cygwinDir())
.then((result) => { return installer.writeFile(this.cygwinPathScript, data, result); })
.then((result) => { return installer.execFile('powershell',
[
Expand Down
2 changes: 1 addition & 1 deletion browser/model/installable-item.js
Expand Up @@ -8,7 +8,7 @@ class InstallableItem {
this.existingInstallLocation = "";
this.useDownload = true;
this.downloaded = false;
this.installed = false;
this.installed = false;

if (downloadUrl == null || downloadUrl == '') {
throw(new Error('No download URL set'));
Expand Down
49 changes: 35 additions & 14 deletions browser/model/jbds.js
Expand Up @@ -18,6 +18,7 @@ class JbdsInstall extends InstallableItem {

this.installerDataSvc = installerDataSvc;

this.downloadedFileName = 'jbds.jar';
this.downloadedFile = path.join(this.installerDataSvc.tempDir(), 'jbds.jar');
this.installConfigFile = path.join(this.installerDataSvc.tempDir(), 'jbds-autoinstall.xml');
this.installGenerator = new JbdsAutoInstallGenerator(this.installerDataSvc.jbdsDir(), this.installerDataSvc.jdkDir());
Expand All @@ -32,23 +33,43 @@ class JbdsInstall extends InstallableItem {

downloadInstaller(progress, success, failure) {
progress.setStatus('Downloading');

// Need to download the file
let writeStream = fs.createWriteStream(this.downloadedFile);

let options = {
url: this.downloadUrl,
headers: {
'Referer': 'https://devstudio.redhat.com/9.0/snapshots/builds/devstudio.product_9.0.mars/latest/all/'
}
};

let downloader = new Downloader(progress, success, failure);
downloader.setWriteStream(writeStream);
downloader.download(options);
var downloads = path.normalize(path.join(__dirname,"../../.."));
console.log(downloads);
if(! fs.existsSync(path.join(downloads, this.downloadedFileName))) {
// Need to download the file
let writeStream = fs.createWriteStream(this.downloadedFile);

let options = {
url: this.downloadUrl,
headers: {
'Referer': 'https://devstudio.redhat.com/9.0/snapshots/builds/devstudio.product_9.0.mars/latest/all/'
}
};

let downloader = new Downloader(progress, success, failure);
downloader.setWriteStream(writeStream);
downloader.download(options);
} else {
this.downloadedFile = path.join(downloads, this.downloadedFileName);
success();
}
}

install(progress, success, failure) {
let jdkInstall = this.installerDataSvc.getInstallable(JdkInstall.key());
if (jdkInstall !== undefined && jdkInstall.isInstalled()) {
this.postInstall(progress, success, failure);
} else {
progress.setStatus('Waiting for JDK to finish installation');
ipcRenderer.on('installComplete', (event, arg) => {
if (arg == 'jdk') {
this.postInstall(progress, success, failure);
}
});
}
}

postInstall(progress, success, failure) {
progress.setStatus('Installing');
let installer = new Installer(JbdsInstall.key(), progress, success, failure);

Expand Down

0 comments on commit 5c3a89c

Please sign in to comment.