I been needing alot of things lately. I was using evernote to keep my notes and ever since they changed their free offering, I've had my notes scattered all over notepad++, atom, code, etc and needed a quick and fast place to stop and keep up with my notes. I needed something portable and that will not get deleted, so I came up with my wiki.sh script!
Features
- tested on macOS, linux, wsl
- creates
wiki
directory in your ${HOME} - cleanup clearns off everything
- runs in both http and https
- ports are configurable
- do not need root, just need to be part of the docker group
Requirements
- docker is needed and for you to be part of the docker group
- container name will be wiki so you can not have other containers named wiki or have a directory named ${HOME}/wiki
- github to be setup with ssh key access https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh
- Create a private github repo named wiki https://docs.github.com/en/github/getting-started-with-github/create-a-repo
Installation
$ curl -fsSL https://raw.githubusercontent.com/jlim0930/scripts/master/mywiki.sh -o mywiki.sh
$ chmod a+x mywiki.sh
$ vi mywiki.sh # add your github username and change ports if needed
Commands
- build - will perform a fresh bootstrap. Creates ${HOME}/wiki and clone from github and start the container
- start - if the container is stopped this will start or build a new one
- stop - stops the wiki container
- pull - Will pull from github and restart your container
- push - will push your local wiki to github
Please note: run ./mywiki.sh push
often so that you are constantly backing up your content.
$ ./mywiki.sh start
[DEBUG] Creating /Users/jlim/wiki
Cloning into '/Users/jlim/wiki'...
remote: Enumerating objects: 4195, done.
remote: Counting objects: 100% (4195/4195), done.
remote: Compressing objects: 100% (3307/3307), done.
remote: Total 4195 (delta 588), reused 4037 (delta 431), pack-reused 0
Receiving objects: 100% (4195/4195), 34.34 MiB | 19.81 MiB/s, done.
Resolving deltas: 100% (588/588), done.
[DEBUG] Creating wiki container
$ ./mywiki.sh push
[main 17202a0] wiki updated 20210223-1629
1 file changed, 2 insertions(+)
Enumerating objects: 9, done.
Counting objects: 100% (9/9), done.
Delta compression using up to 16 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 518 bytes | 518.00 KiB/s, done.
Total 5 (delta 3), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
To github.com:jlim0930/wiki.git
f4081ec..17202a0 main -> main
Branch 'main' set up to track remote branch 'main' from 'origin'.
$./mywiki.sh pull
[DEBUG] wiki container is already running
HEAD is now at 17202a0 wiki updated 20210223-1629
Already up to date.
$ ./mywiki.sh cleanup
[DEBUG] Stopping container
[DEBUG] Removing container
[DEBUG] Removing /Users/jlim/wiki directory