planning-poker-gwargh/Readme.org

2.5 KiB

Readme

Licence:

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Running dev

need 3 teminals

start backend

in sbt

backend/run

continuous ScalaJS compilation

in sbt

project frontend
~fastLinkJS

start Vite

npm run dev
  • starting to serve frontend at localhost:5173
  • started forwarding /api requests to localhost:8080 - backend

Prod deployment (alpha version)

Nix managed server:

build and copy backend

sbt backend/assembly
scp -r backend/target/scala-3.2.0/backend-assembly-0.1.1.jar  <your-server>:~/Downloads/backend-assembly-0.1.1.jar

build and copy frontend

npm run build
scp -r dist/*  <your-server>:/var/www/planning-poker-grargh

start backend

nix shell --extra-experimental-features nix-command --extra-experimental-features flakes nixpkgs#jdk
java -jar ~/Downloads/backend-assembly-0.1.1.jar &
to kill / restart
ps aux | grep backend-assembly
kill <id of found backend java process>
TODO make nix home-manager module with systemd service

configure nginx

services.nginx.virtualHosts."planning-poker.sunshine.industries" = {
    root = "/var/www/planning-poker-grargh"; # copied manually
};

services.nginx.virtualHosts."planning-poker.sunshine.industries".locations."/api" = {
  proxyPass = "http://127.0.0.1:8080"; # started manually
  proxyRedirect = "off";
  extraConfig = ''
    rewrite ^/api/(.*)$ /$1 break;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;

    # Add the following lines for WebSocket support
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
  '';
};