Deploying Laravel 5 & 6 to CloudWays using Envoyer

CloudWays has a super basic introduction to using Envoyer with CloudWays – but disapointingly it doesn’t actually cover any of the things specific to CloudWays. It’s just a generic introduction to a super basic deployment over SSH.

I’ve spent the best part of today getting things running, and wanted to share what I’ve done – to hopefully to help someone else, and also to request feedback from others.

I like automation, I don’t want to have to be doing things manually. That’s the purpose of Envoyer too. When I trigger a deploy in Envoyer, I expect my production site to be fully updated – composer, compiled assets, caches cleared, database migrated.

A little disclaimer

This process has been my attempt to set things up according to best practice. For me, best practice means automating as much as possible to eliminate human error (i.e. me forgetting to run something).

I’m setting this up in August 2019 – if anything doesn’t work well I’ll come back and update this blog (hopefully!). Otherwise please treat this as a suggestion, rather than something tried and tested. Likewise – I’d love your feedback or experiences in the comments below.

Deployment Hook Positions

Here are the Deployment Hooks I have setup, the content for each is in the table after. This one just shows where I’ve positioned each.

Clone New ReleaseBackup
Install Composer DependenciesInstall NPM Dependencies, Build Assets
Activate New ReleaseRebuild Cache, Migrate DatabaseReset App Permissions on CloudWays, Restart FPM on CloudWays
Purge Old Releases

Deployment Hook Content

NameRun AsScript
Backupmaster# Backup the current site, before doing anything.
# Uses package: backpack/backupmanager
cd {{ project }}/current
php artisan backup:run
Install NPM Dependenciesmastercd {{release}}
npm install
Build Assetsmastercd {{release}}
npm run production
Rebuild Cachemastercd {{release}}
php artisan clear-compiled
php artisan cache:clear
php artisan view:clear
php artisan config:cache
Migrate Databasemastercd {{release}}
# Migrate the database without asking us
# if we’re sure.
php artisan migrate -n –force
Reset App Permissions in CloudWaysmasterCURL command (see blow). It was very long and messy to paste in this table.
Restart FPM on CloudWays master# Envoyer can’t restart FPM with the CloudWays SSH user
# but we can easily do it using the API.
CURL command (see blow). It was very long and messy to paste in this table.

Don’t forget to tick the “On Servers” box for each one, too.

Which user to deploy as?

One of the issues I’m trying to overcome is the occasional permissions issue I get in cache (especially template) files on CloudWays. Because I’m compiling my assets as the “master” user, but Apache is running them as the “application” user.

I started of trying to run everything as the application user. But that user cannot run npm properly (permissions issues creating ~/.npm).

I also tried to get the application user to build the assets and do the cache clearing – but again I was getting permissions issues and errors. I presume that’s something to do with the locked down users CloudWays configures.

So in the end – I’m running everything as the master user.

Using the CloudWays API

The CloudWays API is very simple to use, I used the Playground (don’t forget to Authourize with the button in the very top right) to generate the CURL call needed. Heads up: the Bearer header is not your API token, but is created when you authourise on the API Playground.

Grab the Server ID and Application ID by loading the CloudWays platform page and getting the numbers from the ID.

CloudWays API Command to reset file permissions

Since I’m trying to avoid file permissions issues (caused by compiling things or clearing caches as the master user, but serving them as the application user) I opted to run CloudWays’s File Permission Re-setter tool after every deploy.

curl -X POST –header ‘Content-Type: application/x-www-form-urlencoded’ –header ‘Accept: application/json’ –header ‘Authorization: Bearer YOUR_API_TOKEN’ -d ‘server_id=YOUR_BEARER_ID&app_id=YOUR_APP_ID’ ‘’

CloudWays API Command to restart FPM

Envoyer can’t restart FPM over SSH because CloudWays doens’t let us sudo. But we can do it with the API instead. Make sure you’ve got the correct PHP FPM version. Use the /service/get method to check what it should be.

curl -X POST –header ‘Content-Type: application/x-www-form-urlencoded’ –header ‘Accept: application/json’ –header ‘Authorization: Bearer YOUR_BEARER_TOKEN’ -d ‘server_id=YOUR_SERVER_ID&service=php7.3-fpm&state=restart’ ‘’

