Launching an Engineering Blog
Tags: jigsaw, githubactions, blog, jamstack
Published: 2023-02-05 09:49:04



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](https://wordpress.com/) 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](https://engineering.zalando.com/) 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](https://engineering.zalando.com/posts/2020/07/launching-the-engineering-blog.html).

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](#choosing-static-site-generator)

[Jamstack](https://jamstack.org/generators/) 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](https://jigsaw.tighten.com/) as I am familiar with the technologies it's built with ([PHP](https://www.php.net/) , [Tailwind](https://tailwindcss.com/) for styling and [Blade](https://laravel.com/docs/9.x/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](https://jigsaw.tighten.com/docs/installation/) 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](/blog/static-website-infra-on-aws-with-terraform/).

### [Writing and Publishing](#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](https://res.cloudinary.com/dt5qg3orv/image/upload/c_scale,q_auto:eco,w_1400/v1675188773/Screenshot_2023-01-31_at_10.12.06_PM_kscrqy.png)

After writing, I wanted to automate deployment and publishing. I am using Github as a repository and I have experience with [CircleCi](https://circleci.com/) but I wanted to learn [Github Actions](https://github.com/features/actions). I decided to take this opportunity to learn [Github Actions](https://github.com/features/actions) instead of [CircleCi](https://circleci.com/).

#### here's how I automated the deployment

- Create an [IAM user on AWS](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html) 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](https://res.cloudinary.com/dt5qg3orv/image/upload/c_scale,q_auto:good,w_1400/v1675189880/Screenshot_2023-01-31_at_10.31.04_PM_laupnu.png)

- 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

```

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

### [Tracking](#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](https://plausible.io/) and [getinsights](https://getinsights.io/) and decided to go for [getinsights](https://getinsights.io/) because they have a free tier and I am not really expecting heavy traffic at the beginning.

### [Conclusion](#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](/about) if you need more help or have any suggestions.