WSL & LAMP part two

As mentioned before, I’m restarting my windows-based LAMP developer experience after a long sojourn in MacOS. This post is meant to look at where I am a few weeks in, and tips/tricks/problems I’ve encountered. I’ll probably post a review of the actual laptop I went for later.

All in all, the experience has been quite good. I have a full LAMP stack set up and running well, with very few hiccups. Right now I have it set up to run three different sites, two custom PHP and one that runs mostly off WordPress. All I have to do to change which site I want to just off of http://localhost is edit the relevant Apache configs and restart Apache.

I’m a vim user so I haven’t needed to install any big clunky IDEs. I do have sublime which I mostly use as a giant clipboard/notes app. Everything else lives in Trello or Google Sheets, or Slack.

I did have some odd issues initially running my linux terminal – until I got used to it. I just had to get used to opening new terminal windows from within the linux app. The only other niggling issues are that you can’t seem to split the screen (something I do very rarely anyways) – and sometimes when pasting a large amount of text within vim, there’s a slight delay. That’s all!

So, all in all I’ve made the transition quite seamlessly – maybe a day or so of lost productivity while getting everything set up and moved over from my old mac.

Running Linux in Windows

I wrote this post about two weeks ago and apparently forgot to publish it… so publishing it now as a prefix to another post that will explain my new windows-based linux setup (what a weird sentence that is!)

It’s been said before, but what a weird time we live in!

As mentioned previously, I finally had to ditch MacOS as my main work OS, thanks to new machines just not matching the price and functionality (and reliability) point for me. And haven’t been a fan of the changes they’ve been making to MacOS over the years anyways…

So, I’m on day three of my (resumed) Windows journey. But, I’m a web developer primarily in the LAMP stack, and I know that I can’t just set up a dev environment within windows for that, when everything I create is hosted on Linux…

My original plan was to just set up a virtual machine in Windows and just work within that. But, thankfully I remembered that there’s now WSL (Windows Subsystem for Linux) that could be an option… and so far, so good!

WSL lets you run linux within Windows, without the need for a virtual machine, or Docker or whatever. Basically, one it’s set up – you can have a bash prompt – and once you have that, you can install all sorts of things you need to do your job efficiently.

I’m not going to go through the whole process because there’s plenty of good guides out there – I’ve linked to a few at the bottom of this post. Instead, I’ll focus on a couple of the gotchas that held me up as I was getting everything set up.

File Permissions
Once I got the LAMP stack up and running, I grabbed all my files off my old macbook and set them up on the new laptop. But, the first I ran git status it told me every file had changed. Great, that’s not a good sign! My first thought was the old issue with newlines – but that’s not an issue using WSL since you’re inside linux anyways… Turns out there’s some file permission weirdness, and all of my files now had 777– and git thought I wanted to change all those files’ permissions – probably not a good plan! Turns out setting a simple git config option to ignore permission changes took care of that problem:
git config core.filemode false

Getting a Decent Terminal
You can use the built-in windows terminal… and it certainly is leaps and bounds better than last time I used Windows (*cough* Vista) so there’s that. I should probably explore it more.

I tried a few other terminals recommended in one of the guides, w/mediocre results. Some felt slow. And many of them had problems recognizing the arrow keys in vim – I can get by without them but I tend to alternate between the arrow keys and other options when moving around in vim without much though, so having the arrow keys suddenly not working was jarring.

For awhile I was using the Hyper terminal because it looked good and handled arrow keys just fine – but it felt a little slow and had the occasional weird glitch. I guess it’s built with javascript/css, etc which is kind of cool. But, contrary to popular belief we do not have to use javascript (of all things) for everything under the sun…

So, I followed this guide to set up the linux xfce terminal, running via X. I was a little leery at first, flashbacks to my early linux days with X (think pre 2000) but of course things have gotten much easier since then! I’ve gotten it all set up and about to embark on a work session with the new setup – we’ll see!

Resources

https://docs.microsoft.com/en-us/windows/wsl/install-win10
https://cepa.io/2018/02/10/linuxizing-your-windows-pc-part1/
https://www.codza.com/blog/lamp-in-wsl-win10

The End of an Era?

Yesterday I pulled the trigger on a new laptop. For the first time in about a decade, I’ll be using Windows again.

I’ve used Macs for work for most of my career – even going back to the bad old pre-OSX days.

I’m writing this on an early 2013 macbook pro. It’s still decent, but starting to show its age. Battery life is crap. It seems to run hot all the time. And I’m starting to run into cases where I need to upgrade Mac OS to update various software that I use. I’ve always gotten burned when I do Mac OS updates, so I’m always resistant to that. Very little benefit for much risk in my opinion.So, I need a new laptop. But I quickly ruled out another mac:

  • The new macbooks are crazy overpriced, as usual for Apple. I don’t think the quality is there any more.
  • I cannot stand the new keyboards, even if Apple can or has fixed the huge reliability issues.
  • The touchbar thing is simple stupid. Lose a perfectly good and useful set of keys for something that breaks, uses more power and is just pointless.

