Sections
Adventures with Docker III: Nanoservices
[avatar user=”malm” size=”small” align=”left” link=”file” /]
The last couple of posts in the Adventures with Docker series have outlined how to create a cloud-based virtual machine (VM) and then construct a stack of linked Docker containers to hold a low-memory blank installation of WordPress within it. The next step is to configure that stack to restore its database and files from a known previous WordPress backup. Starting from our endpoint last week, we need to introduce one more container to house the volume holding our restore data. The same procedure was required when this blog was migrated from a colocated hosting environment to the Digital Ocean cloud using a fork of wordpress-backup container provided by @charltones. Before using this container we need to make a one-off backup at the source machine running the old blog taking copies of both the MySQL database and PHP files. Typically the MySQL database configuration lives in /var/www/html/wp-config.php and the WordPress PHP files at /var/www/html. It’s important to ensure that the backup adheres to the same format adopted by the wordpress-backup image to ensure that the corresponding container restore script will work. So, assuming you have a shell in the source machine:
srcmachine$ tar --create --gzip -vv --directory="/var/www/html/" --file="/backups/backup_0.tar.gz" "./" srcmachine$ mysql --add-drop-table -u<username> -p <database> --password=<password> | bzip2 -c > /backups/backup_0.sql.bz2
Once we have the backups in place on the source machine, we can copy them over to our target VM uas our data ‘seed’ for subsequent restore purposes. This can be done using scp on the target VM, thus:
tgtmachine$ mkdir /backups tgtmachine$ scp <user>@<srcmachine>:/backups/\{backup_0.tar.gz,backup_0.sql.bz2\} /backups
Now we can fire up the sequence of containers on our target VM to bring up a blank WordPress install exactly as outlined last week using the Docker command line tool from a Windows host environment as before. It’s important to get the username and password combinations right here – they need to match those used within the backup:
C:\> docker run --name mydb -e MYSQL_ROOT_PASSWORD=<mysqlrootpassword> -e MYSQL_USER=<username> -e MYSQL_PASSWORD=<password> -e MYSQL_DATABASE=<database> -d mariadb-lomem C:\> docker run --name mywp-fpm --link mydb:mysql -e WORDPRESS_DB_USER=<username> -e WORDPRESS_DB_PASSWORD=<password> -e WORDPRESS_DB_NAME=<database> -d wordpress-fpm C:\> docker run --name mynginx-fpm --link mywp-fpm:fpm -p 8080:80 --volumes-from mywp-fpm -d nginx-fpm
We then inject the additional wordpress-backup container into the mix and restore data from this backup container as follows:
C:\> git config --global core.autocrlf false C:\> git clone https://github.com/charltones/wordpress-backup C:\> docker build --tag="wordpress-backup" wordpress-backup C:\> docker run --name mybackup -v /backups:/backups --volumes-from=mywp-fpm --link=mydb:mysql -d wordpress-backup C:\> docker exec mybackup restore 0
This should yield the following output:
deleting files from /var/www/html/ restoring files from /backups/backup_0.tar.gz to /var/www/html restoring data from mysql dump file /backups/backup_0.sql.bz2
Now, finally, we should see the restored WordPress site appear the corresponding IP address on port 8080 supported by a stack of four linked Docker containers.
Learning about Docker over the last few weeks has helped me understand in a more hands-on way the promise this technology has. In a real sense Docker enables you to move from cooperating microservices to nanoservices linked but independently running within the same VM with separation of concerns. And those containers can be orchestrated on a mass scale and combined in very powerful ways with auto-scaling as outlined in this fascinating AdRoll tech article authored by Ville Tuulos. However, to use Docker ‘properly’ seems to require that you rearchitect your service to take advantage of the benefits. And use Docker Compose rather than a sequence of individual commands. It may, therefore, be more suitable for use on new initiatives than legacy environments.
Anyhow, that’s more than enough Docker for now.
Mobile Devices and Platforms
- Bloomberg provide a great insight into the origin and development of 3D Touch in the iPhone 6s highlighting the formidable cross-disciplinary engineering effort required to develop and integrate a feature this sophisticated and Apple’s uncompromising design approach:
Ive would rather be sentenced to life with a flip phone than subject his designs to focus groups, so when the company makes a change like 3D Touch, its business plan, basically, is to trust that he and his team are right.
- Last week, this blog outlined the potentially huge impact the introduction of an Apple subscription model could have on mobile industry dynamics suggesting that when rival OEMs clock onto the audacity of Apple’s plan, they will experience a private Kobayashi mug moment of their own.
- Noted journalist and Apple fan Walt Mossberg agrees in this Verge post in which he openly questions some basic assumptions about US network operators:
Why, in an era when networks are well understood and most components standardized, should handset makers be required to undergo onerous “certification” processes that allow carriers to demand changes to the design of their devices if they want to use them on the network?
- Earlier in the week what was purported Apple’s first Android app, “Move to iOS”, was released. It does what it says albeit badly and was caned in early reviews on Google Play Store in part because users felt cheated assuming they would get an iOS teaser on Android. In fact what they got was an app that sucks personal data out of Android and over to an iOS device. Later in the week9to5mac suggested it was built on a pre-existing white label solution called Copy My Data and not developed in-house by Apple. MacWorld outlined how the app works:
Move to iOS will transfer your Android device’s contacts, Gmail, photos, and other data in a few relatively simple steps. It works on any Android device running 4.0 or higher, and will move the data to any iPhone or iPad.
- React Native is a cross-platform JavaScript-based mobile development framework developed by Facebook which can be readily extended with native code. It’s key to their mobile ambitions moving forward and has been used internally in the company in production for over a year on iOS:
React Native brings what developers are used to from React on the web — declarative self-contained UI components and fast development cycles — to the mobile platform, while retaining the speed, fidelity, and feel of native applications.
- This week Facebook released an Android version and published an engineering blog article which described how they used it to build their first cross-platform React Native app, their Ad Manager, with “85% JavaScript code reuse” providing the following impressive visual comparison of the result:
- Profile of alternative Android platform player Cyanogen and its colourful CEO Kirt McMaster. Cyanogen seems the likeliest offering to disrupt the duopoly of iOS and Android and McMaster views his company’s mission as “building the next great smartphone OS“. Interestingly the company is closely linked to Microsoft with an apparent collaboration on deep integration of Cortana opening up the possibility of Windows Phone being replaced in the future by Cyanogen.
- The Nextbit Robin introduced here a couple of weeks ago is now available on Verizon for $349 pre-order. The product picked up over $1 million in funding via Kickstarter and generated lots of tech interest on account of its innovative “smart cloud storage” software which sounds like it had its origins in the Baton project started by some ex-Googlers.
- Mediatek ambitions in India depend on success with Micromax.
Apps and Services
- Wired on how WhatsApp serve 900 million users with just 50 engineers. Key parts of the answer are minimising distractions for engineers and using Erlang:
“Part of the trick is that the company builds its service using a programming language called Erlang. Though not all that popular across the wider coding community, Erlang is particularly well suited to juggling communications from a huge number of users, and it lets engineers deploy new code on the fly.”
- Interesting Bloomberg take on the trend to text based interfaces in part to counter “app fatigue” among smartphone users. Any similarity with traditional texting interfaces of days past ends there, though. Text 2.0 interfaces are typically powered by cloud-hosted artificial intelligence and machine learning. And presumably backend functional languages like Erlang and Scala. TNW highlight Facebook M as the canonical example of a “CUI”:
the development of what’s known as conversational user interfaces (CUI), whereby you use language through text input to engage with a computer, is more natural than the graphical user interface (GUI) of interacting with images on a screen.
It’s essentially a chatbot that assesses the best kind of company a user should work for using questions, powered by IBM Watson, to develop personality insights like culture fit and sentiment, for each user. The idea is that information gleaned from users can help them find the right cultural match in a future employer.
- Meanwhile for Bloomberg, savings promotion tool Digit serves as the canonical example of CUI in action:
Text messaging services can feel particularly intimate because they talk like humans. Digit users who type “thank you” after the software executes a command instantly get a “you’re welcome.” The barriers to using a new service are also lower, because there’s nothing to download.
- Fred Wilson sees services like M, Jobot and Digit as symptomatic of a wider return to prominence of the command line interface (CLI).
- Facebook want small businesses to use Facebook Pages rather than the hassle of hosting and supporting their own sites:
Call-to-action buttons bring a business’s most important objective to the forefront of its Page, whether it’s encouraging people to book an appointment or browse an online shop. And now, Page call-to-action buttons on mobile are more prominent, making it easier for businesses to use their Page to accomplish their goals.
- Good and reasonably balanced, overview to the current heated debate on ad blocking triggered by Apple’s decision to make it a key platform feature of iOS 9.
What is not in dispute is that if ad-blocking becomes ubiquitous (and there’s nearly every reason to think that it will be!) it will be devastating for publications who derive much or all of their revenue from advertising—which comprises most of the professional publications on the internet.
- A reckoning is clearly on its way. Apple’s introduction of ad-blocking has clearly undergone something of a backlash but even so the facts are that a growing number of users are fed up with ever more invasive ads and ad revenues are falling for many content providers like NYT. It raises the question as to what comes next after the ad-supported web content model:
- A great insight into what makes Slack work from the owner of design agency MetaLab reveals its “$2.8 billion secret sauce” to be nothing more than a combination of look, feel and goofiness:
In late 2013, Slack hired us to help them turn their early prototype into a polished product. We did the logo, the marketing site, and the web and mobile apps, all in just six weeks from start to finish. Apart from a few tweaks here and there, much of the product remains unchanged since the day we handed our designs off to the team at Slack.
The Internet of Things
- Veteran mobile device management solution provider Mformation was acquired by Alcatel-Lucent this week in a deal with undisclosed terms. It served as another reminder of the comi
- Why are people buying $17k Apple Edition gold watches “when they know they that the technology will be obsolete in 3 years“? Because they can. Like the Chinese owner of the dog that wears two of them:
- The work of UK innovator Andrew Fentem is of far greater significance and tech interest than a Chinese dog wearing two gold watches. His FlickPixels “Wallpaper for the Internet of Things” is now part of the UK Digital Catapult:
Artificial Intelligence and Robots
- This blog post courtesy of ayoungprogrammer.com outlines a machine learning model for reading comprehension complete with full source code implementation in just 343 lines of Python using NLTK. It illustrates how accessible this technology now is to reasonably competent software developers.
- Ironically, as this BusinessInsider article points out, the very engineers developing artificial intelligence will not be insulated from its effects as it becomes capable of developing and evolving its own software:
A person complemented with an intelligent system can write maybe ten times as much code, maybe a hundred times as much code. The problem then becomes you need a hundred times fewer human programmers.
- Salon.com published a gloomy assessment of the “turmoil” robots will wreak on current human employment arrangements. Taken from a book written by Stanford fellow and serial entrepreneur Jerry Kaplan the article emphasises that much of the debate remains fixated on like for like replacement of human factory workers. Many of remain unaware of the much deeper systemic changes that will result from process reengineering to remove humans from business workflows:
When most people think about automation, they usually have in mind only the simple replacement of labor or improving workers’ speed or productivity, not the more extensive disruption caused by process reengineering. That’s why some jobs that you might least expect to succumb to automation may nonetheless disappear.
- The Telegraph outline how all the world’s largest technology companies right across the globe are in a fierce race to develop a compelling virtual AI assistant to compete with human concierge services. The latest entry is Baidu with Duer. The endgame for all these giants is you:
Eventually, the virtual assistant that wins – and the company behind it – will know you better than you know yourself, so you can’t live life without it. That’s the ultimate prize.
- Popular Mechanics on the “campaign against sex robots” and the difficulty of being absolute when there is such a wide spectrum of possible instantiations. Gizmodo also have doubts about the viability of the campaign suggesting that human-bot relationships will be “normalized” by as soon as 2050.
- Ray Kurzweil outlines what will happen “after the technological singularity” in a video that has a curious retro-future feel to it already. The development of Computronium in case you’re wondering:
https://youtu.be/vtyGst3lYVo
Corporate Open Source Software
- Much coverage this week of a presentation given by Google Engineering Manager Rachel Potvin that estimated the quantity of source code the company uses: “2 billion lines sit in a single code repository available to all 25,000 Google engineers“. It’s a staggering number far beyond the volume of source the likes of Microsoft and Facebook manage. Google have had to develop their own internal version control system called Piper to handle it all. Even so, large scale collaboration on a massive shared codebase seems will be increasingly important aspect of software development in the future:
We’re moving toward a world in which we regularly collaborate on code at a massive scale. This is the only way we can keep up with the rapid evolution of modern Internet services.
- Microsoft meanwhile has developed its own version of Linux as part of its Azure proposition which is a statement many would never have imagined possible as little as 15 years ago. It’s a sign of how completely the OSS (open source software) model has won at least in terms of mindshare for large scale evolving platform development. Fortune provide further evidence of its importance in an article outlining the vital role OSS plays in supporting arch-proprietary platform giant Apple:
When prudent Apple starts betting its massive business on open source, it becomes pretty clear where the IT industry is headed.
Code Culture, Python and Tech Ed
- PyCon UK 2015 took place this week in Coventry, a fitting tribute to founder John Pinner who passed away earlier this year. It was by all accounts bigger than ever before with 100 children turning up to the Education session on the Saturday where sessions on Minecraft coding, AstroPi and “the Internet of Toys” all went down well. AstroPi in particular proved something of a revelation allowing the children to access a wide variety of sensors including humidity and accelerometer via Python and use them to display different LED colours on the output display. While “helping out”, I hacked the AstroPi setup to blinkenlights mode as follows:
- Simplified game development framework PygameZero proved to be another popular draw. It’s a project with growing momentum and relevance to the Educational Python scene. Here is the poster from the poster session run by its author @lordmauve.
- Another key message from PyCon UK was the importance of trying to transition from Python 2 to Python 3 if possible at least for new development. InfoQ provided a summary of the main features of its latest iteration, Python 3.5.
- Hackaday on visualising the Fourier Transform using circles.
- Nick Carr contrarian as ever reckons there should be a lot less focus on using computer technology to teach science and maths and more focus on paper-based methods. He cites evidence to back up his views:
- There was a lot of media coverage of the story of the 14-year old “clock kid” Ahmed Mohamed in the US which descended into an ugly scrap between so-called “truthers” claiming the clock was mediocre at best and a rip-off at worse and those who saw him as a tabula rasa for their own political agenda. The truth is probably in the middle somewhere and has been overshadowed somewhat in the fallout.
- Hackaday again on the rise of DIY fixit culture. Hacking and coding are increasingly eliding with mainstream. Viz this ad spotted on a South West train this week:
Corporate Innovation
- Apple car “will launch in 2019“ following business approval to commit on Project Titan. WSJ are claiming 1800 people will be hired to work on it. Once they’ve dealt with personal transportation they’ll move onto iTrain. Probably.
- Fascinating insight into the “winds of change” at UK pioneer Dyson and their ambitious attempt to “play catch up” and pivot into domestic robotics off the back of their Eye 360 smart vacuum cleaner:
Space
- Could life exist in a huge ocean of water beneath Saturn’s sixth largest moon Enceladus? The Telegraph outlines evidence suggesting it might.
- Breathtaking aerial tour of Pluto created from images provided by the New Horizons probe:
- This Guardian opinion piece casts a jaundiced eye over the current vogue for mega-rich entrepreneurs to get involved in space travel suggesting perhaps they’re gearing up to escape “offworld” and leave the rest of us behind in a miasma of pollution and depleted resources. Sound familiar?
Culture and Society
- Piggate dominated the news agenda this week with the unravelling story eerily similar to the plotline of the notorious National Anthem episode of Charlie Brooker’s memorable TV series Black Mirror. Among the deluge of online commentary reaction, Brooker’s tweet stood out:
Shit. Turns out Black Mirror is a documentary series.
— Charlie Brooker (@charltonbrooker) September 20, 2015
- Rob Fahey provided one of the most compelling analyses of an elite who hold each other in hock through shared transgression. It’s not a circle most of us would have much insight into – we went to the wrong schools and weren’t able to carouse safe in the knowledge that “if you call your dad he could stop it all.” Fahey provides in some ways the most enduring, and suitably course, image of the shabby affair:
The control exerted by elite networks is based on long-standing trust and loyalty, but also, in some cases at least, by a black and rotten heart of what is, in effect, life-long blackmail. Britain’s establishment, at least in part, can be visualised as a group of powerful men standing close together, each with the balls of the man next to him held in a powerful grip. Michael Ashcroft just squeezed, very publicly indeed;
- Fascinating NYT piece on Generation Z to whom Millennials will pass on their social baton. As a group they appear to be more sober and serious than their predecessors and more quietly ambitious entirely unsurprisingly given the media attention around the lucky unicorned few:
“Kids are witnessing start-up companies make it big instantly via social media,” said Andrew Schoonover, a 15-year-old in Olathe, Kan. “We do not want to work at a local fast-food joint for a summer job. We want to make our own business because we see the lucky few who make it big.”
- More post-hoc sanctification of gnomic Jobsianisms. The “simple revelation that changed Steve Jobs’ life” was that “the people leading the world — in business, politics, culture — are just people.” To be fair it is an important life lesson and one suspects Generation Z will learn it a lot more quickly than Generation X or Y did. Meanwhile the official trailer for the Sorkin-Boyle film has been released with Michael Fassbender playing a Steve Jobs spanning a number of his ages. It looks like it could be the definitive celluloid representation:
- Sometimes it’s best to just end with a thought on silence. This one is from Henry David Thoreau from the mighty Walden written over 150 years ago in an age when he couldn’t possibly have imagined the sort of communication possibilities Generation X and beyond have enjoyed:
If we would enjoy the most intimate society with that in each of us which is without, or above, being spoken to, we must not only be silent, but commonly so far apart bodily that we cannot possibly hear each other’s voice in any case. Referred to this standard, speech is for the convenience of those who are hard of hearing; but there are many fine things which we cannot say if we have to shout.