Beispiel #1
0
 /// <summary>
 /// Configure resource options
 /// </summary>
 /// <param name="builder"></param>
 public override void Configure(ContainerResourceBuilder builder)
 {
     builder
     .Name("mongodb")
     .Image("mongo:latest")
     .InternalPort(27017);
 }
 private void AddNetworksToBuilder(ContainerResourceBuilder builder)
 {
     foreach (string network in _composeNetworks)
     {
         builder.AddNetwork(network);
     }
 }
Beispiel #3
0
 /// <summary>
 /// Configure resource options
 /// </summary>
 /// <param name="builder"></param>
 public override void Configure(ContainerResourceBuilder builder)
 {
     builder
     .Name("redis")
     .Image("redis:latest")
     .InternalPort(6379);
 }
Beispiel #4
0
 public override void Configure(ContainerResourceBuilder builder)
 {
     base.Configure(builder);
     builder
     .Name("nginx-sample")
     .InternalPort(80)
     .Image("nginx");
 }
 /// <summary>
 /// Configure resource options
 /// </summary>
 /// <param name="builder"></param>
 public override void Configure(ContainerResourceBuilder builder)
 {
     builder
     .Name("neo4j")
     .Image("neo4j:latest")
     .InternalPort(7687)
     .AddEnvironmentVariable("NEO4J_AUTH=none");
 }
Beispiel #6
0
        /// <summary>
        /// Configure resource options
        /// </summary>
        /// <param name="builder"></param>
        public override void Configure(ContainerResourceBuilder builder)
        {
            var name = "azurite_queue";

            builder
            .Name(name)
            .Image("mcr.microsoft.com/azure-storage/azurite")
            .InternalPort(10001);
        }
Beispiel #7
0
 /// <summary>
 /// Configure resource options
 /// </summary>
 /// <param name="builder"></param>
 public override void Configure(ContainerResourceBuilder builder)
 {
     builder
     .Name("postgres")
     .Image("postgres:latest")
     .Username("postgres")
     .Password(Guid.NewGuid().ToString("N").Substring(12))
     .InternalPort(5432);
 }
Beispiel #8
0
 public override void Configure(ContainerResourceBuilder builder)
 {
     base.Configure(builder);
     builder
     .Name("webapp")
     .InternalPort(80)
     .Image("nginx")
     .AddNetwork("demo-network");
 }
 /// <summary>
 /// Configure resource options
 /// </summary>
 /// <param name="builder"></param>
 public override void Configure(ContainerResourceBuilder builder)
 {
     builder
     .Name("minio")
     .Image("minio/minio:latest")
     .AddCmd("server", "/data")
     .Username(AccessKey)
     .Password(SecretKey)
     .InternalPort(9000);
 }
 public override void Configure(ContainerResourceBuilder builder)
 {
     base.Configure(builder);
     builder
     .Name("selenium-firefox")
     .InternalPort(4444)
     .ExternalPort(4444)
     .Image("selenium/standalone-firefox:latest")
     .AddVolume("/dev/shm:/dev/shm");
 }
 public override void Configure(ContainerResourceBuilder builder)
 {
     base.Configure(builder);
     builder
     .Name("nginx")
     .InternalPort(80)
     .ExternalPort(8080)
     .Image("nginx:latest")
     .AddVolume($"{Path.Combine(Directory.GetCurrentDirectory(),"test-volume")}:/usr/share/nginx/html");
 }
Beispiel #12
0
 public override void Configure(ContainerResourceBuilder builder)
 {
     base.Configure(builder);
     builder
     .Name("login-samples")
     .InternalPort(4200)
     .ExternalPort(4200)
     .Image("spcasquadron.azurecr.io/fusion-login-samples:v2")
     .Registry("myPrivate");
 }
 public override void Configure(ContainerResourceBuilder builder)
 {
     base.Configure(builder);
     builder
     .Name("multi-port-test")
     .InternalPort(22)
     .AddPortMapping(29170)
     .AddPortMapping(29171)
     .Image("fredericbirke/test-image:latest");
 }