So, back to windows. And quite likely Linux, either as dual-boot, or something. We’ll see! I picked a nice ultrabook with a similar form factor to the latest macbook pros. My plan is to experiment with the new linux stuff in windows – and if that’s not up to par I’ll just set up a VM running linux for work – or dual boot.

Wonder if there will ever be another mac in my future… doesn’t look promising right now.

git and the single dev

I’ve returned from (arguably) the last Magento Imagine and have almost recovered from my personal branch of the flu that seems to have been burning through the attendees. While hacking and spluttering and read Reilly Chase’s post on using git as a solo developer and thought it was a great idea for an article.

I think I started using git about 10 years ago (geez) and at the time was acting as solo dev on most of the projects I worked on. It seemed slightly useful, but honestly seemed like a lot of overhead for not much benefit. I already had my own system of local backups that I was quite comfortable with.

But, git was “how real developers worked” so I started to use it. I set up a remote server to use as my remote repo (didn’t use github at first) and had relatively few problems using it locally – but I was paranoid about running it on the live server. It seemed like one flubbed command could really mess up the site!

So, at the time I installed the repo outside of the web root on the live server, and manually copied changed files from there to where they needed to go. Obviously not the most efficient way to do things!

Eventually I moved on to managing a pretty large open source project on github, and quickly began to learn the value of git in the multi-developer context. And once I became a developer working with about a dozen other devs on projects that used an entirely git-based workflow, it was clear how critical a tool git is for multi-developer projects.

But, what about the single dev?

Beyond the obvious advantages of using git (branching/merging/etc) there’s a few others I’d like to highlight

  • Detecting changes on the live server – if site is running from the repo on the server, a single git status command will show you changed files or new untracked files. Very handy in cases where an attacker has gained access to the server!
  • Remembering what you did last – there may be big gaps of time between when I work on a client’s site – while waiting on feedback/payment/etc. A quick git log shows the recent commits. Or look at github/bitbucket to see what you were up to. This is also a great way to reconstruct work done on a site for billing purposes, if you forgot to log your hours :\

My strategy

I generally keep my workflow pretty simple. Almost all work is done locally in MAMP (I mostly work on LAMP stack sites), tracked within a single master branch. I use Bitbucket for my remote. I do occasionally create a branch if I’m messing around on something I think I may need to keep around longer term – best example was working on converting an older site to use PHP7.2 – while ongoing work was going on in PHP 5.6.

On some more complex projects, I have a staging server set up to allow the client to see changes before they go live. This is usually a cheap Lightsail instance. I set up the repo containing the site files there, and just do a quick git fetch when I want to see what updates will be applied, and git pull to bring them down.

The live server is set up the same way. I always do a fetch first to make sure I know exactly what’s going to be pulled on to the live site. No surprises!

I realize I could use hooks or something to have the live server automatically update when I push commits to master, but with my setup that doesn’t make much sense – I prefer to do this manually. And as I mentioned, running git status on the live server now and then gives me one more level of security check… I do have one project moving towards an architecture of multiple front end nodes, in which case I will have to change this model. In that case, I don’t want to have to login to each node to pull down the latest commits. A bridge to cross when I get to it!

My Completely Unnecessary Magento Imagine Guide

That’s right, I’ve decided to post my own guide to Magento Imagine. By my calculations, I will have been to half of the Imagine conferences this year. So, I suppose, I’m half of an expert! So half of what I say below is probably garbage 😃 I’ve also been to a few other Magento events over the years, all over the world.

The Tips

1st night party, 2018

