masatana commented on code in PR #1328:
URL: https://github.com/apache/bigtop/pull/1328#discussion_r1976994342


##########
bigtop-packages/src/common/airflow/install_airflow.sh:
##########
@@ -0,0 +1,77 @@
+#!/bin/bash -x
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -ex
+
+usage() {
+  echo "
+usage: $0 <options>
+  Required not-so-options:
+     --distro-dir=DIR            path to distro specific files (debian/RPM)
+     --build-dir=DIR             path to build directory
+     --prefix=PREFIX             path to install into
+  "
+  exit 1
+}
+
+OPTS=$(getopt \
+  -n $0 \
+  -o '' \
+  -l 'prefix:' \
+  -l 'distro-dir:' \
+  -l 'build-dir:' \
+  -- "$@")
+
+if [ $? != 0 ] ; then
+    usage
+fi
+
+eval set -- "$OPTS"
+
+while true ; do
+    case "$1" in
+        --prefix)
+        PREFIX=$2 ; shift 2
+        ;;
+        --distro-dir)
+        DISTRO_DIR=$2 ; shift 2
+        ;;
+        --build-dir)
+        BUILD_DIR=$2 ; shift 2
+        ;;
+        --)
+        shift ; break
+        ;;
+        *)
+        echo "Unknown option: $1"
+        usage
+        exit 1
+        ;;
+    esac
+done
+
+install -d -p -m 755 ${PREFIX}/etc/default
+install -d -p -m 755 ${PREFIX}/usr/lib/airflow
+install -d -p -m 755 ${PREFIX}/usr/lib/systemd/system
+install -d -p -m 755 ${PREFIX}/usr/lib/tmpfiles.d
+
+find ${BUILD_DIR}/bin -type f -exec sed -i -e "s,$(cd ${BUILD_DIR} && 
pwd),/usr/lib/airflow," {} \;
+find ${BUILD_DIR}/lib -type f -exec sed -i -e "s,/usr/bin/env 
python$,/usr/bin/env python3," {} \;
+
+cp -r ${BUILD_DIR}/{bin,include,lib,pyvenv.cfg} ${PREFIX}/usr/lib/airflow
+cp ${DISTRO_DIR}/airflow.default ${PREFIX}/etc/default/airflow
+cp ${DISTRO_DIR}/airflow-{scheduler,webserver}.service 
${PREFIX}/usr/lib/systemd/system

Review Comment:
   Why don't we use rpm marcos instead of specifying direct path?
   
   
https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html#PIDFile=



##########
bigtop-packages/src/common/airflow/airflow-webserver.service:
##########
@@ -0,0 +1,35 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+[Unit]
+Description=Airflow webserver daemon
+After=network.target postgresql.service mysql.service redis.service 
rabbitmq-server.service
+Wants=postgresql.service mysql.service redis.service rabbitmq-server.service
+
+[Service]
+EnvironmentFile=/etc/default/airflow
+User=airflow
+Group=airflow
+Type=simple
+ExecStart=/usr/lib/airflow/bin/airflow webserver --pid 
/run/airflow/webserver.pid

Review Comment:
   Do we need pid file here? If we need, why don't we use 
[PIDFile=](https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html#PIDFile=)
 configuration? I think we don't need PIDFile with 'Type=simple' as the systemd 
can handle the process without it.



##########
bigtop-packages/src/common/airflow/airflow.conf:
##########
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+D /run/airflow 0755 airflow airflow

Review Comment:
   Should we use `d` instead of `D`? If we use `D`, the content in this 
directory will be deleted when `systemd-tmpfiles --remove` runs
   
   https://www.freedesktop.org/software/systemd/man/latest/tmpfiles.d.html#D



##########
bigtop-packages/src/common/airflow/install_airflow.sh:
##########
@@ -0,0 +1,77 @@
+#!/bin/bash -x
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -ex
+
+usage() {
+  echo "
+usage: $0 <options>
+  Required not-so-options:
+     --distro-dir=DIR            path to distro specific files (debian/RPM)
+     --build-dir=DIR             path to build directory
+     --prefix=PREFIX             path to install into
+  "
+  exit 1
+}
+
+OPTS=$(getopt \
+  -n $0 \
+  -o '' \
+  -l 'prefix:' \
+  -l 'distro-dir:' \
+  -l 'build-dir:' \
+  -- "$@")
+
+if [ $? != 0 ] ; then
+    usage
+fi
+
+eval set -- "$OPTS"
+
+while true ; do
+    case "$1" in
+        --prefix)
+        PREFIX=$2 ; shift 2
+        ;;
+        --distro-dir)
+        DISTRO_DIR=$2 ; shift 2
+        ;;
+        --build-dir)
+        BUILD_DIR=$2 ; shift 2
+        ;;
+        --)
+        shift ; break
+        ;;
+        *)
+        echo "Unknown option: $1"
+        usage
+        exit 1
+        ;;
+    esac
+done
+
+install -d -p -m 755 ${PREFIX}/etc/default
+install -d -p -m 755 ${PREFIX}/usr/lib/airflow
+install -d -p -m 755 ${PREFIX}/usr/lib/systemd/system
+install -d -p -m 755 ${PREFIX}/usr/lib/tmpfiles.d
+
+find ${BUILD_DIR}/bin -type f -exec sed -i -e "s,$(cd ${BUILD_DIR} && 
pwd),/usr/lib/airflow," {} \;
+find ${BUILD_DIR}/lib -type f -exec sed -i -e "s,/usr/bin/env 
python$,/usr/bin/env python3," {} \;
+
+cp -r ${BUILD_DIR}/{bin,include,lib,pyvenv.cfg} ${PREFIX}/usr/lib/airflow
+cp ${DISTRO_DIR}/airflow.default ${PREFIX}/etc/default/airflow
+cp ${DISTRO_DIR}/airflow-{scheduler,webserver}.service 
${PREFIX}/usr/lib/systemd/system
+cp ${DISTRO_DIR}/airflow.conf ${PREFIX}/usr/lib/tmpfiles.d

Review Comment:
   Same above
   
   https://www.freedesktop.org/software/systemd/man/latest/tmpfiles.d.html



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to