pbijdens / centaur-scores-ui

Management front-end for the centaur-scores API. Created using angular.
2 stars 0 forks source link
angular centaur-scores tailwind

Installation steps for the Centaur Scores UI

Requirements

Create a release

To create a release:

npm run build-cs

Then copy the contents of the dist/centaur-scores-ui/browser/ folder to your apache2 server, e.g. in /var/www/centaurscoresui.

First install

Assuming you already installed the API server and copied the dist/centaur-scores-ui/browser/ folder contents into /var/www/centaurscoresui:

Create a file /etc/apache2/conf-available/centaurscores.conf with these contents:

<IfModule alias_module>
    Alias /cs /var/www/centaurscoresui
</IfModule>

<Directory "/var/www/centaurscoresui">
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /cs
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-l
  RewriteRule . index.html [L]
</IfModule>
</Directory>

<Location "/cs/">
    Require all granted
</Location>

The rewrite engine configuration is required because of angular's internal routing, where for most routes no target file exists. All those routes are internally redirected to the index file.

Then run these commands to enable the rewrite module, enable above configuration file and restart apache2.

sudo a2enmod rewrite
sudo a2enconf centaurscores
sudo apache2ctl restart

You should now be able to reach the UI at http:///cs

Scripts

Use this script to install a new version of this centaur scores UI

#!/bin/bash
npm install
npm run build-cs
cp -R dist/centaur-scores-ui/browser/* /var/www/centaurscoresui/

Use this script to install a new version of the backend; run this from the centaur-scores-api/CentaurScores project-folder:

#!/bin/bash
sudo systemctl stop centaurscoresapi
dotnet publish -o /var/www/centaurscoresapi
sudo systemctl start centaurscoresapi