iphone devops part 3

This commit is contained in:
Richard 2023-12-30 16:52:46 +01:00
parent 3c869902ea
commit 06047b1107
3 changed files with 80 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

View File

@ -0,0 +1,80 @@
---
title: "iPhone DevOps - ultimate edition"
date: 2023-12-28T19:57:34+01:00
draft: false
tags: [mobile]
---
I wrote [earlier](https://clearsky.dev/blog/iphone-devops/) about my dream of developing "single-handedly" on an iPhone. Then, I wrote [some more about it](https://clearsky.dev/blog/iphone-devops-python/). The dream still lives strongly! I am now coding single-handedly in any language on my iPhone SE model 2022. But although i still like [pythonista](http://omz-software.com/pythonista/) I am now using a combination of three great apps that allow me to write code in any language using only one hand, holding my son in the other!
> what happened to pythonista? Wasn't it awesome because it could copy-paste and stuff?
Pythonista still is a great app. An update came out early this year featuring a much-needed python version push to 3.10. I still like to use the app for small scripts such as [Advent of Code](http://adventofcode.com).
## A new quest
So what disturbed the bliss of my little pythonista-powered mobile dev heaven? I blame [protohackers](https://protohackers.com). The day I found this site, I knew i had to go back to the drawingboard for my mobile dev workflow.
The idea for protohackers is this: the site gives you a spec for a client-server protocol. You have to implement the server. You then plug the ip and port of your running server into the website, and it runs a series of tests interacting with your server. You have to make all tests pass. You can implement your server in any language you like. The specs are mostly watertight, although there are some surprises in the tests. The protocols are on top of either TCP or UDP. Overall these challenges are really well designed and a lot of fun to implement. My solutions are [here](https://git.clearsky.dev/richard/Proto)
So i wanted to do these challenges, but my workflow could not support it:
* I cant just open up a port on my iPhone. It sits behind a router at home, or some kind of [NAT](https://en.m.wikipedia.org/wiki/Carrier-grade_NAT) outside. Even if I could, I don't know if it would be a good idea security-wise.
* I don't want to do this one in python. I want to use this challenge to gain some more experience in [golang](https://go.dev)
## The search is on (again)
After revisiting all the options from my earlier searches, and looking at a bunch of code editors/ide's, I was just ready to start vim in a terminal and start working completely on my server.
I was using [termius](https://termius.com/) which is a pretty nice terminal app even when you use the free version. But i decided to do a quick search for terminal apps and see if anything popped out that would work even better. And that's when it happened.
I found [secure shellfish](https://secureshellfish.app/)
## Secure shellfish
I wouldn't call it the best terminal app, because the menus are a bit hard to navigate and some design choices are a bit... creative. But in spite of that, I love it! Mostly because this app has 1 killer feature:
✨Offline folders ✨
This is like rsync for your phone. In fact I would not be surprised if this is implemented using rsync. Once you configure an offline folder, it will two-way sync that folder while you use the app. The kicker is: on your phone you can now open that folder in another app (like an editor) and make changes. When you switch back to the shellfish app, the changes are uploaded almost instantly. Also changes that happen on the server come back to the phone.
![Offline folders](offline.png "Offline folders")
For me this is a killer feature because it allows me to switch back and forth between the editor and the shell.
* Make a change
* switch to shellfish
* up arrow enter
* back to the editor
* repeat!
## The place to run code
So now that my code doesn't run on the phone anymore, it needs a place to run.
I already had a vps running, so for me this was not a problem. Any linux based machine will do. I use docker to easily spin up environments for each project. I am on a [contabo](https://contabo.com) vps which has really nice specs for money, but I did have some outages lately. I might switch provider soon.
Ofcourse if you are on a budget, ypu can use any linux machine you have running at home.
## The editor
So now we need to find an editor that can open the "offline folder". I landed on [textastic](https://www.textasticapp.com/) which has its own sftp functionality and even a shell builtin. I didnt get that to work smoothly. The app allows you to open "external folders" which is how you can reach the shellfish folder.
![External folders](external.png "Two synced folders from my vps and one stored locally by working version")
The syncing works really well. I have seen one problem which is that if you type something and then switch the shellfish app, it doesn't seem to sync the file. It looks like textastic didn't save the file. My workaround is to move the cursor, just tap anywhere in the file before switching away from the editor.
Other features that this editor does well is search/replace, search in files and file management (move, rename etc)
Im not sure if other editors can do the "external folders" trick, or if textastic is the best one. So far it works really well. There's room for improvement here, I might test some other editors and write a follow-up some time.
## The version control
I use git mostly as a backup for my code. I have my own git server for private projects and github for public. Now I could use the commandline git and commit that way. That works okay, but I really like the [working copy](https://http://workingcopy.app) app. It can attach to the same "external folder" and you are off to the races! This app is made by the same developer as shellfish.
## The euros
Good things have a price. Here's the full damage report:
* shellfish life unlock: € 24,99
* textastic € 9,99
* working copy life unlock: € 24,99
* contabo vps: € 7,25 / month
Shellfish and working copy also have subscription-based pricing which is great if you are unsure if mobile dev will work for you. I went for the fixed price and am pretty sure I'm going to enjoy these apps for quite some time.
## The conclusion
The conlusion remains the same as the previous editions: it works, but not for impatient people. It has become my alternative to social media. While it might be a lot less effective than a laptop, it's definitely a lot less mind-numbing than instagram.
With that, let's get back to writing some code!

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB