Categories
Blog

Setting up an iPad Pro with Coda and Amazon Lightsail for Coding

Some time ago I tried to set up my iPad Pro for coding. I ended up using  Coda and Amazon Lightsail. If you want to know what I was thinking, you should read: Coding on an iPad Pro.

I figured that article did a great job of explaining why I’d ever want to do something as silly as setting up an iPad Pro for Coding, but it never explained how would would go about setting up an iPad Pro with Coda or Amazon Lightsail for coding or any other reason.

Yeah, so here’s that.

Set up Lightsail. Duh.

This is assuming you’ve already got AWS set up, but not Lightsail. If you want to know how to set up AWS, click here: http://lmgtfy.com/?q=set+up+aws

Getting to Lightsail is pretty easy. It should come up under all your services, right under EC2.

On your first attempt, you probably won’t have anything set up, so I’m going to assume you need to create an instance. If you already have an instance and just need to know how to do the actual set up, you can skip ahead. However, I’d appreciate you scrolling up an down a few times to help me build up my site’s engagement numbers. ^_^

Choose and Image

I ended up going for Node.js for reasons, but you can choose whatever you want for what you need. If you’re just doing this to putz around, I’d suggest just going for an OS only instance.

The biggest gotcha is your SSH Key Pair. By default you’re going to see something that says: You are using the default SSH key pair for connecting to your instance.

This should be left alone unless you have a specific need for custom SSH keys, or again, if you already have this set up and just need to get it onto your iPad. More on that in a bit.

The rest just requires you choosing a payment plan, because this will cost you money. I’m sure you can get everything set up for pennies on the dollar just using straight up EC2, but if you knew how to do that, chances are, you already know what you’re doing. I didn’t. I’m a total hack and have no idea what I’m doing. Just don’t tell my manager or whoever cuts my pay check.

Keys. The pain after the easy part.

If you’ve skipped the set up from before, this is where you should start reading.

This is the part that caused me the biggest grief, because I started the whole process on my iPad. However, getting the keys set up on your iPad requires a file system, and Apple says you can’t be trusted with that sort of thing. We know what a coder can do with a file system, so don’t act all innocent.

Chances are you’ve gotten to this point, and clicked on the little terminal icon to ssh via your browser. But that’s not what we’re here for. You need to set up your iPad.

What Coda needs to connect is an actual public key file. In this case, a .pem file. This is something you can easily download via a desktop browser, but is annoying to transfer over to your iPad.

But we’re hackers. We eat annoying problems and crap solutions!

First things first, on your desktop, download your .pem file. You’ll find it in your accounts page, under SSH Keys.

Going Old School. Transfer via iTunes

This was the annoying bit. I tried using iCloud, AirDrop, even Dropbox. Completely forgot that in the beforefore times, we’d transfer files through a friggin’ wire!

When your iPad is connected through iTunes, look for File Sharing, as of iTunes version 12.7.2, and look for Coda in the list of apps.

You just need to drag the .pem file from your computer’s file system (assuming you’re using a Mac to do this. I suppose Windows also lets you drag and drop, but I haven’t used iTunes on Windows in forever),

It may not seem obvious, but click “Done” when you’re done.

Set up keys in Coda

If you’re with me to this point, your keys should now be on Coda. I’m going to assume you’re setting up a new site in Coda, but if not, it shouldn’t be different to add new keys to an existing site.

From the Settings (little gear thing on top of the main screen of Coda), click Keys.

You’re gonna click the + Icon near the top, and you’ll see a list of ways of importing your key. You should click on Import from Itunes.

If you successfully transferred over the key through iTunes, it should pop up like the image below. If it doesn’t show up, try transferring the file again.

Add Keys to your Site in Coda

I’m going to continue assuming you don’t have an actual site set up in Coda. If you already do, the steps aren’t much different. Just edit the site instead of adding a new one.

Whether it’s a new site, or an existing one, you can click on the little terminal icon to get to your site’s terminal set up.

Click on the little Key icon next to password. The password field is just for passwords, but loading in a key will make it use those credentials and not bug you for a password.

You’ll get a menu that lets you choose your keys. The key you imported before should show up here.

Connect to Lightsale. On an iPad.

We’re in the home stretch now. When you’re in your site, you should now see an option for getting to the terminal.

Assuming your credentials are all set, you’ll get a prompt to add the host to your keys. Obviously you should accept this.

If everything works out, you’ll see a lovely prompt on your iPad.

Keep on hacking!

Categories
Blog

