Having used various note taking apps over the years I have now come to a place where my technical knowledge is at the point where it is actually easier for me to setup the note-taking system managed by me.

Currently at college I am working a lot with command line and .Net Core and there are various concepts and commands that I need to use over and over again. For this reason I thought that it would be nice to have a documentation that is accessible from anywhere aka a website.

So why go through the trouble of setting up a system myself if there are aweseome note-taking tools like Evernote, Notion or Onenote.So yesterday my premium yearly subscription with evernote just ended. I had a student subscription which costed 50% less than the usual which was a great deal, but for some reason you can only get a year of reduced pricing with Evernote even though I am still a college student.

This really got me thinking since I already pay for a server that is hosted somewhere, why not make more use of my server and have the server host my notes aswell. Having though that I knew that the system had to be robust in order to work - proper version control and continious integration and deployment so whenever I jot something down in Vim and push it to remote repository I can see the new changes on docs.tristan.ee.

The open source documentation/wiki I will be using is MkDocs which is mostly geared towards documentation, but will serve the purpose of notetaking well, since I will be writing them in markdown and the mkdocs will generate html based on markdown files. The huge benefit of using markdown for note-taking is the ability to search through my notes through commandline which was previously not possible when using some proprietary app.

So I don’t want to be copying my files manually to my server and generating the html for the site. Instead I want to setup an CI/CD solution using Github Actions. Before looking at the configuration file of the Github action I will have to setup an additional user on my Linux server. This is recommended since I only want this user to have access to only specific files not to the whole operating system. I will not show you how to do it in this post, but there are various posts about how to achieve it on the internet.

Since I am using Mkdocs then and pipenv for the site, I need to build the final html by using a command mkdocs build --clean which creates a folder called site and for that I need to have all the dependencies installed beforehand. For installing pipenv I am using dschep/install-pipenv-action@v1 github action which automatically configures the pipenv for me. Next I will install the dependencies and generate the website. Last but not least is the process of copying all the generated files to the remote server and for that I use appleboy/scp-action@master.

Having looked into open source note taking applications before I have always wrote it down as a bad Idea since it seems too much work on my end to maintain the system. After two weeks of using the new system I can confidently say that I pleasantly surprised how well the system works. I will write the follow up in a year how are my feelings after a year of using this system.


The solution I came up is better suited for developers and tinkerers who want to mess around. For most people I still suggest using a regular note-taking app or the good old - pen and paper. Down below are listed some pros and cons of using an mainstream note-taking app.

Using note-taking app.

Pros

  • No time on managing the underlying infrastructure.
  • Excellent support on editing and formatting the files.
  • Ability to work simultaneously on the same note with many people.
  • Easy to share notes and the integration with other apps might be better.

Cons

  • Cost
  • You need to use specific file format for your notes.

Below is the finished yaml file that build the site and copies the files to remote server.

name: CI

on: 
  push:
    branches:
      - master
jobs:       
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: [3.7]
    steps:
      - uses: actions/checkout@v2

      - name: Setting up Python Environment
        uses: actions/setup-python@v1
        with:
          python-version: ${{ matrix.python-version }}
      
      - name: Install Pipenv
        uses: dschep/install-pipenv-action@v1
  
      - name: Install dependencies
        run: pipenv sync
      
      - name: Build the site
        run: pipenv run mkdocs build --clean
      
      - name: Deploy
        uses: appleboy/scp-action@master
        with:
          source: ${{ secrets.SRC }}
          target: ${{ secrets.WEBSITE }}
          overwrite: true
          host: ${{ secrets.HOST }}
          username: ${{ secrets.USERNAME }}
          key: ${{ secrets.KEY }}
          port: ${{ secrets.PORT }}
Build pipeline

Build pipeline