StrayObject


Hi!

I'm Mike; I help startups and larger companies make their applications as good as possible.
Visit projects or about to learn more.

All Medium Twitter

2016-11-12 I just published “Don’t run composer in your app container…” https://t.co/C5X0rzC5fn

Don’t run composer in your app container…

2016-11-12

…run it in its own container!

I know, I know. Every service should have its own container. We all have heard it and we all aim for that utopia, but having limited time and resources we have to balance the cognitive load, complexity of such a system would have with what the team can realistically handle.
Having a development set up that runs a limited number of containers, one with minimal setup is always nice, however every time we internalize dependencies we are introducing change, we move further away from that ideal 1:1, production to development, environment parity.

With that in mind, rather than dropping a PHAR into a project container, or worse using one installed locally, a much better solution is to utilise a self-contained docker image. With that, assuming we start in the app folder on our dev machine all it takes to update dependencies is:

docker run --rm --name composer -v “$PWD:/app” composer/composer:alpine update

More options and info at docker hub.

EDIT: A friend of mine just pointed out that he wrote a short how to on this subject quite a while ago - and it’s much better. Head to his post for more indepth example of using dockerised composer taking into account user id and keys/tokens.

2016-10-28 hey @twitter seems adding phone number via android app v6.20.0 on Android 6.0 is not working. White screen and back to settings.

2016-10-27 I just published “SSL is hard (sometimes)” https://t.co/8yLcLhuwYS

SSL is hard (sometimes)

2016-10-27

TL;DR;

If you are getting error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
or server and client could not agree on the encryption method/cipher
the first thing you should check is permissions on every folder in the path you are reading both the cert and key from.

Backstory

I was testing a fairly simple setup, however, one however, where I’ve been using a mix of new technologies and it forced me to spend quite some time trying to figure out, what turned out to be a very simple issue.

What I wanted to deploy is a dockerised haproxy and a few containers with a small website I built using Aerys (amphp based server) with an automated certificate issuance via Let’s Encrypt. I know I could have used this awesome image to have scaling automated, but where would be the fun in that?
Instead I rolled out the default image read up on how to configure it and deployed the whole thing.
Rather than moving the auto generated key and cert to my project folder I left it where acme.sh has created it and just used that path in the server setup.

When testing with browsers I was getting a message that server and client could not agree on the encryption method/cipher, in both curl and openssl I was getting an error:

error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure

Having both, haproxy and aerys set up not to support sslv3 I was pulling my hair out as to what was going on. I reconfigured everything, ensured that both server and proxy is using the same cipher suite only to be met with the same error.
Not to bore you any further, it turns out that this is also a response to the situation where no key and certificate are available. A quick check of permissions on the default location was all that was needed. As soon as I fixed that everything was back to normal.

2016-10-24 I just published “Aerys/root() vs new Root()” https://t.co/SeUYxRfDAL

Aerys/root() vs new Root()

2016-10-24

For the past week or so I’ve been playing with Aerys and AMPHP in general.
Everything was going fine until I moves styles from a <style> tag into a css file. Basically, the css has been read but discarded. It took me a while to realise that the reason for this was the fact that the css file has been sent as text/plain and not text/css and why it was sent with that mime type.

Instead of instantiating the static file root object via a function call as per docs:

$docroot = Aerys\root(__DIR__ . “/public”);

I’ve done it with the good old fashioned new keyword:

$docroot = new Aerys\Root(__DIR__ . “/public”);

Quick check in the functions.php pointed me straight to the answer. The Aerys\root() function if not passed an options array is setting a path to mime types file. Because I instantiated the object myself, my $docroot was missing that and hence it was falling back onto a default type of text/plain. I rectified that and everything is working fine now.

$docroot = new Root(__DIR__.’/web’);
$docroot->setOption(‘mimeFile’, __DIR__.’/vendor/amphp/aerys/etc/mime’);

2016-10-22 https://t.co/QrLUXMBawR

2016-10-14 Even my #keyboard ain't happy. https://t.co/lWYSwxWUir

This is not the same number as above.

2016-10-12

This is not the same number as above.

2016-10-09 It seems that Tories are favouring planned economy now. Soon they will be telling people what jobs they must do. https://t.co/a9KlJwsaar

2016-10-09 "[...]foreign workers should not be able to “take the jobs that British people should do”[...]" I guess Mark Carney was first and last then.

2016-10-08 https://t.co/PoCsJsX3h1

2016-09-21 What It Costs to Run Let's Encrypt https://t.co/4CtZEqUCQa

2016-09-01 Applicable to any #programming language. “Line of sight in code” @matryer https://t.co/e6jpqQLJdX

I would have liked it better if you did not mention “net neutrality", because it clearly does not…

2016-08-11

I would have liked it better if you did not mention “net neutrality", because it clearly does not mean what you are trying to say.

Possibly the best thing I’ve read in a while.

2016-04-30

Possibly the best thing I’ve read in a while.

GoSublime error: MarGo build failed

2016-01-18

I’ve recently got back to learning GO and I was welcomed back by a frustrating issue related to my set up (Ubuntu+SublimeText3+GoSublime).

GoSublime error: MarGo build failed

I’ve read through and done what couple other people were suggesting might fix this, however, without success. In the end solution was simple and the culprit has been mentioned a bit further down in that error.

Cannot find GOROOT

All I had to do was to edit my user settings file for GoSublime and remove the line where I declared GOROOT from the env section of the settings file.

Take care,
Mike

Edit: Apparently, MarGo build failed issue has also been reported fixed by updating your version of GO to 1.5.2+ (mine is 1.5.1)