WPP
Joplin でタグなしのノートを検索したい時

以前は NAS の Synology Note を使っていたのですがいつからか Joplin というノートアプリに移行しました。Synology Note が遅くなってきたのが理由だと思いましたがちょっと定かではないです。

で、ちょうど少しノートの整理をしてた時、タグなしのノートを見つけたかったので調べました。

検索窓に `-tag:*’ と入力すると OK でした。

参考リンクに他の検索項目の見つけ方があったので貼ってあります。

関係ないですが、Outlook のメール検索の場合は label を検索する時は、categories: だったような気がしますが、このあたりツールごとに少しずつ意味するものと名前が違うのでいつも混乱というか都度調べるのが面倒です。早いとこ Copilot のような AI エージェントがチャットで適当に条件指定するといい感じで検索してくれるようにな世界になってほしいものです。

参考

Searching | Joplin

podman / docker 内の Caddy admin API にアクセスする方法

ひきつづき podman 関連のネタです。 podman に CakePHP5 環境を作っている途中ですが、 せっかくなので今回はnginx ではなく Caddy Server を使おうと思い試行錯誤しています。

Caddy は /config/ にアクセスすると設定を取得/変更することができるエンドポイントがありますが、その性質上 localhost (127.0.0.1) からしかアクセスできないようにデフォルトで設定されています。

で今回は、docker でも podman でもコンテナ内で Caddy を動かすとホスト側のブラウザからのアクセスは、コンテナにとっては外部からのアクセスになるのでアクセスできません。(コンテナ使うとよく出会うあの現象です。)

ここにさらっと localhost からのアクセスに制限されているとありますが、どうやったら設定を変更できるかは正直言って見つけにくいです。

わかってしまえば Caddyfile のGlobal block に設定を入れれることがわかるのですが、わからなかったので記事にします。

# global block
# ようは一番上に {} のブロックを入れると global ブロックになるようだ。
{
  admin 0.0.0.0:2019
}
:80 {
  # 80 で待ち受ける内容が以下につづく。
  ....
}

これで curl localhost:2019/config/ でアクセスできるようになりました。

参考

How to execute the Caddy API in Docker? – Help – Caddy Community

Global options (Caddyfile) — Caddy Documentation

podman の補完を設定する

ぼちぼち、podman をいじり始めているわけですがどうも completion が効いていない気がします。 docker (podman も同じように) はコマンドが長いので補完なしでは厳しすぎるので調べてみます。

podman 3.4.4 では –help としても completion のことはまったく出てきませんが、気にせずヘルプを表示してみます。どうやら、bazh、zsh、fish を powershell 用の補完設定ができるようです。

今回は bash で設定します。

$ podman completion --help 
Generate shell autocompletions

Description:
  Generate shell autocompletions.
  Valid arguments are bash, zsh, and fish.
  Please refer to the man page to see how you can load these completions.

Usage:
  podman completion [options] {bash|zsh|fish|powershell}

Examples:
  podman completion bash
  podman completion zsh -f _podman
  podman completion fish --no-desc

Options:
  -f, --file string   Output the completion to file rather than stdout.
      --no-desc       Don't include descriptions in the completion output.

$ sudo  podman completion bash >> /etc/bash_completion.d/podman
$ source /etc/bash_completion.d/podman

これで、補完が効くようになりました。

早いとこコンテナを pod に押し込んで yaml を吐き出して docker compose の代わりに動かしたいのですがなかなかそこまでたどり着きませんね。。。しばらく続きます。

参考

Debian 11 bullseyeでpodmanとdocker-composeを使ってみた | Days of speed

podman search で検索できるようにする(レジストリの設定)

CakePHP5 へのマイグレーションついでに docker compose から podman への移行もテストすることにした。

おもむろにインターネットを検索すると多数のページがヒットするが、大抵はハローワールド的に httpd (apache) を動作させているか、cli のコマンドが docker とどれだけ似ているかを確かめるページにぶちあたる。

そういうのはいいんだよ、公式をなぞっているだけでしょ?と文句をいいつつ、むしろ Docker hub からさくっと取ってきてスグに環境作れるってのがどうなるのよ?ってのを知りたいわけだ。

なので、レジストリから検索して pull できるようになるとこまでを晒します。

環境

  • Linux Mint 21.3
  • podman をインストールすると現在 (2024/4/20) バージョン 3.4.4 がインストールされる。

手順

上記のパターンなのかおま環なのかわかりませんが、 registry が設定されていません。なので、 podman search としても虚しく改行されるだけで終わります。
そこで 3.2. コンテナーレジストリーの設定 Red Hat Enterprise Linux 8 | Red Hat Customer Portal に従いレジストリの設定をしていきます。

$ podman info |less 
;; regisries の search が空に設定されていました。

$ touch ~/.config/containers/registries.conf
$ vi ~/.config/containers/registries.conf
unqualified-search-registries = ["registry.access.redhat.com", "registry.redhat.io", "docker.io"]
short-name-mode = "permissive"
:wq

registries となっているとので redhat のもの 2 つ と docker.io を設定したようだ。

nginx を検索するとちゃんと見つかりました。(registry.redhat.io と docker.io で見つかった模様)

$ podman search nginx
INDEX       NAME                                                       DESCRIPTION                                      STARS       OFFICIAL    AUTOMATED
docker.io   docker.io/library/nginx                                    Official build of Nginx.                         19768       [OK]        
docker.io   docker.io/library/unit                                     Official build of NGINX Unit: Universal Web ...  26          [OK]        
docker.io   docker.io/nginx/nginx-ingress                              NGINX and  NGINX Plus Ingress Controllers fo...  89                      
docker.io   docker.io/nginxinc/nginx-unprivileged                      Unprivileged NGINX Dockerfiles                   144                     
docker.io   docker.io/nginx/nginx-prometheus-exporter                  NGINX Prometheus Exporter for NGINX and NGIN...  40                      
docker.io   docker.io/nginxinc/nginx-s3-gateway                        Authenticating and caching gateway based on ...  6                       
docker.io   docker.io/nginx/unit                                       This repository is retired, use the Docker o...  64                      
docker.io   docker.io/nginx/nginx-ingress-operator                     NGINX Ingress Operator for NGINX and NGINX P...  2                       
docker.io   docker.io/nginxinc/amplify-agent                           NGINX Amplify Agent docker repository            1                       
docker.io   docker.io/nginx/nginx-quic-qns                             NGINX QUIC interop                               1                       
docker.io   docker.io/nginxinc/ingress-demo                            Ingress Demo                                     4                       
docker.io   docker.io/nginxproxy/nginx-proxy                           Automated nginx proxy for Docker containers ...  132                     
docker.io   docker.io/nginxproxy/acme-companion                        Automated ACME SSL certificate generation fo...  130                     
docker.io   docker.io/bitnami/nginx                                    Bitnami container image for NGINX                186                     [OK]
docker.io   docker.io/bitnami/nginx-ingress-controller                 Bitnami container image for NGINX Ingress Co...  32                      [OK]
docker.io   docker.io/nginxproxy/docker-gen                            Generate files from docker container meta-da...  16                      
docker.io   docker.io/bitnami/nginx-exporter                           Bitnami container image for NGINX Exporter       5                       
docker.io   docker.io/nginxinc/mra-fakes3                                                                               0                       
docker.io   docker.io/ubuntu/nginx                                     Nginx, a high-performance reverse proxy & we...  112                     
docker.io   docker.io/nginxinc/mra_python_base                                                                          0                       
docker.io   docker.io/nginxinc/ngx-rust-tool                                                                            0                       
docker.io   docker.io/rancher/nginx-ingress-controller                                                                  13                      
docker.io   docker.io/kasmweb/nginx                                    An Nginx image based off nginx:alpine and in...  7                       
docker.io   docker.io/rancher/nginx-ingress-controller-defaultbackend                                                   2                       
redhat.io   registry.redhat.io/rhel8/nginx-114                         Nginx is a web server and a reverse proxy se...  0                       
redhat.io   registry.redhat.io/rhel8/nginx-118                         Platform for running nginx 1.18 or building ...  0                       
redhat.io   registry.redhat.io/ubi8/nginx-120                          Platform for running nginx 1.20 or building ...  0                       
redhat.io   registry.redhat.io/rhel9/nginx-120                         rhcc_registry.access.redhat.com_rhel9/nginx-...  0                       
redhat.io   registry.redhat.io/rhel8/nginx-122                         rhcc_registry.access.redhat.com_rhel8/nginx-...  0                       
redhat.io   registry.redhat.io/rhel8/nginx-116                         Platform for running nginx 1.16 or building ...  0                       
redhat.io   registry.redhat.io/ubi8/nginx-118                          Platform for running nginx 1.18 or building ...  0                       
redhat.io   registry.redhat.io/rhel8/nginx-120                         Platform for running nginx 1.20 or building ...  0                       
redhat.io   registry.redhat.io/ubi9/nginx-120                          rhcc_registry.access.redhat.com_ubi9/nginx-1...  0                       
redhat.io   registry.redhat.io/ubi8/nginx-122                          rhcc_registry.access.redhat.com_ubi8/nginx-1...  0                       
redhat.io   registry.redhat.io/rhel9/nginx-122                         rhcc_registry.access.redhat.com_rhel9/nginx-...  0                       
redhat.io   registry.redhat.io/ubi9/nginx-122                          rhcc_registry.access.redhat.com_ubi9/nginx-1...  0                       
redhat.io   registry.redhat.io/rhscl/nginx-18-rhel7                    Nginx 1.8 server and a reverse proxy server      0                       
redhat.io   registry.redhat.io/rhscl/nginx-112-rhel7                   Nginx is a web server and a reverse proxy se...  0                       
redhat.io   registry.redhat.io/rhscl/nginx-110-rhel7                   Nginx container image that delivers an nginx...  0                       
redhat.io   registry.redhat.io/rhscl/nginx-16-rhel7                    Nginx 1.6 server and a reverse proxy server      0                       
redhat.io   registry.redhat.io/rhscl/nginx-114-rhel7                   Nginx is a web server and a reverse proxy se...  0                       
redhat.io   registry.redhat.io/rhscl/nginx-116-rhel7                   Platform for running nginx 1.16 or building ...  0                       
redhat.io   registry.redhat.io/rhscl/nginx-118-rhel7                   Platform for running nginx 1.18 or building ...  0                       
redhat.io   registry.redhat.io/ubi7/nginx-118                          Platform for running nginx 1.18 or building ...  0                       
redhat.io   registry.redhat.io/rhscl/nginx-120-rhel7                   Platform for running nginx 1.20 or building ...  0                       
redhat.io   registry.redhat.io/ubi7/nginx-120                          Platform for running nginx 1.20 or building ...  0                       
redhat.io   registry.redhat.io/3scale-amp23/apicast-gateway             3scale's API gateway (APIcast) is an OpenRe...  0                       
redhat.io   registry.redhat.io/3scale-amp20/apicast-gateway            3scale's API gateway (APIcast) is an OpenRes...  0                       
redhat.io   registry.redhat.io/rhamp10/apicast-gateway                 3scale's API gateway (APIcast) is an OpenRes...  0  

$ podman pull nginx
Resolved "nginx" as an alias (/home/mnishi/.cache/containers/short-name-aliases.conf)
Trying to pull docker.io/library/nginx:latest...
Getting image source signatures
Copying blob b9d060e68bbc done  
Copying blob 4a666f159bd0 done  
Copying blob c028eb95b065 done  
Copying blob e74ab6743f66 done  
Copying blob c46d32988911 done  
Copying blob 13808c22b207 done  
Copying blob 297a65ba6f04 done  
Copying config 2ac752d7ae done  
Writing manifest to image destination
Storing signatures
2ac752d7aeb1d9281f708e7c51501c41baf90de15ffc9bca7c5d38b8da41b580

pull する時、初回はどのレジストリを使うか選択肢が表示されるが 2 回目は表示されないのでどこかで記憶されているようだ。今回は docker.io を選んだが変えたくなったときにまた調べないといけなそうだ。(キャッシュを消せば OK か ?)

下記の「日記というほどでも」をみると検索の仕方も色々あって公式のみに絞るとかは自分的にはよく使うことになりそう。

追記

github の ghcr.io を追加するには、同様に unqualified-search-registries に “ghcr.io” を追加すれば良いようだ。ただし検索速度がものすごく遅くなるのでやらない方がいいかもしれない。

参考

3.2. コンテナーレジストリーの設定 Red Hat Enterprise Linux 8 | Red Hat Customer Portal

Podmanコマンドで本気でコンテナイメージを探すには | 日記というほどでも

CakePHP5 の日本語チュートリアルでハマったら英語版を見よう!

追記: プルリクが取り込まれたのでこのページの内容は本家見れば OK になりました。

引続き、CakePHP5 のチュートリアルを進行してますが、どうもコードサンプルが古いバージョンのもののようです。そのため、少しハマりました。まあ、英語版見ろよと。。。

具体的には CMS チュートリアル – Articles コントローラーの作成 – 5.x の ArticleController の paginator 部分でエラーが発生します。

英語版 を見てみるとコードが違っていました。こんな感じです。

<?php
// src/Controller/ArticlesController.php

namespace App\Controller;

class ArticlesController extends AppController
{
    public function index()
    {
        $articles = $this->paginate($this->Articles);
        $this->set(compact('articles'));
    }
}

paginate はコンポーネントではなくてそもそも組み込まれているようです。日本語版のドキュメントにプルリクだしましたが、英語力が怪しすぎるので蹴られるかもしれません。

わりとちゃんと翻訳されてそうな雰囲気だったので盲信してチュートリアル進めてきたのですが、思わぬ落とし穴に突き当たりました。せめてチュートリアルページだけでもちゃんと整備しておかないとますます CakePHP の不人気に拍車がかかりそうだなと感じた一幕でした。

CakePHP の migrations で外部キーを作る時は、unsigned にするといいかもしれない話

ある長年動いていた CakePHP 3 アプリを移行するために、一旦 CakePHP5 の tuta をやり始めたところだ。

Cake公式のチュートリアルはブログアプリをつくることになるのだが、DB の作成はベタで SQLを叩くようになっている。そのままやってももちろんいいし最短時間で目的の状態になるのだが、今回は移行時に使うことになるのであえて migrations を使ってみた。

で要点から、 migrations はデフォルトで、id フィールドを作ってくれるのですがそれが int(11) になっているようです。一方、migrations で integer でフィールドを作成すると int(10) になるのがデフォルトのようです。
となると結果として外部キーを作成するときにフィールドの桁数が合わずに作れずエラーになるという事象に遭遇したという話です。

ブログチュータで実際のコードはこんな感じになります。

ファイル名の先頭部分は日時を示します。 空のファイル自身もこんなふうに migrations で生成できます。
./app/bin/cake migrations create CreateUsers

でユーザーテーブルはこれです。

<?php
declare(strict_types=1);

use Migrations\AbstractMigration;

class CreateUsers extends AbstractMigration
{
    /**
     * Change Method.
     *
     * More information on this method is available here:
     * https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
     * @return void
     */
    public function change(): void
    {
        $table = $this->table('users');
        $table->addColumn('email', 'string', [
            'default' => '',
            'limit' => 255,
            'null' => false,
            'comment' => ''
        ])
        ->addIndex(['email']);
        $table->addColumn('password', 'string', [
            'default' => '',
            'limit' => 255,
            'null' => false,
        ]);
        $table->addColumn('created', 'datetime', [
            'default' => null,
            'null' => false,
        ]);
        $table->addColumn('modified', 'datetime', [
            'default' => null,
            'null' => false,
        ]);
        $table->create();
    }
}

アーティクルテーブルはこうなりました。

user_id フィールドの signed を false にする必要がある。

<?php
declare(strict_types=1);

use Migrations\AbstractMigration;

class CreateArticles extends AbstractMigration
{
    /**
     * Change Method.
     *
     * More information on this method is available here:
     * https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
     * @return void
     */
    public function change(): void
    {
        $table = $this->table('articles');
        $table->addColumn('user_id', 'integer', [
            'null' => false,
            'signed' => false,
        ]);
        // ->addIndex(['user_id']);
        $table->addColumn('title', 'string', [
            'default' => '',
            'limit' => 255,
            'null' => false,
        ]);
        $table->addColumn('slug', 'string', [
            'default' => '',
            'limit' => 191,
            'null' => false,
        ]);
        $table->addColumn('body', 'text', [
            'default' => null,
            'null' => true,
        ]);
        $table->addColumn('published', 'boolean', [
            'default' => false,
        ]);
        $table->addColumn('created', 'datetime', [
            'default' => null,
            'null' => false,
        ]);
        $table->addColumn('modified', 'datetime', [
            'default' => null,
            'null' => false,
        ]);
        $table->addIndex('slug', [
            'unique' => true
        ]);
        $table->addForeignKey('user_id', 'users', 'id',
            [
                'delete' => 'NO_ACTION', 
                'update' => 'NO_ACTION'
            ]
        );
        // $table->changePrimaryKey(['article_id', 'tag_id']);
        $table->create();
    }
}

tags テーブルはこうなる。

<?php
declare(strict_types=1);

use Migrations\AbstractMigration;

class CreateTags extends AbstractMigration
{
    /**
     * Change Method.
     *
     * More information on this method is available here:
     * https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
     * @return void
     */
    public function change(): void
    {
        $table = $this->table('tags');
        $table->addColumn('title', 'string', [
            'limit' => 191,
        ]);
        $table->addColumn('created', 'datetime', [
            'default' => null,
            'null' => false,
        ]);
        $table->addColumn('modified', 'datetime', [
            'default' => null,
            'null' => false,
        ]);
        $table->addIndex('title', [
            'unique' => true
        ]);
        $table->create();
    }
}

Articles テーブルと同じように外部キーを保存するフィールドはアンサインドにする。

<?php
declare(strict_types=1);

use Migrations\AbstractMigration;

class CreateAticlesTags extends AbstractMigration
{
    /**
     * Change Method.
     *
     * More information on this method is available here:
     * https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
     * @return void
     */
    public function change(): void
    {
        $table = $this->table('aticles_tags');
        $table->addColumn('article_id', 'integer', [
            'null' => false,
            'signed' => false,
        ]);
        $table->addColumn('tag_id', 'integer', [
            'null' => false,
            'signed' => false,
        ]);
        $table->addColumn('created', 'datetime', [
            'default' => null,
            'null' => false,
        ]);
        $table->addColumn('modified', 'datetime', [
            'default' => null,
            'null' => false,
        ]);
        $table->addForeignKey('tag_id', 'tags', 'id', [
            'delete' => 'NO_ACTION', 'update' => 'NO_ACTION'
        ]);
        $table->addForeignKey('article_id', 'articles', 'id', [
            'delete' => 'NO_ACTION', 'update' => 'NO_ACTION'
        ]);
        $table->create();
    }
}

これで DBの構築はできたが、先に進んだ所で間違いがあれば修正していくかもしれない。

flatpak でインストールしたアプリ起動すると org.kde.Platrome がないと怒られる

これは定番ネタなのかもしれませんが、知らなかったのでポストします。
結論からいうと flatpak で kde ランタイムが不足しているときにインストールしたって話です。恐らく同様にランタイム不足のエラーの時同じような対応で行ける気がします。

数週間前から Linux Mint のデスクトップ環境をメイン PC として作業しているのですが、flatpak で gitty というアプリをインストールした時のことです。LM メニュー()から起動しようとしてもどうにも立ち上がってきません。

仕方ないのでラウンチャアイテムのプロパティを見てみると ’/usr/bin/flatpak run –branch=stable –arch=x86_64 –command=gittyup com.github.Murmele.Gittyup’ というコマンドを実行しているのがわかります。おもむろに実行すると。。。

$ /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=gittyup com.github.Murmele.Gittyup
error: runtime/org.kde.Platform/x86_64/5.15-21.08 not installed

kde 関連のライブラリが不足しているようです。

Bing のcopilot がいうには、’flatpak repair –user’ や ‘sudo flatpak update’ すればいい的なこと言っていますが実施しても変わらずです。

参考リンクを見ながら適当にイントールしてみます。

flatpak install で怒られたライブラリをしていすれば良いようです。

$ flatpak install org.kde.Platform
Looking for matches…
Similar refs found for ‘org.kde.Platform’ in remote ‘flathub’ (system):

   1) runtime/org.kde.Platform/x86_64/5.13
   2) runtime/org.kde.Platform/x86_64/5.10
   3) runtime/org.kde.Platform/x86_64/5.12
   4) runtime/org.kde.Platform/x86_64/5.11
   5) runtime/org.kde.Platform/x86_64/5.15
   6) runtime/org.kde.Platform/x86_64/5.14
   7) runtime/org.kde.Platform/x86_64/5.15-21.08
   8) runtime/org.kde.Platform/x86_64/5.15-22.08
   9) runtime/org.kde.Platform/x86_64/5.15-23.08
  10) runtime/org.kde.Platform/x86_64/6.2
  11) runtime/org.kde.Platform/x86_64/6.3
  12) runtime/org.kde.Platform/x86_64/6.4
  13) runtime/org.kde.Platform/x86_64/6.5
  14) runtime/org.kde.Platform/x86_64/6.6
  15) runtime/org.kde.Platform/x86_64/6.7
  16) runtime/org.kde.Platform/x86_64/5.9

Which do you want to use (0 to abort)? [0-16]: 7
Info: org.kde.Platform//5.15-21.08 is end-of-life, with reason:
   We strongly recommend moving to the latest stable version of the Platform and SDK
Applications using this runtime:
   com.github.Murmele.Gittyup
Info: org.freedesktop.Platform.GL.default//21.08 is end-of-life, with reason:
   org.freedesktop.Platform 21.08 is no longer receiving fixes and security updates. Please update to a supported runtime version.


        ID                                             Branch                Op            Remote             Download
        ID                                             Branch                Op            Remote             Download
 1. [✓] org.freedesktop.Platform.GL.default            21.08                 i             flathub            129.8 MB / 129.8 MB
 2. [✓] org.freedesktop.Platform.openh264              2.0                   i             flathub              1.8 MB / 1.5 MB
 3. [✓] org.kde.Platform.Locale                        5.15-21.08            i             flathub              1.2 MB / 348.0 MB
 4. [✓] org.kde.Platform                               5.15-21.08            i             flathub            327.7 MB / 311.1 MB

Installation complete.

無事起動しました!

flatpak はなんとなく避けていましたが、そろそろ使い方を覚えないといけないな、と思った出来事でした。

参考

Problems Updating Flatpak Via Terminal: org.kde.Platform – Fedora Discussion

Linux Mint 21.3に docker インストール

定番ネタのひとつですが、apt-key が DEPRECATED らしいのでそれに対処したのでメモする

Linux Mint はほぼ Ubuntu と考えて問題ないのだが公式にも Mint は Ubuntu バージョンの環境変数が違うよ。と指摘されている。

素直に書き換えると、にこうなる。

$ sudo apt-get update
$ sudo apt-get install ca-certificates curl
$ sudo install -m 0755 -d /etc/apt/keyrings
$ sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
$ sudo chmod a+r /etc/apt/keyrings/docker.asc

$ echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$UBUNTU_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
$ sudo apt-get update

しかしこのやり方だと apt update で warrning が出る。調べると apt-key が DEPRECATED なことに関連しているらしい。

man apt-key してみると、公開鍵を /etc/apt/trusted.gpg.d に置くのが正解のようだ。

そうすると、docker.list の中の signed-by= の場所がずれてしまうが、同フォルダの他のソース設定ファイルをみると signed-by はなくてもよさそうなので削ってみる。

$ sudo mv /etc/apt/keyrings/docker.asc /etc/apt/trusted.gpg.d/

; signed-by を削除
$ sudo vi /etc/apt/sources.list.d/docker.list 
deb [arch=amd64] https://download.docker.com/linux/ubuntu jammy stable
:wq

これで apt update 時に warning (ワーニング ? ウォーニング ? どっちが正しい ?) が出なくなった。

最初からやるには、 キーを取ってくるときに、trusted.gpg.d に置けばいいと思う。

Mint のバージョンが異なると相当する Ubuntu のコード名が変わるのだけであとは同じ。コード名は最初のスクリプトが示す通り /etc/os-release を見ればわかる。

参考

Install Docker Engine on Ubuntu | Docker Docs

Linux Mintにdockerを入れる #Docker – Qiita

Wine を OS が英語モードのまま日本語表示する

internet には Wine に fakecjk とか ipafont とかのフォントを入れて日本語化するという tips を見つけることができます。

しかし、OS が英語モードで動作しているときはそれだけでは、日本語を表示できない。

というのも Linux コンソール(用語が間違っているかもしれない)の設定が日本語になっていないので環境変数正しくを設定する必要があるようです。

$ LANG=ja_JP.UTF-8 LANGUAGE="ja_JP:ja" wine ./WINAPP.EXE

; あるいは
$ export LANG=ja_JP.UTF-8
$ export LANGUAGE="ja_JP:ja" 
$ wine ./WINAPP.EXE

毎回入力するのは面倒なので 環境変数を設定した上で wine を起動するスクリプトを書くのがいいだろう。

Synology NAS の 5001 ポートを何とかする

Synology の NAS では Web アプリが 5001 で待受けをしています。制限のゆるいネット環境では恐らくなんの問題もなくアクセスできるでしょう。

しかし会社等 PROXY 経由でインターネットに抜ける環境などの制限がきついネットワークでは 5001 ポートにアクセスできないことがあります。逆向きにいうと 443 ポートでないと自由に外に抜けられないことが多いということです。

そんなときに NAS のリバースプロキシを使って解決することができます。

手順

  1. コントロールパネルを開きます。
  2. ログインポータルから Advanced を開きます。
  3. Reverse Proxy をクリックします。
  4. Create ブタンをクリックします。
  5. イメージのように
    Source側
    Protocol: HTTPS
    Hostname: 新サブドメイン.自分のDDNS (例 dsm.ZZXXYY.myde.me 適宜アジャストしてください。)
    Port: 443
    Destination側
    Protocol: HTTPS
    Hostname: localhost
    Port: 5001
    と設定します。
  6. ブラウザで https://dsm.ZZXXYY.myds.me にアクセスして DSM の Web が表示するはずです。

解説

リバースプロキシの設定では外側のプロトコル、ホスト名、ポートの組をどこか他に流すという設定をします。

ところで NSA ホスト名は Synology の DDNS で振り出されるサブドメインを利用していることが多いと思います。自分の環境では、myds.me のサブドメインが振り出されています。ここではダミーサンプルとして ZZXXYY という名前を使用します。実際にはご自分で決めたサブドメインになっているはずです。

ここがポイントなのですが、Synology のDDNS は自分で決めた ZZXXYY の更にしたのレベルのサブドメインを作ってもちゃんと NASに向けて名前解決してくれます。DDNS の内部では * で全部のサブドメインを受けてくれているようです。

要するに、dsm.ZZXXYY.myds.me としても自分の NAS に向けてアクセスしにくるということです。

この tips がインターネットを検索しても見当たらないので記事にしました。せっかく NAS 使用していてもリバースプロキシ使ったらいいのにと思う記事が多く、少しでも知識が広まってくれれば嬉しいです。