Added debug mode for backend

This commit is contained in:
Lucien Cartier-Tilet 2020-05-07 15:46:36 +02:00
parent a82fa74a6b
commit 90106df0f6
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
3 changed files with 41 additions and 6 deletions

View File

@ -100,11 +100,39 @@
#+END_SRC #+END_SRC
** Running in development mode ** Running in development mode
To run this backend in development mode, you will have to remove the # 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 # ~--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 # will allow webdev to compile Dart files faster, but at the price of slower
compiled Javascript files. If you use Docker, dont forget to rebuild your # compiled Javascript files. If you use Docker, dont forget to rebuild your
image. # 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? ** How can I use this in my org files?
Lets say you serve your files on org.example.com, add the following lines to Lets say you serve your files on org.example.com, add the following lines to

View File

@ -6,5 +6,7 @@ services:
ports: ports:
- 8010:8080 - 8010:8080
restart: always restart: always
environment:
- RELEASE=debug
volumes: volumes:
- ./web:/app/web - ./web:/app/web

View File

@ -1,3 +1,8 @@
#!/bin/bash #!/bin/bash
sass --watch web/style/:web/style -tcompressed & 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