From 51f152dbd04c34e4ef13d3b84b05f033a88d2804 Mon Sep 17 00:00:00 2001 From: jo Date: Fri, 1 Oct 2021 17:37:23 +0200 Subject: [PATCH 1/7] Refactor pip install command --- install | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/install b/install index 9e60dce93..075b4f879 100755 --- a/install +++ b/install @@ -995,12 +995,13 @@ loud "-----------------------------------------------------" python_version=$($python_bin --version 2>&1 | awk '{ print $2 }') verbose "Detected Python version: $python_version" +pip_cmd="$python_bin -m pip" verbose "\n * Installing necessary python services..." -loudCmd "$python_bin -mpip install setuptools --upgrade" +loudCmd "$pip_cmd install setuptools --upgrade" # Required here because PyGObject requires it, but it is installed after PyGObject # when pip parses the setup.py file in airtime_analyzer -loudCmd "$python_bin -mpip install pycairo==1.19.1" +loudCmd "$pip_cmd install pycairo==1.19.1" verbose "...Done" verbose "\n * Creating /run/airtime..." From 24203e2086d9ddcfce6bbe30897b4aab73cfcffd Mon Sep 17 00:00:00 2001 From: jo Date: Fri, 1 Oct 2021 17:37:47 +0200 Subject: [PATCH 2/7] Install api_clients using pip --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index 075b4f879..564de3411 100755 --- a/install +++ b/install @@ -1024,7 +1024,7 @@ if [ ! -d /var/log/airtime ]; then fi verbose "\n * Installing API client..." -loudCmd "$python_bin ${AIRTIMEROOT}/python_apps/api_clients/setup.py install --install-scripts=/usr/bin" +loudCmd "$pip_cmd install ${AIRTIMEROOT}/python_apps/api_clients" verbose "...Done" verbose "\n * Installing pypo and liquidsoap..." From d7615cfe373043029c91557e57122421cce363f6 Mon Sep 17 00:00:00 2001 From: jo Date: Fri, 1 Oct 2021 17:41:20 +0200 Subject: [PATCH 3/7] Install pypo with pip and change script prefix to default /usr/local --- install | 2 +- python_apps/pypo/install/systemd/libretime-liquidsoap.service | 2 +- python_apps/pypo/install/systemd/libretime-playout.service | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/install b/install index 564de3411..259a70595 100755 --- a/install +++ b/install @@ -1028,7 +1028,7 @@ loudCmd "$pip_cmd install ${AIRTIMEROOT}/python_apps/api_clients" verbose "...Done" verbose "\n * Installing pypo and liquidsoap..." -loudCmd "$python_bin ${AIRTIMEROOT}/python_apps/pypo/setup.py install --install-scripts=/usr/bin" +loudCmd "$pip_cmd install ${AIRTIMEROOT}/python_apps/pypo" loudCmd "mkdir -p /var/log/airtime/{pypo,pypo-liquidsoap} /var/tmp/airtime/pypo/{cache,files,tmp} /var/tmp/airtime/show-recorder/" loudCmd "chown -R ${web_user}:${web_user} /var/log/airtime/{pypo,pypo-liquidsoap} /var/tmp/airtime/pypo/{cache,files,tmp} /var/tmp/airtime/show-recorder/" systemInitInstall libretime-liquidsoap "$web_user" diff --git a/python_apps/pypo/install/systemd/libretime-liquidsoap.service b/python_apps/pypo/install/systemd/libretime-liquidsoap.service index 2d7a1abb9..ca1eb2f86 100644 --- a/python_apps/pypo/install/systemd/libretime-liquidsoap.service +++ b/python_apps/pypo/install/systemd/libretime-liquidsoap.service @@ -2,7 +2,7 @@ Description=Libretime Liquidsoap Service [Service] -ExecStart=/usr/bin/airtime-liquidsoap +ExecStart=/usr/local/bin/airtime-liquidsoap User=libretime-playout Group=libretime-playout Restart=always diff --git a/python_apps/pypo/install/systemd/libretime-playout.service b/python_apps/pypo/install/systemd/libretime-playout.service index bd86973a9..2009b9645 100644 --- a/python_apps/pypo/install/systemd/libretime-playout.service +++ b/python_apps/pypo/install/systemd/libretime-playout.service @@ -3,7 +3,7 @@ Description=Libretime Playout Service After=network-online.target [Service] -ExecStart=/usr/bin/airtime-playout +ExecStart=/usr/local/bin/airtime-playout User=libretime-pypo Group=libretime-pypo Restart=always From 53af85de02129a27befedf7c70bf893e3d1b028b Mon Sep 17 00:00:00 2001 From: jo Date: Fri, 1 Oct 2021 17:42:33 +0200 Subject: [PATCH 4/7] Install celery using pip --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index 259a70595..43409370b 100755 --- a/install +++ b/install @@ -1036,7 +1036,7 @@ systemInitInstall libretime-playout "$web_user" verbose "...Done" verbose "\n * Installing airtime-celery..." -loudCmd "$python_bin ${AIRTIMEROOT}/python_apps/airtime-celery/setup.py install" +loudCmd "$pip_cmd install ${AIRTIMEROOT}/python_apps/airtime-celery" # Create the Celery user if $is_centos_dist; then loudCmd "id celery 2>/dev/null || adduser --no-create-home -c 'LibreTime Celery' -r celery || true" From af656d54814ddcecafdadbee5ee7352e8f5637ac Mon Sep 17 00:00:00 2001 From: jo Date: Fri, 1 Oct 2021 17:43:20 +0200 Subject: [PATCH 5/7] Install analyzer with pip and change script prefix to default /usr/local --- install | 2 +- .../airtime_analyzer/install/systemd/libretime-analyzer.service | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/install b/install index 43409370b..7f0aea609 100755 --- a/install +++ b/install @@ -1052,7 +1052,7 @@ systemInitInstall libretime-celery verbose "...Done" verbose "\n * Installing libretime-analyzer..." -loudCmd "$python_bin ${AIRTIMEROOT}/python_apps/airtime_analyzer/setup.py install --install-scripts=/usr/bin" +loudCmd "$pip_cmd install ${AIRTIMEROOT}/python_apps/airtime_analyzer" systemInitInstall libretime-analyzer "$web_user" verbose "...Done" diff --git a/python_apps/airtime_analyzer/install/systemd/libretime-analyzer.service b/python_apps/airtime_analyzer/install/systemd/libretime-analyzer.service index d646343ed..5cc301ced 100644 --- a/python_apps/airtime_analyzer/install/systemd/libretime-analyzer.service +++ b/python_apps/airtime_analyzer/install/systemd/libretime-analyzer.service @@ -2,7 +2,7 @@ Description=LibreTime Media Analyzer Service [Service] -ExecStart=/usr/bin/libretime-analyzer +ExecStart=/usr/local/bin/libretime-analyzer User=libretime-analyzer Group=libretime-analyzer Restart=always From 691b564ad5c980a00affd75d61fe30b5fda28025 Mon Sep 17 00:00:00 2001 From: jo Date: Fri, 1 Oct 2021 17:44:16 +0200 Subject: [PATCH 6/7] Install api using pip --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index 7f0aea609..4795375e1 100755 --- a/install +++ b/install @@ -1057,7 +1057,7 @@ systemInitInstall libretime-analyzer "$web_user" verbose "...Done" verbose "\n * Installing API..." -loudCmd "python3 ${AIRTIMEROOT}/api/setup.py install --install-scripts=/usr/bin" +loudCmd "$pip_cmd install ${AIRTIMEROOT}/api" systemInitInstall libretime-api "$web_user" mkdir -p /etc/airtime sed -e "s@WEB_USER@${web_user}@g" \ From 6013434393af1383eb7694c66630ec5fc7dc8834 Mon Sep 17 00:00:00 2001 From: jo Date: Fri, 1 Oct 2021 17:49:33 +0200 Subject: [PATCH 7/7] Install api with prod extra requires --- api/setup.py | 5 +++-- install | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/api/setup.py b/api/setup.py index 19cf4ed9f..16a8c7607 100644 --- a/api/setup.py +++ b/api/setup.py @@ -28,10 +28,11 @@ setup( "django-url-filter", "markdown", "model_bakery", - "psycopg2", # TODO: Move to prod requires ], extras_require={ - "prod": [], + "prod": [ + "psycopg2", + ], "dev": [ "psycopg2-binary", ], diff --git a/install b/install index 4795375e1..7a69bba60 100755 --- a/install +++ b/install @@ -1057,7 +1057,7 @@ systemInitInstall libretime-analyzer "$web_user" verbose "...Done" verbose "\n * Installing API..." -loudCmd "$pip_cmd install ${AIRTIMEROOT}/api" +loudCmd "$pip_cmd install ${AIRTIMEROOT}/api[prod]" systemInitInstall libretime-api "$web_user" mkdir -p /etc/airtime sed -e "s@WEB_USER@${web_user}@g" \