From 5eed1849bc71ccc2f01be9011bc6818671568355 Mon Sep 17 00:00:00 2001 From: Lukas Heiligenbrunner Date: Thu, 22 Oct 2020 19:36:29 +0200 Subject: [PATCH] improve creation of symlink for php socket and install dep package for example container --- .gitlab-ci.yml | 8 ++++---- deb/OpenMediaCenter/DEBIAN/postinst | 17 +++++++++++++---- .../nginx/sites-available/OpenMediaCenter.conf | 2 +- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 15ece61..a2ff573 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -65,7 +65,7 @@ package_debian: - cp ../database.sql ./OpenMediaCenter/tmp/openmediacenter.sql - chmod -R 0775 * - dpkg-deb --build OpenMediaCenter - - mv OpenMediaCenter.deb OpenMediaCenter-0.1_amd64.deb + - mv OpenMediaCenter-0.1.deb OpenMediaCenter-0.1_amd64.deb artifacts: paths: - deb/OpenMediaCenter-0.1_amd64.deb @@ -76,7 +76,7 @@ deploy_test1: image: luki42/alpineopenssh:latest needs: - test - - build + - package_debian only: - master script: @@ -84,6 +84,6 @@ deploy_test1: - ssh-add <(echo "$SSH_PRIVATE_KEY") - mkdir -p ~/.ssh - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' - - scp -r build/* root@192.168.0.42:/var/www/html/ - - scp -r api/ root@192.168.0.42:/var/www/html/ + - scp deb/OpenMediaCenter-*.deb root@192.168.0.42:/tmp/ + - ssh root@192.168.0.42 "apt-get --reinstall install /tmp/OpenMediaCenter-*.deb" diff --git a/deb/OpenMediaCenter/DEBIAN/postinst b/deb/OpenMediaCenter/DEBIAN/postinst index 7f9d3d0..add629c 100755 --- a/deb/OpenMediaCenter/DEBIAN/postinst +++ b/deb/OpenMediaCenter/DEBIAN/postinst @@ -1,11 +1,20 @@ #!/bin/bash # enable nginx site -rm /etc/nginx/sites-enabled/OpenMediaCenter.conf -ln -s /etc/nginx/sites-available/OpenMediaCenter.conf /etc/nginx/sites-enabled/OpenMediaCenter.conf +ln -sf /etc/nginx/sites-available/OpenMediaCenter.conf /etc/nginx/sites-enabled/OpenMediaCenter.conf # link general socket to current one -rm /var/run/php-fpm.sock -ln -s /var/run/php/php*-fpm.sock /var/run/php-fpm.sock +phpsymlink="/var/run/php-fpm.sock"; + +# create a gneral symlink to the php socket if not already existing +if [ -L ${phpsymlink} ] ; then + if [ -e ${phpsymlink} ] ; then + echo "general php symlink already exists." + else + ln -sf /var/run/php/php*.*-fpm.sock /var/run/php/php-fpm.sock + fi +else + ln -sf /var/run/php/php*.*-fpm.sock /var/run/php/php-fpm.sock +fi # setup database mysql -uroot -pPASS -e "CREATE DATABASE IF NOT EXISTS mediacenter;" diff --git a/deb/OpenMediaCenter/etc/nginx/sites-available/OpenMediaCenter.conf b/deb/OpenMediaCenter/etc/nginx/sites-available/OpenMediaCenter.conf index 38b2a38..4e717cd 100755 --- a/deb/OpenMediaCenter/etc/nginx/sites-available/OpenMediaCenter.conf +++ b/deb/OpenMediaCenter/etc/nginx/sites-available/OpenMediaCenter.conf @@ -5,7 +5,7 @@ server { location ~ \.php$ { include snippets/fastcgi-php.conf; - fastcgi_pass unix:/var/run/php-fpm.sock; + fastcgi_pass unix:/var/run/php/php-fpm.sock; } root /var/www/openmediacenter;