I covered my packing tips below, these are intended to be helpful once you get there

  • Maps – the Wynn is huge, make sure you have a map – paper or digital – handy!
  • The Dry Run – If it’s your first time, or just in case – figure out the route and how long it takes you to get from your lodging to the conference area. No surprises when you’re in a rush!
  • WhatsApp Group – be sure to join the WhatsApp group for Imagine (contact me for details). It’s very handy for finding out the various other events that are happening before, during and after the conference. Twitter is also very popular – watch the Imagine hashtag! If you’re trying to find something to go to – just say something.
  • Side Events – there are tons of events going on beyond the main conference events. Keep an eye on twitter and Whatsapp, and ask around…
  • Food – while the drinks are free-flowing – the food can disappear quickly at the events! Obviously, this can cause problems… Be sure to chow down when you find food, especially at the parties each night. And drink lots of water. Don’t be like me.
  • Introvert? Don’t worry, the Magento community is incredibly welcoming. Don’t be starstruck, most of the Magento folks are very personable, as well as the Masters, sponsors, etc. Check below for list of conversation starts in case you’re like me and tend to blank out… and of course feel free to say hi if you see me staggering around the conference.
  • The Booze – there’s lots of it. Pace yourself and know your limits! Yes, great chance to try all sorts of things – enjoy but be careful!
  • Parasol Up – This is almost the unofficial gathering spot of Imagine, with the Wynn Tower Bar being a close second – and also B Bar. These are all quite close or inside of the main casino floor at the Wynn. If you’re bored and looking for Magento peeps, check it out!
  • Finding Food – As I mentioned, the food at the conference can disappear quickly. Lunch and dinners and generally great so no need to search for alternatives. Moreover, even costly restaurants can be pretty mediocre unless you have specific recommendations. Grand Lux Cafe across the street at the Venetian has decent food at decent prices – especially for breakfast. Its also a short walk away. There’s also a french restaurant in the Venetian called Bouchon that’s pretty good. La Cave and Jardin in Wynn/Encore are ok… The burger place across the street from the Wynn is also pretty popular – you’ll probably find some Magento folks there… You can get by with the free breakfast, lunch and dinner options on each conference day, so don’t feel like you need to spend a bunch for the crappy casino buffet, unless that’s your thing.
  • Water – Vegas is dry – make sure to bring chapstick, or grab some in the vendor hall. And grab those water bottles whenever you see them.
  • Your Badge is Your Life – don’t lose it, and don’t forget it! They’re serious when they say they won’t replace it… And you’ll need to be sure to have appropriate ID on you (driver’s license, or passport) for a lot of the events.
  • Badge colors/designs – the badges generally have different colors/borders to indicate “categories” of attendee – i.e. merchant, magento employee, etc. This can be helpful if you’re trying to find certain sorts of people.
  • Enter all the things – There are tons of giveaways, make sure to drop your business card in all of them! It’s worth the spam you may end up getting.
  • The Strip – The Wynn is at one end of the strip, with the Venetian next to it. If you want to go see the strip, do it at night – it’s both cooler (literally) and more scenic. Walking the strip always takes longer than you expect, things seem closer than they are because they’re so huge – and you’re always getting diverted into casinos, etc. You can’t just walk straight up and down the strip!
  • Off Strip – Go check out “old Vegas” i.e. Fremont Street. It’s worth the trip. You can get there cheaply by bus. No doubt groups from the conference will be heading there as well.
    Ellis Island casino and restaurant are closer to the Wynn for a taste of “old Vegas”. They brew their own beer and have decent deals on food. It’s a couple (long) blocks off the strip. It’s very smoky though, but not as smoky as Silver Sands a little further away. Go there if you are on the prowl for a cheap simple buffet.
  • Got a question? Ping me on twitter – @adwatson. If I can, I’ll help. Or introduce you to someone who knows more than me (plenty of options there!)
Straight pimpin’ with the always fabulous Fabian – and many other wonderful people!

Packing List

Here’s a few ideas of what to pack. Save lots of room in your luggage though. There will be lots of swag! Or, check out my cheap tip below if you have too much swag for your luggage space…

  • Sunscreen and Shades – you’ll certainly spend most of your time in the Wynn/Encore. But, the lunches are held outside, and the tables with shade fill up quickly! Bring sunscreen and shades, especially if like you know who, you don’t have the hair up top you once had.
  • Backpack – we’ll almost certainly get a free bag when we get our badges, and they’re usually pretty decent.
  • Phone chargers – have a way to recharge your phone, you’ll be draining that battery quick. Lots of vendors will have free chargers as swag in the vendor hall – some will even be pre-charged! Bring the relevant cables (USB -> whatever you need).
  • Less Shirts than you need – if you’re tight on space (and not picky on style), you can get by packing fewer shirts than you need – there will be tons of tee-shirts available as swag.
  • Business Cards – You will have many, many chances to hand these out!
  • Walking Shoes – everyone says this, and for good reason. Even if you’re staying at the Wynn, expect a 15-20 minute hike just to get to the conference area. Add more for when you get lost 🙂 And then you’ll spend a good chunk of the day wandering around the conference area… And then you’ll get lost again heading to your room…
  • Coffee? Despite the 5 stars (and the 5 star cost) the Wynn/Encore doesn’t have coffee makers in the rooms. So you’ll have to go down to the main floor to buy over-priced coffee every morning. Or get by until you can get to the free coffee at the conference.
  • Cheap “Luggage” – Here’s my cheap packing tip. If you end up with more swag than you have space for – there will be no shortage of cardboard boxes available in the vendor hall. Be sure to pack some packing tape and tape the heck out that thing. Depending on your travel plans – it may only need to survive one trip! We’ve successfully done this a few times.

Conversation Ideas

More of us are bad at this then you probably think. Maybe these will help? I tried to keep the list short to make them easier to remember.

  • Is this your first time at Imagine? What do you think?
  • What other events have you been to?
  • What do you do? What does your company do?
  • Where’s the best swag?
  • What time did you get in? When do you leave?
  • What else are you planning to do in Vegas?
Most important – have fun!