Coding on an iPad Pro

So, I have an iPad Pro. And I want to use it for coding.

I use it mostly to do artwork (I also have an art blog) and quite recently I picked up a keyboard so I can do some writing. Mostly working on comic scripts, because I like to think I’m man of many talents, but mostly to silence the voices in my head.

It got me to thinking, if I have an iPad Pro, and I have a keyboard. Why can’t I use this combination to write code?

(If you want step by step instructions, read my actual instructions for Setting up an iPad Pro with Coda and Amazon Lightsail for Coding)

Some time ago, I had dabbled in some coding on my iPhone (and Android before I switched over to iOS because of reasons) and remembered a few apps that were essentially interactive shells, but nothing useful for writing “production” code. This was some time ago, so I had hoped there’d be some new development (pun not intended?) in using tablets and mobile devices for coding.

Not an Ad. I’m just linking to things that I’ve used to support the developers.

Sad to say, there wasn’t much on the iOS side that was useful. There were a few apps, like VIM for iOS and JSAnywhere that were kinda nifty, but again, still siloed and not really useful. Overall, the biggest players, in my opinion, were CodeAnywhere and Coda. I’m sure I could write some serious articles about both of them, and I probably will in the near future, but ultimately I found Coda to be the most useful for my purposes.

Coda VS Code Anywhere

Long story short, a lot coding that I do outside of my “day job” ranges from basic webmaster stuff like “My WordPress Site” or “custom HTML thingie my nephew wrote” doesn’t work to prototype a React/Redux thingie for fun. CodeAnywhere and Coda worked great for the former, not as great for the latter, at least not immediately out of the box.

I had been using CodeAnywhere for some time for one specific client, as she required simple html changes from time to time. CodeAnywhere let me set up a simple ftp connection to her site and I could jump in from anywhere to make changes. In one case, over my iPhone, while I was commuting into my day job.

The specifics are beyond this article, but simply put, if I had my physical keyboard connected, the software keyboard for CodeAnywhere would push the code up and off-screen, where I couldn’t see what I was coding. No bueno CodeAnywhere.

So where am I going with this?

I started digging around (links at the end) for other people’s experiences with trying to set up an iPad Pro for coding, and came to the conclusion that an I’d be better off treating the iPad Pro as s thin client rather than a dev machine. This approach would actually be ideal, because I wouldn’t have to worry about code syncing or machine performance, since everything would work through SSH. The downside would be that I’d be required to have an internet connection.

Sticking with CodeAnywhere, I realized that their service was kind of doing the same thing, and maybe I could try using ssh to connect to my CodeAnywhere remote box. This worked, but the trouble was that I was using the “Free” version and the machine would go offline. While that doesn’t sound like a deal breaker, I found that I had to log into CodeAnywhere via a desktop browser to wake up the virtual machine. Kind of annoying and counter productive if I was traveling with only my iPad Pro.

By this point, I had the same revelation that you might have had: Why not Amazon?

Amazon

Seriously. This is not an ad.

While I was reading up about EC2 and other Amazon Services, I had also started reading more about Coda for iOS. I had considered using Coda as a desktop IDE for OSX back years ago, but I ended up going down the TextMate route instead. That’s a story for another day, but I always kind of kept my eye on Coda over the years and was intrigued at how it progressed on iOS.

Screenshot stolen from Panic, Coda’s manufacturer.

I decided to bite the bullet and pick up a copy of it, and try to set up EC2. For me, the difficulty wasn’t setting up Coda, but ultimately EC2 itself. There was just too many options and it was kind of overwhelming. However, all my furious googling for EC2 instructions lead me towards Lightsail, a new product (as of this writing) from Amazon.

Light at the end of the tunnel

If I had to describe Lightsail, I’d say it’s EC2 for newbs. I had a simple node server set up in under a half hour, that I was able to ssh in from a browser in no time. Setting it up via iTerm2 was just as easy.

The hard part, was the iPad.

The biggest hurdle for me was getting my public key onto the iPad, since of course, Amazon expects you to be using a desktop computer, with a file system. A this point, I’m sure all of you Android fanboys are rolling your eyes at me, but whatever.

Getting the key set up with Coda was troublesome, but ultimately I got it working by copying the .pem file over to my iPad Pro via iTunes. I hated myself for doing it this way, but it worked, and yeah, I now have an iPad Pro that I can do actual code on.

Now, onto getting Git set up…

Step by step Instructions: Setting up an iPad Pro with Coda and Amazon Lightsail

More Reading: