diff --git a/Makefile b/Makefile index bee3bc0..e82e77b 100644 --- a/Makefile +++ b/Makefile @@ -4,5 +4,5 @@ build: push: docker-compose push -deploy: bulid +deploy: build docker-compose -f docker-compose.production.yml up -d \ No newline at end of file diff --git a/source/_drafts/camping.md b/source/_drafts/camping.md index 53b35cc..b3ca732 100644 --- a/source/_drafts/camping.md +++ b/source/_drafts/camping.md @@ -13,7 +13,7 @@ title: 準ソロキャンプ - 寝袋 - モンベル ダウンハガー 800 #3 - 5 度を下回ると普通に寝れない - - と思っていたが、サーモライトリアクターをインナーに入れることで氷点下 2 度の中で寝ることができた + - と思っていたが、サーモライトリアクターを中に入れることで氷点下 2 度の中で寝ることができた - マット - Thermarest Z Lite SOL S - 帆布シートの上に敷いて座布団としても使える @@ -21,10 +21,10 @@ title: 準ソロキャンプ - asobito 綿帆布シート - そのままだと硬く寒いため銀マットを座布団として使う - 多少の防水性と耐火性があるため、焚き火・ブッシュクラフトスタイルと相性が良い - - 前室に敷いておけば、寝ている間地面の湿気から荷物を守れる + - 前室に敷いておけば、寝ている間地面の湿気から荷物を守ってくれる - 手袋 - グリップスワニー G-1 ブラック - - 燃えている薪を数秒程度なら持てる + - 燃えている薪でも数秒程度なら持てる - 柔軟性があるため細かい作業ができる - ナイフ - MOSSYOAK 225mm @@ -45,20 +45,21 @@ title: 準ソロキャンプ - ワインオープナーと小型ナイフがメイン用途 - ランタン - Feuerhand 276 - - こだわりが無ければ LED ランタンの方が圧倒的に明るいし便利 + - こだわりが無ければ LED ランタンの方が明るいし便利 - サブランタン - UCO キャンドルランタン オイル化改造 - ソロキャンであればこれくらいの明るさでも作業できる - 2 人キャンで 2 人分をカバーするようなことはできない - - 焚き火調理中にフライパンの中の様子を見たいといった場合には厳しいかもしれない + - 焚き火調理中にフライパンの中の様子を見たいといった場合には厳しい - 不安定な地面やメッシュテーブルに置くと倒れそうになるのでパーツを自作して補強する必要がある - ヘッドライト - Petzl Zipka - 普通の作業でずり落ちることはない - - 赤色灯が地味に便利で、目の明順応を軽減する効果がある + - 赤色灯が地味に便利で、明順応を軽減する効果がある - ゴミ袋 - ジップロック - - 基本戦略としてゴミを作らないことが大事野菜などは紙で包んでいくことで焚き火の火口にできる + - 基本戦略としてゴミを作らないことが大事 + - 野菜などは紙で包んでいくことで焚き火の火口にできる - iPhone - ロープワークのリファレンスアプリを入れてオフラインでも参照できるようにする - 現地までの道案内 @@ -69,23 +70,21 @@ title: 準ソロキャンプ - パラコード - テントやタープの固定、トライポッド自作、ケトルの吊り下げ、ランタンの吊り下げ、薪の固定等、あらゆる状況で使える - 1m や 3m のロープを何束か作っておくと便利 - - ジップロック L サイズ - 消毒用アルコール - トイレットペーパー ## 焚き火 - 斧 - - ハスクバーナのキャンプ用斧ダイヤモンドシャープナーで研いでおく + - ハスクバーナのキャンプ用斧 - ハンマーとしても使える - 折りたたみノコギリ - 薪を現地調達するなら必要 - フェロセリウムロッド - 趣味 - - マグネシウムロッドよりも火花が大きい大きいサイズが良い + - マグネシウムロッドよりも火花が大きい - マッチ - - キャンドルランタンや焚き火の火口への点火時に使用する - - 切ったロープの端を処理する際にも使える + - 趣味 - ガストーチ(予備) - SOTO のマイクロトーチ - マッチが濡れた場合や雨天時に備えて用意しておく diff --git a/source/_drafts/math-api-ja.md b/source/_drafts/math-api-ja.md deleted file mode 100644 index dc8c0ba..0000000 --- a/source/_drafts/math-api-ja.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -title: 数学API:SVG画像としてのLaTeX Math -description: のような場所にLaTeX数学方程式を配置します。 -tags: - - LaTeX - - Math - - API - - showdev ---- - -私はいつも、LaTeX Math 方程式を、MathJax が内部で実行できない Web ページに配置したいと思っていました。 - -少し時間をかけて、LaTeX Math マークアップを SVG 画像にレンダリングする[Math API](https://math.now.sh) を作成しました。 - -したがって、GitHub、Jupyter Notebook、dev.to、そして Qiita(こちら!)など、 ``または Markdown( `![]()`)を配置できるほぼすべての場所に方程式を配置できます。 - -```markdown -![](https://math.now.sh?from=\LaTeX) -``` - -![](https://math.now.sh?from=\LaTeX) - -```markdown -![](https://math.now.sh?from=\log\prod^N_i x_i = \sum^N_i \log{x_i}) -``` - -$$ -\log\prod^N_i x_i = \sum^N_i \log{x_i} -$$ - -## インライン画像 - -![](https://thepracticaldev.s3.amazonaws.com/i/fqea9nq2wv9in15lqlf3.png) - -![](https://thepracticaldev.s3.amazonaws.com/i/43slt0h6dfhox1xwmuti.png) - -クエリを「from」から「inline」に変更することにより、インライン方程式を生成することができます。 - -```markdown - -``` - -## オンラインエディター - -また、[Math API](https://math.now.sh) で利用可能なオンラインエディターがあります。 - -![](https://thepracticaldev.s3.amazonaws.com/i/gg2wil3exu9lyj7ppuoy.png) - -## 結論 - -ソースコードは[GitHub](https://github.com/uetchy/math-api)で入手できます。 -それを試してみて、新機能のコメント/アイデアを残してください。 diff --git a/source/_drafts/namae-ja.md b/source/_drafts/namae-ja.md deleted file mode 100644 index b2251dd..0000000 --- a/source/_drafts/namae-ja.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: namae.devでアプリのスリック名を付けます -tags: - - javascript - - web -cover_image: https://thepracticaldev.s3.amazonaws.com/i/uafydwlnfneikuiyxe2w.png ---- - -新しい OSS プロジェクトまたは Web アプリの命名に苦労したことがありますか? GitHub、npm、Homebrew、PyPI、Domains などで希望するものを誰も要求していないことを望みながら、最適な名前を ​​ 選択するのは退屈です。 - -だからこそ、[namae](https://namae.dev)を作成しました。 - -## namae - -![namae](https://thepracticaldev.s3.amazonaws.com/i/np1a40lrch9m10b1s7nz.gif) - -[namae](https://namae.dev) は、開発者と起業家向けのプラットフォーム間名前可用性チェッカーです。 - -使用する名前をフォームに入力すると、namae はさまざまなレジストリを調べて、名前がすでに使用されているかどうかを確認します。 - -![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/pww3x6ycshadfiiotep9.png) - -## サポートされているプラ ​​ ットフォーム - -namae は 15 のパッケージレジストリと Web プラットフォームをサポートしており、成長しています。 - -- ドメイン -- GitHub Organization -- npm / npm Organization -- PyPI -- RubyGems -- crates.io (Rust) -- Homebrew / Homebrew Cask -- LaunchPad / APT (Linux) -- Twitter -- Spectrum -- Slack -- Heroku -- ZEIT Now -- AWS S3 -- js.org - -さらに、検索結果には、**GitHub**および**App Store**に類似した名前のプロジェクトのリストが含まれています。 - -## 名前の提案 - -namae には、**Name Suggestion**という独自の機能もあります。共通の接頭辞/接尾辞と同義語で構成される自動生成された名前を提案します。いくつかの例を見てみましょう。 - -![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/aas52pwbrueyzrulfiae.png) - -![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/j6jv0rq4gin28hks1ika.png) - -提案をクリックすると、ナマエはフォームを完成させて、レジストリを検索し始めます。 - -## オープンソース - -namae は完全にオープンソースであり、ソースコード全体は[GitHub](https://github.com/uetchy/namae)で入手できます。 API 用の Node.js Lambda と Web フロントエンド用の React アプリで構成され、[ZEIT Now](https://now.sh)で実行されています。 - -## 結論 - -namae を使用すると、ホスティングプロバイダーとパッケージレジストリのセットの周りで普遍的に利用可能な名前を検索する時間を節約できます。 - -[namae.dev](https://namae.dev/)に移動して、将来の製品名が入手可能かどうかのレポートを取得します。何か提案があれば、コメントを残すか、Twitter([@uetschy](https://twitter.com/uetschy))で私に連絡してください。 diff --git a/source/_posts/2021/installing-arch-linux.md b/source/_posts/2021/installing-arch-linux.md index 237c93a..2673528 100644 --- a/source/_posts/2021/installing-arch-linux.md +++ b/source/_posts/2021/installing-arch-linux.md @@ -71,8 +71,6 @@ reflector --protocol https --latest 30 --sort rate --save /etc/pacman.d/mirrorli pacman -S vim man-db man-pages git base-devel ``` -reflector --protocol https --latest 30 --sort rate --save /etc/pacman.d/mirrorlist --verbose - ## locale ```bash @@ -397,34 +395,34 @@ yay -S telegraf # Configuration for telegraf agent [agent] -interval = "10s" -round_interval = true -metric_batch_size = 1000 -metric_buffer_limit = 10000 -collection_jitter = "0s" -flush_interval = "10s" -flush_jitter = "0s" -precision = "" -hostname = "" -omit_hostname = false + interval = "15s" + round_interval = true + metric_batch_size = 1000 + metric_buffer_limit = 10000 + collection_jitter = "0s" + flush_interval = "10s" + flush_jitter = "0s" + precision = "" + hostname = "" + omit_hostname = false # Read InfluxDB-formatted JSON metrics from one or more HTTP endpoints [[outputs.influxdb]] -urls = ["http://127.0.0.1:8086"] -database = "" -username = "" -password = "" + urls = ["http://127.0.0.1:8086"] + database = "" + username = "" + password = "" # Read metrics about cpu usage [[inputs.cpu]] -percpu = true -totalcpu = true -collect_cpu_time = false -report_active = false + percpu = true + totalcpu = true + collect_cpu_time = false + report_active = false # Read metrics about disk usage by mount point [[inputs.disk]] -ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"] + ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"] # Read metrics about disk IO by device [[inputs.diskio]] @@ -443,32 +441,41 @@ ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squash # Read metrics about network interface usage [[inputs.net]] -interfaces = ["enp5s0"] + interfaces = ["enp5s0"] # Read metrics about docker containers [[inputs.docker]] -endpoint = "unix:///var/run/docker.sock" -perdevice = false -total = true + endpoint = "unix:///var/run/docker.sock" + perdevice = false + total = true [[inputs.fail2ban]] -interval = "15m" -use_sudo = true + interval = "15m" + use_sudo = true # Pulls statistics from nvidia GPUs attached to the host [[inputs.nvidia_smi]] -timeout = "30s" + timeout = "30s" [[inputs.http_response]] -interval = "5m" -urls = [ - "https://example.com" -] + interval = "5m" + urls = [ + "https://example.com" + ] # Monitor sensors, requires lm-sensors package [[inputs.sensors]] -interval = "60s" -remove_numbers = false + interval = "60s" + remove_numbers = false + +# Run executable as long-running input plugin +[[inputs.execd]] + interval = "15s" + command = ["/metrics.sh"] + name_override = "metrics" + signal = "STDIN" + restart_delay = "20s" + data_format = "logfmt" ``` ```ini /etc/sudoers.d/telegraf @@ -502,6 +509,7 @@ notification: ```ini /etc/cfddns/domains example.com +dev.example.com ``` ``` @@ -511,110 +519,75 @@ systemctl enable --now cfddns ## backup ```bash -pacman -S borg +pacman -S restic ``` -```ini /etc/backups/borg.service +```ini /etc/backup/restic.service [Unit] -Description=Borg Daily Backup Service +Description=Daily Backup Service [Service] Type=simple Nice=19 IOSchedulingClass=2 IOSchedulingPriority=7 -ExecStart=/etc/backups/run.sh +ExecStart=/etc/backup/run.sh ``` -```ini /etc/backups/borg.timer +```ini /etc/backup/restic.timer [Unit] -Description=Borg Daily Backup Timer +Description=Daily Backup Timer [Timer] WakeSystem=false -OnCalendar=*-*-* 03:00 -RandomizedDelaySec=10min +OnCalendar=*-*-* 14:00 +RandomizedDelaySec=5min [Install] WantedBy=timers.target ``` -```bash /etc/backups/run.sh +```bash /etc/backup/run.sh #!/bin/bash -ue -# The udev rule is not terribly accurate and may trigger our service before -# the kernel has finished probing partitions. Sleep for a bit to ensure -# the kernel is done. -sleep 5 +# https://restic.readthedocs.io/en/latest/040_backup.html# -# -# Script configuration -# -export BORG_PASSPHRASE="" -MOUNTPOINT=/mnt/backup -TARGET=$MOUNTPOINT/borg +export RESTIC_REPOSITORY=/path/to/backup +export RESTIC_PASSWORD= +export RESTIC_PROGRESS_FPS=1 -# Archive name schema -DATE=$(date --iso-8601) - -# -# Create backups -# - -# Options for borg create -BORG_OPTS="--stats --compression lz4 --checkpoint-interval 86400" - -# No one can answer if Borg asks these questions, it is better to just fail quickly instead of hanging. -export BORG_RELOCATED_REPO_ACCESS_IS_OK=no -export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=no - -# Log Borg version -borg --version - -echo "Starting backup for $DATE" - -echo "# system" -borg create $BORG_OPTS \ - --exclude /root/.cache \ - --exclude /root/.pyenv \ - --exclude /root/.vscode-server \ - --exclude /root/.local/share/TabNine \ - --exclude 'sh:/home/*/.cache' \ - --exclude 'sh:/home/*/.cargo' \ - --exclude 'sh:/home/*/.pyenv' \ - --exclude 'sh:/home/*/.vscode-server' \ - --exclude 'sh:/home/*/.local/share/TabNine' \ +# system +restic backup --tag system -v \ --one-file-system \ - $TARGET::'system-{now}' \ - /etc /boot /home /root /srv + --exclude .cache \ + --exclude .venv \ + --exclude .vscode-server \ + --exclude .vscode-server-insiders \ + --exclude TabNine \ + --exclude node_modules \ + --exclude /var/lib/docker/overlay2 \ + / /boot -echo "# data" -borg create $BORG_OPTS \ - --exclude 'sh:/mnt/data/nextcloud/appdata_*/preview' \ - --exclude 'sh:/mnt/data/nextcloud/appdata_*/dav-photocache' \ - $TARGET::'data-{now}' \ - /mnt/data - -echo "# ftl" -borg create $BORG_OPTS \ - $TARGET::'ftl-{now}' \ +# ftl +restic backup --tag ftl -v \ /mnt/ftl -echo "Start pruning" -BORG_PRUNE_OPTS_NORMAL="--list --stats --keep-daily 7 --keep-weekly 3 --keep-monthly 3" -borg prune $BORG_PRUNE_OPTS_NORMAL --prefix 'system-' $TARGET -borg prune $BORG_PRUNE_OPTS_NORMAL --prefix 'data-' $TARGET -borg prune $BORG_PRUNE_OPTS_NORMAL --prefix 'ftl-' $TARGET +# data +restic backup --tag data -v \ + --exclude 'appdata_*/preview' \ + --exclude 'appdata_*/dav-photocache' \ + /mnt/data -echo "Completed backup for $DATE" +restic forget --prune --group-by tags \ + --keep-daily 7 --keep-weekly 3 --keep-monthly 3 -# Just to be completely paranoid -sync +restic check ``` ```bash -ln -sf /etc/backups/borg.{service,timer} /etc/systemd/system/ -systemctl enable --now borg +chmod 700 /etc/backup/run.sh +ln -sf /etc/backup/restic.{service,timer} /etc/systemd/system/ +systemctl enable --now restic ``` ## Kubernetes @@ -866,7 +839,7 @@ Audit=no This occurs after updating linux kernel. -- Run `docker --rm --gpus all -it nvidia/cuda:10.2-cudnn7-runtime nvidia-smi` once. +- Run `docker run --rm --gpus all --device /dev/nvidia0 --device /dev/nvidiactl --device /dev/nvidia-modeset --device /dev/nvidia-uvm --device /dev/nvidia-uvm-tools -it nvidia/cuda:10.2-cudnn7-runtime nvidia-smi` once. # Useful links @@ -878,5 +851,4 @@ This occurs after updating linux kernel. - [udev - ArchWiki](https://wiki.archlinux.org/title/Udev#Debug_output) - [[HOWTO] Repair Broken system, system without a kernel / Forum & Wiki discussion / Arch Linux Forums](https://bbs.archlinux.org/viewtopic.php?id=18066) - [Archboot - ArchWiki](https://wiki.archlinux.org/title/Archboot) -- [Restoring with the Borg](https://blog.jamesthebard.net/restoring-with-the-borg/) -- [Restore with Borg | BorgBase Docs](https://docs.borgbase.com/restore/borg/) +- [Restic Documentation — restic 0.12.1 documentation](https://restic.readthedocs.io/en/stable/) diff --git a/source/_posts/2021/server-2020.md b/source/_posts/2021/server-2020.md index 89e1a21..aeef92f 100644 --- a/source/_posts/2021/server-2020.md +++ b/source/_posts/2021/server-2020.md @@ -7,15 +7,13 @@ date: 2021-02-13T00:00:00 # 用途 -- セルフホスト (Dockerized) +- セルフホスト (Docker) - メールサーバー - - DNS サーバー - Nextcloud(ファイル、カレンダー、連絡先等) - - GitLab - プライベート Docker レジストリ - - VPN 他 + - VPN 等 - 計算実験 -- Docker Swarm ノード +- Docker Swarm マスターノード - VS Code Remote SSH のホストマシン # スペック @@ -24,6 +22,8 @@ date: 2021-02-13T00:00:00 > 結果から言うとメモリはもっと必要でした。巨大な Pandas データフレームを並列処理なんかするとサクッと消えてしまいます。予算に余裕があるなら 128GB ほど用意したほうが良いかもしれません。 +> 追記: メモリ異常を起因とするシステム誤動作により、`/sbin` 以下がゼロ上書きされカーネルが起動しなくなるなど様々な厄災に襲われました。後日 Hynix 製のチップを搭載した V-color 社の ECC 付き U-DIMM に交換してからは、サーバーが安定動作するようになり現在に至ります。やはり 365 日稼働し続けるサーバーには最初からケチらずに ECC 付きメモリを選んでおいた方が賢明です。 + GPU は古いサーバーに突っ込んでいた NVIDIA GeForce GTX TITAN X (Maxwell)を流用しました。グラフィックメモリが 12GB ちょっとですが、最大ワークロード時でも 5GB は残るので今のところ十分です。必要になったタイミングで増やします。 記憶装置は WD HDD 3TB 2 台と Samsung 970 EVO Plus 500GB M.2 PCIe、そして古いサーバーから引っこ抜いた Samsung 870 EVO Plus 500GB SSD です。NVMe メモリは OS 用、SSD/HDD はデータとバックアップ用にします。 @@ -55,8 +55,9 @@ Arch Linux のセットアップは[個別に記事](https://uechi.io/blog/insta # 組立ての勘所 +- 半年間はすべての箱・書類を取っておく - 筐体は無視してまずマザボ、CPU、クーラー、(オンボードグラフィックが無い CPU なら)グラボ、そして電源を繋いで通電・動作テストをする - - [MemTest86](https://www.memtest86.com/)でメモリの動作テスト + - [MemTest86](https://www.memtest86.com/)でメモリの動作テストを最後までやる(エラーが出たら交換依頼) - USB ブートで OS の起動確認 - Ethernet が死んでいる場合は USB-Ethernet アダプターでまずネットを確保する - ほとんどの場合 Linux カーネルのバージョンを上げると(デバイスドライバーも新しくなり)直る diff --git a/source/me.md b/source/me.md index d58dcbb..0c28be6 100644 --- a/source/me.md +++ b/source/me.md @@ -1,5 +1,5 @@ --- -title: Yasuaki Uechi +title: about me ---