Better backend launching
This commit is contained in:
parent
8b85ea5952
commit
19f2b99d7e
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,2 +1,6 @@
|
|||||||
*.css
|
*.css
|
||||||
*.map
|
*.map
|
||||||
|
/.dart_tool/
|
||||||
|
/.packages
|
||||||
|
/pubspec.lock
|
||||||
|
/.sass-cache/
|
||||||
|
@ -11,6 +11,7 @@ ADD pubspec.* /app/
|
|||||||
RUN pub get
|
RUN pub get
|
||||||
RUN pub get --offline
|
RUN pub get --offline
|
||||||
|
|
||||||
|
# Get Ruby Sass
|
||||||
RUN apt update && apt install ruby-sass ruby-dev build-essential -y
|
RUN apt update && apt install ruby-sass ruby-dev build-essential -y
|
||||||
RUN gem install sass-listen
|
RUN gem install sass-listen
|
||||||
|
|
||||||
|
36
README.org
36
README.org
@ -55,17 +55,38 @@
|
|||||||
|
|
||||||
*** Running locally
|
*** Running locally
|
||||||
You could install Dart on your machine, as well as the Ruby implementation
|
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~,
|
of SASS with its dependencies. Next, you will need to install ~webdev~ and
|
||||||
and you’re good to go! Content will be delivered on the 8080 port. If you
|
install the Dart dependencies:
|
||||||
wish to deliver content to another port, you can edit this file.
|
#+BEGIN_SRC sh
|
||||||
|
$ pub global activate webdev
|
||||||
|
$ pub get
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
By the way, you have to ensure your Dart cache’s bins are in your ~$PATH~.
|
||||||
|
They are generally installed in your ~$HOME/.pub-cache/bin~ directory.
|
||||||
|
|
||||||
|
Then, you have to run ~start.sh~, and you’re 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
|
*** Docker
|
||||||
A Dockerfile is also provided so you can run this server inside a 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
|
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
|
#+BEGIN_SRC sh
|
||||||
$ docker build . --tag owb:1.0
|
docker build . --tag owb:1.0
|
||||||
$ docker run \
|
#+END_SRC
|
||||||
|
|
||||||
|
And then you can run it:
|
||||||
|
#+BEGIN_SRC sh
|
||||||
|
docker run \
|
||||||
-p 8080:8080 \
|
-p 8080:8080 \
|
||||||
-e RELEASE="release" \
|
-e RELEASE="release" \
|
||||||
--restart always \
|
--restart always \
|
||||||
@ -79,10 +100,9 @@
|
|||||||
filesystem. This will also make ~webserver~ run in development mode; expect
|
filesystem. This will also make ~webserver~ run in development mode; expect
|
||||||
shorter Dart compilation time, but slower Dart code execution.
|
shorter Dart compilation time, but slower Dart code execution.
|
||||||
#+BEGIN_SRC sh
|
#+BEGIN_SRC sh
|
||||||
$ docker run \
|
docker run \
|
||||||
-p 8080:8080 \
|
-p 8080:8080 \
|
||||||
-v ./web:/app/web \
|
-v ./web:/app/web \
|
||||||
-e RELEASE="debug" \
|
|
||||||
--restart always \
|
--restart always \
|
||||||
--detach \
|
--detach \
|
||||||
--name owb \
|
--name owb \
|
||||||
|
@ -6,5 +6,3 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- 8010:8080
|
- 8010:8080
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
|
||||||
- ./web/:/app/web/
|
|
||||||
|
15
start.sh
15
start.sh
@ -1,3 +1,18 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
function start_release() {
|
||||||
|
echo "Starting backend in RELEASE mode"
|
||||||
sass --watch web/style/:web/style -tcompressed &
|
sass --watch web/style/:web/style -tcompressed &
|
||||||
webdev serve --release --hostname 0.0.0.0
|
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
|
||||||
|
Reference in New Issue
Block a user