Change Log


  • Changed page title to include Laravel 6 – which I’m now using.
  • Moved “Build Assets” from “Before Activate New Release” to ” Before Install Composer Dependencies” to resolve “Mix Manifest not found” error.
  • Moved “Install NPM Dependencies ” from “After Install Composer Dependencies” to “Before Install Composer Dependencies” because it has to come before “Build Assets”

Comments, Suggestions, Feedback

As mentioned above, this is a voyage of discovery for me. Hopefully it’ll run smoothly going forward. I’ll definitely be adding to it (I intend to setup the Laravel Job Queue at some point).

Please share below any experience or suggestions you have. I struggled to find any detailed articles addressing this so hope to create one.


A Humanist Chanukah

I am by no means an authority on Humanism, I’ve met a few inspirational people who have been working on it for a lot longer than myself. However I’ve found it hard to find drop in alternatives to some of my families usual traditions. Rather than reinvent the wheel every year, I’m going to start writing them down – and doing so publicly so that others can comment and improve on them and perhaps find easy god-free ways to mark the passing seasons with their friends and families too.

What is Chanukah all about?

The first thing we need to do is figure out what Chanukah is about, why do we get together every year to light candles eat particular food? Some of these traditions will be specific to my personal preferences, my family, my community, my country and my ancestors traditions. Yours will probably differ – but that’s the joy of variety.

On Chanukah we:

Light the Chanukiah:

  • To count the days/mark the passing of time.
  • For an excuse to get together every day for a week (especially now that most of my siblings are living in difference places)
  • Because lights are pretty
  • To cheer us up at what can be a down-trodden time of year (it’s getting colder, it’s getting wet – but we’re not quite remembering our coat every time we leave the house).

Decorate the house – especially with lights

By the time Chanukah comes around, it’s usually dark when we leave work. It’s also dark when we get out of bed. Humans like daytime, we’re not nocturnal creatures. Brightening up our house – especially on the outside – is almost like saying “It’s dark, we might have street lights to see the path – but lets add colour to make us happy too”. We’re turning the darkness into happiness.

Give Presents

Because the giving and receiving of gifts is nice. Gift giving on Chanukah has actually become less central to my family as we’ve got older.


The playing of Deeidel traditionally stems from when the Jews were prohibited from teaching Torah under the Greeks they would hide out in the forest to study Torah – if the Greek patrols came around they’d hide the learning materials and pull out spinning tops – pretending they were just playing with them.

Later on the Dreidel was incorporated into the Chanukah traditions and the letter was added to relate it to the Miracle of the Oil. This is inherently problematic for a humanist Chanukah which is trying to avoid the supernatural.

The tradition of gambling on Chanukah seems to stem from the Dreidel – rather than anything else. Gambling always starts with hope – even though you know that hope is usually not going to come about. This could tie in nicely with an idea that the story of Chanukah is about fighting for what you believe in – and of being hopeful but realistic.

Humanist Chanukah Ceremony

With all that in mind, perhaps we’re ready to put some words down.

Welcome to Chanukah

Chanukah is the Jewish festival of light. As the nights get longer and the days get colder it can be easy to contrast this season with the warm and bright summer which suddenly seems so long ago.

Spring might be only a few months away, but those months will be filled with not-enough-jumpers, forgotten rain coats and slippery pavements.

Festival of Light

As an antidote to this downtrodden time of year we try to bring more light into the world. We decorate our homes – inside and out. We make an extra effort to see our friends and families – to bring light into our hearts, but also to connect with them in advance of the tough season ahead – a season when many people struggle with ill health, cold houses, tough transport and isolation. It’s a chance to remind us of who we have, and to remind others that they can call on us if they need any assistance.

A Story of Hope

The story of Chanukah tells of a small band of people fighting for what they believe in against a great and mighty foe.

The tale goes that King Antiochus destroyed the second temple and outlawed Judaism. The Jews fought for a couple of years to take back their temple – eventually winning! They rededicated the temple – the Hebrew word Chanukah means Dedication – and their culture survived.

