Skip to main content

Posts

Showing posts with the label docker

Replacing GCP with Railway for faster cold start

TL;DR I switched a Dart API from Cloud Run to Railway for a 300% faster cold start, simplified DevOps, and a straightforward fee structure. Problem I'm working on this project github.com/daohoangson/flutter_widget_from_html . It is a pub.dev package that's super handy for Flutter developers who want to seamlessly render HTML in their apps. Now, when it comes to HTML, it can get pretty dynamic, right? That's why having a playground to showcase features, troubleshoot issues, and tackle bugs is crucial. The Google team has this fantastic tool called dartpad.dev , which is just perfect for this kind of thing. However, there's a little catch - third-party packages like mine usually can't be used there (unless you have thousands of likes, as explained on  Medium ). So I decided to take matters into my own hands, forked it, then deployed try.fwfh.dev with additional package support. Initial idea since 2019 First deployment  in 2021 Cl...

A faster Docker for Mac experience

Docker for Mac is freaking slow, this is known issue for years. I'm switching to docker-machine running within Parallels for now... Image from unsplash.com Install the tools I use brew to quickly install these: brew install docker-machine brew install docker-machine-parallels Create the virtual machine The --driver param and vm name is required. The others are all optional, the default values are quite low so I bumped the specs a bit. docker-machine create --driver=parallels \   --parallels-cpu-count=2 \   --parallels-disk-size=100000 \   --parallels-memory=4096 \   parallels Usage Set up the shell environment: eval $(docker-machine env parallels) Then use the cli as normal: docker ls docker-compose up -d To get the vm IP address: docker-machine ip parallels

Making GIF of iOS Simulator without additional apps

This is how I did it: open Terminal and execute this command: ``` xcrun simctl io booted recordVideo \   --code=h264 \   --force "$( date +%Y%m%d%H%M%S ).mov" ``` Running this will record the Simulator screen until you press ` Control+C `. The filename will be something like ` 20200730095757.mov `. The next step is to convert this video into GIF, FFMPEG is required for this. You can either install it via Homebrew but I prefer running it in a Docker container, something like this: ``` docker run --rm -it -v $PWD:/data -w /data --entrypoint /bin/bash jrottenberg/ffmpeg ``` Once you have FFMPEG installed or are inside the container, execute this command: ``` ffmpeg -i 20200730095757.mov \   -vf "fps=fps=5,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \   20200730095757.gif ``` I have played around with the command line arguments and came up with those. Basically it will create a decent GIF to use in issue report etc. Bec...