use of org.platformlayer.ops.networks.PublicEndpoint in project platformlayer by platformlayer.
the class MemcacheServerController method addChildren.
@Override
protected void addChildren() throws OpsException {
MemcacheServer model = OpsContext.get().getInstance(MemcacheServer.class);
InstanceBuilder instance = InstanceBuilder.build(model.dnsName, this, model.getTags());
// TODO: Memory _really_ needs to be configurable here!
instance.publicPorts.add(MEMCACHE_PORT);
instance.minimumMemoryMb = 1024;
instance.hostPolicy.allowRunInContainer = true;
addChild(instance);
instance.addChild(PackageDependency.build("memcached"));
MemcacheTemplateModel template = injected(MemcacheTemplateModel.class);
instance.addChild(TemplatedFile.build(template, new File("/etc/memcached.conf")));
// Collectd not restarting correctly (doesn't appear to be hostname problems??)
// instance.addChild(CollectdCollector.build());
{
PublicEndpoint endpoint = injected(PublicEndpoint.class);
// endpoint.network = null;
endpoint.publicPort = MEMCACHE_PORT;
endpoint.backendPort = MEMCACHE_PORT;
endpoint.dnsName = model.dnsName;
endpoint.tagItem = model.getKey();
endpoint.parentItem = model.getKey();
instance.addChild(endpoint);
}
instance.addChild(ManagedService.build("memcached"));
}
use of org.platformlayer.ops.networks.PublicEndpoint in project platformlayer by platformlayer.
the class NginxServiceController method addChildren.
@Override
protected void addChildren() throws OpsException {
NginxService model = OpsContext.get().getInstance(NginxService.class);
InstanceBuilder instance = InstanceBuilder.build(model.dnsName, this, model.getTags());
instance.hostPolicy.allowRunInContainer = true;
instance.publicPorts.add(80);
instance.publicPorts.add(443);
addChild(instance);
instance.addChild(PackageDependency.build("nginx"));
instance.addChild(NginxServerBootstrap.build());
// Can't restart collectd
// instance.addChild(CollectdCollector.build());
instance.addChild(ManagedService.build("nginx"));
{
PublicEndpoint endpoint = injected(PublicEndpoint.class);
endpoint.publicPort = 80;
endpoint.backendPort = 80;
endpoint.dnsName = model.dnsName;
endpoint.tagItem = model.getKey();
endpoint.parentItem = model.getKey();
instance.addChild(endpoint);
}
{
PublicEndpoint endpoint = injected(PublicEndpoint.class);
endpoint.publicPort = 443;
endpoint.backendPort = 443;
endpoint.dnsName = model.dnsName;
endpoint.tagItem = model.getKey();
endpoint.parentItem = model.getKey();
instance.addChild(endpoint);
}
addChild(injected(NginxBackendConfiguration.class));
addChild(injected(NginxSites.class));
}
use of org.platformlayer.ops.networks.PublicEndpoint in project platformlayer by platformlayer.
the class MysqlServerController method addChildren.
@Override
protected void addChildren() throws OpsException {
MysqlServer model = OpsContext.get().getInstance(MysqlServer.class);
InstanceBuilder instance = InstanceBuilder.build(model.dnsName, this, model.getTags());
// TODO: Memory _really_ needs to be configurable here!
instance.publicPorts.add(3306);
instance.minimumMemoryMb = 2048;
instance.hostPolicy.allowRunInContainer = true;
addChild(instance);
{
PackageDependency serverPackage = instance.addChild(PackageDependency.build("mysql-server"));
// mysql-server-5.1 mysql-server/root_password_again password
// mysql-server-5.1 mysql-server/root_password password
// mysql-server-5.1 mysql-server-5.1/start_on_boot boolean true
// mysql-server-5.1 mysql-server-5.1/postrm_remove_databases boolean false
// mysql-server-5.1 mysql-server/error_setting_password error
// mysql-server-5.1 mysql-server-5.1/nis_warning note
// mysql-server-5.1 mysql-server-5.1/really_downgrade boolean false
// mysql-server-5.1 mysql-server/password_mismatch error
// mysql-server-5.1 mysql-server/no_upgrade_when_using_ndb error
// We need to install with a default password, which we then change
String plaintextPassword = DEFAULT_BOOTSTRAP_PASSWORD.plaintext();
serverPackage.addConfiguration("mysql-server-5.1", "mysql-server/root_password", "password", plaintextPassword);
serverPackage.addConfiguration("mysql-server-5.1", "mysql-server/root_password_again", "password", plaintextPassword);
}
// TODO: Is there a window of vulnerability when first booting a machine?
// Do we need to secure it so that mysql doesn't listen remotely initially (or isn't running)?
// Maybe use mysql-server-5.1 mysql-server-5.1/start_on_boot boolean true
instance.addChild(PackageDependency.build("mysql-client"));
instance.addChild(MysqlServerBootstrap.build());
instance.addChild(SimpleFile.build(getClass(), new File("/etc/mysql/conf.d/bind_all.cnf")));
instance.addChild(SimpleFile.build(getClass(), new File("/etc/mysql/conf.d/skip_name_resolve.cnf")));
// Collectd not restarting correctly (doesn't appear to be hostname problems??)
// instance.addChild(CollectdCollector.build());
{
PublicEndpoint endpoint = injected(PublicEndpoint.class);
// endpoint.network = null;
endpoint.publicPort = 3306;
endpoint.backendPort = 3306;
endpoint.dnsName = model.dnsName;
endpoint.tagItem = model.getKey();
endpoint.parentItem = model.getKey();
instance.addChild(endpoint);
}
instance.addChild(ManagedService.build("mysql"));
}
use of org.platformlayer.ops.networks.PublicEndpoint in project platformlayer by platformlayer.
the class SystemAuthServiceController method addChildren.
@Override
protected void addChildren() throws OpsException {
// int port = PORT;
// String dnsName = model.dnsName;
InstanceBuilder vm;
{
vm = InstanceBuilder.build(model.dnsName, this, model.getTags());
// vm.publicPorts.add(port);
vm.hostPolicy.configureCluster(template.getPlacementKey());
// TODO: This needs to be configurable (?)
vm.minimumMemoryMb = 2048;
addChild(vm);
}
{
SystemAuthInstall install = vm.addChild(SystemAuthInstall.class);
}
{
SystemAuthInstance service = vm.addChild(SystemAuthInstance.class);
}
{
PublicEndpoint endpoint = vm.addChild(PublicEndpoint.class);
// endpoint.network = null;
endpoint.publicPort = BACKEND_PORT;
endpoint.backendPort = BACKEND_PORT;
// endpoint.dnsName = dnsName;
endpoint.tagItem = model.getKey();
endpoint.parentItem = model.getKey();
endpoint.transport = Transport.Ipv6;
}
loadBalancing.addHttpSite(this, model, model.dnsName, template.getSslKeyPath(), SslMode.Tunnel);
}
Aggregations