#+title: 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 .
* Running dev
need 3 teminals
** start backend
in sbt
#+begin_src sbt
backend/run
#+end_src
** continuous ScalaJS compilation
in sbt
#+begin_src sbt
project frontend
~fastLinkJS
#+end_src
** start Vite
#+begin_src bash
npm run dev
#+end_src
- 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
#+begin_src bash
sbt backend/assembly
scp -r backend/target/scala-3.2.0/backend-assembly-0.1.1.jar :~/Downloads/backend-assembly-0.1.1.jar
#+end_src
*** build and copy frontend
#+begin_src bash
npm run build
scp -r dist/* :/var/www/planning-poker-grargh
#+end_src
*** start backend
#+begin_src bash
nix shell --extra-experimental-features nix-command --extra-experimental-features flakes nixpkgs#jdk
java -jar ~/Downloads/backend-assembly-0.1.1.jar &
#+end_src
**** to kill / restart
#+begin_src bash
ps aux | grep backend-assembly
kill
#+end_src
**** TODO make nix home-manager module with systemd service
*** configure nginx
#+begin_src nix
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";
'';
};
#+end_src