The world today is full of so many rights, but also so many wrongs and we often feel helpless. Sometimes the biggest contributions we can make might still seem tiny in the grand scheme of things.

Even if I wasted nothing; travelled and ate responsibly; and considered the impact of my choices – would the world notice the impact?

No – it probably wouldn’t but if we were one of a thousand other people doing the same then the collective impact will all add up.

The Story of Chanukah is one of hope in the face of big issues, so whether you’re fighting to end animal cruelty, reduce environmental damage, to care for the needy or for a more just world – whatever your good fight is don’t give up on it.

Lighting the Lights

We’re now going to light the Chanukiah. We’ll be lighting all 8 branches because today is the 8th day of Chanukah. Once they’re lit, I’d like to invite you to spend some time enjoying their light and their warmth and to remember this moment when the whole world seems to be dark and cold.

Light the candles


Why turning the lights off matters

This article was making the rounds on Social Media this afternoon, and I felt the desire to respond. Why Jewish Environmentalism is Pretty Useless
I was once asked what difference I thought I was making on my own, it’s not like I’m out converting 1,000 people to veganism – now that would make a real difference.
But for every 1 person converting 1,000 – there are 1,000 people quietly getting on with being a vegan. I was one of them.
The article seems to say that our individual actions don’t make a real difference, what we need is a change in society. Yet he then suggests that a change in society starts by talking to our neighbours – who are individuals.
I don’t agree with the sentiment, if our Synagogues work on helping our congregates to live sustainable lives, and churches, mosques, councils, scout groups and drinking buddies work with their communities then we’ll soon have a change in society.
The change, as I see it, is not that we need to be “more environmentally friendly” it’s that we need to stop only considering the financial and personal value of something. The race to the lowest price is why people choose unsustainable over sustainable, shop in supermarkets, buy electricity from coal.
Humans are lazy and averse to change, our parents and peers grew up eating whatever they wanted, buying snazzy new gadget and recreationally shopping. None of those are sustainable, but they’re tasty and fun so what the heck?

Object to the Hasmoneon Development on Copthall Fields

The decision is now with the Mayor of London

If you’d like to object to the planning application to build on the Copthall Fields (please do!) this is what you need to do, since Barnet (narrowly) approved it – it’s now with the mayor.

Click here to open your email client with the below details pre-filled.

Send your email:

To: [email protected]

CC: Andrew Dismore <[email protected]>

Subject: Objection to planning application Ref: 16/6662/FUL Hasmonean High School 2-4 Page Street London NW7 2EU

Body: In the body explain why you’re against.

Email Body Tips

Format your email body like this:

  1. A nice formal greeting. “To whom it may concern” or “Dear All”
  2. A sentence or two about who you are and your connection to the field. (e.g. a local resident, someone who explores London’s green spaces etc).
  3. List your reasons for objecting (only some things can be considered – pick them from the document below).
  4. Thank them for their time, and perhaps say you’re looking forward to their decision.
  5. Sign off with your full name and address (required, without your name and address the objection can’t be used).

You can only object on certain grounds, use this easy guide to see what you can object based on. You don’t need to write much, just mention why you’re objecting.

Do this soon! The mayor only has another week or so to respond.


Share this page with anyone you know who would value keeping places like this available to the public. Talk to your friends and neighbours.

Contact the local group of residents to see how you can help further:



Draft: Coder requests for Graphic Designers / How to design for code

WORK IN PROGRESS – this is a work in progress, if you have anything to add let me know here:  contact me!

Design is important, really important. Making things look right has an incredible impact on how visitors use our creations.

But not all design is essential, and not all styles are fixed.

Over many years of coding designs from mockups I’ve come across many habits graphic designers have which are very complicated to code.

So in my quest to ease Designer/Develoepr relations I’m compiling here a list of tips for designers to help them create designs which are easy (or not very messy) to code.

Naturally, if a design is wanted it can be coded. The Internet is magical like that – but if it doesn’t really matter if the logo is 2% larger on tablets than mobiles, lets keep them the same and keep the code sane.

Do use Rows

Everything on the web is either a rectangle or sits inside a rectangle.

