カテゴリー: 技術系

  • git svn initを実行したらエラーになった

    Windows10で、git svn initを実行して、SVNのリポジトリをGitのリポジトリに変換しようとしたところ、perlでエラーになった。

    C:\Users\hoge\Documents\SVN>git svn init -T http://svn.xenos.jp/svn/app1/Trunk/ -t http://svn.xenos.jp/svn/app1/Tags/ --username=hoge
    svn: E235000: In file 'subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c' line 1666: assertion failed (get_current_pool_cb != NULL)
          1 [main] perl 1052 cygwin_exception::open_stackdumpfile: Dumping stack trace to perl.exe.stackdump
    C:\Users\hoge\Documents\SVN>
    C:\Users\hoge\Documents\SVN>git --version
    git version 2.27.0.windows.1
    C:\Users\hoge\Documents\SVN>
    

    バージョンを確認したら、新しいGitのバージョンが出ていたので、2.29.2にアップデートして、もう一度、試したら、成功した。

    参考: https://teratail.com/questions/266878

  • Google Cloud SQLでネットワーク接続制限を解除する

    Google Cloud SQLで、接続元のIPアドレスを固定できず、どこからでも接続できる設定にする。基本的にセキュリティがゆるゆるになるので、開発のときか、確認のための一時的な設定にした方がよい。

    1. GCPの管理画面で、Cloud SQLを開く。
    2. サイドメニュから「接続」を選択する。
    3. 接続の「パブリックIP」にチェックを入れる(もしくは入っていることを確認する)。
    4. 「+ネットワークを追加」をクリックする
    5. ネットワークに「0.0.0.0/0」を指定して、完了をクリックする。
    6. 次に「保存」をクリックする(保存しないとネットワークに反映されない)。

    これで、外部からCloud SQLのDBに接続できるようになる。

  • Windows10の大型アップデートをあてると、復元ポイントが消える

    Windows10の大型アップデート(October 2020 Update)を実行する前に、手動で復元ポイントを作成した。

    大型アップデートを適用して、Ver.20H2になったWindows10で復元ポイントを確認したところ、復元ポイントがなくなっていた。大型アップデートを適用してから、日が浅いので、以前のバージョンに戻して、復元ポイントを確認したが、前に作成した復元ポイントはすべてなくなっていた。

    つまり・・・

    • 復元ポイントを使って、大型アップデートの適用前には戻せない。(前のバージョンに戻せる期間を過ぎると戻せなくなる)
    • 大型アップデートを行うと、手動で作成した復元ポイントも消される。

    いろいろと不具合が起きても、過去のポイントには、Windows10の機能では戻れなくなるので、注意が必要。

  • Magentoのインストールでハマったところ

    インストールのときの「Username」と「Password」がわからない。

    ubuntu@ip-172-31-45-120:/var/www/html$ sudo composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition /var/www/html/
    
    Do not run Composer as root/super user! See https://getcomposer.org/root for details
    Creating a "magento/project-community-edition" project at "./"
    Warning from repo.magento.com: You haven't provided your Magento authentication keys. For instructions, visit 
    https://devdocs.magento.com/guides/v2.3/install-gde/prereq/connect-auth.html
        Authentication required (repo.magento.com):
          Username:
          Password:
    Warning from repo.magento.com: You haven't provided your Magento authentication keys. For instructions, visit 
    https://devdocs.magento.com/guides/v2.3/install-gde/prereq/connect-auth.html
    Warning from repo.magento.com: You haven't provided your Magento authentication keys. For instructions, visit 
    https://devdocs.magento.com/guides/v2.3/install-gde/prereq/connect-auth.html
    Warning from repo.magento.com: You haven't provided your Magento authentication keys. For instructions, visit 
    https://devdocs.magento.com/guides/v2.3/install-gde/prereq/connect-auth.html
    
    In RemoteFilesystem.php line 746:
    
      Invalid credentials for 'https://repo.magento.com/packages.json', aborting.
    
    
    create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--add-repository] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--ignore-platform-reqs] [--] [ [ 
    []]]
    
    ubuntu@ip-172-31-45-120:/var/www/html$
    

    この「Username」と「Password」は、MangentのMarketplaceで、「Create A New Access Key」で発行するAccess Keyがこれにあたり、Public KeyとPrivate Keyがユーザ名とパスワードにあたる。(いや、これ、わかりにくい)

    Username = Public Key
    Password = Private Key

    参考: https://qiita.com/yutahonaga/items/bfb09205ca16c20aa44d

  • Cisco Catalyst 2960-Lの後継は、Cisco Catalyst 1000。

    Cisco Catalyst 2960-Lの後継は、Cisco Catalyst 1000とのこと。慣れ親しんだ2960の番号じゃなくなるのは、ちょっと寂しい。

    Catalyst 1000では、「Single IP management」で複数のエッジスイッチをまとめて1台かのように扱えるのでいい。むかしH3Cのスイッチで同じような構成を使ったけれど、リング構成にできるので、経路の冗長構成もふくめて、なんだかんだで便利。

    しかし、悲しいかな、これを使える機会がない。

    参考: https://cloud.watch.impress.co.jp/docs/topic/special/1283227.html

  • Bitnami Redmineで3.4.6から4.1.1にアップグレード

    Bitnami Redmineで、Redmineの3.4.6を使っている。3.4系が古いので、Redmineの4.1.1にアップグレードにアップグレードしたときの作業を残す。基本的には、Bitnamiのドキュメントの流れでインストールはできた。インストーラーを普通に走らせるとパスなどは変わるので、そこらへんはアレンジしてる。

    ■参考
    https://docs.bitnami.com/general/apps/redmine/administration/upgrade/

    ■やったこと

    アップデート前の環境のDBのユーザ名とパスワードをファイルから抜く。対象のファイルは、下記。

    /opt/redmine-3.4.6-1/apps/redmine/htdocs/config/database.yml
    

    接続の確認をする

    /opt/redmine-3.4.6-1/mysql/bin/mysql -u bitnami -p
    

    データを保存するフォルダを作る

    mkdir data
    cd data
    

    mysqldumpでデータベースのデータを保存する

    /opt/redmine-3.4.6-1/mysql/bin/mysqldump bitnami -p --databases bitnami_redmine --add-drop-database < bitnami_redmine.sql
    

    Redmineのファイルを保存する

     tar czf redmine_files.tar.gz -C /opt/redmine-3.4.6-1/apps/redmine/htdocs/files .
    

    プラグインのファイルを保存する

    tar czf redmine_plugins.tar.gz -C /opt/redmine-3.4.6-1/apps/redmine/htdocs/plugins .

    現在の環境のbitnami redmineを停止する

    sudo /opt/redmine-3.4.6-1/ctlscript.sh stop
    

    新しいバージョンのbitnami redmineのインストーラを実行する。ウィザード形式なので、ウィザードにしたがって設定をする。

    sudo ./bitnami-redmine-4.1.1-5-linux-x64-installer.run
    

    インストールができたら、新しいRedmineが起動しているので、アクセスして、アクセスできることを確認する。

    アクセスができ(=インストールされている)ていれば、次にApacheを停止する

    sudo /opt/redmine-4.1.1-5/ctlscript.sh stop apache
    

    新しいデータベースの接続情報を確認する。下記のファイルに記載されている。

    /opt/redmine-4.1.1-5/apps/redmine/htdocs/config/database.yml

    旧環境のデータを保存したディレクトリに移動し、下記のコマンドで、データベースのデータを入れる。

    /opt/redmine-4.1.1-5/mysql/bin/mysql -u bitnami -p < ./bitnami_redmine.sql
    

    次に、データを展開する。プラグインを使っているようであれば、プラグインも同じように展開する。

    sudo tar xzf ./redmine_files.tar.gz -C /opt/redmine-4.1.1-5/apps/redmine/htdocs/files
    

    Productionログのパーミッションを一時的に変更する(後から戻す)。

    sudo chmod 666 /opt/redmine-4.1.1-5/apps/redmine/htdocs/log/production.log
    

    新しい環境のRedmineの実行環境のディレクトリに移動する

    cd /opt/redmine-4.1.1-5/apps/redmine/htdocs/
    

    次にDBのマイグレーションを実行する。

    sudo /opt/redmine-4.1.1-5/ruby/bin/ruby bin/rake db:migrate RAILS_ENV=production
    

    キャッシュをクリーンナップする

    sudo /opt/redmine-4.1.1-5/ruby/bin/ruby bin/rake tmp:clear

    Productionログの権限を元に戻す

    sudo chmod 644 /opt/redmine-4.1.1-5/apps/redmine/htdocs/log/production.log
    

    Apacheを起動する

    sudo /opt/redmine-4.1.1-5/ctlscript.sh start apache
    

    設定ファイルなどの変更が必要な場合には変更する。

  • WSL2でDockerを使えるようにインストールする

    メモとして。前提として、WSL2のインストールは終わっている。

    Docker Desktop for Windowsをダウンロードする。下記のURLにアクセスして、「Get Docker」からダウンロードする。

    https://hub.docker.com/editions/community/docker-ce-desktop-windows/

    ダウンロードしたインストーラー(EXEファイル)を実行する。インストールのときに、「Install required Windows components for WSL2」にチェックが入っているので、WSL2対応もばっちり。

    インストールが終わったら、Windows10の再起動が入る。

    で、なにをしたらいいのかわからないので、チュートリアルを実施。

    チュートリアルの通りにやったら、チュートリアルのコンテナが立ち上がった。

    このコンテナがどこで動いているのか気になって、WSL2のUbuntuでpsコマンドをたたいてみると、dockerに関連したプロセスが起動しているので、WSL2の上で動作していることが確認できた。

     root       185  0.0  0.5 1463396 31664 pts/1   Ssl+ 20:06   0:00 /mnt/wsl/docker-desktop/docker-desktop-proxy --distro-n 
  • Windows 10 ver 20H2のIMEの予測変換がひどいのでオフにする

    Windows 10 Ver.20H2のIMEの予測変換がかなりひどいので、オフにしてみる。Ver.2004でもひどかったが、20H2はさらにひどい。IMEは止め時なのかもしれないが、選択肢がほぼないので、オフにして様子を見る。

    1. 右下のツールバーで、IMEを選んで、右クリックする(「A」か「あ」のアイコン)
    2. 「設定」を選ぶ
    3. 「全般」を選ぶ
    4. 「予測入力」の部分のプルダウンで、「オフ」を選択する

    これで、予測入力は使えなくなるが、誤変換や勝手に選択される問題もなくなる。

  • PHPのバージョンアップしたら、Nginxが起動しなくなった

    Ubuntu 18.04で、PHPをPHP7.2からPHP7.4にアップデートしたところ、作業後にOSを再起動したら、Nginxが起動しなくなった。原因を調べて対処したので、メモを残す。

    Nginxのステータスを確認したところ。

    ubuntu@ip-10-0-0-122:/etc/nginx$ sudo service nginx status
    ● nginx.service - A high performance web server and a reverse proxy server
       Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
       Active: failed (Result: exit-code) since Wed 2020-10-14 22:35:23 PDT; 5s ago
         Docs: man:nginx(8)
      Process: 1296 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
    Oct 14 22:35:23 ip-10-0-0-122 systemd[1]: Starting A high performance web server and a reverse proxy server...
    Oct 14 22:35:23 ip-10-0-0-122 nginx[1296]: nginx: [emerg] "try_files" directive is duplicate in /etc/nginx/sites-enabled
    Oct 14 22:35:23 ip-10-0-0-122 nginx[1296]: nginx: configuration file /etc/nginx/nginx.conf test failed
    Oct 14 22:35:23 ip-10-0-0-122 systemd[1]: nginx.service: Control process exited, code=exited status=1
    Oct 14 22:35:23 ip-10-0-0-122 systemd[1]: nginx.service: Failed with result 'exit-code'.
    Oct 14 22:35:23 ip-10-0-0-122 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
    ubuntu@ip-10-0-0-122:/etc/nginx$
    

    PHP7.4にアップデートしたタイミングで、Apacheがインストールされて、これが自動起動しており、Nginxと、ポート80の使用が競合して、Nginxが落ちていた。apache2の自動起動を停止する。

    sudo systemctl disable apache2
    

    それでも、まだ、Nginxの起動でエラーになる。ログを見ると、コンフィグの問題のようなので、configtestを実施し、見事にエラーになる。

    ubuntu@ip-10-0-0-122:/etc/nginx/sites-available$ sudo service nginx configtest
     * Testing nginx configuration                                                                                   [fail]
    ubuntu@ip-10-0-0-122:/etc/nginx/sites-available$
    

    Nginxのコンフィグのdefaultで、php7.2-fpmの部分を、php7.4-fpmのsockに書き換え。

    その後、Nginxの起動を試すが失敗。Nginxのコンフィグチェックを行って、エラーになっている行を特定。

    sudo nginx -t
    nginx: [emerg] "try_files" directive is duplicate in /etc/nginx/sites-enabled/default:77
    nginx: configuration file /etc/nginx/nginx.conf test failed
    

    “try_files” がダブっているというので、場所を確認して、変更した。なぜ、急にエラーになったのか、はあるが、とりあえず、スルー。修正後は、Nginxが無事に起動した。

    最初のStatusのログをみると、最初から”try_files ”が問題って書いてあった。おちついて、見る必要あり。

  • Windows10 October 2020 Updateが配信された

    Windows 10 October 2020 Update (Ver 20H2)が配信されたので、早速、VAIOにWindows 10に適用した。とりあえず、動作に問題はなし。

    春のとき(Ver 2004)に廃止されていた大型アップデートを遅らせるためのGUIの画面は復活せず。それは、もう、グループポリシーで設定するしかないようだ。

    あと、Ver.20H2にすることで、EdgeがChromiumベースのEdgeに置き換わった。なので、個別にアップデートをしなくても、October 2020 Updateを入れるだけで、Edgeの更新ができる。これは管理する側からすると楽。

    バージョンは、今回は20H2となっている。これは、全部数字にすると、2010になるので、紛らわしくなるので、変えたとのこと。

    https://forest.watch.impress.co.jp/docs/news/1284147.html