I learned about Zero downtime deployment while working on our server at Qwickpage. That’s where I first implemented zero down time deployment uisng Laravel Envoy and GitLab. This week I did another setup, this time with BitBucket. It was quiet less stressful with Bitbucket.
What is Zero downtime deployment
Zero downtime deployment is a deployment method where your website or application is never down or in an unstable state during the deployment process. To achieve this the web server doesn’t start serving the changed code until the entire deployment process is complete.
Now you get the gist lets get started.
I am assuming you have a Laravel application you want to deploy, a VPS (virtual private server) and also a Bitbucket account.
Server Setup
Digital Ocean has a lot of server setup tutorials. So I will assume you have already done your VPS setup.
Login to your VPS and create a base directory for our project deployment and cd into that directory.
mkdir ~/betaApp && cd ~/betaApp
For this setup lets pull Laravel from Github so we can make a copy of the storage directory and .env.example file. We will make use of them in all our deployments.
git clone https://github.com/laravel/laravel.git initial cp -a ~/betaApp/initial/storage ~/betaApp/storage cp -a ~/betaApp/initial/.env.example ~/betaApp/.env
You can now update your ~/betaApp/.env file with all credentials your app will need to run.
We are goin to create two more directories inside the ~/betaApp directory.
mkdir ~/betaApp/sources mkdir ~/betaApp/current
The source directory will contain all the releases of our app that has been deployed to the server. The current directory will be a symbolic link (reference) to the last release that was deployed to the server. So make sure you point your server to this directory ~/betaApp/current/public.
That all for now, lets go setup our deployment script đ
Laravel Envoy
Laravel Envoy provides a clean, minimal syntax for defining common tasks you run on your remote servers. Its pretty simple.
Create a new file (Envoy.blade.php) inside your local project root directory. this file will contain all the task we want to run during deployment. Here is the one we are going to use.
@servers(['production' => 'user@server_ip']) @setup /* Project repository url */    $repo = 'repository_url'; /* Project base directory as setup on the server*/     $appDir = '~/betaApp'; /* repository branch we want to deploy*/     $branch = 'master';     date_default_timezone_set('UTC'); /* we will use timestamp as directory name of ï»żevery release */     $date = date('YmdHis'); /* directory where our release will be saved */ $builds = $appDir . '/sources'; /* full path to the release we are deploying */     $deployment = $builds . '/' . $date; /* path to the symlink directory on the server */ $serve = $appDir . '/current'; /* path to our server .env file */     $env = $appDir . '/.env'; /* path to our storage directory */     $storage = $appDir . '/storage'; @endsetup @story('deploy')     clone     install     live @endstory @task('clone', ['on' => 'production'])     git clone -b  "" @endtask @task('install', ['on' => 'production'])     cd         rm -rf /storage        ln -nfs  /.env        ln -nfs  /storage        composer install --prefer-dist     php artisan migrate @endtask @task('live', ['on' => 'production'])     ln -nfs  @endtask
Inside our Envoy.blade.php file we have our @server section which contains the server we are deploying to. The @setup section is where we decleared all the variables we are going to be using during deployment. I believe those variable with those comments are self explanatory.
We have three @task section which includes the clone task (clone from our repository), the install task (removes the storage directory and the .env file, symlink our default storage directory and .env file, install all the php packages for the app and run migrations) and the live task (symlink this current release to the current directory).
The @story section is where all the @task are called in the order we want it to run.
BitBucket Pipeline
I will assume you already have your app pushed to Bitbucket. Create bitbucket-pipelines.yml file inside your project root folder on your local machine.
image: php:7.2-fpm pipelines:   default:     - step:         script:           - apt-get update && apt-get install -qy git curl libmcrypt-dev           - apt-get update && apt-get install -y unzip openssh-client           - yes | pecl install mcrypt-1.0.1           - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer           - composer install                   - composer global require laravel/envoy           - ~/.composer/vendor/bin/envoy run deploy
So our Bitbucket pipeline will pull php7.2 docker image, install all necessary php extenstion, install composer, install Laravel Envoy and then execute our envoy script.
Deployment Keys
GitBucket is going to help us generate a public key for our deployment. Goto the settings of your project repository on BitBucket. Under Pipeline click settings and enable pipeline for your project. You will be asked to configure your Pipeline but you don’t have to, we have already done that.
Now lets generate a public key. Go back to the settings of your project repository on BitBucket. Under Pipeline click SSH Keys, when the page is done loading click on generate key.
Now copy the public key to your ~/.ssh/authorized_keys file on your VPS. Go back to page where you generated the SSH key on BitBucket, add your VPS domain name or IP address and click the fetch button. If you added the public key successfully, BitBucket will be able to fetch your host’s fingerprint and youe are good to go.
Finally go back to your project on your local machine, commit all these changes and push. Check your BitBucket pipleine to know when the deployment is complete.
Conclusion
Now your have implemented a Zero downtime deployment you can revert back to any previous release by running this command on your VPS
If you enjoyed my article why not signup for my newsletter to receive them directly in your inbox. I also send out hand picked resource links every week.
Nexmo Voice Channel is a package that adds a notification channel to Laravel using Nexmo’s voice API:
This package provides a notification channel for the Laravel framework that works with Nexmo’s voice API, allowing text-to-speech phone calls. It also provides a fluent interface to construct your message content.
To use this notification channel, you route a notification through VoiceChannel and provide a toVoice() method. The readme documents an example so you can get a visual of using this package:
use Roomies\NexmoVoiceChannel\Markup\Message; use Roomies\NexmoVoiceChannel\Markup\SayAs; use Roomies\NexmoVoiceChannel\Markup\Sentence; use Roomies\NexmoVoiceChannel\NexmoVoiceChannel; /** * Get the notification's delivery channels. * * @param mixed $notifiable * @return array */ public function via($notifiable) { return [NexmoVoiceChannel::class]; } /** * Get the voice representation of the notification. * * @param mixed $notifiable * @return \Roomies\NexmoVoiceChannel\Markup\Message */ public function toVoice($notifiable) { return new Message([ new Sentence('Hi, thanks for joining Roomies.'), new Sentence([ 'Your verification code is', new SayAs('ABC123')->interpretAs('spell-out') ]), ]); }
Here’s another example demonstrating the package’s markup types you can use to create a notification:
new Sentence([ 'Hey!', (new Pause)->time('1s'), (new Prosody('Wake up!'))->volume('loud'), (new Substitution( (new SayAs('US'))->interpretAs('spell-out'), ))->alias('United States'), ])
You can learn more about this package, get full installation instructions, and view the source code on GitHub at roomies-com/nexmo-voice-channel.
This package was submitted to our Laravel News Links section. Links is a place the community can post packages and tutorials around the Laravel ecosystem. Follow along on Twitter @LaravelLinks
Puzzle maker Ravensburgerâs kits are a blast for kids and kids at heart, letting you easily assemble fast-moving and complex marble runs. Modular components encourage experimentation, and include loops, magnetic cannons, and other tricks. The starter set comes with 122 pieces, while weâd go for the 240-piece XXL set.
Creating an HTML email can feel like stepping back a few years as a web developer. All of our new layout functionality is unavailable to us ïżœ email clients render the same layout in completely different ways. Just when we think we have it all fixed, another email client shows up with a new set of bugs.
There was so much useful information contained in these sessions that we wanted to release them more widely â including the webinar transcript and references to slides and resources. If you have ever struggled with email development, these will give you a great starting point to understand why an email isnât rendered properly, and how to squash those nasty bugs quickly.
If you enjoy learning from these videos, check out Smashing Membership. Starting from this month, we will be showing some of the live sessions we run every month to a wider audience â absolutely free of charge to view. However, if youâd like to join the discussion live and perhaps have your work reviewed by an expert, join Smashing Membership. For the price of one coffee a month, you can support the creation of more content like this.
Now get ready to learn everything you need to know about HTML email!
Screenreader:: Mailchimp Presents has a new collection of original content made with entrepreneurs in mind. In recent months, weâve rolled out documentaries, short-form series and podcasts that live only on Mailchimp. Today, we officially launch a platform.
Screenreader: Counting pairs, web content. Blank, blank, blank. Table 1 column. Nine rows. Blank. Column 1 of 1. Row 2. Nine Level 2 tables, seven columns. One row, Column 1 of 1. Blank. Column 3 of 7. Blank. Column 4 of 7. Blank. Column 5 of 7. Blank. Column 7 of 7. End of table. Row 3 of 9, blank. Column 1 of 1. Row 4 of 9, Row 2 table, seven columns, one blank. Column 1 of 7. Blank. Blank. End of table. Row 5 of 9, blank. Row 6 of 9, blank. Column, blank, blank, column end of table. Row 7 of 9, blank. Row 8 of 9 Row 2 table, blank. Column 1, blank. Column end of table. Row 9 of 9 blank. Column end of table.
Scott: No. There was just two questions I was going to get out of the way. One was from Pawan, whoâs a very, very active member of the Smashing membership. He is asking us, any thoughts on applying fonts consistently through HTML email?
Scott: Thatâs a really good point. Thereâs Zach Leatherman, whoâs a very active member with Smashing and a presenter at SmashingConf, heâs done a lot of presentations about the fallback on fonts, so thatâs interesting to make that correlation between email and web-based fonts.
Scott: Before I hand it over to Vitaly, my other question is, a lot of people are talking about interactive emails. There was actually, not this past SmashingConf, I believe the SmashingConf before, there was a presentation about interactive emails where you can actually complete an action just with one click of a button in an email, and mostly itâs based on AMP email. I was just curious, what do you know, what is AMP email and whatâs the support for it currently?
Scott: Definitely. That falls back on what I was asking at the beginning before you started the presentation is, is there going to be some sort of standard that comes across for email clients? Thatâs my dream is that that will happen. On that note, Vitaly, Iâm going to hand over to you for some questions.
Vitaly: ⊠a lot. I was a little bit not shocked, but in a way, I felt like itâs just wrong that weâre preaching these best practices for email which are not necessarily best practices full stop in 2019. Itâs really about time that web standards have evolved.
Vitaly: We do have an open question from Pawan. Just before we do that, I have a couple, but one thing I wanted to know from somebody whoâs so deeply motivated by the beauty and horror of email, I do have to find out, do you sleep well at night?
Vitaly: Iâm curious, then, do you see that there has been a lot of progress in terms of email client supporting new features, broadening CSS support, Gmail, support of media queries and all? Do you see that the differences have been remarkable over the last five years or is it a very slow progress? Just so we can set expectations of what we should be expecting coming up next on the platform.
Vitaly: Itâs a little bit loud here. Iâm just in a park, I promise. Pawan is wondering, do you have any thoughts on embedding HTML forms in emails? Is it a good idea or not?
Vitaly: Because just today, I had to send out a wonderful email to our wonderful Smashing subscribers. One thing that stuck with me, and I wasnât really sure how to deal with it. Not every client who understand media queries. Gmail does. You will have the media rule and then it will be all fine, but then, for some reason, when weâre sending out with Mailchimp and we do inline styles, actually inline styles in the attributes, what happens is you have the inline styles say font size 21 pixel, letâs say, on H2. Then you have a media that overrides it with font size 28 or something else.
Vitaly: Am I correct to assume that itâs probably a good idea to avoid bang importance one way or the other, because it will override whatever you have in the inline styles? If you have a media rule, and then that media rule, you actually have font size 30 pixels importance, will it override inline styles or not in most-
Vitaly: For testing, weâre using Mailchimp just to see how it looks in different clients, but Doug Working is asking, do you have any recommendations for tools to test email code to see how it looks in different email clients?
Vitaly: But then, it basically takes screenshots that you have to analyze. If you discover something like a major bug, how do you debug? Any tools for remote debugging, so to say?
Vitaly: That makes sense. One more thing that actually came up as well, is it safe to use SVG in emails? Or if youâre having the same image, would you prefer to use SVG or would you recommend to stay away from SVG and use PNG or JPEG instead, or God forbid GIF?
Vitaly: Thatâs actually an answer I was expecting, to be honest. Maybe just one final question. Iâm sure Iâll have more later, but I know you do also have family and all and itâs quite late as well, and I get to meet you in Freiburg, so this is just a couple of weeks from now, so at SmashingConf Freiburg. This is going to be exciting.
Vitaly: I do have a question, though, still. I remember for a while, maybe a year ago, maybe two years ago, I found these two resources which were great. One of them was responsiveemailpatterns.com. The other is responsiveemailresources, or something like that, .com. One of them has gone away. Itâs just down I think at this point, but I will also post the link later. Can you recommend some websites, resources where you can get copy-pastes almost email codes, snippets or something that you can reuse on a daily basis? I have heard that you might be working on something. Was I wrong?
Vitaly: Just one final, just the really, really last one, and then Iâll let you go. Sorry, excuse me if you mentioned it already in the session, but Iâm wondering, as of today, as of 2019, looking at the best practices and the email clients, what are the baseline where you would say, letâs support this kind of client?
Vitaly: Because at this point, when we think about a 8, sometimes you obviously want to search something accessible to a 8, but youâre not going to optimize for a 8. Weâre getting to the point where some companies can actually start dropping a 9 in the same way, but again, weâre quite far away yet.
Vitaly: When it comes to email clients, is Outlook 2013 still a thing? I remember the big update that Outlook brought in 2013 changed a lot of things in email, if I remember correctly. As of today, when we look into the landscape of email clients, what is the baseline we absolutely have to support at least?
Vitaly: On that note, Scott, any other updates we should keep in mind or anything we need to mention?
Scott: I was going to ask you, Vitaly. Tomorrow, we have another Smashing TV.
Vitaly: Yes. Friends, weâre trying something else and something new every time. Apparently, well, finally, today we got ⊠I hope we received, because I didnât get the confirmation yet, but weâre supposed to receive the first copies of the Smashing Print or our new printed magazine dedicated to topics that are often not covered well enough on the web, or maybe that just got lost in the myriad of workflows.
Vitaly: The first issue is dedicated to ethics and privacy. As a dedication to that, weâre going to have a live session, a live stream on Smashing TV tomorrow with five panelists, all contributors to this first issue of Smashing Print. Itâs going to be broadcasted on YouTube. If you go on Smashing.TV, youâll find the links, but we also will be publishing an article tomorrow featuring the links and everything.
Vitaly: Beyond that, we also have a few more things coming up, I think.
Scott: On the 13th, Mr. Paul Boag, who has been a very prominent mentor in the Smashing community, many Smashing Conferences, many webinars, August 13th, Paul Boag is doing the customer journey mapping where UX and marketing meet.
Vitaly: Then we have Cassie Evans on August 20th exploring the interactive web animation with SVG. This is going to be fun as well. If you actually ever wanted to do a bit more or try to figure out a better workflow for SVG animation, thatâs definitely a session not to miss, so looking forward to that.
Vitaly: All right, I think weâre good here. Any more announcements, major announcements, Scott, that we need to share with the world around us?
Scott: Youâre making me feel like Iâm forgetting something, but ⊠SmashingConf Freiburg?
SmashingConf Freiburg Presentation âThink Like An Email Geekâ
At the end of the Webinar, Vitaly mentions that Remi will be speaking at Freiburg. You donât have to wait for that as we also have that video to share with you, along with the slides and resources.
We hope you enjoyed this look into HTML email. If you would like to enjoy more of this kind of content, plus the chance to interact with the presenters and other members while helping to support the creation of independent content for web designers and developers join us here.
PWA would also respond even if you are disconnected from the internet connection. This feature is especially beneficial for businesses that have a catalog, where the user doesnât need to reload it again and again to view it.
No update required
Some traditional app requires a manual update over a wi-fi connection which consumes lots of data and further increases the cost to the customer. Laravel eCommerce PWA doesn’t have this problem.
Less Storage Usage
Compared to any traditional app, the cost of using Laravel eCommerce PWA is very low for the customer. Laravel eCommerce PWA doesn’t require any significant storage and performs better on their smartphones.
Instant Loading
When the user adds PWA on the home screen, with the help of the service worker it loads instantly. FOR 3G connection, It takes 2.5 sec to load for the first visit and 7.1 sec to fully load the page. It takes 0.8 sec for the second visit.
Secure
PWA provides HTTPS secure solutions which allow the browser to maintain some level of server encryption. This adds to the benefit of PWA as it operates only through HTTPS to prevent the common man-in-middle attack.
Easy Social Sharing
On PWA, you can easily share the products on your favourite social channels like Facebook, Twitter, Whatsapp etc amongst your friends and relatives to get their views. The feature is also equipped to work in offline mode too.
Once you have published the config file you can customize:
where the files will be generated, the default location is in database\schemas
the file extension, the default is .schema.json
you add any tables you would like to ignore
Why
Have you ever needed to know what fields a certain table contains… so you open up the create migration for that table? The problem is the more migrations you have the better chance that the schema for that table has changed.
You are left with two options, go through every migration file (đ€ź), or open up a database GUI (đ).
I wanted a quick way to see the current table columns and data-types in my code editor, this is how this package was born. I hope you might find it useful as well đ
Change log
Please see the changelog for more information on what has changed recently.
In this classic sketch from Key & Peele, the duo poke fun at crime dramas. Peele potrays a suspect who attempts to use his calm demeanor and lying skills like Verbal Kint in The Usual Suspects. But heâs not quite as effective at making up his answers off of stuff he sees on the copâs wall.
There are plenty of people in the business world who think that leadership is declaring yourself in charge and then verbally abusing and cutting down anyone who doesnât fall in line. Fortunately, most people know thatâs not how leadership works and a lot of them are able to recognize the difference between a boss and a leader.
If you are in a position of management over others, how can you be sure you are creating a working environment that is not toxic? How sure are you that you are leading instead of bossing everyone around? Are you aware of the traits of highly effective leaders?
Why Is Leadership Important?
Weâve all had jobs we dread going to every day.
When you have a bad boss, it just drains the life right out of you and everyone around you. Working in an environment like that is oppressive and can eventually take a toll on your health.
Only 59% of people working for a bad boss feel passionate about their job while 94% of those with great bosses say they feel passionate about work. Whatâs more, 14% of engagement at work has to do with how employees rate their boss. Being a bad boss doesnât just make people unhappy, but it also affects performance on the job.
Bad leadership also drives away good employees.
Two in three people have left a job or plan to leave their current job because of poor leadership. Of those who plan to leave their job over the next year, 77% say they have a bad boss while just 18% say they have a good boss.
People with bad managers report their behavior as self-absorbed, rude, selfish, lazy, arrogant, and untrustworthy. Itâs not difficult to imagine why so many people would want to get away from such bosses.
Meanwhile, those with good bosses report their behavior as honest, supportive, trustworthy, respectful, and communicative. Itâs easy to see why working in that type of environment would be preferable.
How To Be A Leader, Not A Boss
If you are in a position of management, itâs worth taking stock of your leadership traits to see whether there are any areas where you can make an improvement.
The most important traits of highly effective leaders include:
Clear purpose â Know your goals and have a plan to achieve them.
Contagious passion â If your job isnât getting you out of bed in the morning, itâs not getting your employees out of bed, either.
Self-accountability â Own up to your mistakes and create an environment where others feel free to do the same without fear of punishment.
Flexible determination â Be willing to change courses when needed.
Sustainable outlook â Ensure your goals are achievable.
Dual focus â Keep your eyes on the prize, but donât forget the little stuff along the way.
These are the traits of highly effective leaders and they can be learned. If you truly want to be a good leader, all you have to do is take stock of your leadership qualities from time to time and make adjustments.
If you find yourself casting blame and being punitive, look at your goals and plans. They might not be realistic anymore and they could be in need of an update to make them work again.
Making periodic checks of your goals and workflow can help prevent you from becoming a scared, punitive, angry boss instead of a leader. Understanding that your employees are your team and everyone shares the same goals creates a much better working environment.
Would it surprise you to learn that 65% of workers say they would choose a better boss over a higher salary?
Your leadership style has a direct impact on your companyâs bottom line in the form of quality of work, turnover, and more. Bad bosses drive good workers away and make those who stay less effective at their jobs. Good bosses attract better talent and help people achieve their fullest potential.
Focus on building relationships instead of managing people and let people manage themselves. Take an interest in employeesâ lives and make sure they know you care about them. Stay consistent, give feedback consistently, and recognize when someone on your team accomplishes something â little celebrations along the way confirm a job well done.
The cost of car maintenance covers a pretty broad range. While it can be tempting to buy the cheapest products—brake pads, for example—to take a little strain off your wallet, there’s always the thought that maybe those more expensive pads might actually hold up better in the long run. But are they actually worth it? And, if they are, do you have to go really expensive to see any benefits to both your vehicle and your budget?
For our answer, we turn to Engineering Explained on YouTube, which purchased five different brake pads at various price points and put them all through similar tests to see which were more durable when faced with high temperatures, corrosion, and general compositional tests.
Each brake pad tested in this video came from different manufacturers, but were made for the front brakes of the same model vehicle. The brake pads chosen are the low-tier, mid-tier, and upper-tier priced pads that you could find at your local parts store, the original pads found on the car from the manufacturer, and pads from NRS (the company sponsoring the video; it’s at the NRS test facility that the video is filmed).
Each set of pads underwent four tests: a performance test to look at brake fade, followed by a corrosion test, a shear test, and, finally, a noise test.
The video gets pretty science-y (it’s well-explained and easily digestible, but I’ll let you watch the video and hear it straight from Engineering Explained) but the results are pretty clear. The cheapest, budget-tier brake pads are often the most unpredictable. If you were to take these pads out to a track day, you’d notice a lot of variability in the pressure needed to slow the car down, especially right at first. The longer you run with the cheaper brake pads, the faster they’ll wear out—which isn’t ideal for the whole “saving money” thing, considering you’ll have to replace them more often.
But what if you live in the terrible, terrible North, where harsh winter conditions (and salt corrosion) wear at your brakes? Interestingly, all the tiered pads you can buy at the store were covered with rust after the corrosion test, while the OEM and NRS pads remained pretty clean. Rust, as you can imagine, is not great; the whole-ass pad can just slowly start falling off when subjected to a lot of use.
The main takeaway here is that of all the tiered options you can buy at the parts store, the mid-tier pads actually proved to be the most durable—even when compared to the most expensive, high-tier brake pads. Those mid-tier pads are worth the extra money you spend, but you don’t have to break the bank to get them. But, if you can, it’s still best to nab yourself some OEM pads if you can.
Discovery UK digs into the How Itâs Made archives for this brief look at the process that goes into creating traditional magnets. After melting a cocktail of various metals in an electrical induction furnace, the fiery metal is poured into sand molds, then cooled, separated, and charged with multiple electromagnetic fields.