Launching an Engineering Blog

bahaanoah

Bahaa Noah

Posted on February 5, 2023

Launching an Engineering Blog

Launching a personal engineering blog has always been one of my career goals, which I had put off for a long time before finally achieving. There has been always a push back when it comes to choosing tech stack for building it, I never been a big fan of CMS solutions like wordpress and other similar CMS, there is nothing wrong with it, it's just a personal preference. The other option was to build it myself using any of the languages I am familiar with like PHP or Java but that was an over kill and too much for just a blog.

I got inspired to start when I came across a blog post from Zalando Engineering on linkedin about how they launched there engineering blog and that was the triggering point for me, you can read more about it here Launching the Engineering Blog.

In this post, I'll take you through how I built my blog using static site generator and automating publishing and deployment on AWS S3 using Github Actions.

Choosing Static Site Generator

Jamstack provides a wide range of static site generators. They are all pretty much having similar functionalities to render a website from Markdown.

I decided to choose jigsaw as I am familiar with the technologies it's built with (PHP , Tailwind for styling and Blade as template engine) as it will be easy to customize if needed besides that, it comes with decent amount of features out of the box, I barely did any customization to it, just followed the installation instructions and got started.

After installation and customizing it, I wanted to setup the infrastructure where it will be hosted. I wrote another blog post on how I used Terraform to build static website infrastructure on AWS, read more about it here.

Writing and Publishing

As it's an engineering blog writing markdown is pretty much familiar to most of software engineers given the fact we have to write markdown documentation all the time.

writing-markdown

After writing, I wanted to automate deployment and publishing. I am using Github as a repository and I have experience with CircleCi but I wanted to learn Github Actions. I decided to take this opportunity to learn Github Actions instead of CircleCi.

here's how I automated the deployment

  • Create an IAM user on AWS with S3 full access permission and save the access key and secret for later.
  • In Github in your repository setting under security section, click on Actions option and create two new repository secrets from the keys you have from the previous step AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

Creating Environment Secrets

  • Finally create an action workflow that will trigger once merged on the main branch.
name: Main

on:
  push:
    branches: ["master"]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Install Composer Dependencies
        run: composer install
      - name: Install Npm
        run: npm install
      - name: Run Npm prod
        run: npm run prod
      - name: Build Jigsaw site
        run: ./vendor/bin/jigsaw build production

      - name: Configure AWS credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: ap-south-1 // change that to the region you are using
      - name: deploy
        run: aws s3 sync build_production/. s3://bahaanoah.com/ --region ap-south-1 --delete

Enter fullscreen mode Exit fullscreen mode

And there you have it a functional blog with automated CI/CD.

Tracking

Eventually I wanted to get some insights on blog views without invading visitors privacy and being GDPR compliance without Cookie banners. I found some great options like plausible and getinsights and decided to go for getinsights because they have a free tier and I am not really expecting heavy traffic at the beginning.

Conclusion

I do strongly believe one of the best ways to learn is by teaching and that has been one of the main reasons I started blogging, besides that I am passionate about sharing knowledge and simplifying complex subjects.

I hope this was helpful and will inspire you to start your own blog and start writing as well. It can be also a good use as an engineering blog for your company that provides a good platform for engineers to publish their thoughts and share the engineering culture there.

Thanks for reading, I hope this was helpful. Please feel free to reach out if you need more help or have any suggestions.

💖 💪 🙅 🚩
bahaanoah
Bahaa Noah

Posted on February 5, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Launching an Engineering Blog
jigsaw Launching an Engineering Blog

February 5, 2023