Week 38

Published on Author malmLeave a comment

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

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.

Inspired By The Usual Suspects - Kobayashi Porcelain Mug

  • 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?

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 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.

Robin

Apps and Services

“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.”

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.

jobot

  • 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.

Instead of functioning via a standalone app, the money-saving tool Digit uses text messaging to communicate with its customers.

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.

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.

Screen Shot 2015-09-14 at 5.20.48 PM

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

  • 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

  • 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.

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.

Don't Have Sex With Robots, Say Ethicists

  • 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.

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:

blinkenlights

  • 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.

pgzero

oecdmath2

  • 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:

photo2

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.

SWITZERLAND-AUTO-SHOW-US-INTERNET-APPLE-COMPUTERS

Space

Enceladus is now thought to have a global ocean

  • 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?

jeff bezos really proud

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:

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:

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.

Leave a Reply