Beispiel #14
0
        /// <summary>
        /// Configure resource options
        /// </summary>
        /// <param name="builder"></param>
        public override void Configure(ContainerResourceBuilder builder)
        {
            var password = "******" + Guid.NewGuid().ToString("N");

            builder
            .Name("mssql")
            .Image("microsoft/mssql-server-linux:latest")
            .InternalPort(1433)
            .Username("sa")
            .Password(password)
            .AddEnvironmentVariable("ACCEPT_EULA=Y")
            .AddEnvironmentVariable($"SA_PASSWORD={password}");
        }
 /// <summary>
 /// Configure resource options
 /// </summary>
 /// <param name="builder"></param>
 public override void Configure(ContainerResourceBuilder builder)
 {
     builder
     .Name("mysql")
     .Image("mysql:latest")
     .AddEnvironmentVariable($"MYSQL_ROOT_PASSWORD={Password}")
     .AddEnvironmentVariable($"MYSQL_USER={User}")
     .AddEnvironmentVariable($"MYSQL_PASSWORD={Password}")
     .WaitTimeout(60)
     .Username(User)
     .Password(Password)
     .InternalPort(3306);
 }
Beispiel #16
0
        public override void Configure(ContainerResourceBuilder builder)
        {
            CreateAndTagImage().Wait();

            base.Configure(builder);
            builder
            .Name("local-demo-image")
            .InternalPort(80)
            .Image(LocalImageTests.LocalTagName)
            .Tag(LocalImageTests.LocalTagVersion)
            .CopyFileToContainer("appsettings.json", "/appsettings.json")
            .PreferLocalImage();
        }
Beispiel #17
0
 public override void Configure(ContainerResourceBuilder builder)
 {
     builder
     .Name("sftp-server")
     .Image("atmoz/sftp:latest")
     .Username(Username)
     .Password(Password)
     .InternalPort(22)
     .WaitTimeout(120)
     .AddKeyValue(WellKnown.DirectoryName, Directory)
     .AddCmd($"{Username}:{Password}:::{Directory}")
     .PreferLocalImage();
 }
Beispiel #18
0
        internal async Task StartAsync()
        {
            if (ResourceSettings.Type == ComposableResourceType.Container)
            {
                var builder = ContainerResourceBuilder.New();
                ResourceSettings.ContainerOptions.Configure(builder);
                BuildResourceInstance();
                Resource.SetEnvironmentVariables(EnvironmentVariables.ToList());
                await Resource.InitializeAsync();

                Exports = Resource.GetComposeExports();
            }
        }
Beispiel #19
0
        /// <summary>
        /// Initializes the resources
        /// </summary>
        public async virtual Task InitializeAsync()
        {
            ResourceOptions = new TOptions();
            var builder = ContainerResourceBuilder.New();

            ResourceOptions.Configure(builder);
            Settings = builder.Build();

            SetComposeVariables();
            OnSettingsBuilded(Settings);
            ValidateSettings(Settings);

            DockerConfiguration dockerConfig = Settings.DockerConfigResolver();

            Manager     = new DockerContainerManager(Settings, dockerConfig);
            Initializer = new ContainerInitializer(Manager, Settings);
            await Manager.CreateAndStartContainerAsync();
        }
Beispiel #20
0
        public async Task WaitAsync_Ready_IsReady()
        {
            //act
            Mock <IDockerContainerManager> managerMock = ArrangeContainerManagerMock();

            var initilizer = new ContainerInitializer(
                managerMock.Object,
                ContainerResourceBuilder.New()
                .WaitTimeout(7)
                .Build());

            // act
            Status result = await initilizer.WaitAsync(new OneThrowStatusProvider());


            // assert
            result.IsReady.Should().BeTrue();
        }
