Better backend launching

This commit is contained in:
Lucien Cartier-Tilet 2020-05-05 15:10:55 +02:00
parent 8b85ea5952
commit 19f2b99d7e
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
5 changed files with 51 additions and 13 deletions

4
.gitignore vendored
View File

@ -1,2 +1,6 @@
*.css
*.map
/.dart_tool/
/.packages
/pubspec.lock
/.sass-cache/

View File

@ -11,6 +11,7 @@ ADD pubspec.* /app/
RUN pub get
RUN pub get --offline
# Get Ruby Sass
RUN apt update && apt install ruby-sass ruby-dev build-essential -y
RUN gem install sass-listen

View File

@ -54,18 +54,39 @@
This is everything you need for beautiful org-generated websites.
*** Running locally
You could install Dart on your machine, as well as the Ruby implementation
of SASS with its dependencies. Then, all you have to do is run ~start.sh~,
and youre good to go! Content will be delivered on the 8080 port. If you
wish to deliver content to another port, you can edit this file.
You could install Dart on your machine, as well as the Ruby implementation
of SASS with its dependencies. Next, you will need to install ~webdev~ and
install the Dart dependencies:
#+BEGIN_SRC sh
$ pub global activate webdev
$ pub get
#+END_SRC
By the way, you have to ensure your Dart caches bins are in your ~$PATH~.
They are generally installed in your ~$HOME/.pub-cache/bin~ directory.
Then, you have to run ~start.sh~, and youre good to go! Content will be
delivered on the 8080 port. If you wish to deliver content to another port,
you can edit this file.
#+BEGIN_SRC sh
# Release mode
RELEASE="release" ./start.sh
# Debug mode
./start.sh
#+END_SRC
*** Docker
A Dockerfile is also provided so you can run this server inside a Docker
container, and thus you can avoid the hassle of installing Dart and Ruby
Sass. In order to run OWB, you can run the following:
Sass. In order to run OWB, you can first build the Docker image:
#+BEGIN_SRC sh
$ docker build . --tag owb:1.0
$ docker run \
docker build . --tag owb:1.0
#+END_SRC
And then you can run it:
#+BEGIN_SRC sh
docker run \
-p 8080:8080 \
-e RELEASE="release" \
--restart always \
@ -79,10 +100,9 @@
filesystem. This will also make ~webserver~ run in development mode; expect
shorter Dart compilation time, but slower Dart code execution.
#+BEGIN_SRC sh
$ docker run \
docker run \
-p 8080:8080 \
-v ./web:/app/web \
-e RELEASE="debug" \
--restart always \
--detach \
--name owb \

View File

@ -6,5 +6,3 @@ services:
ports:
- 8010:8080
restart: always
volumes:
- ./web/:/app/web/

View File

@ -1,3 +1,18 @@
#!/bin/bash
sass --watch web/style/:web/style -tcompressed &
webdev serve --release --hostname 0.0.0.0
function start_release() {
echo "Starting backend in RELEASE mode"
sass --watch web/style/:web/style -tcompressed &
webdev serve --release --hostname 0.0.0.0
}
function start_debug() {
echo "Starting backend in DEBUG mode"
sass --watch web/style/:web/style -tcompressed &
webdev serve --hostname 0.0.0.0
}
echo Relase: $RELEASE
[ "$RELEASE" == "release" ] \
&& start_release \
|| start_debug