public void LaunchNewComputeInstance() { // string packageBitsSource = @"C:\Dev\Open Source\CloudAbstractions\CloudMorph\CloudMorphToolsPackage\TopShelfJob\bin\Debug\"; string packagePath = @"TopShelfJob.zip"; if (File.Exists(packagePath)) File.Delete(packagePath); PackageCompressor.Compress(packageBitsSource, packagePath); var realm = new AwsRealm(); var storage = realm.StorageProvider; if (storage.ExistInBucket("igor-morphCloud-packages", packagePath)) storage.DeleteFromBucket("igor-morphCloud-packages", packagePath); storage.AddToBucket("igor-morphCloud-packages", packagePath); var compute = realm.ComputeInfrastructureProvider; compute.LaunchInstance("igor-compute1", InstanceSize.Small, "TopShelfJob.zip"); }
public void Start() { _realm = new AwsRealm(); _queueProvider = _realm.QueueProvider; _queue = _queueProvider.GetQueueByUri(new Uri("https://queue.amazonaws.com/867587891196/testQueue")); _queueProvider.SendMessage(_queue, "hello from TopShelfJob"); }
public void UpdateJobStatus(Guid id, string jobDescription, string status) { IRealm realm = new AwsRealm(); IKvStorageProvider kvStorage = realm.KvStorageProvider; var bag = new Dictionary<string, string>(); bag.Add("Description", jobDescription); bag.Add("Status", status); kvStorage.Put("igor-cloudMorph-roster-jobs", id.ToString(), bag, true); }
public void UpdateInstanceStatus(Guid id, string instanceName, string status) { IRealm realm = new AwsRealm(); IKvStorageProvider kvStorage = realm.KvStorageProvider; var bag = new Dictionary<string, string>(); bag.Add("Name", instanceName); bag.Add("Status", status); kvStorage.Put("igor-cloudMorph-roster", id.ToString(), bag, true); }
public void UploadPackage() { string packagePath = @"C:\Dev\Open Source\CloudAbstractions\CloudMorph\CloudMorphToolsPackage\TopShelfJob\bin\TopShelfJob.zip"; var realm = new AwsRealm(); var storage = realm.StorageProvider; //storage.CreateBucket("igor-morphCloud-packages"); string id = storage.AddToBucket("igor-morphCloud-packages", packagePath); }
public void DownloadPackageFordeployment() { string packageId = "PingPongJob.zip"; var realm = new AwsRealm(); var storage = realm.StorageProvider; using (var fs = new FileStream(packageId, FileMode.Create, FileAccess.Write)) { storage.GetFromBucket("igor-morphCloud-packages", packageId, fs); } }
public void SaveData() { var realm = new AwsRealm(); var provider = realm.KvStorageProvider; string tblName = "customers"; provider.CreateTable(tblName); var bag = new Dictionary<string, string> { { "Name", "Igor Moochnick" }, { "Marital Status", "married" } }; var id = Guid.NewGuid(); provider.Put(tblName, id.ToString(), bag, true); }
public void PublishPackageForDeployment() { //string packagePath = @"C:\Dev\BlueMetal\CloudAbstractions\MorphCloud\CloudMorphToolsPackage\PingPongJob\bin\PingPongJob.zip"; string packagePath = @"C:\Dev\Open Source\CloudAbstractions\CloudMorph\CloudMorphToolsPackage\TopShelfJob\bin\TopShelfJob.zip"; var realm = new AwsRealm(); var storage = realm.StorageProvider; //string id = storage.AddToBucket("igor-morphCloud-packages", packagePath); string id = Path.GetFileName(packagePath); var queueProvider = realm.QueueProvider; var queue = queueProvider.GetQueueById("igor-cloudMorph-deployments"); var o = JObject.FromObject(new { Command = "launch-job", PackageName = id}); queueProvider.SendMessage(queue, o.ToString()); }
public void UploadPackage() { IRealm realm = new AwsRealm(); var storage = realm.StorageProvider; /* var buckets = storage.Buckets; foreach (var bucket in buckets) { Console.WriteLine(bucket.Name); } */ string bucketName = "igor_another_test"; var bucket1 = storage.CreateBucket(bucketName); string filePath = @"C:\Temp\kinect.jpg"; storage.AddToBucket(bucketName, filePath); //storage.DeleteFromBucket(bucketName, Path.GetFileName(filePath)); }
public void DelayedStart() { _log = LogManager.GetLogger(typeof(DeploymentService)); // _queueProvider = _realm.QueueProvider; // _queueDeploymentsCommands = _queueProvider.GetQueueById("igor-cloudMorph-deployments"); try { var realm = new AwsRealm(); var environment = realm.Current; var metadata = environment.GetMetadata(); string packageName = null; if (metadata.TryGetValue("metadata", out packageName)) { _log.Info("Package Name: " + packageName); } else { _log.Warn("Can't retreive metadata."); packageName = ConfigurationManager.AppSettings["packageName"]; } _log.Info("Target to download the package: " + packageName); var storage = realm.StorageProvider; const string deplDir = @"Packages"; if (!Directory.Exists(deplDir)) Directory.CreateDirectory(deplDir); string packagePath = Path.Combine(deplDir, packageName); if (File.Exists(packagePath)) { _log.Info("The package was already deployed. Exiting ..."); return; } using (var package = File.Create(packagePath)) { storage.GetFromBucket("igor-morphCloud-packages", packageName, package); } string serviceLocation = Path.Combine(@"Services", Path.GetFileNameWithoutExtension(packageName)); _log.Info("Unpacking package to: " + serviceLocation); if (!Directory.Exists(serviceLocation)) Directory.CreateDirectory(serviceLocation); PackageCompressor.Decompress(packagePath, serviceLocation); } catch (Exception e) { _log.Error("Failed to get the package", e); } }