diff --git a/gnuhealth.sh b/gnuhealth.sh index 97f1c47..35794f7 100755 --- a/gnuhealth.sh +++ b/gnuhealth.sh @@ -5,12 +5,12 @@ SOURCE_DIR=$(realpath $(dirname "${0}")) # Install dependencies for GNU Health apt-get -y --no-install-recommends install python3 python3-virtualenv virtualenv -# Add NodeJS repository for SAO (Tryton web client) +# Add NodeJS repository for Sao (Tryton web client) wget https://deb.nodesource.com/gpgkey/nodesource.gpg.key -O - | apt-key add - echo 'deb https://deb.nodesource.com/node_8.x xenial main' > /etc/apt/sources.list.d/nodejs.list apt-get -y update -# Install dependencies for SAO (Tryton web client) +# Install dependencies for Sao (Tryton web client) apt-get -y --no-install-recommends install nodejs # Download GNU Health @@ -19,7 +19,7 @@ tar xzf /tmp/gnuhealth.tgz -C /srv mv /srv/gnuhealth-3.2.8 /srv/gnuhealth rm -f /tmp/gnuhealth.tgz -# Clone SAO (Tryton web client) repository +# Clone Sao (Tryton web client) repository git clone --depth 1 https://github.com/tryton/sao /srv/gnuhealth/sao # Create Python virtualenv @@ -39,7 +39,7 @@ chown -R gnuhealth:gnuhealth /srv/gnuhealth # Install GNU Health sudo -u gnuhealth -i /srv/gnuhealth/gnuhealth-setup install -# Install SAO (Tryton web client) +# Install Sao (Tryton web client) sudo -u gnuhealth npm install --production --prefix /srv/gnuhealth/sao sudo -u gnuhealth bash -c 'cd /srv/gnuhealth/sao && /srv/gnuhealth/sao/node_modules/grunt-cli/bin/grunt' @@ -58,6 +58,13 @@ systemctl daemon-reload systemctl enable gnuhealth systemctl start gnuhealth +# Create nginx site definition +cp ${SOURCE_DIR}/gnuhealth/etc/nginx/sites-available/gnuhealth /etc/nginx/sites-available/gnuhealth +ln -s /etc/nginx/sites-available/gnuhealth /etc/nginx/sites-enabled/gnuhealth + +# Restart nginx +systemctl restart nginx + # Add portal application definition -${SOURCE_DIR}/basic/portal-app-manager.py gnuhealth "{host}:8006" admin "${GNUHEALTH_ADMIN_PWD}" +${SOURCE_DIR}/basic/portal-app-manager.py gnuhealth "https://{host}:8006/" admin "${GNUHEALTH_ADMIN_PWD}" ${SOURCE_DIR}/basic/portal-app-manager.py gnuhealth-clients diff --git a/gnuhealth/etc/nginx/sites-available/gnuhealth b/gnuhealth/etc/nginx/sites-available/gnuhealth new file mode 100644 index 0000000..7908ad4 --- /dev/null +++ b/gnuhealth/etc/nginx/sites-available/gnuhealth @@ -0,0 +1,22 @@ +server { + listen 8006 ssl http2; + listen [::]:8006 ssl http2; + + access_log /var/log/nginx/gnuhealth.access.log; + error_log /var/log/nginx/gnuhealth.error.log; + + root /srv/gnuhealth/sao; + try_files $uri @app; + + location @app { + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header X-Forwarded-Proto https; + proxy_set_header Host $http_host; + proxy_set_header Proxy ""; + proxy_redirect off; + proxy_buffering off; + proxy_read_timeout 90; + proxy_connect_timeout 90; + proxy_pass http://127.0.0.1:8097; + } +} diff --git a/gnuhealth/srv/gnuhealth/gnuhealth/tryton/server/config/trytond.conf b/gnuhealth/srv/gnuhealth/gnuhealth/tryton/server/config/trytond.conf index 7c9f814..f1f3f9c 100644 --- a/gnuhealth/srv/gnuhealth/gnuhealth/tryton/server/config/trytond.conf +++ b/gnuhealth/srv/gnuhealth/gnuhealth/tryton/server/config/trytond.conf @@ -3,7 +3,7 @@ uri = postgresql://gnuhealth:${GNUHEALTH_PWD}@localhost path = /srv/gnuhealth/attach [web] -listen = 0.0.0.0:8006 +listen = 127.0.0.1:8097 root = /srv/gnuhealth/sao [webdav]