Skip to content

Commit

Permalink
added public_address property to docker
Browse files Browse the repository at this point in the history
  • Loading branch information
fabrizyo committed Sep 28, 2015
1 parent c57902d commit fc771c5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 10 deletions.
8 changes: 6 additions & 2 deletions doc/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ It's also possible to use ```docker-compose``` for running SpagoBI with a MySQL
$ docker-compose up
```

## Properties

The only one environment property used by SpagoBI is:

* ```PUBLIC_ADDRESS``` : *optional* - define the IP Host of SpagoBI visible from outside the container (eg. ```http://$PUBLIC_ADDRESS:8080/SpagoBI```), the url's host part of SpagoBI url. If not present (like the above examples) the default value is the IP of container. You can use the IP of virtual machine (in OSX or Windows environment) or localhost if you map the container's port.

# Use SpagoBI

Get the IP of container :
Expand All @@ -69,8 +75,6 @@ Open SpagoBI on your browser at url (use your container-ip):

> container-ip:8080/SpagoBI
It's necessary to test it through the container, so without mapping the port to the host.

If you run the host with a Virtual Machine (for example in a Mac environment) then you can route the traffic directly to the container from you localhost using route command:

```console
Expand Down
11 changes: 8 additions & 3 deletions docker/5.1-all-in-one/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#!/bin/bash
set -e

#get the address of container
#example : default via 172.17.42.1 dev eth0 172.17.0.0/16 dev eth0 proto kernel scope link src 172.17.0.109
PUBLIC_ADDRESS=`ip route | grep src | awk '{print $9}'`
if [[ -z "$PUBLIC_ADDRESS" ]]; then
#get the address of container
#example : default via 172.17.42.1 dev eth0 172.17.0.0/16 dev eth0 proto kernel scope link src 172.17.0.109
PUBLIC_ADDRESS=`ip route | grep src | awk '{print $9}'`
fi


#replace the address of container inside server.xml
sed -i "s/http:\/\/.*:8080/http:\/\/${PUBLIC_ADDRESS}:8080/g" ${SPAGOBI_DIRECTORY}/conf/server.xml
sed -i "s/http:\/\/192\.168\.93\.1:8080/http:\/\/${PUBLIC_ADDRESS}:8080/g" ${SPAGOBI_DIRECTORY}/webapps/SpagoBIConsoleEngine/WEB-INF/web.xml
sed -i "s/http:\/\/192\.168\.93\.1:8080/http:\/\/${PUBLIC_ADDRESS}:8080/g" ${SPAGOBI_DIRECTORY}/webapps/SpagoBIChartEngine/WEB-INF/web.xml

#wait for MySql if it's a compose image
if [ -n "$WAIT_MYSQL" ]; then
Expand Down
11 changes: 8 additions & 3 deletions docker/5.1-fiware-all-in-one/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#!/bin/bash
set -e

#get the address of container
#example : default via 172.17.42.1 dev eth0 172.17.0.0/16 dev eth0 proto kernel scope link src 172.17.0.109
PUBLIC_ADDRESS=`ip route | grep src | awk '{print $9}'`
if [[ -z "$PUBLIC_ADDRESS" ]]; then
#get the address of container
#example : default via 172.17.42.1 dev eth0 172.17.0.0/16 dev eth0 proto kernel scope link src 172.17.0.109
PUBLIC_ADDRESS=`ip route | grep src | awk '{print $9}'`
fi


#replace the address of container inside server.xml
sed -i "s/http:\/\/.*:8080/http:\/\/${PUBLIC_ADDRESS}:8080/g" ${SPAGOBI_DIRECTORY}/conf/server.xml
sed -i "s/http:\/\/192\.168\.93\.1:8080/http:\/\/${PUBLIC_ADDRESS}:8080/g" ${SPAGOBI_DIRECTORY}/webapps/SpagoBIConsoleEngine/WEB-INF/web.xml
sed -i "s/http:\/\/192\.168\.93\.1:8080/http:\/\/${PUBLIC_ADDRESS}:8080/g" ${SPAGOBI_DIRECTORY}/webapps/SpagoBIChartEngine/WEB-INF/web.xml

#wait for MySql if it's a compose image
if [ -n "$WAIT_MYSQL" ]; then
Expand Down
8 changes: 6 additions & 2 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ It's also possible to use ```docker-compose``` for running SpagoBI with a MySQL
$ docker-compose up
```

## Properties

The only one environment property used by SpagoBI is:

* ```PUBLIC_ADDRESS``` : *optional* - define the IP Host of SpagoBI visible from outside the container (eg. ```http://$PUBLIC_ADDRESS:8080/SpagoBI```), the url's host part of SpagoBI url. If not present (like the above examples) the default value is the IP of container. You can use the IP of virtual machine (in OSX or Windows environment) or localhost if you map the container's port.

# Use SpagoBI

Get the IP of container :
Expand All @@ -69,8 +75,6 @@ Open SpagoBI on your browser at url (use your container-ip):

> container-ip:8080/SpagoBI
It's necessary to test it through the container, so without mapping the port to the host.

If you run the host with a Virtual Machine (for example in a Mac environment) then you can route the traffic directly to the container from you localhost using route command:

```console
Expand Down

0 comments on commit fc771c5

Please sign in to comment.