Esempio n. 1
0
        public async Task <object> Parse(object value, TemplateData template = null)
        {
            template ??= (await _components
                          .FindAll <ICloudformationComponent>(Components.Direction.In)
                          .Select(x => x.component?.GetCloudformationData(x.tree))
                          .WhenAll())
            .Merge();

            return(await CloudformationResources.ParseValue(
                       value,
                       template,
                       _projectSettings,
                       _configuration.Settings.AwsRegion,
                       async service =>
            {
                var services = _configuration.GetConfiguredServices();

                if (!services.Contains(service))
                {
                    return (false, _configuration.Settings.ServicesPort);
                }

                var isRunning = await WaitForStartedAndResourcesCreated(TimeSpan.FromMinutes(2));

                return (isRunning, _configuration.Settings.ServicesPort);
            }));
        }
Esempio n. 2
0
        public async Task <bool> Start(Components.ComponentTree components)
        {
            var startedServices = _configuration.GetConfiguredServices();

            if (!startedServices.Any())
            {
                return(true);
            }

            _isStarting = true;

            var startResult = await _dockerContainer.Run("");

            if (!startResult)
            {
                _isStarting = false;
                return(false);
            }

            var started = await WaitForStart(TimeSpan.FromMinutes(1));

            if (!started)
            {
                _isStarting = false;

                return(false);
            }

            var template = (await components
                            .FindAll <ICloudformationComponent>(Components.Direction.In)
                            .Select(x => x.component?.GetCloudformationData(x.tree))
                            .WhenAll())
                           .Merge();

            await CloudformationResources.EnsureResourcesExist(template, _configuration, _projectSettings);

            _isStarting = false;

            return(true);
        }