Randomdevops
Joined 3 years ago
Joined 3 years ago
" Dependency Management
Standing up a service typically also means standing up a series of related services. If an application has dependencies on other applications, wouldn't it be nice if those dependencies (and any transitive dependencies they may have) were automatically instantiated by the cluster-management system? "
I haven't quite wrapped my head around Nix yet, but https://hydra.nixos.org/build/203347995/download/2/manual/#e...
### Databases
zipcodes = {
name = "zipcodes";
pkg = customPkgs.zipcodes;
dependsOn = {};
type = "mysql-database";
};
...
### Web services
ZipcodeService = {
name = "ZipcodeService";
pkg = customPkgs.ZipcodeService;
dependsOn = {
inherit zipcodes;
};
type = "tomcat-webapplication";
};
...
And then in the ZipcodeService you can access your dependency attributes
https://hydra.nixos.org/build/203347995/download/2/manual/#e... contextXML = ''
<Context>
<Resource name="jdbc/ZipcodeDB" auth="Container" type="javax.sql.DataSource"
maxActivate="100" maxIdle="30" maxWait="10000"
username="${zipcodes.target.container.mysqlUsername}" password="${zipcodes.target.container.mysqlPassword}" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://${zipcodes.target.properties.hostname}:${toString (zipcodes.target.container.mysqlPort)}/${zipcodes.name}?autoReconnect=true" />
</Context> 3
'';
Still wondering if the 'zipcodes.target.properties.hostname' is a fixed schema that could be validated or if it is just a map...So yeah it looks like I'm searching for what they describe as a 'services-model' where as docker compose is what they describe as a 'deployment model'...
Their idea of always doing a new deployment and leaving the old versions running, so you can always do a rollback is interesting.
Clicking together some apps in a GUI is nice for some random tests, but I want some kind of manifest that can be promoted between environments.
A few labels and magic!
As for Kubernetes, developers currently don't run it locally, they just run the app/apps they're developing from their IDEs and connect to a 'build' environment for the other services/databases (far from ideal)
So say the application is compromised, it can't connect to the internet, from there it could only connect to the declared database and webservice. So those would need to have vulnerabilities too that could be exploiting from that end, hence limiting the blast radius.
So not really worried about physical access, but more in the lines of a RCE(Spring4Shell) probing the rest of the network or a supply chain attack that tries to send out data...
But imagine the complete deployment looks like 2 monoliths, a dozen supporting webservices, 3 databases, redis, an elasticsearch cluster, ActiveMQ and a mailserver.
Then for a development track you only want to run monolith A (cost/resources/startup time) and the mailserver being MailHog so you don't accidentally send something to real addresses.
But you can't just split the 2 monoliths in separate compose files, as they share services/dbs. If you did that you would have to wire them in manually.
For local development you might only want to run webservice B (which has a db and redis as dependencies)
And indeed if you try to manage several files that need to be combined in a specific way things gets messy...
So then things seems to boil down to starting every service separately and relying on service-discovery, but then the lifecycle isn't tied together anymore. So if I want to tear them all down, how would I know which ones I spun up in this imaginary context?
Say I want to spin up an on demand integration environment for an application, what else do I start too?
Of course each implementation is opinionated, AWS for example is deploying to ECS with ALBs.
And it is all good for a list of services, but when you add configuration it becomes a mess:
So now you can no longer use your neat docker-compose file to deploy locally on your docker as it is referring to an external secret.So to keep the interface clean you would need to split it up in a Service model and a Deployment model that exposes the needed configuration for the target platform plus the service configuration for the specific environment.
Or something...
Thinking of something generic that works in all cases is hard and complex...and opinionated hence the many platforms, I think.
I posted this a while ago https://news.ycombinator.com/item?id=34225669