// creating app with name f1 => apptype = Compose_f1 // create app with name f1 (fabric:/f1) // service name is from docker compose file public async Task CreateApp(string appName, string imagePath, int replicaCount) { var yaml = $"version: \"3\"\r\nservices:\r\n {appName}Service:\r\n image: {imagePath}\r\n ports:\r\n - \"{_nextAvailablePort++}:1337/http\"\r\n deploy:\r\n replicas: {replicaCount}"; var composeApplication = new ComposeApplication(appName, yaml); await _clusterManager.CreateComposeApp(composeApplication); //todo add locks _sfApps[appName] = new ServiceFabricApp(appName, $"{appName}Service"); }
private async Task LoadExistingApps() { var appsJson = await _clusterManager.GetApplications(); foreach (var item in appsJson.Items) { string key = Convert.ToString(item.Id); if (!_sfApps.ContainsKey(key)) { _sfApps[key] = new ServiceFabricApp(key, $"{key}Service"); } } }