LoginSignup
1
0

More than 3 years have passed since last update.

【Airflow on Kubernetes】トラブルシューティング - WEB UIの/staticディレクトリが500 Internal Server Error

Last updated at Posted at 2019-07-31

Airflow on Kubernetesで発生したエラーの内容と対策方法。

Issue

AIRFLOWのJIRAにIssueを出しました。

PR

AIRFLOWにPull Requestを出しました。

目次

発生バージョン

エラー内容

AirflowのWEB UIをブラウザで閲覧すると、一部のアイコンなどが表示されず、ChromeのinspectorのNetworkタブを確認すると、/staticディレクトリが500 Internal Server Errorとなっている。
Screen Shot 2019-07-31 at 15.10.45.png

調査

Deploy時のログを確認

scripts/ci/kubernetes/kube/deploy.shを実行しPodを起動しようとする際、initContainersのcommandairflow create_userの処理で、Please make sure to build the frontend in static/ directory and restart the serverというログが出力されている。

+ airflow create_user -u airflow -l airflow -f jon -e airflow@apache.org -r Admin -p airflow
/usr/local/lib/python2.7/dist-packages/airflow/configuration.py:575: DeprecationWarning: Specifying airflow_home in the config file is deprecated. As you have left it at the default value you should remove the setting from your airflow.cfg and suffer no change in behaviour.
  category=DeprecationWarning,
[2019-07-31 06:04:49,824] {settings.py:182} INFO - settings.configure_orm(): Using pool settings. pool_size=5, pool_recycle=1800, pid=23
[2019-07-31 06:04:50,174] {__init__.py:51} INFO - Using executor KubernetesExecutor
Please make sure to build the frontend in static/ directory and restart the server

Build時のログを確認

scripts/ci/kubernetes/docker/build.shを実行すると、compile_assets.shnpm installを実行する部分で、以下のエラーが出力されている。
npmコマンドが無いと言われている。

running compile_assets
./airflow/www_rbac/compile_assets.sh: 26: ./airflow/www_rbac/compile_assets.sh: npm: not found

原因

scripts/ci/kubernetes/docker/build.shの中でscripts/ci/kubernetes/docker/compile.shを実行してcompileをするが、compile.shの中でnpmをインストールする処理が書かれていないため、npmコマンドが存在せずに実行できず、staticディレクトリが生成されない。

対策

scripts/ci/kubernetes/docker/compile.shにnpmをインストールする処理を追加する。

diff --git a/scripts/ci/kubernetes/docker/compile.sh b/scripts/ci/kubernetes/docker/compile.sh
index 9a84d4d..6db842b 100755
--- a/scripts/ci/kubernetes/docker/compile.sh
+++ b/scripts/ci/kubernetes/docker/compile.sh
@@ -27,6 +27,6 @@ apt-get install -y --no-install-recommends curl gnupg2
 curl -sL https://deb.nodesource.com/setup_8.x | bash -

 apt-get update
-apt-get install -y --no-install-recommends git nodejs
+apt-get install -y --no-install-recommends git nodejs npm
 pip install GitPython
 python setup.py compile_assets sdist -q
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0