Sysadmin job is no fun unless you can automate boring and repetitive tasks. All the commands we have learned so far could be automated by putting all the commands in a
Dockerfile and we can use
docker build command to automatically build a container.
Create a Dockerfile:123$ mkdir nginxcd nginxvim Dockerfile
- Build a container from a Dockerfile:
Every command/ directive we put in the Dockerfile adds a new layer into the container adding extra space and cruft. So, it’s important to add as much data as we can into each directive, such as
With Docker, not only you can spin-off your own containers from a base image, but you can create your own image with some custom libraries installed. It sort of works like git.
- After installing nginx, diff your container:
- Commit the changes
- Run nginx from our own base image
The above method runs nginx but because it is running as a daemon, Docker kills the container thinking there is nothing running. To avoid that, one thing we can do is to make nginx not run as a daemon:
Just like git, we can check the history of an image as well:
Currently I’m learning Docker using the excellent Shipping Docker video series. I just wanted to dump everything I’ve learned through the end of each chapter for my future self here.
I use toastr for showing alerts in my web apps. Before it was as easy as adding a script tag and a link tag from CDNJS. But with Webpack and Laravel 5.4, this no longer works. Not just
toastr, I’ve found that, at least in my experience, any libraries that depend on jQuery has the same issue. The only way I could make it work is through npm. It’s a bit pain to npm every package, to be honest. …
[Update: Laravel Mix now supports Browsersync out-of-the-box.]
Laravel Mix is basically a wrapper around Webpack and even comes with few scripts out-of-the-box. This is great and I like it a lot, esp. Hot Module Replacement part. But this also means we can no longer use old Laravel Elixir plugins. The one plugin that I really missed was the Browsersync support.
At first, I thought I’d fine without it but as soon as I started working on a real project, I realized that the lack of auto-refreshing of browser made me less productive. After spending hours trying different things to make Browsersync work, I finally got it working! Turns out it is actually very easy. Here are the steps: …
Unlike AppCode, Xcode doesn’t allow you to associate a custom file extension with a color scheme. When using Vapor and Leaf, this means you have to go to
Editor > Syntax Coloring and select
HTML every time you open a .leaf file. This is annoying and to make things worse Xcode doesn’t remember this setting after you (re)build the project 😡
To fix this annoyance, I’ve made a very tiny MacOS app that automatically associates .leaf to .html file for you. All you have to download this tiny app, and double-click it. You can then close the app. No further action required! You can now open your .leaf file and Xcode will recognize it as an HTML file and automatically sets syntax coloring for you.
Download the app here: https://github.com/ashokgelal/xcode-leaf-color-schemer/releases
The source is open and on GitHub: https://github.com/ashokgelal/xcode-leaf-color-schemer
Trying a different framework after using Laravel is anything but easy. And as I was expecting, it didn’t take me too long to realize this. Laravel is not only a solid, well-written, and well-documented framework but it also brings with it a handful of essential packages such as Cashier, Socialite, Echo, Dusk etc. These packages are officially supported and make your day to day job as a web developer much enjoyable and very productive.
Yes, I know there are many build tools such as Gulp, Webpack, Grunt, Rollup etc. But, for better or worse, Laravel has spoiled me. I want to be more productive writing actual code and not spent hours fiddling with configurations.
Thankfully, Laravel Mix, despite its name, seems to work well with any other kind of frameworks including Vapor. There are few Laravel specific features such as the need for a function called
mix if you need versioning but nothing that should block us from using it in our own Vapor project. In this post, I’ll show you how to integrate Laravel Mix in your own Vapor project. …
Mac doesn’t like you to open multiple copies of an application. If you try to open a new copy, it will switch to the running copy. If you want to open a new copy, this is what you need to do from your terminal: …