mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-30 00:00:13 +01:00
added docker files
This commit is contained in:
parent
5e07229f3f
commit
21fca892e2
4 changed files with 155 additions and 0 deletions
17
docker-compose-dev.yml
Normal file
17
docker-compose-dev.yml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
ember: &defaults
|
||||||
|
image: danlynn/ember-cli
|
||||||
|
volumes:
|
||||||
|
- .:/myapp
|
||||||
|
command: server --watcher polling
|
||||||
|
ports:
|
||||||
|
- "4200:4200"
|
||||||
|
- "35729:35729"
|
||||||
|
|
||||||
|
npm:
|
||||||
|
<<: *defaults
|
||||||
|
entrypoint: ['/usr/local/bin/npm']
|
||||||
|
|
||||||
|
bower:
|
||||||
|
<<: *defaults
|
||||||
|
entrypoint: ['/usr/local/bin/bower', '--allow-root']
|
||||||
|
|
35
docker-compose.yml
Normal file
35
docker-compose.yml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
nginx:
|
||||||
|
image: nginx
|
||||||
|
volumes:
|
||||||
|
- nginx.default.conf:/etc/nginx/conf.d/default.conf
|
||||||
|
links:
|
||||||
|
- orion
|
||||||
|
- ember
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
||||||
|
|
||||||
|
ember:
|
||||||
|
image: danlynn/ember-cli
|
||||||
|
volumes:
|
||||||
|
- .:/myapp
|
||||||
|
command: server --watcher polling
|
||||||
|
|
||||||
|
mongo:
|
||||||
|
image: mongo:2.6
|
||||||
|
command: --smallfiles --nojournal --dbpath=/tmp/
|
||||||
|
|
||||||
|
orion:
|
||||||
|
image: fiware/orion
|
||||||
|
links:
|
||||||
|
- mongo
|
||||||
|
command: -dbhost mongo
|
||||||
|
|
||||||
|
#playback:
|
||||||
|
# image: playback
|
||||||
|
# volumes:
|
||||||
|
# - /share:/share
|
||||||
|
# links:
|
||||||
|
# - orion
|
||||||
|
# command: orion:1026
|
||||||
|
|
||||||
|
|
54
docker.sh
Executable file
54
docker.sh
Executable file
|
@ -0,0 +1,54 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Note that this will automagically be ran if you have rvm installed.
|
||||||
|
# This shell file sets up the following aliases whenever you cd into
|
||||||
|
# the current directory tree:
|
||||||
|
#
|
||||||
|
# + ember
|
||||||
|
# + npm
|
||||||
|
# + bower
|
||||||
|
#
|
||||||
|
# If rvm is not installed then you can simply run:
|
||||||
|
# . setup.sh
|
||||||
|
#
|
||||||
|
# Note that these aliases revert back to executing the system version
|
||||||
|
# of each command whenever you exit the current project dir tree.
|
||||||
|
|
||||||
|
PREV_ROOT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||||
|
|
||||||
|
function npm() {
|
||||||
|
if [[ $PWD/ = $PREV_ROOT_DIR/* ]]; then
|
||||||
|
# echo "docker-compose -f $PREV_ROOT_DIR/docker-compose-dev.yml run --rm npm $@"
|
||||||
|
docker-compose -f $PREV_ROOT_DIR/docker-compose-dev.yml run --rm npm $@
|
||||||
|
else
|
||||||
|
# echo "`which npm` $@"
|
||||||
|
`which npm` $@
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function bower() {
|
||||||
|
if [[ $PWD/ = $PREV_ROOT_DIR/* ]]; then
|
||||||
|
# echo "docker-compose -f $PREV_ROOT_DIR/docker-compose-dev.yml run --rm bower $@"
|
||||||
|
docker-compose -f $PREV_ROOT_DIR/docker-compose-dev.yml run --rm bower $@
|
||||||
|
else
|
||||||
|
# echo "`which bower` $@"
|
||||||
|
`which bower` $@
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function ember() {
|
||||||
|
if [[ $PWD/ = $PREV_ROOT_DIR/* ]]; then
|
||||||
|
# echo "docker-compose -f $PREV_ROOT_DIR/docker-compose-dev.yml run --rm ember $@"
|
||||||
|
docker-compose -f $PREV_ROOT_DIR/docker-compose-dev.yml run --rm ember $@
|
||||||
|
else
|
||||||
|
# echo "`which ember` $@"
|
||||||
|
`which ember` $@
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# manual method of aliasing that persists when outside of current dir (BAD)
|
||||||
|
# alias npm='docker-compose -f docker-compose-dev.yml run --rm npm'
|
||||||
|
# alias bower='docker-compose -f docker-compose-dev.yml run --rm bower'
|
||||||
|
# alias ember='docker-compose -f docker-compose-dev.yml run --rm ember'
|
||||||
|
|
||||||
|
# echo 'Configured npm, bower, and ember for current project'
|
49
nginx.default.conf
Normal file
49
nginx.default.conf
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
server_name labmashup;
|
||||||
|
|
||||||
|
# proxy for ember-cli
|
||||||
|
location ^~ /frontend/ {
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
|
||||||
|
proxy_pass http://ember:4200/frontend/;
|
||||||
|
}
|
||||||
|
|
||||||
|
# proxy for orion context broker
|
||||||
|
location ^~ /api/ {
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
|
||||||
|
if ($request_method = 'OPTIONS') {
|
||||||
|
add_header Access-Control-Allow-Origin '$http_origin' always;
|
||||||
|
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS, PUT, DELETE' always;
|
||||||
|
add_header Access-Control-Allow-Credentials 'true' always;
|
||||||
|
add_header Access-Control-Allow-Headers 'Origin,Content-Type,Accept' always;
|
||||||
|
add_header Content-Length 0;
|
||||||
|
add_header Content-Type text/plain;
|
||||||
|
|
||||||
|
return 204;
|
||||||
|
}
|
||||||
|
|
||||||
|
# rewrite url to exclude /api on context broker side
|
||||||
|
rewrite ^/api/?(.*) /$1 break;
|
||||||
|
|
||||||
|
add_header Access-Control-Allow-Origin '*' always;
|
||||||
|
add_header Access-Control-Allow-Credentials 'true' always;
|
||||||
|
|
||||||
|
proxy_pass http://orion:1026;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 404 /404.html;
|
||||||
|
location = /404.html {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
location = /50x.html {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue