git管理している内、git管理に含めたくないフォルダやファイルはgitignoreに記載して除外しています。
しかし、gitignoreに含まれるフォルダの中でgit管理したいファイルが発生した場合は次のコマンドを実行することでgit管理に追加することができる。
git add -f {git管理したいファイル名}
git管理している内、git管理に含めたくないフォルダやファイルはgitignoreに記載して除外しています。
しかし、gitignoreに含まれるフォルダの中でgit管理したいファイルが発生した場合は次のコマンドを実行することでgit管理に追加することができる。
git add -f {git管理したいファイル名}
とある環境を用意したいので、ubuntuのdockerコンテナを作成。
Dockerfileに記述して、ビルド
すると、エラーが発生。
$ docker-compose build
........
省略
........
#0 166.6 Ign:7 http://ports.ubuntu.com/ubuntu-ports focal/universe arm64 Packages
#0 226.7 Ign:7 http://ports.ubuntu.com/ubuntu-ports focal/universe arm64 Packages
#0 286.7 Ign:7 http://ports.ubuntu.com/ubuntu-ports focal/universe arm64 Packages
#0 287.3 Ign:7 http://ports.ubuntu.com/ubuntu-ports focal/universe arm64 Packages
#0 287.6 Err:7 http://ports.ubuntu.com/ubuntu-ports focal/universe arm64 Packages
#0 287.6 Connection failed [IP: 185.125.190.36 80]
#0 287.7 Fetched 9407 kB in 4min 47s (32.7 kB/s)
#0 287.7 Reading package lists...
#0 287.8 E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/focal/universe/binary-arm64/Packages Connection failed [IP: 185.125.190.36 80]
#0 287.8 E: Some index files failed to download. They have been ignored, or old ones used instead.
続きを読む ある日、コンテナをビルドしなおしてみるとエラーとなってコンテナが起動しない。
container_name | /usr/local/lib/node_modules/npm/lib/es6/validate-engines.js:31
container_name | throw err
container_name | ^
container_name |
container_name | Error: Cannot find module 'timers/promises'
container_name | Require stack:
container_name | - /usr/local/lib/node_modules/npm/node_modules/@npmcli/agent/lib/util.js
container_name | - /usr/local/lib/node_modules/npm/node_modules/@npmcli/agent/lib/index.js
container_name | - /usr/local/lib/node_modules/npm/node_modules/make-fetch-happen/lib/remote.js
container_name | - /usr/local/lib/node_modules/npm/node_modules/make-fetch-happen/lib/cache/entry.js
container_name | - /usr/local/lib/node_modules/npm/node_modules/make-fetch-happen/lib/cache/index.js
container_name | - /usr/local/lib/node_modules/npm/node_modules/make-fetch-happen/lib/fetch.js
container_name | - /usr/local/lib/node_modules/npm/node_modules/make-fetch-happen/lib/index.js
container_name | - /usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/lib/index.js
container_name | - /usr/local/lib/node_modules/npm/lib/utils/replace-info.js
container_name | - /usr/local/lib/node_modules/npm/lib/utils/error-message.js
container_name | - /usr/local/lib/node_modules/npm/lib/utils/exit-handler.js
container_name | - /usr/local/lib/node_modules/npm/lib/cli-entry.js
container_name | - /usr/local/lib/node_modules/npm/lib/cli.js
container_name | - /usr/local/lib/node_modules/npm/bin/npm-cli.js
container_name | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
container_name | at Function.Module._load (internal/modules/cjs/loader.js:725:27)
container_name | at Module.require (internal/modules/cjs/loader.js:952:19)
container_name | at require (internal/modules/cjs/helpers.js:88:18)
container_name | at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/agent/lib/util.js:3:16)
container_name | at Module._compile (internal/modules/cjs/loader.js:1063:30)
container_name | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
container_name | at Module.load (internal/modules/cjs/loader.js:928:32)
container_name | at Function.Module._load (internal/modules/cjs/loader.js:769:14)
container_name | at Module.require (internal/modules/cjs/loader.js:952:19) {
container_name | code: 'MODULE_NOT_FOUND',
container_name | requireStack: [
container_name | '/usr/local/lib/node_modules/npm/node_modules/@npmcli/agent/lib/util.js',
container_name | '/usr/local/lib/node_modules/npm/node_modules/@npmcli/agent/lib/index.js',
container_name | '/usr/local/lib/node_modules/npm/node_modules/make-fetch-happen/lib/remote.js',
container_name | '/usr/local/lib/node_modules/npm/node_modules/make-fetch-happen/lib/cache/entry.js',
container_name | '/usr/local/lib/node_modules/npm/node_modules/make-fetch-happen/lib/cache/index.js',
container_name | '/usr/local/lib/node_modules/npm/node_modules/make-fetch-happen/lib/fetch.js',
container_name | '/usr/local/lib/node_modules/npm/node_modules/make-fetch-happen/lib/index.js',
container_name | '/usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/lib/index.js',
container_name | '/usr/local/lib/node_modules/npm/lib/utils/replace-info.js',
container_name | '/usr/local/lib/node_modules/npm/lib/utils/error-message.js',
container_name | '/usr/local/lib/node_modules/npm/lib/utils/exit-handler.js',
container_name | '/usr/local/lib/node_modules/npm/lib/cli-entry.js',
container_name | '/usr/local/lib/node_modules/npm/lib/cli.js',
container_name | '/usr/local/lib/node_modules/npm/bin/npm-cli.js'
container_name | ]
container_name | }
container_name exited with code 7
続きを読む さくらインターネットのレンタルサーバーのスタンダードプランでCRONで仮想環境でのPythonをスケジュールで実行する方法を調べました。
まずは、実行したいPythonをサーバーに保存します。
続いて、Pythonがサーバー上で問題なく実行できるかの確認を行います。
続きを読むとあるフォームにGoogle reCAPTCHA V3を導入しました。
Google reCAPTCHA V3の管理画面のリクエスト数というものあったのですが、この数値が不明でした。
公式には以下の記載があります。
リクエスト数
このグラフは、指定したアクション名についてサイトから reCAPTCHA が受信したリクエストの数を示しています。
つまり?
続きを読むとある開発環境をLaradockで構築しており、久しぶりに起動してみることに。
コンテナをbuildしていくと、途中で落ちる現象にぶち当たる。
=> ERROR [laradock_workspace 54/92] RUN if [ true = true ]; then mk 34.7s
------
> [laradock_workspace 54/92] RUN if [ true = true ]; then mkdir -p /home/laradock/.nvm && curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash && . /home/laradock/.nvm/nvm.sh && nvm install node && nvm use node && nvm alias node && if [ ]; then npm config set registry ;fi && if [ true = true ]; then npm install -g gulp ;fi && if [ false = true ]; then npm install -g bower ;fi && if [ true = true ]; then npm install -g @vue/cli ;fi && if [ false = true ]; then npm install -g @angular/cli ;fi && ln -s `npm bin --global` /home/laradock/.node-bin ;fi:
#0 0.260 % Total % Received % Xferd Average Speed Time Time Time Current
#0 0.268 Dload Upload Total Spent Left Speed
100 12819 100 12819 0 0 15831 0 --:--:-- --:--:-- --:--:-- 15924
#0 1.091 => Downloading nvm from git to '/home/laradock/.nvm'
=> Cloning into '/home/laradock/.nvm'...
#0 2.918 => Compressing and cleaning up git repository
#0 2.970
#0 3.031 => Appending nvm source string to /home/laradock/.bashrc
#0 3.058 => Appending bash_completion source string to /home/laradock/.bashrc
#0 3.206 => Installing Node.js version node
#0 13.11 Downloading and installing node v19.3.0...
#0 13.88 Downloading https://nodejs.org/dist/v19.3.0/node-v19.3.0-linux-x64.tar.xz...
######################################################################## 100.0%
#0 15.90 Computing checksum with sha256sum
#0 16.19 Checksums matched!
#0 22.75 node: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by node)
#0 22.75 node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.25' not found (required by node)
#0 22.75 node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node)
#0 22.85 nvm is not compatible with the npm config "prefix" option: currently set to ""
#0 22.85 Run `nvm use --delete-prefix v19.3.0` to unset it.
#0 23.71 Failed to install Node.js node
#0 23.71 => Close and reopen your terminal to start using nvm or run the following to use it now:
#0 23.71
#0 23.71 export NVM_DIR="$HOME/.nvm"
#0 23.71 [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
#0 23.71 [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
#0 32.22 v19.3.0 is already installed.
#0 32.76 node: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by node)
#0 32.76 node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.25' not found (required by node)
#0 32.76 node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node)
#0 32.84 nvm is not compatible with the npm config "prefix" option: currently set to ""
#0 32.84 Run `nvm use --delete-prefix v19.3.0` to unset it.
#0 33.53 Creating default alias: default -> node (-> v19.3.0)
#0 34.55 node: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by node)
#0 34.55 node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.25' not found (required by node)
#0 34.55 node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node)
#0 34.63 nvm is not compatible with the npm config "prefix" option: currently set to ""
#0 34.63 Run `nvm use --delete-prefix v19.3.0` to unset it.
以前は正常に起動していたのに。
なぜ・・・・。
続きを読むいつもどおりlaradockを起動しようとすると次のメッセージが出て起動しない。
------
> [laradock_workspace 5/92] RUN set -xe; apt-get update -yqq && pecl channel-update pecl.php.net && groupadd -g 1000 laradock && useradd -u 1000 -g laradock -m laradock -G docker_env && usermod -p "*" laradock -s /bin/bash && apt-get install -yqq apt-utils libzip-dev zip unzip php7.3-zip nasm && php -m | grep -q 'zip':
#40 0.252 + apt-get update -yqq
#40 31.24 + pecl channel-update pecl.php.net
#40 31.29 Updating channel "pecl.php.net"
#40 31.69 Update of Channel "pecl.php.net" succeeded
#40 31.69 + groupadd -g 1000 laradock
#40 31.70 + useradd -u 1000 -g laradock -m laradock -G docker_env
#40 31.73 + usermod -p * laradock -s /bin/bash
#40 31.74 + apt-get install -yqq apt-utils libzip-dev zip unzip php7.3-zip nasm
#40 33.07 E: Unable to correct problems, you have held broken packages.
------
failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c set -xe; apt-get update -yqq && pecl channel-update pecl.php.net && groupadd -g ${PGID} laradock && useradd -u ${PUID} -g laradock -m laradock -G docker_env && usermod -p "*" laradock -s /bin/bash && apt-get install -yqq apt-utils libzip-dev zip unzip php${LARADOCK_PHP_VERSION}-zip nasm && php -m | grep -q 'zip']: exit code: 100
why?
続きを読むgit で誤ってローカルのmasterブランチに意図しないマージを行ってしまった。
これを消したい場合。
リモートの追跡を解除して、masterブランチを削除(もしくはリネーム)
git fetch
git checkout master
で復旧できた。
Djangoでエラー通知をメールで受信したいことがありましたので備忘録。
settings.pyに設定を追記すればいいみたいでしたが、少しはまりました。
ADMINSの設定
NG:[(‘John’, ‘john@example.com’)]
OK:[(‘John’, ‘john@example.com’),]
末尾のカンマが必要だった。
EMAIL_PORT=465
EMAIL_USE_TLS=True
とするも送信できない。
EMAIL_PORT=587
EMAIL_USE_TLS=False
とすると送信できる。
送信エラーを見ると、メールサーバーがSTARTTLSに対応していない。
記事を見ると、EMAIL_PORTとEMAIL_USE_TLSの設定項目のみの記述が多いのですが、公式ドキュメントを確認すると、EMAIL_USE_SSLの設定もある。
なので、
EMAIL_PORT=465
EMAIL_USE_TLS=False
EMAIL_USE_SSL=True
とすると送信できた。
とあるActive directyドメインネットワーク内のMySQLサーバーとドメインネットワーク外のWebサーバー(Apache+PHP)との接続があるタイミングから遅くなってしまった。
元々、ドメインネットワーク内に属していたWebサーバーでしたが、DMZに入れることになりドメインネットワークから切り離したタイミングでMySQLの接続が遅い現象が発生。
DMZとのネットワーク関係を疑っていたのだけど、解決方法がわからず。
そんな中、LinuxOSで構築したWebサーバーからも同様に接続が遅い。
接続ができないわけでなく、遅い。
接続に5秒から20秒かかる。
逆引きができていない場合は同様の現象が発生するらしく、MySQLサーバーをホスト名ではなくIPアドレスで指定すると解決するとか。
しかし、MySQLサーバーとの接続はIPアドレス指定。
結論として、名前解決がうまくいっていないため、ログイン認証に時間がかかっているだけでした。
MySQLサーバー側のhostsファイルに接続が遅いPCのIPアドレスとコンピュータ名を追記することで解決。
また、localhostとMySQLサーバーを指定していたホスト名を127.0.0.1で指定すると1秒程度かかることがあった接続が1秒以下になりました。