From 90106df0f689952fbd122fc6311f57d66cd3a127 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Thu, 7 May 2020 15:46:36 +0200 Subject: [PATCH] Added debug mode for backend --- README.org | 38 +++++++++++++++++++++++++++++++++----- docker-compose.yml | 2 ++ start.sh | 7 ++++++- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/README.org b/README.org index 0dd734c..7440814 100644 --- a/README.org +++ b/README.org @@ -100,11 +100,39 @@ #+END_SRC ** Running in development mode - To run this backend in development mode, you will have to remove the - ~--release~ option from the ~webdev~ command in the ~start.sh~ file. This - will allow webdev to compile Dart files faster, but at the price of slower - compiled Javascript files. If you use Docker, don’t forget to rebuild your - image. + # To run this backend in development mode, you will have to remove the + # ~--release~ option from the ~webdev~ command in the ~start.sh~ file. This + # will allow webdev to compile Dart files faster, but at the price of slower + # compiled Javascript files. If you use Docker, don’t forget to rebuild your + # image. + To run this backend in development mode, you can add to your environment the + variable ~RELEASE~ with the value ~debug~. Running the backend locally, you + would start it like so: + #+BEGIN_SRC sh + RELEASE=debug ./start.sh + #+END_SRC + + Running it with Docker, you would use the following command: + #+BEGIN_SRC sh + docker run \ + -p 8080:8080 \ + -v ./web:/app/web \ + -e RELEASE=debug \ + --restart always \ + --detach \ + --name owb \ + owb:1.0 + #+END_SRC + + And with docker-compose, you would add the following line to your ~owb~ + service: + #+BEGIN_SRC yaml + environment: + - RELEASE=debug + #+END_SRC + + Any other value to this environment variable will make your backend run in + release mode (actually, it will only make ~webdev~ run in release mode). ** How can I use this in my org files? Let’s say you serve your files on org.example.com, add the following lines to diff --git a/docker-compose.yml b/docker-compose.yml index 748766c..470f093 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,5 +6,7 @@ services: ports: - 8010:8080 restart: always + environment: + - RELEASE=debug volumes: - ./web:/app/web diff --git a/start.sh b/start.sh index c655788..f7ba352 100755 --- a/start.sh +++ b/start.sh @@ -1,3 +1,8 @@ #!/bin/bash sass --watch web/style/:web/style -tcompressed & -webdev serve --release --hostname 0.0.0.0 + +[ "$RELEASE" == "debug" ] \ + && webdev serve --hostname 0.0.0.0 \ + || webdev serve --release --hostname 0.0.0.0 + +# webdev serve --release --hostname 0.0.0.0