Posts

Showing posts from 2023

Mobile app development with Flutter

Jumping into📱 Mobile App development with Flutter🪽. Its a code once deploy many framework backed by Google that lets you deploy Android, iOS, Linux, Windows and Mac apps from the same code base. We are using it to develop a Weather and Emergency response app for the Tonga Met Services. 🫣 Ive found it doesnt play well with Docker which means you have to install the dev environment directly on your machine 👎 . The setup takes about 30 to 60 mins⏳️ depending on your internet connection.  For Android app development its also recommended to plug in a real phone for testing as the emulator takes ages to run. Im close to deploying to my phone. Watch this space! 🎥

IT support, centralising staff data and Drupal upgrades

Been a minute!👋 What have I been working on lately? The team have been on a round of duty travel and annual leave meaning I've had to cover for them. I've dived back into some good ol tech support provisioning new laptops, installing printers, dealing with outlook, firewall and .Net issues. Phew! Still got it! 😂 Its reminded me of some duplications we have in data. I'll be looking at building some systems for better integration of our staff info across Active Directory, Office 365 and our inhouse CRM system. I also found some forgotten repositories that one my ex-colleagues left behind that was in dire need of security patches. Upgrading for Drupal v8.5.x to 8.9x to 9.11.x and converting to a docker based dev environment using composer and Continuous Integration tests. 🤖

Automated software testing

 💥 Developing automated tests 🧪 for your code can be 🕰 time consuming but its worth it knowing that future features or code refactoring will not break your work and give unnecessary ❌️ errors/headaches for the users. Spent 30 mins developing a new software feature and 2 hours writing a test for it. It was worth it to discover and fix a 🐞 bug. As bonus, I learnt some techniques to make them run 70% faster 🚀.

Cross-cutting programming techniques

The great thing about coding in different languages is you realise they tend to borrow from one another and you're able to apply patterns, styles and principles across languages.  Being trained in backend development and Object Oriented Programming (OOP), I found it strange but useful that Javascript (JS) would allow you to define single functions and import them into your code. I mostly work with Drupal and PHP. But it wasnt until I used Laravel that I found PHP traits which gives you the same ability as Javascipt to reuse a function in multiple places.  Furthermore using Python I found skipping semi colons for each line of code liberating. When I realised JS supported this, it was byebye semi colons. These days Im in love with JS for being super responsive. But I know that securing the backend is critically important. 

Cloud Development environments for LEMP stack using Android in Samoa

Image
  Cloud IDEs have exploded in recent times with the likes of Replit , Stackblitz and CodeSandbox . They allow you to code from any machine using only your browser and a stable internet connection. Many options favour Javascript (JS) frameworks such as Vue , React and Svelte . Yet, it's difficult to find support for a LEMP stack which uses Linux, Nginx, Mariadb/ MySQL and PHP. Codespace for Cloud Dev environments using Docker Compose Recently, I had to work from my phone so I looked at Cloud IDEs to code using Samsung Dex . I tried several options and chose Github Codespace . Codespace lets you get started for free. Out of the box you have access to docker, docker compose, node and git from the terminal. You also have a VsCode Editor available. The repo I worked on was already set up for docker and docker compose. With this setup, Nginx, Mariadb and PHP all run in their own containers and use Docker Compose to communicate . Getting started was a matter of cloning my repo from Git

Upgrading Wodby servers from Debian 9 to 11

Image
  TL;DR You need to upgrade from Debian 9 to 10 . Then from Debian 10 to 11 . IMPORTANT: Before upgrading to the next major version of an OS, the docs recommend to: Stop kube and docker services at first Perform the upgrade Reboot Make sure Docker was not installed from packages (we require a specific version that we manually install during server connection) Check iptables version via iptables --version . If it's 1.8.2 or newer switch it to legacy mode: update-alternatives --set iptables /usr/sbin/iptables-legacy Make sure cgroup2 disabled Background We use the Wodby service to effortlessly provision and deploy our web applications. It allows you to bring your own servers and deploy your own stacks using docker containers. Out of the box they provide several popular stacks such as Drupal and Wordpress. The Docs While performing some maintenance I realised that one of my servers was running Debian 9 and wanted to upgrade it the recommended Debian 11. I dove strai

Tips for improving Drupal security

Image
  I had a chance to check out the Talking Drupal: Drupal security podcast. These were my key takeaways. Top 3 tips Its stuff we already know about but don't do. Lets educate and remind ourselves and others. Do not write down passwords (especially on sticky notes). Use a Password Manager e.g. LastPass , Bitwarden , Passbolt Patch your modules. Security patches are released every 3rd Tuesday of the month by the Drupal Security team . Sign up to security announcements. You can use RSS feeds to bring updates to your slack, teams, etc. There is also a Discord site . Use tools that make your code better. e.g. CI to make it more readable (coding styles, comments). Code reviews. Write the least amount of code as possible. No code is best ie only using Core and Contrib modules. (IMO, as a developer this is impossible 😂)    Contrib modules to help improve Drupal security Cloudsec - Uses the Crowdsec service to block malicious traffic Username enumeration prevention - Prevents a

Deploying Laravel Jetstream Inertia based app on LEMP stack and Ubuntu 22

Image
Today I deployed a Laravel 10 Jetstream Inertia based app on LEMP stack and Ubuntu 22. Here is the gist of what I went through. Deploy server with Ubuntu 22 I deployed a private Github repo so I needed to generate a public ssh key for your user . ssh-keygen -t ed25519-sk -C "YOUR_EMAIL" . Next add that key to your Github repo deploy tokens. Clone repo to /var/www/[your-site] git clone [myrepo] . Install Basic Laravel with LEMP stack and Composer with this tutorial . Also handy to refer to Laravel's recommended Nginx config Used strong (level 2) password for mysql setup which required logging in using sudo mysql and setting the root password before continuing with the usual sudo mysql_secure_installation process. Also needed additional php plugins for my app php-gd, php-zip My public folder was not in the root so I have to set it to ./laravel/public for my vhost file. In order to mock my production domain (which does not have DNS records yet). I edited my local

Challenges of self hosted Gitlab with docker compose and Cloudflare

Image
  SSH ports Self hosted Gitlab normally uses port 22 for SSH access. When running docker this is not ideal as its usually used by the server. Its best to map it to another port. The Gitlab docs provides an example of using port 2224. Gitlab Web UI booted up great! But I could not clone or push to the repos using port 2224. First this port is blocked by my organisations firewall. Using online tools I checked if it was accessible outside of our network. Nada! We proxy our traffic using Cloudflare. To get it working, I used one of the allowed non-caching ports. This allows me to have my Web UI proxied but still have access to SSH for git cloning. There are other options available . Server specs I used a cloud server and initially set the specs too low. Ensure to check the minimum server requirements before selecting your specs. Boot time Although docker compose reports that the container is running as soon as you issue the docker compose up -d command, it takes a while for G