From ada877e19d09971cff2d0f37dcff1f1aa22bc23b Mon Sep 17 00:00:00 2001 From: Vincent BENOIT Date: Wed, 16 Nov 2022 12:02:31 +0100 Subject: [PATCH] ajout des fichiers pour la construction du package debian et la compilation de l'application angular --- VERSION | 1 + angular.json | 4 +-- build.sh | 44 +++++++++++++++++++++++ misc/010-configurateur.conf | 39 ++++++++++++++++++++ misc/template/changelog | 5 +++ misc/template/configurateurfront.postinst | 21 +++++++++++ misc/template/control | 12 +++++++ misc/template/install | 2 ++ misc/template/rules | 12 +++++++ src/environments/environment.prod.ts | 3 +- 10 files changed, 140 insertions(+), 3 deletions(-) create mode 100644 VERSION create mode 100755 build.sh create mode 100644 misc/010-configurateur.conf create mode 100644 misc/template/changelog create mode 100644 misc/template/configurateurfront.postinst create mode 100644 misc/template/control create mode 100644 misc/template/install create mode 100755 misc/template/rules diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..3eefcb9 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.0.0 diff --git a/angular.json b/angular.json index 35abd58..3eb4d0e 100644 --- a/angular.json +++ b/angular.json @@ -40,8 +40,8 @@ "budgets": [ { "type": "initial", - "maximumWarning": "500kb", - "maximumError": "1mb" + "maximumWarning": "2mb", + "maximumError": "3mb" }, { "type": "anyComponentStyle", diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..98cc138 --- /dev/null +++ b/build.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# +# Author : vincent.benoit@benserv.fr +# Date : Novembre 2022 +# Version : 1.0.0 +# Brief : création du package Debian ncessaire pour le Frontend du configurateur +# +################################################################################ + +create_deb() { + dirname=configurateurfront-$1 + /usr/bin/mkdir -p "$2/bdist_deb/$dirname" + cd "$2/bdist_deb/$dirname" + debvers=`/usr/bin/cat /etc/debian_version` + IFS='.' + read -ra vers <<< "$debvers" + if [ "$vers" == "10" ]; then + # Write compat file to deb template for Debian 10.x + cat > $2/misc/template/compat << EOF +11 +EOF + fi + /usr/bin/dh_make -t $2/misc/template -n -y -i -d + cd "$2" + /usr/local/bin/ng build --configuration "production" --output-path "bdist_deb/$dirname/app-configurateur" + cd "$2/bdist_deb/$dirname" + /usr/bin/find $2/misc -type f -name "*.conf" -exec /usr/bin/cp -a {} . \; + /usr/bin/dpkg-buildpackage -b -uc -us -rfakeroot + /usr/bin/rm -f $2/misc/template/compat + cd .. + if [ ! -d "$2/dist" ]; then + /usr/bin/mkdir -p $2/dist + /usr/bin/find . -type f -name "*.deb" -exec /usr/bin/cp -a {} $2/dist \; + fi +} + +echo "*** Remove old dirs ***" +/usr/bin/rm -rf bdist_deb dist +echo "*** read version ***" +vers=`/usr/bin/cat VERSION` +echo "VERSION => $vers" +rootpath=`pwd` +echo "*** Create Debian Misc Package ***" +create_deb "$vers" "$rootpath" diff --git a/misc/010-configurateur.conf b/misc/010-configurateur.conf new file mode 100644 index 0000000..3043e58 --- /dev/null +++ b/misc/010-configurateur.conf @@ -0,0 +1,39 @@ +Listen 80 + + + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + #ServerName www.example.com + + ServerAdmin vincent.benoit@benserv.fr + DocumentRoot /var/www/app-configurateur + + Order Allow,Deny + Allow from all + AllowOverride none + Require all granted + Header always set Access-Control-Allow-Origin "*" + Header always add Access-Control-Allow-Headers "origin, x-requested-with, content-type" + Header always add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS" + Header always add Access-Control-Expose-Headers "Content-Security-Policy, Location" + Header always add Access-Control-Max-Age "3600" + + + + ProxyPreserveHost On + ProxyPass http://127.0.0.1:5000/api + ProxyPassReverse http://127.0.0.1:5000/api + + + LogLevel info + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + + +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet diff --git a/misc/template/changelog b/misc/template/changelog new file mode 100644 index 0000000..b41a763 --- /dev/null +++ b/misc/template/changelog @@ -0,0 +1,5 @@ +#PACKAGE# (#VERSION#) stable; urgency=medium + + * Initial release + + -- #USERNAME# <#EMAIL#> #DATE# diff --git a/misc/template/configurateurfront.postinst b/misc/template/configurateurfront.postinst new file mode 100644 index 0000000..169fcf6 --- /dev/null +++ b/misc/template/configurateurfront.postinst @@ -0,0 +1,21 @@ +#!/bin/sh +# postinst script for sclesignrestfulmisc +# +# see: dh_installdeb(1) + +set -e +user="root" + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +/usr/sbin/a2enmod headers > /dev/null 2>&1 +/usr/sbin/a2enmod proxy > /dev/null 2>&1 +/usr/sbin/a2enmod proxy_http > /dev/null 2>&1 +/usr/sbin/a2enmod rewrite > /dev/null 2>&1 +/usr/sbin/a2enmod ssl > /dev/null 2>&1 +/usr/sbin/a2ensite 010-configurateur.conf > /dev/null 2>&1 + +/usr/bin/systemctl restart apache2 > /dev/null 2>&1 diff --git a/misc/template/control b/misc/template/control new file mode 100644 index 0000000..694d034 --- /dev/null +++ b/misc/template/control @@ -0,0 +1,12 @@ +Source: #PACKAGE# +Section: misc +Priority: optional +Maintainer: #USERNAME# <#EMAIL#> +Build-Depends: #BUILD_DEPS# +Standards-Version: #POLICY# +Homepage: https://git.nas.benserv.fr/vincent/Kine-frontend + +Package: #PACKAGE# +Architecture: all +Depends: ${misc:Depends}, apache2 +Description: Installation des fichiers nécessaires au fonctionnement du Frontend Configurateur diff --git a/misc/template/install b/misc/template/install new file mode 100644 index 0000000..f2c41bc --- /dev/null +++ b/misc/template/install @@ -0,0 +1,2 @@ +app-configurateur /var/www/ +010-configurateur.conf /etc/apache2/sites-available diff --git a/misc/template/rules b/misc/template/rules new file mode 100755 index 0000000..7dab8e0 --- /dev/null +++ b/misc/template/rules @@ -0,0 +1,12 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +#export DH_VERBOSE = 1 + +#RULES_START_TEXT# +%: + dh $@#DH_ADDON# + +override_dh_auto_install: + +#RULES_END_TEXT# diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 3612073..e37f4b2 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -1,3 +1,4 @@ export const environment = { - production: true + production: true, + host: "" };