Commit 94d869ee authored by Mike Street's avatar Mike Street
Browse files

FE: Update to import script

parent 8fac904b
---
title: 10 Moments I Hate About Cycling
published: 2016-3-7
updated: 2017-5-3
tags:
- General
- Thoughts
- Cycling
---
A little while ago, Evans Cycles blogged [10 Moments Every Cyclist Hates](http://blog.evanscycles.com/other_stuff/10-moments-every-cyclist-hates/) and before I had even read the blog, plenty of moments popped into my head - but none of them were mentioned! Here are my top 10.
#### 10) When you don't head out on the Bike as you're not in the mood, then you regret it later in the day
When you wake up, its a little bit cloudy and you love the cocoon of the mattress so decide to stay in. Later on you are then itching to go out - but you have plans!
#### 9) When you don't know what to wear
Is it going to be hot? Windy? Cold? Raining? Longs? Shorts? Arms? Fingers? Finger-less?
#### 8) When you take your lid off, and have to put it back on with sweaty pads
I sometimes go out for a pre-work ride, cycling to work means I have to put a sweaty helmet back on.
#### 7) When you catch someone up going downhill, but don't quite have the speed or space to overtake
Touching the brakes, not quite getting terminal velocity and not quite getting your fastest time
#### 6) When your steed starts squeaking or rattling
You either put up with it or pull over every 5 minutes trying to work out where its coming from
#### 5) Cars & Traffic
They get in the way don't they? Cutting up, pulling out, going too slow (see 7 or 3). Also that moment when you overtake a bus, to then get overtaken, to overtake again...
#### 4) When you give it all you've got but its not...
When you sprint and try so hard to get your best time, but it only comes up 3rd best on Strava...
#### 3) When you build up momentum to attack a hill and have to slow down due to someone else
Starting up your legs again is a killer!
#### 2) When you drop your chain - especially on a climb
Having your chain drop in the middle of an ascent is the worst way to stop - especially if you're clipped in
#### 1) When you pull away but can't get your second clip in
Trying and trying, but it just won't go - especially a nightmare when its a hill!
A bonus one from [@frazz9](http://www.twitter.com/frazz9)!
---
title: 10 Moments I Hate About Cycling
date: 2016-03-07
updated: 2017-05-03
tags:
- General
- Thoughts
- Cycling
---
<p>A little while ago, Evans Cycles blogged <a href="http://blog.evanscycles.com/other_stuff/10-moments-every-cyclist-hates/">10 Moments Every Cyclist Hates</a> and before I had even read the blog, plenty of moments popped into my head - but none of them were mentioned! Here are my top 10.</p>
<h4>10) When you don't head out on the Bike as you're not in the mood, then you regret it later in the day</h4>
<p>When you wake up, its a little bit cloudy and you love the cocoon of the mattress so decide to stay in. Later on you are then itching to go out - but you have plans!</p>
<h4>9) When you don't know what to wear</h4>
<p>Is it going to be hot? Windy? Cold? Raining? Longs? Shorts? Arms? Fingers? Finger-less?</p>
<h4>8) When you take your lid off, and have to put it back on with sweaty pads</h4>
<p>I sometimes go out for a pre-ride work, cycling to work means I have to put a sweaty helmet back on.</p>
<h4>7) When you catch someone up going downhill, but don't quite have the speed or space to overtake</h4>
<p>Touching the brakes, not quite getting terminal velocity and not quite getting your fastest time</p>
<h4>6) When your steed starts squeaking or rattling</h4>
<p>You either put up with it or pull over every 5 minutes trying to work out where its coming from</p>
<h4>5) Cars & Traffic</h4>
<p>They get in the way don't they? Cutting up, pulling out, going too slow (see 7 or 3). Also that moment when you overtake a bus, to then get overtaken, to overtake again...</p>
<h4>4) When you give it all you've got but its not...</h4>
<p>When you sprint and try so hard to get your best time, but it only comes up 3rd best on Strava...</p>
<h4>3) When you build up momentum to attack a hill and have to slow down due to someone else</h4>
<p>Starting up your legs again is a killer!</p>
<h4>2) When you drop your chain - especially on a climb</h4>
<p>Having your chain drop in the middle of an ascent is the worst way to stop - especially if you're clipped in</p>
<h4>1) When you pull away but can't get your second clip in</h4>
<p>Trying and trying, but it just won't go - especially a nightmare when its a hill!</p>
<p>A bonus one from <a href="http://www.twitter.com/frazz9">@frazz9</a>!</p>
<blockquote class="twitter-tweet" lang="en"><a href="https://twitter.com/mikestreety">@mikestreety</a> you missed falling off because you don't take the correct foot out of your clips!<br>&nbsp;Katharine Matthews (@frazz9) <a href="https://twitter.com/frazz9/statuses/479722956772638720">June 19, 2014</a></blockquote>
<script async="" src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
<script async="" src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
\ No newline at end of file
---
title: 2017 in review
published: 2018-1-11
updated: 2020-1-20
date: 2018-01-11
updated: 2020-01-20
intro: It seems to be the done thing to do a "year in review" post. I initially scoffed at the idea, but the more I thought about it, the more I thought about how keeping track of accomplishments can be a little encouragement and ego boost. So here goes!
tags:
- General
......@@ -94,4 +94,4 @@ I also owned my Fitbit for the full year, so I was able to pull some stats, not
It is worth noting that when I cycle, my Fitbit does count steps, so it's not 100% accurate!
That's 2017 wrapped! What a fun & productive year it's been!
That's 2017 wrapped! What a fun & productive year it's been!
\ No newline at end of file
---
title: 2018 in review
published: 2019-1-8
updated: 2020-1-20
date: 2019-01-08
updated: 2020-01-20
intro: 2018 was a big year for me, in all sorts of ways. This blog post summarises one of the most life-changing years of my life.
tags:
- General
......
---
title: 2019 In Review
published: 2020-1-6
updated: 2020-1-27
date: 2020-01-06
updated: 2020-01-27
intro: 2019 was a strange year, new kitchen, bathroom car and bike. But overall it was good. I enjoyed it.
tags:
- General
......
---
title: 2020 In Review
date: 2021-01-07
updated: 2021-01-11
intro: 2020 brought the first pandemic of my lifetime, but plenty of good things too
tags:
- General
- Thoughts
---
2020 was an absolute bellend of a year. It will go down in history books and probably be taught in schools in years to come. 2021 isnt going to be much better, but at least those that make New Year's resolutions are going to be able to be more realistic, as they have acclimatised themselves to this new normal.
Word of warning: This post isnt really going to be an interesting/gipping/thrilling post. It is a place for me to gather my thoughts after a year and allow myself somewhere to create something to look back upon to reminisce. Also as a side-note, the date of the post is the last day of 2020 for organisational sake but I am writing this a few days into January.
## The pandemic
2020 saw the eruption of the COVID-19 virus (Corona virus). What started in a faraway land at the beginning of the year, COVID soon spread across the globe and essentially shut the world down.
March saw the first lockdown in the UK, which lasted longer than anyone anticipated, with a second lockdown following at the end of the year in December. There was a brief period over the summer where we could socialise, but even that felt odd.
Birthdays and celebrations were had over video calls and, suddenly, everyone got familiar with the people they lived with and the spaces they lived in (and quickly learnt that you only needed to be presentable from the waist up).
I miss going to the pub. Going to the pub with friends was something I used to relish and apparently didnt appreciate fully until it was taken away from me. I feel like Ive handled being without physical friendships quite well, but putting the worlds to right after a few beers just doesnt seem the same over Zoom.
## Liquid Light
As with the rest of the world, we pivoted to working from home in March as swiftly as we could. I spent the week leading up to, and the week after, our decision to work from home trying to work out tech, logistics and infrastructure. The government announced you should work from home if you can which gave us time to sort ourselves out before a couple of days later, announcing a national lockdown.
Liquid Light had always, traditionally, been an office-based business and setting up the technology to enable a whole workforce to work from home took a bit of co-ordination. One of the things required was to collect all the computers from work and drive them round to all our employees.
When lockdown started, there was an initial drop in work as companies tightened their belts while heading into the unknown. Since then, business has picked up again as everyone gets used to the new normal and realised websites arent going anywhere.
We had a front-end developer. Minna, start 3 days before we took the decision to work from home. Its been interesting teaching remotely but it seems to have worked (certainly helps that Minna is so easy going and a quick learner) and hasnt put us off working & onboarding from home in the future.
We also took on a new backend-developer, Zaq, in December. Hes hit the ground running and already feels like one of the team. Again, remote onboarding (while not perfect) seems to have worked. I did spend a week in the office with him on his first week pointing at things on the screen in a pysical world, which felt weird.
With regards to my personal professional progression, 2020 saw the 3 new directors (Myself, Owen and Matt) fully run the company, with the existing directors transitioning into more of a safety net role. It was good to finally step up and take charge and it was reassuring to get positive feedback in our end-of-year internal 360 reviews.
## Side projects & writing
2020 saw peaks and troughs with both blog post writing and side projects on my part.
The year was a slow start but March & April saw plenty of blog posts appearing while I was initially stuck at home. The lockdown then started to wear me down a little, my output pretty much bottomed out and has stayed there. One of my goals for this year is to write more (this post doesnt count).
With regards to side projects, [Behind the Source](https://www.behindthesource.co.uk/) was a success and went from inception to delivery in the first few months of 2020. I also re-wrote the backend of [email.subscribeto](https://email.subscribeto.at/) to be powered by Craft CMS. Im still not that happy with it so it might get pulled apart again this year. With regards to new projects, I am working on an RSS SaaS app and some more blog posts/tutorials.
## Appearances
Despite the pandemic and lack of blog posts, 2020 did have a couple of firsts.
It was the first time I was on a Podcast - [Make Life Work](https://makelifeworkpodcast.com/mike-street/) with Si Jobling talking about working from home during a lockdown and other things. I also gave my first virtual talk at [PHP Sussex](https://www.meetup.com/PHP-Sussex/events/269482580/). It was a more honed, practiced (and better quality) version than the one I [gave at Bytes Conf](https://www.youtube.com/watch?v=FnYL-QEoi68) many years ago.
I'm hoping 2021 contains a few more podcast appearances, now I am at home and able to record them on my lunch break in silence.
## House and Family
With working from home the new norm (and an impending expansion to our family), my wife and I took the decision to have an office built in the garden for me. Its a great little space to focus on work (and get out the way of being inside the house). My "commute" to work now involves walking down the garden and thinking about decking. We werent ready to move (we considered it) as we had only just felt like we were settled after having a new kitchen (which we [only got in 2019](https://www.mikestreety.co.uk/blog/2019-in-review)).
Lockdown also saw the start of Alfie walking and talking properly. He is now an unstoppable chatting machine. Its so much better now he can express his wants and desires (even if we dont always grant them) rather than the grunting he had developed. This was one of the silver linings to the cloud of the pandemic - being at home to watch him take his first steps and for him to be there when I make a cup of tea. He is now showing off with his talking - counting up to 20 (sometimes 30 with a couple of prompts) and knowing all the letters of the alphabet.
## Interests
Despite being at home more, my cycling dwindled. The cycling "club" I co-founded ran a couple of events with set routes you rode solo and then compared times. This gave me targets of places to go, but as everyone lived in Brighton the routes were very much geared towards starting and finishing there - I live a 10 mile bike ride from most starts, so it meant additional mileage (and more importantly time) which I didn't always have.
We did, however, go on plenty more walks. All you were allowed to do is exercise and, with everywhere closed, walking the streets is all we could do. Again, despite this, my annual step count was down (more on that later...).
In terms of what piqued my interest digitally, it mainly revolved around sparks created from requests at work. I now understand serverless workers thanks to Syntax FM and some work I did for Liquid Light. This started on Cloudflare workers but has expanded into Netlify functions as well. I have also deployed (and have running) a couple of sites on Netlify, including a statically generated 11ty site (Behind the Source) - which I'm super proud of.
I am also much more familiar and comfortable with writing and structuring PHP. I've been working a lot on the TYPO3 backend (plus writing my own RSS app and Craft CMS to 11ty converter).
## Stats
Each year I gather and reflect on various stats such as steps, miles cycled and blog post popularity.
### Blog Posts
The most popular posts on [mikestreety.co.uk](https://www.mikestreety.co.uk/) for 2020:
Interesting number 7 has stayed at 7 for 2 years running. No surprise the rest of the top 10 have remained the same due to my low blog post output this year.
<table>
<tr><td><strong>1</strong></td><td> - </td><td><a href="https://www.mikestreety.co.uk/blog/vue-js-using-localstorage-with-the-vuex-store">Vue: Using localStorage with Vuex store</a></td><td>13/10/17</td></tr>
<tr><td><strong>2</strong></td><td><small>New!<small></td><td><a href="https://www.mikestreety.co.uk/blog/how-to-use-fetch-in-javascript-to-get-or-post-data">How to use fetch in JavaScript to GET or POST data</a></td><td>20/4/19</td></tr>
<tr><td><strong>3</strong></td><td><small>New!<small></td><td><a href="https://www.mikestreety.co.uk/blog/the-git-commit-hash">The Git Commit Hash</a></td><td>28/5/20</td></tr>
<tr><td><strong>4</strong></td><td class="loser">↓ 2</td><td><a href="https://www.mikestreety.co.uk/blog/multiple-transition-delay">Multiple transition delays</a></td><td>03/05/17</td></tr>
<tr><td><strong>5</strong></td><td class="loser">↓ 2</td><td><a href="https://www.mikestreety.co.uk/blog/github-for-pc-and-setting-up-a-local-testing-environment">Github for PC and setting up a local testing environment</a></td><td>05/05/12</td></tr>
<tr><td><strong>6</strong></td><td class="loser">↓ 1</td><td><a href="https://www.mikestreety.co.uk/blog/use-a-raspberry-pi-with-multiple-wifi-networks">Use a Raspberry Pi with multiple WiFi networks</a></td><td>11/10/15</td></tr>
<tr><td><strong>7</strong></td><td> - </td><td><a href="https://www.mikestreety.co.uk/blog/vue-js-filters-what-are-they-how-do-you-use-them-and-how-do-you-make-them-video">Filters in Vue.js: What are they, how do you use them, and how do you make them?</a></td><td>08/11/17</td></tr>
<tr><td><strong>8</strong></td><td class="loser">↓ 4</td><td><a href="https://www.mikestreety.co.uk/blog/get-background-image-information-if-element-has-a-one-in-jquery">Get background image information if element has a one in jQuery</a></td><td>04/03/16</td></tr>
<tr><td><strong>9</strong></td><td class="loser">↓ 1</td><td><a href="https://www.mikestreety.co.uk/blog/filtering-tables">Filtering Tables</a></td><td>12/02/15</td></tr>
<tr><td><strong>10</strong></td><td><small>New!<small></td><td><a href="https://www.mikestreety.co.uk/blog/using-cloudflare-workers-to-set-a-cookie-based-on-a-get-parameter-or-path">Using Cloudflare Workers to set a cookie based on a GET parameter or path</a></td><td>5/3/20</td></tr>
</table>
### Liquid Light
And what about the posts on [Liquid Light](https://www.liquidlight.co.uk/blog/author/mike-street/)?
The top 10 stayed exactly the same with just a couple of shuffles. I should really write some more posts all round!
<table>
<tr>
<td><strong>1</strong></td><td> - </td>
<td><a href="https://www.liquidlight.co.uk/blog/how-do-i-update-to-gulp-4/">How do I update to Gulp 4?</a></td>
<td>22/03/2016</td>
</tr>
<tr>
<td><strong>2</strong></td><td class="winner"> 1</td>
<td><a href="https://www.liquidlight.co.uk/blog/using-vue-js-with-a-lumen-powered-api/">Using Vue.js with a Lumen powered API</a></td>
<td>18/10/2018</td>
</tr>
<tr>
<td><strong>3</strong></td><td class="winner"> 1</td>
<td><a href="https://www.liquidlight.co.uk/blog/how-can-i-verify-my-google-event-tracking-is-working/">How can I verify my Google Event Tracking is working?</a></td>
<td>03/10/2017</td>
</tr>
<tr>
<td><strong>4</strong></td><td class="winner"> 1</td>
<td><a href="https://www.liquidlight.co.uk/blog/using-a-post-merge-git-hook-to-clean-up-old-branches/">Using a post-merge git hook to clean up old branches</a></td>
<td>28/03/2019</td>
</tr>
<tr>
<td><strong>5</strong></td><td class="loser">↓ 3</td>
<td><a href="https://www.liquidlight.co.uk/blog/raspberry-pi-what-is-it-and-why-do-i-need-one/">Raspberry Pi: what is it and why do i need one?</a></td>
<td>15/02/2016</td>
</tr>
<tr>
<td><strong>6</strong></td><td> - </td>
<td><a href="https://www.liquidlight.co.uk/blog/git-for-beginners-an-overview-and-basic-workflow/">Git for Beginners: An Overview and Basic Workflow</a></td>
<td>10/03/2015</td>
</tr>
<tr>
<td><strong>7</strong></td><td> - </td>
<td><a href="https://www.liquidlight.co.uk/blog/navigation-drop-downs-should-they-be-hover-or-click/">Navigation drop-downs. Should they be hover or click?</a></td>
<td>24/07/2017</td>
</tr>
<tr>
<td><strong>8</strong></td><td class="winner"> 1</td>
<td><a href="https://www.liquidlight.co.uk/blog/creating-a-custom-mailchimp-template-with-layout-variations/">Creating a custom Mailchimp template with layout variations</a></td>
<td>04/05/2016</td>
</tr>
<tr>
<td><strong>9</strong></td><td class="loser">↓ 1</td>
<td><a href="https://www.liquidlight.co.uk/blog/why-were-not-dropping-slack-for-google-hangouts-chat-yet/">Why we're not dropping Slack for Google Hangouts Chat...yet.</a></td>
<td>15/03/2018</td>
</tr>
<tr>
<td><strong>10</strong></td><td> - </td>
<td><a href="https://www.liquidlight.co.uk/blog/youtube-videos-vs-self-hosted-which-one-is-better-for-you/">YouTube videos vs self-hosted: Which one is better for you?</a></td>
<td>25/01/2016</td>
</tr>
</table>
### Instagram
It's no surprise with plenty of lockdowns and lack of socialising (and going places) that my personal instagram suffered and my beer review account thrived
<table class="fixed">
<tr><th></th><th><a href="https://www.instagram.com/mikestreety/">Personal</a></th><th><a href="https://www.instagram.com/ale_house_rock/">Ale House Rock</a></th></tr>
<tr><td class="center"><strong>2017</strong></td><td class="center">39</td><td class="center">91</td></tr>
<tr><td class="center"><strong>2018</strong></td><td class="center">24</td><td class="center">101</td></tr>
<tr><td class="center"><strong>2019</strong></td><td class="center">29</td><td class="center">77</td></tr>
<tr><td class="center"><strong>2020</strong></td><td class="center">6</td><td class="center">138</td></tr>
</table>
### Cycling
As mentioned at the beginning, my cycling dropped a lot over 2020. With working from home the regular 60-100 miles a week I was doing while commuting disappeared, so it is no surprise all the stats are down (makes it easier to beat in 2021 though :wink:).
Interesting that, because the rides I did in 2020 were _rides_ and not flat commutes, the elevation gain is much higher this year!
<table class="fixed">
<tr><th></th><th><strong>Distance</strong></th><th><strong>Time spent on rides</strong></th><th><strong>Elevation gain</strong></th><th><strong>Total number of rides</strong></th></tr>
<tr><td class="center"><strong>2017</strong></td><td class="loser center">2,249.7 mi</td><td class="center">180h 16m</td><td class="winner center">134,459 ft</td><td class="center">443</td></tr>
<tr><td class="center"><strong>2018</strong></td><td class="winner center">3,273.5 mi</td><td class="winner center">235h 24m</td><td class="center">112,178 ft</td><td class="center">291</td></tr>
<tr><td class="center"><strong>2019</strong></td><td class="loser center">2,689.4 mi</td><td class="loser center">178h 45m</td><td class="loser center">46,368 ft</td><td class="center">288</td></tr>
<tr><td class="center"><strong>2020</strong></td><td class="loser center">1,927.3 mi</td><td class="loser center">132h 56m</td><td class="winner center">69,400 ft</td><td class="center"> 149</td></tr>
</table>
### Walking
Once again, there is no surprise all the walking stats are lower
<table class="fixed">
<tr><th></th><th>Steps stepped</th><th>Floors climbed</th><th>Calories burned</th></tr>
<tr><td class="center"><strong>2019</strong><td class="center">2,659,838</td><td class="center">4,583</td><td class="center">1,033,167</td></tr>
<tr><td class="center"><strong>2020</strong><td class="center loser">2,126,312</td><td class="center loser">2,690</td><td class="center loser">1,020,728</td></tr>
</table>
---
title: A placeholder mixin - for Less and Scss
published: 2016-3-7
updated: 2016-4-9
date: 2016-03-07
updated: 2016-04-09
tags:
- Web
- CSS
......
---
title: A simple Sass compilation gulpfile.js
published: 2016-3-7
updated: 2019-3-27
date: 2016-03-07
updated: 2019-03-27
tags:
- Web
- CSS
......
---
title: A world without the web
published: 2016-3-7
updated: 2016-4-8
date: 2016-03-07
updated: 2016-04-08
tags:
- General
- Ramblings
......
---
title: Advance mixin with Less && SCSS- Variable attributes
published: 2018-1-24
updated: 2018-1-24
date: 2018-01-24
updated: 2018-01-24
intro: Setting many attributes via a mixin
tags:
- Web
......
---
title: Advanced Gulp File
published: 2016-3-7
updated: 2019-3-27
date: 2016-03-07
updated: 2019-03-27
tags:
- Web
- Front-end Development
......
---
title: An Introduction to CSS Preprocessors
published: 2017-6-22
updated: 2017-6-22
tags:
- Web
- CSS
---
---
title: An Introduction to CSS Preprocessors
date: 2017-06-22
updated: 2017-06-22
tags:
- Web
- CSS
---
<p>Writing and updating CSS can be a repetitive, tedious and arduous task - especially for big projects. CSS preprocessors can help with that - amalgamating related styles and helping you make your style sheets more <strong>DRY </strong>(Dont Repeat Yourself).</p>
<p>We have been using CSS Preprocessors for quite some time now - first starting with off with <a href="http://lesscss.org/">Less</a> and recently moving on to <a href="http://sass-lang.com/">Sass</a> (there is also <a href="http://learnboost.github.io/stylus/">Stylus</a> as an alternative - but that wont be covered in this article).</p>
<h2 id="what-is-a-preprocessor-">What is a Preprocessor?</h2>
......@@ -181,4 +181,4 @@ $line-height: 1.4;
<p>if youre still unsure about which preprocessor to go for, I wrote about Bozboz moving from <a href="http://www.mikestreety.co.uk/blog/from-less-to-sass">Less to Sass</a> which might help you sway one way or the other.</p>
<p>Picking up a preprocessor can be tricky, but once youve started using one youll never go back.</p>
<hr>
<p>This post was originally posted on <a href="https://www.bozboz.co.uk/insight">Bozboz</a> in 2014</p>
<p>This post was originally posted on <a href="https://www.bozboz.co.uk/insight">Bozboz</a> in 2014</p>
\ No newline at end of file
---
title: Automatically deploying your Lumen App with PHP Deployer (and zero downtime) so you don't have to manually do it
date: 2021-02-08
updated: 2021-02-11
intro: PHP Deployer is a great little utility for deploying your PHP app via command line. It doesn't force you to use any specific tech stack and simplifies the process of getting your app live.
tags:
- Web
- PHP
---
[PHP Deployer](https://deployer.org/) is a great little utility for deploying your PHP app via command line. It doesn't force you to use any specific tech stack and simplifies the process of getting your app live.
## Prerequisites
This blog post assumes the following:
- You have an app or website written in PHP, be it a popular framework or just plain ol' PHP
- You are familiar with command line, SSH and are looking for a deployment method
- You have SSH access to the server where your site/app will be hosted
- Your website is not mission critical (there might be errors :wink:)
I have a Lumen app which I will be deploying with Deployer in this blog post, so there might be Lumen/Laravel specific commands and roles.
## Install
There are a couple of ways you can [install](https://deployer.org/docs/installation.html) deployer. To keep my code device & environment agnostic, I have opted for the [composer](https://deployer.org/docs/installation.html#distribution-composer-installation) method.
This means I don't have to set up deployer on the machine if I wish to deploy my app, just SSH access and composer.
The composer version of deployer is run with `php vendor/bin/dep`, however for the rest of this tutorial I will reference the global command `dep`.
## Deployment and finishing
This may seem like an odd step to put here, but seeing the finished result will help you understand the configuration.
Once deployed (the example below has a couple of deployments), a PHP Deployer app has the following folder & file structure in the `deploy_path` location:
- current -> releases/2
- .dep/
- releases/
- 1/
- ... your application code
- .env -> ../../shared/.env
- 2/
- ... your application code
- .env -> ../../shared/.env
- shared/
- .env
- storage/
(I hope that makes sense).
To summarise, there is a "current" symlink which points to the latest/active release. Each release then exists in the releases folder. This means, in the event of an issue, running `dep rollback` will point the `current symlink` to the previous release.
Between each release, there are some shared files and folders. With the default Laravel recipe, this includes the `.env` file and `storage`. The original of these files are kept in the `shared` folder. Each release then symlinks to these files meaning, for example, you only need to change the `.env` file once should you wish to change a setting.
<div class="info">Using the "out the box" settings requires some reconfiguration on the server. The web root needs to point to <code>/path/to/dir/<strong>current</strong>/public</code>. </div>
I negated the server reconfiguration by using PHP deployed to deploy alongside my configured web root and then, using a symlink, pointed to the `current/public` folder.
## Set up
Deployer has an init function you can run
<pre class="language-bash">dep init</pre>
This asks for the framework you are using and creates a default `deploy.php` in the root of the project. As my app is Lumen, I chose Laravel.
## Configure
Open up the `deploy.php` and update the `host()` section. The contents of `host` is the name of which you use to ssh into your server. E.g. if you normally do `ssh mike@123.456.789.100`, your host would be `123.456.789.100`.
You can, if required, add a `->user` to the host, if it is not the same as your current user (or you haven't set up the ssh config file). For example:
<pre class="language-php">host('123.456.789.100')
->user('mike')</pre>
With the `deploy_path`, make sure this is an absolute path. The rest of the default `deploy.php` can be left as is.
<div class="info">If you are using a public repo, it might be worth considering having your host & user in the advised <a href="https://deployer.org/docs/hosts.html#inventory-file">yaml</a> configuration and utilising <code>.gitignore</code> to prevent someone trying to hack your server. However, if your SSH key security & firewall is good enough, then the convenience of having your host details fixed might prevail</div>
## Lumen customisations
Lumen, although built by the creators of Laravel, has several differences in the available artisan commands. Because of this, I redefined the `deploy` task, removing the unavailable tasks from the stack and define a new `cache:clear` command to run the `artisan` command on deployment.
### Unsetting tasks
The Laravel recipe comes with a lot of `artisan` ready commands, which don't work with lumen. To remove them from the `dep` help screen, you can make them empty functions and set them private.
<pre class="language-php">task('artisan:config:cache', function() {})->setPrivate();
task('artisan:down', function() {})->setPrivate();
task('artisan:event:cache', function() {})->setPrivate();
task('artisan:event:clear', function() {})->setPrivate();
task('artisan:horizon:terminate', function() {})->setPrivate();
task('artisan:optimize', function() {})->setPrivate();
task('artisan:optimize:clear', function() {})->setPrivate();
task('artisan:route:cache', function() {})->setPrivate();
task('artisan:storage:link', function() {})->setPrivate();
task('artisan:up', function() {})->setPrivate();
task('artisan:view:cache', function() {})->setPrivate();
task('artisan:view:clear', function() {})->setPrivate();</pre>
### Creating a cache:clear task
The next step is to utilise the `cache:clear` artisan command available. We can make a new task at the end of our `deploy.php`:
<pre class="language-php">task('artisan:cache:clear', function () {
run('{{bin/php}} {{release_path}}/artisan cache:clear');
})->desc('Execute artisan cache:clear');</pre>
### Overriding `deploy` task
Lastly, we override the `deploy` task, which removes the Laravel commands and adds in our `artisan:cache:clear` command.
<pre class="language-php">task('deploy', [
'deploy:info',
'deploy:prepare',
'deploy:lock',
'deploy:release',
'deploy:update_code',
'deploy:shared',
'deploy:vendors',
'deploy:writable',
'artisan:cache:clear',
'deploy:symlink',
'deploy:unlock',
'cleanup',
]);</pre>
## Final file
With our Lumen customisations in place, the `deploy.php` file should look like the below (note, I've capitalised the variables you should change).
<pre class="language-php">&lt;?php
namespace Deployer;
require 'recipe/laravel.php';
// Project name
set('application', 'APPLICATION_NAME');
// Project repository
set('repository', 'GIT_REPO');
// Hosts
host('IP_ADDRESS')
->user('SERVER_USER')
->set('deploy_path', '/PATH/TO/WEBROOT');
task('artisan:cache:clear', function () {
run('{{bin/php}} {{release_path}}/artisan cache:clear');
})->desc('Execute artisan cache:clear');
task('artisan:config:cache', function() {})->setPrivate();
task('artisan:down', function() {})->setPrivate();
task('artisan:event:cache', function() {})->setPrivate();
task('artisan:event:clear', function() {})->setPrivate();
task('artisan:horizon:terminate', function() {})->setPrivate();
task('artisan:optimize', function() {})->setPrivate();
task('artisan:optimize:clear', function() {})->setPrivate();
task('artisan:route:cache', function() {})->setPrivate();
task('artisan:storage:link', function() {})->setPrivate();
task('artisan:up', function() {})->setPrivate();
task('artisan:view:cache', function() {})->setPrivate();
task('artisan:view:clear', function() {})->setPrivate();
// Tasks
task('deploy', [
'deploy:info',
'deploy:prepare',
'deploy:lock',
'deploy:release',
'deploy:update_code',
'deploy:shared',
'deploy:vendors',
'deploy:writable',
'artisan:cache:clear',
'deploy:symlink',