Beispiel #21
0
        public async Task WaitAsync_NotReady_Throws()
        {
            //act
            Mock <IDockerContainerManager> managerMock = ArrangeContainerManagerMock();

            var initilizer = new ContainerInitializer(
                managerMock.Object,
                ContainerResourceBuilder.New()
                .WaitTimeout(3)
                .Build());

            // act
            Func <Task> action = async()
                                 => await initilizer.WaitAsync(new NotReadyStatusProvider());

            // assert
            await action.Should().ThrowAsync <InvalidOperationException>();
        }
Beispiel #22
0
 public override void Configure(ContainerResourceBuilder builder)
 {
     builder
     .Name("ftp-server")
     .Image("fauria/vsftpd")
     .AddVariable(DynamicPort1VariableName, VariableType.DynamicPort)
     .AddEnvironmentVariable($"FTP_USER={Username}")
     .AddEnvironmentVariable($"FTP_PASS={Password}")
     .AddEnvironmentVariable($"PASV_ADDRESS=127.0.0.1")
     .AddEnvironmentVariable($"PASV_MIN_PORT={{{DynamicPort1VariableName}}}")
     .AddEnvironmentVariable($"PASV_MAX_PORT={{{DynamicPort1VariableName}}}")
     .AddEnvironmentVariable($"PASV_ENABLE=YES")
     .Username(Username)
     .Password(Password)
     .InternalPort(21)
     .AddPortMapping(DynamicPort1VariableName, DynamicPort1VariableName)
     .WaitTimeout(120)
     .PreferLocalImage();
 }
Beispiel #23
0
        public async Task WaitAsync_Ready_IsReadyAndConsumeLogsCalledOnce()
        {
            //act
            Mock <IDockerContainerManager> managerMock = ArrangeContainerManagerMock();

            var initilizer = new ContainerInitializer(
                managerMock.Object,
                ContainerResourceBuilder.New()
                .WaitTimeout(7)
                .Build());

            // act
            Status result = await initilizer.WaitAsync(new OneThrowStatusProvider());


            // assert
            result.IsReady.Should().BeTrue();
            managerMock.Verify(m => m.ConsumeLogsAsync(It.IsAny <TimeSpan>()),
                               Times.Once);
        }
        internal async Task StartAsync()
        {
            if (ResourceSettings.Type == ComposableResourceType.Container)
            {
                var builder = ContainerResourceBuilder.New();
                ResourceSettings.ContainerOptions.Configure(builder);
                BuildResourceInstance();
                Resource.SetEnvironmentVariables(EnvironmentVariables.ToList());

                // Give over the networks if resource is not generic
                if (!IsResourceGenericType())
                {
                    IList <string> networks = builder.Build().Networks;
                    Resource.SetNetworks(networks);
                }

                await Resource.InitializeAsync();

                Exports = Resource.GetComposeExports();
            }
        }
Beispiel #25
0
 /// <summary>
 /// Configure resource options
 /// </summary>
 /// <param name="builder"></param>
 public override void Configure(ContainerResourceBuilder builder)
 {
     builder.Name("generic");
     SetTcpStatusChecker();
 }
Beispiel #26
0
 public override void Configure(ContainerResourceBuilder builder)
 {
     base.Configure(builder);
     builder.Tag("alpine");
 }
Beispiel #27
0
 public override void Configure(ContainerResourceBuilder builder)
 {
     base.Configure(builder);
     builder.AddNetwork("demo-network");
 }
Beispiel #28
0
 /// <summary>
 /// Configures the resource
 /// </summary>
 /// <param name="builder">The builder.</param>
 public abstract void Configure(ContainerResourceBuilder builder);
Beispiel #29
0
 public void Configure(ContainerResourceBuilder builder, string httpStatusCheckPath)
 {
     Configure(builder);
     ConfigureHttpStatusChecker(httpStatusCheckPath);
 }
Beispiel #30
0
 public void Configure(ContainerResourceBuilder builder,
                       Func <ContainerAddress, CancellationToken, Task <Status> > statusChecker)
 {
     Configure(builder);
     StatusChecker = statusChecker;
 }