docs: local and prod execution
This commit is contained in:
parent
57618b268d
commit
d54d35eed1
69
Readme.org
69
Readme.org
|
@ -12,5 +12,70 @@ more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along with
|
You should have received a copy of the GNU General Public License along with
|
||||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
* TODO Running dev
|
* Running dev
|
||||||
* TODO Prod deployment
|
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 <your-server>:~/Downloads/backend-assembly-0.1.1.jar
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
*** build and copy frontend
|
||||||
|
#+begin_src bash
|
||||||
|
npm run build
|
||||||
|
scp -r dist/* <your-server>:/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 <id of found backend java process>
|
||||||
|
#+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
|
||||||
|
|
Loading…
Reference in New Issue