Better backend launching
This commit is contained in:
		
							parent
							
								
									8b85ea5952
								
							
						
					
					
						commit
						19f2b99d7e
					
				
							
								
								
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1,2 +1,6 @@ | ||||
| *.css | ||||
| *.map | ||||
| /.dart_tool/ | ||||
| /.packages | ||||
| /pubspec.lock | ||||
| /.sass-cache/ | ||||
|  | ||||
| @ -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 | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										38
									
								
								README.org
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								README.org
									
									
									
									
									
								
							| @ -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 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. | ||||
|     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 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 | ||||
|     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 \ | ||||
|  | ||||
| @ -6,5 +6,3 @@ services: | ||||
|     ports: | ||||
|       - 8010:8080 | ||||
|     restart: always | ||||
|     volumes: | ||||
|       - ./web/:/app/web/ | ||||
|  | ||||
							
								
								
									
										19
									
								
								start.sh
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								start.sh
									
									
									
									
									
								
							| @ -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 | ||||
|  | ||||
		Reference in New Issue
	
	Block a user