TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

12 Fractured Apps

146 点作者 kelseyhightower超过 9 年前

11 条评论

andrewguenther超过 9 年前
The article starts off by talking about trying to run legacy applications and then just casually tells you to modify the source code to solve all your problems. Not everything you want to run in a container is something which you want to modify.<p>Also, I really don&#x27;t see the problem with the volume mounting approach. It may look ugly on the command-line, but when you&#x27;re using an orchestration tool, it is actually quite painless and solves a lot of the issues mentioned in the article.<p>I do completely agree that one should completely avoid running a custom entrypoint. They are often written and then forgotten and can lead to really nasty bugs.<p>Lastly (this is more a Docker criticism, not the article) writing to stdout is all well and good, but Docker does a terrible job handling it. There is no way to truncate logs to stdout coming from a Docker container so Docker just holds onto the entirety of the log contents until the container is removed. For long running applications, this makes logging to stdout a deal-breaker. In a move absolutely contrary to my last point, I commonly use a custom entrypoint purely to handle logging. It passes all arguments to the application and then redirects stdout and stderr to cronolog which writes to a volume in my log pulling container.
评论 #10786734 未加载
评论 #10787310 未加载
Weizilla超过 9 年前
Two things which I never understood about using environment variables are how do you version control the changes and how do you manage these variables when you have more than just a handful of them?<p>In this example, it&#x27;s only six simple values but what happens when you have 10 or 20? Or you have 10 applications with six values each that need to be deployed to four different environments?<p>Or what about if there are multiple teams making concurrent changes at the same time? What if some application starts failing due to to a recent variable change and you want to revert back or track down who made the change?<p>I feel like once your application grows to more than just a few simple values, you end up creating a big file to populate these values and you end up back to using configuration files.
评论 #10786208 未加载
评论 #10786199 未加载
评论 #10786210 未加载
评论 #10789205 未加载
评论 #10786638 未加载
nzoschke超过 9 年前
Thank you for this guide Kelsey.<p>I worked with countless apps and developers at Heroku on getting their apps running well on the platform. There was always one great mystery: why not build our apps a bit differently (dare I say better) to work in the cloud?<p>The database connection pattern is spot on. For any network resource, try to connect and if there is a problem retry with back off.<p>Also log the connection error events that a monitoring tool can notify off of.<p>I&#x27;ve seen apps that have the absolute worst behavior around this error that will happen. The worst is crashing the app in a way that triggers thrashing around restarts.<p>We had to build tons of complex restart back off logic into the Heroku platform to handle this.<p>I often wish app frameworks made this easier. I think most devs don&#x27;t do these things because it is a chore for s problem that only happens occasionally.<p>But what if Rails baked this into ActiveRecord?<p>At one point Rails only logged to files on disk. We came together to add stdout logging to the framework.
评论 #10788834 未加载
merb超过 9 年前
Everything written in this article is easily done without docker. Just with groups &#x2F; systemd. Docker makes these things way harder to do. Especially since packaging isn&#x27;t so hard anymore. Mostly Dynamic Language&#x27;s are harder to package, but when I think about Java, Go or other compiled language&#x27;s you mostly could just create a single file which you could version.
jsnk超过 9 年前
This is an aside, but somewhat related.<p>Where are you suppose to store secretive environment variables like database password or apikey&#x2F;secret pair etc (say in Ubuntu server)? Is storing in something like ~&#x2F;.profile or ~&#x2F;.bashrc and doing `export SECRET_KEY=&#x27;plaintext_secret&#x27;` on the server enough, or should they be treated in an even more secretive manner?
评论 #10787288 未加载
allan_s超过 9 年前
How do you manage things like database schema (except by switching to schema-less database :) ), is it your software which is suppose to create it if non existing ?<p>In case the database is pristine, ok I see, I do a &quot;create table if not exist&quot;<p>But if the database is at version N and I want to go version N+1 , what do I do? I mean I do know about database migration tools, but how does it integrates in your &quot;pure 12factor&quot; deployement, as it means when you deploy you need to have at least this order:<p>1. bring up the database 2. run the migration script 3. bring up the application<p>and the article was advocating to make things in a way that you don&#x27;t need to have a &quot;you MUST first run this, then that&quot;
评论 #10787901 未加载
评论 #10791383 未加载
davidbanham超过 9 年前
At no point does the author elaborate on why failing to start if the environment isn&#x27;t sane is a bad thing. All my software checks for the things it expects to be in place, then bails hard and fast if they aren&#x27;t.<p>It&#x27;s then up to the init daemon to attempt to restart that process, and up to the monitoring and orchestration tools to ensure that the environment returns to sanity over time.
评论 #10787683 未加载
评论 #10787629 未加载
kazagistar超过 9 年前
There is one thing that really confuses me about 12 factor...<p>It suggests that you provide the locations of backing services in the config. This seems insane, since it means that you cannot move any backing services. Do they expect you to restart when you switch backing services? Do they expect you to run all your internal traffic through load balancers?<p>We provide each container with the address of the local service discovery server (Consul) and it finds what it needs itself, when it needs it. I assume everyone using this kind of setup in production is doing something similar?
评论 #10786189 未加载
评论 #10786648 未加载
评论 #10786324 未加载
评论 #10786408 未加载
jacques_chester超过 9 年前
&gt; <i>As you can see there’s nothing special here, but if you look closely you can see this application will only startup under specific conditions, which we’ll call the happy path. If the configuration file or working directory is missing, or the database is not available during startup, the above application will fail to start.</i><p>Why not let a PaaS do this for you? Heroku, Cloud Foundry, OpenShift or the others I&#x27;ve yet to learn about?<p>Disclaimer: I work for Pivotal who donate the majority of engineering effort to Cloud Foundry.
评论 #10787007 未加载
kimi超过 9 年前
Whaleware was created to address some of these issues with Docker. Default configuration, a definite application init phase, plus internal monitoring and lifecycle reporting. <a href="https:&#x2F;&#x2F;github.com&#x2F;l3nz&#x2F;whaleware" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;l3nz&#x2F;whaleware</a>
akramhussein超过 9 年前
If you haven&#x27;t seen Kelsey give a talk, well worth watching - really funny guy and intelligent. He gave one on Nomad and Kubernetes that&#x27;s good.