Self-hosting simple-blog

2021/02/09 14:26

#simple-blog #hosting

Simple steps to self-host your own instance of simple-blog

Why?

Initially, simple-blog was created for my own use case. However, my younger brother wants a personal blog too, so I hosted another instance of simple-blog for him at realhuy.

To make it usable for other, non-tech people, I have to update many things in the admin page (to make the UX friendlier), as well as update the deployment process.

What?

As stated in the introduction post, simple-blog uses Docker for deployment.

Now, to further simplify the whole process, I created a simple script to automatically build and publish the image to docker hub every time a new tag is out.

The docker hub repository can be found here: https://hub.docker.com/repository/docker/nkhdo/simple-blog

How?

So, the docker image is published, how to host simple-blog now?

There are 4 simple steps:

  1. Install docker and docker-compose
  2. Create docker-compose.yml file with this content:
version: "3.3"
services:
  blog:
    image: nkhdo/simple-blog:latest
    ports:
      - "3333:3333"
    volumes:
      - ./.env:/simple-blog/.env
      - ./tmp/:/simple-blog/tmp/

  1. Create .env file with this content:
PORT=3333
HOST=0.0.0.0
NODE_ENV=production
SESSION_DRIVER=cookie
APP_KEY=your-secure-key
APP_URL=your-website-root

Remember to change APP_KEY and APP_URL. APP_KEY can be generated at https://passwordsgenerator.net/

  1. Start the blog by running:
docker-compose up -d

What next?

It’s still not easy enough, and requires some technical knowledge. I will try to make it simpler in the future (create a generator, maybe).

Back to Blog