diff options
Diffstat (limited to '_posts')
| -rw-r--r-- | _posts/2020-12-06-fossil-to-git.md | 68 | ||||
| -rw-r--r-- | _posts/2020-12-09-fossil-autoupdate-cronjob.md | 67 | ||||
| -rw-r--r-- | _posts/2021-01-06-run-cgit-on-obsd.md | 272 | ||||
| -rw-r--r-- | _posts/2021-05-23-join-the-test-of-my-matrix-server.md | 58 | ||||
| -rw-r--r-- | _posts/2021-06-02-i-launched-a-gemini-capsule-recently.md | 98 | ||||
| -rw-r--r-- | _posts/2021-08-18-matrix.aaoth.xyz-is-down.md | 32 | ||||
| -rw-r--r-- | _posts/2021-11-03-dualboot-linux-and-openbsd-with-grub.md | 70 |
7 files changed, 0 insertions, 665 deletions
diff --git a/_posts/2020-12-06-fossil-to-git.md b/_posts/2020-12-06-fossil-to-git.md deleted file mode 100644 index cacb4c9..0000000 --- a/_posts/2020-12-06-fossil-to-git.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: fossil export to git -author: la-ninpre -tags: fossil git tutorial ---- - -i was trying to export my website repo to fossil using suggested method from -[fossil website][1]: - -``` -git fast-export --all | fossil import --git repo.fossil -``` - -[1]:https://www.fossil-scm.org/home/doc/trunk/www/inout.wiki - -but i didn't like that fossil recognizes my email as username and so commit -messages user was `user@example.com` instead of `user`. - -<!--more--> - -i then read a bit about options of `git fast-export` and found `--anonymize` -flag. but it's results weren't satisfying either. - -when i looked on a raw output of `git fast-export`, i noticed that commit author -is specified there as - -``` -author user <user@example.com> -``` - -and then it's flashed in my head: why not pipe git export through sed and just -replace the contents of `<>` with username instead of email. - -so the final command looks like this: - -``` -git fast-export --all | \ - sed -E 's/^((author)|(committer))[[:blank:]]+([[:graph:]]+)[[:blank:]]+(<[[:alnum:]]+@[[:alnum:]]+\.[[:alnum:]]+>)/\1 \4 <\4>/' | \ - fossil import --git repo.fossil -``` - -and it converts - -``` -author user <user@example.com> -``` - -to - -``` -author user <user> -``` - -which is odd, but fine for fossil import. - ---- - -update: i tested this on a bigger repo with older history and found that this -regexp was not perfect, i updated it to handle situations like -`user@example.co.uk` and also names that consist of more than one word. - -``` -git fast-export --all | \ - sed -E 's/^((author)|(committer))[[:blank:]]+([[:graph:]]+([[:blank:]]+[[:graph:]]+)*)[[:blank:]]+(<[[:graph:]]+@[[:graph:]]+(\.[[:graph:]]+)+>)/\1 \4<\4>/' | \ - fossil import --git repo.fossil -``` - -it's veery evil looking horrible thing, but it works. diff --git a/_posts/2020-12-09-fossil-autoupdate-cronjob.md b/_posts/2020-12-09-fossil-autoupdate-cronjob.md deleted file mode 100644 index 70f8fc8..0000000 --- a/_posts/2020-12-09-fossil-autoupdate-cronjob.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -title: auto-update fossil using cron(8) -tags: openbsd tutorial fossil -date: 2020-12-09T01:37+03:00 ---- - -i'm running an instance of fossil on my openbsd server (it's the same that is -powering this website) and for some reason i want it to be up-to-date. more -presicely, bleeding edge. - -<!--more--> - -for that i added this part to my `daily.local` script (for those of you who -don't know, it's script that running every day by cron(8)): - -``` -cd /root/fossil && \ - /usr/local/bin/fossil up | \ - awk '/changes:/ { - if ($2 == "None."){ - print "No changes, exiting..."; - exit 1 - }else{ - out=""; - for(i=2; i<=NF; i++){ - out=out" "$i - }; - } - print out; - exit 0 - }' && \ - /usr/local/bin/fossil revert src/repolist.c >/dev/null && \ - patch src/repolist.c /var/www/htdocs/fsl.aaoth.xyz/repolist.c.patch \ - >/dev/null && \ - ./configure --static >/dev/null && \ - make >/dev/null && \ - cp fossil /var/www/bin && \ - make distclean >/dev/null && \ - /usr/local/bin/fossil stat -``` - -it is very straightforward and simple. firstly, it's changing directory into -place, where i have fossil checkout (made with `fossil clone` and -`fossil open`). then it runs `fossil up` and piping it to a small awk script -that is checking, is there any changes pulled down. - -after that there's one interesting part. `fossil revert src/repolist.c` is there -because i modified it a little bit to make my [repolist][1] page look better. -after my edits, i exported a patch by executing: - -``` -fossil diff > repolist.c.patch -``` - -maybe it would be better if i committed those changes, but i don't want to hold -a full fossil repo among my other fossils, because its history is fairly long. -and also i'm not very good at c programming, so i'll keep it as is for now. -if you're interested this patch is free to use and you can [check it out][2]. - -after that, there's just a normal configure and make procedure and also final -cleanup. - -i also have a mail server running there, so i get an email of what changes were -applied and that everything went fine. - -[1]:https://fsl.aaoth.xyz -[2]:https://fsl.aaoth.xyz/repolist.c.patch diff --git a/_posts/2021-01-06-run-cgit-on-obsd.md b/_posts/2021-01-06-run-cgit-on-obsd.md deleted file mode 100644 index e1c74bd..0000000 --- a/_posts/2021-01-06-run-cgit-on-obsd.md +++ /dev/null @@ -1,272 +0,0 @@ ---- -title: run cgit on openbsd -date: 2021-01-06T13:30+03:00 -author: la-ninpre -tags: openbsd git tutorial ---- - -i started using git for my personal pet projects. a little time then i decided -that it would be a nice idea to make them as open as i can. i use github, but -to support that idea of self-hosting, i wanted some free and easy web frontend -to git. cgit is one of the most popular ones, but it was kinda tough to run on -openbsd. - -<!--more--> - -i know gitweb exists, but i just like cgit more. - -cgit is quite easy to install still, but needs some work done, it's not like -two commands. - -[official cgit page][1] has some installation instructions. it mentions that -it's distributed in binary form for some linux distros, but of course openbsd's -not there, so we'll need to build it from source. - -first of all, i wanted to use openbsd's native web server`httpd` and native -fastcgi server -- `slowcgi`. -the issue is that openbsd's httpd web server lives in chroot-jail and that fact -is complicating the configuration. -but before we need to build cgit from source. - -## building cgit - -to do that, clone cgit source code from [official cgit page][1] -(or if you like [my cgit page][2], you can clone it instead): - -``` -$ git clone https://git.zx2c4.com/cgit -``` - -then move to this directory: - -``` -$ cd cgit -``` - -there are some source files and a Makefile. by default, it'll install cgit in -`/var/www/htdocs/cgit`. if you want a different path, make corresponding change -in a Makefile by editing `CGIT_SCRIPT_PATH` variable. - -but before compiling cgit itself, we need to init and build git submodule -(i suppose, this is the source code of git itself that is needed to make some -git operations on repositories): - -``` -$ git submodule init -$ git submodule update -``` - -and then we can compile cgit. note that gnu version of make utility is used, -install `gmake` from openbsd repositories (`doas pkg add gmake`): - -``` -$ gmake && doas gmake install -``` - -notice that this command should be executed by user who has write permissions -to `/var/www` and `/usr/local/lib` (usually root). - -when it's done, the rest is to create directories needed for cgit to work -and also to configure `httpd` and `slowcgi`. - -## creating directories and dev/null - -cgit uses following files to work: -- `/etc/cgitrc` -- needed for configuration - (see [man page][3] for available options) -- `/var/cache/cgit` -- cache that is used by cgit to reduce cpu usage -- `/var/www/htdocs/cgit/` - - `cgit.css` -- stylesheet - - `cgit.png` -- logo - - `favicon.ico` -- favicon - - `robots.txt` -- instructions for indexers -- `/usr/local/lib/cgit/*` -- different filters and stuff - (i didn't need it at all, because it's hard to make it work in a chroot) -- `/dev/null` -- i don't know exactly why it's needed, but it won't work without - it - -because cgit will run in chroot-jail, all those files and directories except -`/var/www/htdocs/cgit` should be located in `/var/www` -(e.g. `/var/www/etc/cgitrc` and so on). - -``` -$ doas mkdir -p /var/www/{cache/cgit,dev,etc,usr/lib,usr/libexec} -$ doas chown -R www:www /var/www/{cache/cgit,htdocs/cgit} -``` - -`/dev/null` is not a regular file, it's a device, so it must be created using: - -``` -$ doas install -d -g daemon /template/dev -$ cd /template/dev -$ doas mknod -m 666 null c 2 2 -$ doas mount_mfs -s 1M -P /template/dev /dev/sd0b /var/www/dev -``` - -this instruction is taken from [fossil docs][4]. - -## copying libraries - -since cgit is not linked statically, it also needs some dynamic libraries. -they all need to be accessible from chroot, so we need to copy them to -`/var/www/usr/lib`. to check, what should be copied, run: - -``` -$ ldd /var/www/htdocs/cgit/cgit.cgi - -/var/www/htdocs/cgit/cgit.cgi: - Start End Type Open Ref GrpRef Name - 00000b068a590000 00000b068a7b6000 exe 2 0 0 /var/www/htdocs/cgit/cgit.cgi - 00000b0927dcb000 00000b0927de7000 rlib 0 1 0 /usr/lib/libz.so.5.0 - 00000b0937409000 00000b093750b000 rlib 0 2 0 /usr/local/lib/libiconv.so.7.0 - 00000b0978c28000 00000b0978c37000 rlib 0 1 0 /usr/local/lib/libintl.so.7.0 - 00000b091fdc0000 00000b091fdcc000 rlib 0 2 0 /usr/lib/libpthread.so.26.1 - 00000b0920331000 00000b09203be000 rlib 0 1 0 /usr/local/lib/libluajit-5.1.so.1.0 - 00000b091cc5f000 00000b091cd54000 rlib 0 1 0 /usr/lib/libc.so.96.0 - 00000b089fffb000 00000b08a002b000 rlib 0 1 0 /usr/lib/libm.so.10.1 - 00000b08b2542000 00000b08b2585000 rlib 0 1 0 /usr/lib/libc++abi.so.3.0 - 00000b08cebc7000 00000b08cebc7000 ld.so 0 1 0 /usr/libexec/ld.so -``` - -and it'll return a list of all dependencies. copy them to `/var/www/lib`: - -``` -$ doas cp /usr/lib/{libz.so.5.0,libpthread.so.26.1,libc.so.96.0,libm.so.10.1,libc++abi.so.3.0} /var/www/lib -$ doas cp /usl/local/lib/{libiconv.so.7.0,libintl.so.7.0,libluajit-5.1.so.1.0} /var/www/lib -$ doas cp /usr/libexec/ld.so /var/www/usr/libexec -``` - -you should be able now to test cgit using this command: - -``` -$ doas chroot -u www /var/www /htdocs/cgit/cgit.cgi -``` - -it should return no errors but a webpage. - -## configuring cgit - -as already mentioned, cgit is configured using `/var/www/etc/cgitrc`. i suggest -reading [manpage][3] for detailed overview of all available options, but here's -an example cgitrc to start with: - -``` -#cache -cache-size=1000 -cache-dynamic-ttl=60 -cache-static-ttl=44640 -cache-root-ttl=6 -cache-repo=5 - -#index page -enable-index-links=1 -enable-index-owner=0 -max-repodesc-length=60 -root-title=aaoth's git repos -root-desc=some personal projects - -#repo global -enable-git-config=1 -enable-commit-graph=1 -enable-follow-links=1 -enable-blame=1 -enable-http-clone=1 -enable-log-filecount=1 -enable-log-linecount=1 -enable-html-serving=1 -branch-sort=age -snapshots=tar.gz zip -side-by-side-diffs=0 -max-stats=week - -#root -readme=:README.md -readme=:readme.md -readme=:README -readme=:readme - -#mimetypes -mimetype.html=text/html -mimetype.gif=image/gif -mimetype.jpg=image/jpeg -mimetype.jpeg=image/jpeg -mimetype.png=image/png -mimetype.svg=image/svg+xml -mimetype.pdf=application/pdf - -scan-path=/git -``` - -some of the settings are omitted, but you can tweak it further as you wish. - -note that i use autoscan feature of cgit. i have all my repos located in -`var/www/git` as described by `scan-path` option. -all of them are chowned by www user and have `cgitrc` text file inside. - -each repo-specific `cgitrc` looks like this: - -``` -name=test_repo -desc=test repository to test cgit -owner=username -max-stats=month -``` - -## configuring httpd and slowcgi - -and now the last part is to actually serve cgit using httpd and slowcgi - -first of all, enable and start slowcgi: - -``` -$ doas rcctl enable slowcgi -$ doas rcctl start slowcgi -``` - -then edit your `/etc/httpd.conf`, you need to create a simple server statement - -``` -server "example.com" { - - listen on egress port 80 - root "/htdocs/cgit" - - location "/cgit.css" { - root "/htdocs/cgit" - } - - location "/cgit.png" { - root "/htdocs/cgit" - } - - location "/robots.txt" { - root "/htdocs/cgit" - } - - location "/favicon.ico" { - root "/htdocs/cgit" - } - - location "/*" { - fastcgi { - socket "/run/slowcgi.sock" - param SCRIPT_FILENAME "/htdocs/cgit/cgit.cgi" - } - } -} -``` - -i know it can seem *very* odd, but it's the only way it works for me. as always, -all improvement suggestions are welcome. - -and finally, (re-)start httpd: - -``` -$ doas rcctl enable httpd -$ doas rcctl start httpd -``` - -[1]:https://git.zx2c4.com/cgit -[2]:https://git.aaoth.xyz/cgit/cgit.git -[3]:https://git.zx2c4.com/cgit/tree/cgitrc.5.txt -[4]:https://www.fossil-scm.org/home/doc/trunk/www/server/openbsd/fastcgi.md#chroot diff --git a/_posts/2021-05-23-join-the-test-of-my-matrix-server.md b/_posts/2021-05-23-join-the-test-of-my-matrix-server.md deleted file mode 100644 index 929e509..0000000 --- a/_posts/2021-05-23-join-the-test-of-my-matrix-server.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -title: join the test of my matrix server -date: 2021-05-23T19:57:34+03:00 -author: la-ninpre -tags: openbsd testing matrix ---- - -i launched my instance of [matrix][0] server recently. it runs on my openbsd vps -and the server software i'm using is [synapse][1]. homeserver address is -(unsurprizingly) `matrix.aaoth.xyz`. - -i also launched an instance of [element][2] matrix web-client on -[element.aaoth.xyz][3], so you can try it. - -[0]:https://matrix.org -[1]:https://matrix.org/docs/projects/server/synapse -[2]:https://element.io -[3]:https://element.aaoth.xyz - -<!--more--> - -matrix is relatively new standard for instant messaging. the main reason i am -interested in it is that it's open-source. it means that anyone could launch -their instance of synapse and be happy with it. -it also means that the whole system is decentralized, providing protection -against global surveillance. - -## about my server - -after you create an account, you will be connected to the broadcast room. -it is unencrypted and read-only. -there are some links to other rooms. - -note that everything going on with my server should be considered temporary -and i could be able to stop, disable or wipe everything completely, -so don't rely on this as production-ready tool. - -also note that pretty much everything is in russian, because i launched matrix -primarily for my friends. - -## about openbsd - -here is a tutorial by the great man **robert d herb** who addressed a lot of -quirks installing synapse on openbsd, which helped me a lot: -[running a matrix homeserver with synapse and element][4] - -because i haven't figured out completely how openbsd's relayd is working, -i broke my [fossils][5]. i hope i'll fix them later, but now they look messy. -there are some issues, i think, with internal structure of fossil's ui. -it needs to be served directly by httpd. but for synapse to work it is mandatory -to run relayd as reverse proxy. - -if you know how to shift some portion of traffic to relayd and some to httpd, -please, [drop me a line][6]. - -[4]:https://robertdherb.com/things/matrix.html -[5]:https://fsl.aaoth.xyz -[6]:mailto:aaoth@aaoth.xyz diff --git a/_posts/2021-06-02-i-launched-a-gemini-capsule-recently.md b/_posts/2021-06-02-i-launched-a-gemini-capsule-recently.md deleted file mode 100644 index 89ff602..0000000 --- a/_posts/2021-06-02-i-launched-a-gemini-capsule-recently.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -title: i launched a gemini capsule recently -date: 2021-06-02T22:36:43+03:00 -author: la-ninpre -tags: gemini openbsd ---- - -i launched my own gemini capsule, yay! - -it is available on the same domain, just type `gemini://aaoth.xyz` in your -favourite gemini client. - -<!--more--> - -for those of you that don't know, gemini is a relatively new internet protocol. -it is already gained popularity among some enthusiasts out there. - -it is intended to be simple and lightweight, it's just plaintext. and the whole -specification is so simple that usable server and/or client for it could be -written within about 100 lines of code. - -learn more on: - -[gemini website](https://gemini.circumlunar.space) - -## about quirks and vger - -firstly i looked through the list of gemini servers on gemini website. -and one particular server there attracted me. it was `vger`. -it is saying that it is secure and openbsd-centric. - -so i tried installing it. it is even packaged for openbsd, which was pretty -convenient, even though i don't mind building stuff from source. -especially if it is not a big bloated thing. - -and surprisingly the configuration was **so** simple, that i even hadn't -realized it for a first couple of minutes. -but then i wanted to launch some fancy cgi things, such as, for example, -gemlikes. it is providing simple like and comment system for a blog. - -and there vger failed me. maybe it is me failed myself, but i tried all -possible configuration options. i think, for now vger is not capable of -running cgi scripts for some parts of the capsule. - -in other words, i'm talking about this. -consider some capsule with tld `gemini://example.com`. -it serves some static pages on `gemini://example.com/blog/*` and -`gemini://example.com/about.gmi`. -gemlikes need three binaries and a `gemlikes.toml` config file. -they suggest placing them in `/cgi-bin/gemlikes/`. -i placed them there, but i couldn't make it so it is how it needs to be. -my vger is serving only cgi or only static pages. - -## another try - -so i looked though a list again, and found `gmid` there. it seemed like -a good option too, because it's written in c and openbsd-aware too. - -and this was nice expirience, because gmid's config file is very -similar to other openbsd's tool configs, such as relayd or httpd. -the only peculiarity with gmid is that it's not yet packaged for -openbsd, so i had to compile it manually. and also i created the daemon -script for it in rc.d(8). - -here it is, if you need it: - -/etc/rc.d/gmid -```sh -#!/bin/ksh - -daemon="/usr/local/bin/gmid" -daemon_flags="-c /etc/gmid.conf" - -. /etc/rc.d/rc.subr - -rc_pre() { - ${rcexec} "${daemon} -n ${daemon_flags}" -} - -rc_cmd $1 -``` - -and of course, my config is in `/etc/gmid.conf`. manpage of gmid contains -very good descriptions of all the options available. - -## thoughts about geminispace - -my first impressions of gemini were a little odd. it's a little bit hard -to read just text, when you are used to graphically overwhelming -flashing websites with pictures and interactive stuff. -but after a little bit of time comes the appretiation of the beauty -of the pure text. - -i can see gemini as a perfect place to host some informative resources, -personal blogs and also for creative writing. -and especially the latter, because it is so easy to spin up your own -instance, i can see at as a great option for writers out there to -host their content. diff --git a/_posts/2021-08-18-matrix.aaoth.xyz-is-down.md b/_posts/2021-08-18-matrix.aaoth.xyz-is-down.md deleted file mode 100644 index d27abd8..0000000 --- a/_posts/2021-08-18-matrix.aaoth.xyz-is-down.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: matrix.aaoth.xyz is down -date: 2021-08-18T17:41:32+03:00 -author: la-ninpre -tags: matrix openbsd testing ---- - -i decided to shut down the matrix server that i launched recently -(see [previous post][1]). -here's my thoughts about this brief matrix experience. - -<!--more--> - -my main intention behind matrix server was to use it with my friends, but -almost nobody responded, so it's over. -synapse server is a bit resource heavy, so without it performance will be -better. - -overall, matrix seemed like a good alternative to proprietary messengers to me. -it's ability to maintain group end-to-end encrypted rooms is very good and -also it was not so hard to set up. - -the biggest con for me was that matrix is spamming all the chats with a huge -pile of system messages and notices. for example, all status changes of a -chat room are displayed as separate messages and i find this very annoying. -also, you can delete messages, but message deletion event is left forever in -the chat history. - -maybe in future i will launch my server again -(i haven't purged all my configs). - -[1]:https://aaoth.xyz/2021/05/23/join-the-test-of-my-matrix-server.html diff --git a/_posts/2021-11-03-dualboot-linux-and-openbsd-with-grub.md b/_posts/2021-11-03-dualboot-linux-and-openbsd-with-grub.md deleted file mode 100644 index bc24e2f..0000000 --- a/_posts/2021-11-03-dualboot-linux-and-openbsd-with-grub.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -title: dualboot linux and openbsd with grub -date: 2021-11-03T15:23:00+03:00 -author: la-ninpre -tags: openbsd linux grub tutorial ---- - -i've been trying to dualboot openbsd with linux using grub on both bios and -uefi machines and here's a solution that i've come up with. - -<!--more--> - -there are some guides about this on the internet, but there's no single guide -that covers both bios and uefi. @rootbsd has a video where he shows how to -do this, but his solution has one little disadvantage. he's specifying drives -in a grub config using relative drive and partition numbers, such as -`(hd0,gpt2)`. since these numbers could be different if one inserts a new drive -to the computer, or changes drive order, the boot option could fail -(which happened). - -all partitions and drives have their unique identifier -- uuid. there's no -direct way to specify uuid in grub configuration, but there is a workaround. - -grub manual describes the `search` command which has an option to set root -device if it is found. so we can use it for our purposes. - -## steps for dualbooting in bios/legacy mode - -1. install linux system on one of your drives - -2. reboot and boot from openbsd install media and install openbsd to other drive -or partition. - -3. reboot and login to your linux system - -4. open a terminal and run `blkid` or `lsblk -f` to get an output partition -uuids. - -5. write the following at the bottom of `/etc/grub.d/40_custom`: - - ``` - menuentry 'OpenBSD' { - search -su --no-floppy *UUID* - chainloader +1 - } - ``` - - where *UUID* is the uuid of your openbsd partition (with type 'ufs2') - -6. run either `update-grub` or `grub-mkconfig` depending on what distribution -you are using. consult your distro's wiki to find a way to update your grub -configuration with recent changes. - -7. now reboot and you should see an openbsd's boot option in grub menu. - -## steps for uefi system - -for boot in uefi mode there are few differences. after installing openbsd -don't reboot, but choose **shell**. now cd into `/mnt` directory and -download `BOOTX64.EFI` from your desired openbsd mirror. for example: - ``` - # cd /mnt - # ftp https://cdn.openbsd.org/pub/OpenBSD/7.0/amd64/BOOTX64.EFI - # reboot - ``` - -after that the only other difference is that `chainloader` directive should -be `chainloader /BOOTX64.EFI`. - -all other steps are the same. |