You cannot see the rectangles which are responsible for layouts, but they’re still there. Making them overlap is possible, but not easy to do right.

Keeping things aligned in these invisible rows and columns makes coding life much easier.

Don’t make small changes

Every tiny visual change requires code to make the change and define when or where to apply the change. Having a button be 3px taller on the newsletter signup form than on the contact form requires about an extra 6 lines of code.

Don’t mix percentage and fixed widths

Having the form-labels be a fixed 150px wide and the form element take up the rest of the page is not fun to make happen in code. Either use percentage widths, or use fixed widths (which can be defined differently at different overall widths, but see “Don’t make small changes” above.


Pixel Density vs CSS

Pixel Density. This post is part sharing my research over the past few weeks, and part continuing it by requesting your feedback in the comments below.

Years ago everyone got excited for Retina and it’s high density pixels. Now every smart phone has it’s own configuration all the up to a Sony with 806ppi (a PC monitor usually has 72px).

The question is – how do we accommodate this so a phone can look awesome and a PC can still load fast and efficiently.


The real answer, it seems, is to use vectors wherever possible. SVG support is here in all recent versions of all major browsers. Perfect for icons and fancy elements.

HTTP2 Push means we don’t even need to sprite them, but you still can if you wish.

Fonts are vectors, CSS is all vectors. Looking good.


For bitmaps – photos and graphics – we have srcset so we can tell the browser which sizes of the image are available, and let the device pick the best size (based on pixel density, network speed, user preference – amazing!). Srcset works everywhere except IE (but srcset falls back to the old src way anyway, so no difference).

The PX Value in CSS

The big question is what do we do with “px” values in CSS – which are increasingly meaningless. They could just become an arbitrary CSS value which devices calculate against their Pixel-Ratio and that may well work forever.

Another possibility is do we use Viewport values for everything – one viewport value is 1% of the width or height of the viewport. It’s an exciting new value!

And guess what? Viewport Units are already widely supported!


In short: The situation is pretty great  🙂 The PX value is probably going to stick around for a bit (unless I’ve totally missed something) but devices know that and they’re happy to accommodate you for now.

Other Questions?

If you have other comments, or questions, leave them in the comments below.



What Minimum Screen Size for Responsive Sites?

Until recently I’ve been testing responsive sites down to 320px out of habit but without really knowing whether it’s worth the effort. After all, Bootstrap 3 only has media queries down to 768px and Bootstrap 4 will be 34em (roughly/often 544px).

So should we bother optimising responsive websites for 320px, 480px, 768px or bring back the 1990s with Best Viewed in 800×600

I had a play with some stat from to find out.

My Process

  1. Show Screen Resolutions for the 12 months up to June 2016.
  2. Filters it for data for the UK (since most of my sites are mostly visited by people in the UK)
  3. Delete all screen resolutions wider than 1000px.
  4. Combine the matching widths – ignoring heights.
  5. Plot them on a graph

The Graph

The graph has two lines – one for individual market share and one for accumulative market share (i.e. how many people have 800px or smaller).

The aim was to find where the browser width jumps to a notable proportion.


The Results

The results are fascinating! 2.5% of visits come from a browser less than 720px wide but 15% have a screen bigger than that – and nearly double that have at least 800px.

The case for a minimum 720px Width

What to optimise for depends on your market – if you’re happy with 2.5% of your visitors getting frustrated that your site does not work – then don’t bother with less than 720px.

The case for a minimum 320px Wide Responsive Site

Optimising for 320px instead of 360px will only help 0.12% (one person in every thousand) use your site better – for a small business website getting 75 hits a day that’s one person every fortnight who’ll have a less than optimal time on your site.

Finding out who (or what, if they’re bots) are using very narrow screens would also be interesting. Are these bots, browser bugs or perhaps people just making a window smaller to get it out the way for a while? If they’re not your target audience, you can forget them and spend your time making the wider-screen experience excellent.

Raw Data

If you want to have a play yourself, here’s the data formatted as CSV:

Screen Width,Share %,Accumulative Share %


I’m not statistician and other interpretations of these results might be useful. If you have any feedback or other thoughts – let me know in the comments below.


WordPress Shortcodes for Website Editors

Overview of Shortcodes

WordPress Shortcodes are snippets of code which WordPress turns into more advanced things. For example the gallery shortcode is very simple in the editor, but turns into a complicated bunch of code for displaying many images.

A basic shortcode is a word wrapped in square brackets, like this:


Simple Shortcode

A shortcode to display the most recent posts might look like this:


you can put that anywhere you like in your post body and when you view it on the front-end of the website it’ll display a list of recent posts.

Closing Shortcodes

Some shortcodes can be wrapped around some text, for example a shortcode might make a paragraph stand out and flash. In this case you put the usual shortcode form above before the content, and a repeat of it but with a forward slash added after the first square bracked after the content.

[stand_out_and_flash]This is the content[/stand_out_and_flash]

The shortcode will then generate some code to go before and after the content – in this case to make it stand out and flash.

Shortcode Settings

A shortcode can also have settings – this lets you use the same shortcode in different places but with different results. Taking the example of the recent-posts shortcode above we might want to choose how many of the most recent posts to show. We do this by adding a space after the shortcode name, followed by the setting name, and equals and then the value – followed by the closing square bracket.

You can add as many settings as you like (as long as the shortcode supports them) by repeating the format.

If the value of the setting contains a space (or some other special characters) you need to put it in quotes (you can put all values in quotes if you prefer too).

You don’t repeat the settings in the closing shortcode (E.g. the [[/stand_out_and_flash]] – they are always just a forward slash followed by the shortcode name.

Here are some examples:

[recent-posts count=10 order="oldest first"]
[recent-posts count=5]
[stand_out_and_flash flash_speed=fast] This will flash really fast[/stand_out_and_flash]

Have any questions or tips about Shortcodes? Ask in the comments below.


Download MyDefrag-v4.3.1.exe

One of my favourite defragmentation tools MyDefrag (formerly known as JKDefrag) has long ago stopped development and recently the website has also gone down. However the software is still fully functional and as useful as the day the bread was baked.

MyDefrag was maintained for years as an excellent, free defragger. It’s essentially feature complete and just kept on ticking, but after a problem with the hosting Jereon decided to let the site close.

In his final post on the former official MyDefrag forum he said he hopes that free software download sites keep serving it up for download – I’ve not found it terribly easy to find so I’m hosting my own mirror here for my own benefit and yours.

Download MyDefrag

MyDefrag Download Verification

You can pop the download URL into to do an online-virus scan for some reassurance:

  • EXE:
  • ZIP:

Unfortunately I have no other way to prove that the exe is not the original and untouched download from the original site (I made the zip myself) – since there isn’t a checksum listed and available via You’ll just have to take my word for it I’m afraid. I’m hosting a MyDefrag download because I love the software, use it frequently (and recommend it in my guide to cleaning your own computer)

Thanks Jereon!

This feels like an appropriate place to put a sincere thank you to Jereon for his years of time and effort to make MyDefrag! The donate button has died with the website, if you didn’t have a chance to donate before and find a way for people to donate now let me know in the comments so we can keep the money-sharing-love alive.


Kindu Klub Collection

At the end of this month I’ll be going to Ethiopia to spend a couple of weeks with a youth group who work with children in Gondar to support them through life and school.

It’s a super project, you can read more about them here:

I’m also in the process of trying to get in touch with some Scouts over there too!

Love Football?

One of the things the children love most is a passion shared by many here in the UK too. Football!

If you have any spare football related items in need of a very worthy new home please let me know! The club are trying to setup a football team and could really use some football shirts, boots or other clothes.

Not into Football?

If your wardrobe, like mine, isn’t packed full of old football stuff it would also be really useful for me to take any of your spare:

  • Laptops – help share the joys and opportunities of IT and the Internet
  • Shoes – Of any shape, size or colour
  • Hygine Stuff – New/Spare Tooth Brushes, toothpastes, flannels, towels etc

Already Decluttered?

Good for you for not keeping stuff you don’t need! If you’d still like to help, you can donate some cash which I’ll pool together to purchase the items most required!
Please get in touch if you have anything you can offer and we’ll work out drop offs or collections!

All the little things from all the good people will add up to make a difference 🙂