summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRamón M. Gómez <ramongomez@us.es>2019-05-06 13:23:57 +0200
committerRamón M. Gómez <ramongomez@us.es>2019-05-06 13:23:57 +0200
commit5b5d6f5afdb7a3a3c0b5dcc1fb026b3fab7626be (patch)
tree24bf6099ada93ac5eb87d498e3d64bd86d163f37
parent5bb60e2b95f57e07b8aa97537302b886bc83c550 (diff)
#761 Fixing bugs when installing OpenGnsys 3 and generating ogagent-oglive package.
-rwxr-xr-xinstaller/opengnsys_installer.sh59
-rw-r--r--server/etc/apache-console3.conf.tmpl58
-rw-r--r--server/etc/apache.conf.tmpl52
3 files changed, 90 insertions, 79 deletions
diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh
index 211b096f..59fe871e 100755
--- a/installer/opengnsys_installer.sh
+++ b/installer/opengnsys_installer.sh
@@ -169,7 +169,7 @@ OSVERSION="${OSVERSION%%.*}"
case "$OSDISTRIB" in
ubuntu|debian|linuxmint)
PREREQS=( curl software-properties-common )
- DEPENDENCIES=( subversion apache2 php php-ldap php-fpm mysql-server php-mysql isc-dhcp-server bittorrent tftp-hpa tftpd-hpa xinetd build-essential g++-multilib libmysqlclient-dev wget doxygen graphviz bittornado ctorrent samba rsync unzip netpipes debootstrap schroot squashfs-tools btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq udpcast libev-dev shim-signed grub-efi-amd64-signed git php-mbstring php-xml nodejs )
+ DEPENDENCIES=( subversion apache2 php php-ldap php-fpm mysql-server php-mysql isc-dhcp-server bittorrent tftp-hpa tftpd-hpa xinetd build-essential g++-multilib libmysqlclient-dev wget doxygen graphviz bittornado ctorrent samba rsync unzip netpipes debootstrap schroot squashfs-tools btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq udpcast libev-dev shim-signed grub-efi-amd64-signed git php-mbstring php-xml nodejs debhelper )
UPDATEPKGLIST="apt-get update"
INSTALLPKG="apt-get -y install"
CHECKPKG="dpkg -s \$package 2>/dev/null | grep Status | grep -qw install"
@@ -1051,45 +1051,52 @@ function installWebFiles()
local $tmpdir
echoAndLog "${FUNCNAME}(): Copying backend files..."
+sed -e "s/ database_name:.*/ database_name: $OPENGNSYS_DATABASE/" \
+ -e "s/ database_user:.*/ database_user: $OPENGNSYS_DB_USER/" \
+ -e "s/ database_password:.*/ database_password: $OPENGNSYS_DB_PASSWD/" \
+ $WORKDIR/opengnsys/admin/WebConsole3/backend/app/config/parameters.yml.dist \
+ > $WORKDIR/opengnsys/admin/WebConsole3/backend/app/config/parameters.yml
chown -R $OPENGNSYS_CLIENT_USER:$OPENGNSYS_CLIENT_USER $WORKDIR/opengnsys/admin/WebConsole3
-cp -a $WORKDIR/opengnsys/admin/WebConsole3/backend $INSTALL_TARGET/www
+cp -a $WORKDIR/opengnsys/admin/WebConsole3/backend $INSTALL_TARGET/www3
if [ $? != 0 ]; then
errorAndLog "${FUNCNAME}(): Error copying backend files."
exit 1
fi
echoAndLog "${FUNCNAME}(): Installing backend framework..."
-pushd $INSTALL_TARGET/www/backend
+pushd $INSTALL_TARGET/www3/backend
sudo -u $OPENGNSYS_CLIENT_USER composer.phar install
chmod 777 -R var/cache var/logs
-php app/console doctrine:database:create --if-not-exists
-php app/console doctrine:schema:update --force
+sudo -u $OPENGNSYS_CLIENT_USER php app/console doctrine:database:create --if-not-exists
+sudo -u $OPENGNSYS_CLIENT_USER php app/console doctrine:schema:update --force
echo yes | php app/console doctrine:fixtures:load
php app/console fos:user:create "$OPENGNSYS_DB_USER" "${OPENGNSYS_DB_USER}@localhost.localdomain" "$OPENGNSYS_DB_USER"
# Generar nuevos tokens de seguridad.
-read -e ID SECRET <<<"$(php app/console opengnsys:oauth-server:client:create --no-ansi | \
- awk 'BEGIN {RS=" "} /^(id|secret)$/ {getline; gsub(/(,|.*_)/,""); printf("%s ", $0)}')"
+read -e CLIENTID CLIENTSECRET <<< \
+ "$(php app/console opengnsys:oauth-server:client:create --no-ansi | \
+ awk 'BEGIN {RS=" "}
+ /^(id|secret)$/ {getline; gsub(/(,|.*_)/,""); printf("%s ", $0)}')"
popd
echoAndLog "${FUNCNAME}(): Installing frontend framework..."
pushd $WORKDIR/opengnsys/admin/WebConsole3/frontend
-$tmpdir=$(mktemp -d)
+tmpdir=$(sudo -u $OPENGNSYS_CLIENT_USER mktemp -d)
echo "cache = $tmpdir" > .npmrc
sudo -u $OPENGNSYS_CLIENT_USER npm install
sed -i -e "s/SERVERIP/$SERVERIP/" \
- -e "s/CLIENTID/$ID/" \
- -e "s/CLIENTSECRET/$SECRET/" src/environments/environment.ts
-sed -i 's,base href=.*,base href="/opengnsys/">,' src/index.html
+ -e "s/CLIENTID/$CLIENTID/" \
+ -e "s/CLIENTSECRET/$CLIENTSECRET/" src/environments/environment.ts
+sed -i 's,base href=.*,base href="/opengnsys3/frontend/">,' src/index.html
sudo -u $OPENGNSYS_CLIENT_USER ng build
+rm -fr $tmpdir
echoAndLog "${FUNCNAME}(): Copying frontend files..."
-cp -a dist/opengnsysAngular6/* $INSTALL_TARGET/www/frontend
+cp -a dist/opengnsysAngular6 $INSTALL_TARGET/www3/frontend
if [ $? != 0 ]; then
errorAndLog "${FUNCNAME}(): Error copying frontend files."
exit 1
fi
popd
-rm -fr $tmpdir
echoAndLog "${FUNCNAME}(): Web files installed successfully."
}
@@ -1219,7 +1226,8 @@ function createDirs()
mkdir -p $path_opengnsys_base/log/clients
ln -fs $path_opengnsys_base/log /var/log/opengnsys
mkdir -p $path_opengnsys_base/sbin
- mkdir -p $path_opengnsys_base/www
+ mkdir -p $path_opengnsys_base/www/descargas
+ mkdir -p $path_opengnsys_base/www3 ### TEMPORAL
mkdir -p $path_opengnsys_base/images/groups
mkdir -p $TFTPCFGDIR
ln -fs $TFTPCFGDIR $path_opengnsys_base/tftpboot
@@ -1346,6 +1354,9 @@ function copyClientFiles()
echoAndLog "${FUNCNAME}(): Copying OpenGnsys Client files."
cp -a $WORKDIR/opengnsys/client/shared/* $INSTALL_TARGET/client
+ sed -i -e "s/CLIENTID/$CLIENTID/" \
+ -e "s/CLIENTSECRET/$CLIENTSECRET/" \
+ $INSTALL_TARGET/client/etc/init/default.sh ### TEMPORAL
if [ $? -ne 0 ]; then
errorAndLog "${FUNCNAME}(): error while copying client estructure"
errstatus=1
@@ -1404,6 +1415,23 @@ function clientCreate()
}
+# Función temporal para generar y copiar el agente OGAgent para ogLive
+function createOgagentPackage ()
+{
+local ogagentdir=$WORKDIR/opengnsys/admin/Sources/Clients/ogagent/oglive
+
+echoAndLog "${FUNCNAME}(): Creating OGAgent for ogLive package..."
+OGAGENTFILE=$($ogagentdir/build-package.sh | awk -F\' '/building package/ {print $(NF-1)}')
+if [ -z "$OGAGENTFILE" ]; then
+ errorAndLog "${FUNCNAME}(): Error generating OGAgent pacakage."
+ return 1
+fi
+OGAGENTFILE=$(realpath $ogagentdir/$OGAGENTFILE)
+cp -va $OGAGENTFILE $INSTALL_TARGET/images
+echoAndLog "${FUNCNAME}(): OGAgent for ogLive package has been copied to the repository"
+}
+
+
# Configuración básica de servicios de OpenGnsys
function openGnsysConfigure()
{
@@ -1705,6 +1733,9 @@ for i in $OGLIVE; do
fi
done
+# Copiar paquete ogagent-oglive en el repositorio.
+createOgagentPackage
+
# Configuración de servicios de OpenGnsys
openGnsysConfigure
diff --git a/server/etc/apache-console3.conf.tmpl b/server/etc/apache-console3.conf.tmpl
deleted file mode 100644
index 91b61cfb..00000000
--- a/server/etc/apache-console3.conf.tmpl
+++ /dev/null
@@ -1,58 +0,0 @@
-# OpenGnsys Web Admin Console 3 template configuration for Apache.
-
-Alias /opengnsys/v3 CONSOLEDIR3
-
-# PHP-FPM configuration
-<IfModule proxy_fcgi_module>
- <FilesMatch ".+\.ph(p[3457]?|t|tml)$">
- SetHandler "proxy:fcgi://127.0.0.1:9000"
- </FilesMatch>
-</IfModule>
-
-RewriteEngine On
-
-# Redirect HTTP to HTTPS and default configuration.
-<Directory CONSOLEDIR3>
- RewriteCond %{HTTPS} !=on
- RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]
- Require all granted
- Options -Indexes +FollowSymLinks
- DirectoryIndex index.html index.php
- AddType octet/stream .pkg
-</Directory>
-
-# Redirect HTTP to HTTPS and RESTful configuration.
-<Directory CONSOLEDIR3/backend/web>
- #RewriteBase /opengnsys3/rest/web
- #RewriteRule .? - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
- #RewriteCond %{HTTPS} !=on
- #RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]
- #RewriteCond %{REQUEST_FILENAME} !-f
- #RewriteRule ^ index.php [QSA,L]
- DirectoryIndex app.php
-
- <IfModule mod_rewrite.c>
- RewriteEngine On
- RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
- RewriteRule ^(.*) - [E=BASE:%1]
-
- # Sets the HTTP_AUTHORIZATION header removed by apache
- RewriteCond %{HTTP:Authorization} .
- RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
-
- RewriteCond %{ENV:REDIRECT_STATUS} ^$
- RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
-
- RewriteCond %{REQUEST_FILENAME} -f
- RewriteRule .? - [L]
-
- # Rewrite all other queries to the front controller.
- RewriteRule .? %{ENV:BASE}/app.php [L]
- </IfModule>
-
- <IfModule !mod_rewrite.c>
- <IfModule mod_alias.c>
- RedirectMatch 302 ^/$ /app.php/
- </IfModule>
- </IfModule>
-</Directory>
diff --git a/server/etc/apache.conf.tmpl b/server/etc/apache.conf.tmpl
index edb3fda8..099d9ea5 100644
--- a/server/etc/apache.conf.tmpl
+++ b/server/etc/apache.conf.tmpl
@@ -21,12 +21,50 @@ RewriteEngine On
AddType octet/stream .pkg
</Directory>
+Alias /opengnsys3 CONSOLEDIR3
+
+# Redirect HTTP to HTTPS and default configuration.
+<Directory CONSOLEDIR3>
+ RewriteCond %{HTTPS} !=on
+ RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]
+ Require all granted
+ Options -Indexes +FollowSymLinks
+ DirectoryIndex index.html index.php
+ AddType octet/stream .pkg
+</Directory>
+
# Redirect HTTP to HTTPS and RESTful configuration.
-<Directory CONSOLEDIR/rest>
- RewriteBase /opengnsys/rest/
- RewriteRule .? - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
- RewriteCond %{HTTPS} !=on
- RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]
- RewriteCond %{REQUEST_FILENAME} !-f
- RewriteRule ^ index.php [QSA,L]
+<Directory CONSOLEDIR3/backend/web>
+ #RewriteBase /opengnsys3/rest/web
+ #RewriteRule .? - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
+ #RewriteCond %{HTTPS} !=on
+ #RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]
+ #RewriteCond %{REQUEST_FILENAME} !-f
+ #RewriteRule ^ index.php [QSA,L]
+ DirectoryIndex app.php
+
+ <IfModule mod_rewrite.c>
+ RewriteEngine On
+ RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
+ RewriteRule ^(.*) - [E=BASE:%1]
+
+ # Sets the HTTP_AUTHORIZATION header removed by apache
+ RewriteCond %{HTTP:Authorization} .
+ RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
+
+ RewriteCond %{ENV:REDIRECT_STATUS} ^$
+ RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
+
+ RewriteCond %{REQUEST_FILENAME} -f
+ RewriteRule .? - [L]
+
+ # Rewrite all other queries to the front controller.
+ RewriteRule .? %{ENV:BASE}/app.php [L]
+ </IfModule>
+
+ <IfModule !mod_rewrite.c>
+ <IfModule mod_alias.c>
+ RedirectMatch 302 ^/$ /app.php/
+ </IfModule>
+ </IfModule>
</Directory>