The aim of this project is to set up a virtual machine with two containers, the first one is the data server which contains the postgres+postgis image with an automatically added shapefile layer, and the second one is the application server which contains the geoserver image. at the end we will be able to see the Paris department shapefile from the geoserver web page, and its atribute table from the pgAdmin client interface. The schemas below show what we are attempting to do. In this project we suppose that you have already installed Vagrant. If not, please do it.
execute the appropriate script for the appropriate OS. If you are using Linux Debian/Ubuntu (run_me.sh):
- In your home directory create a workspace folder:
mkdir ~/workspace
- move to your workspace directory:
cd ~/workspace
- clone this repository :
git clone https://github.com/mohamedamjad/ASI.git
- execute the run_me.sh script:
sh ~/workspace/ASI/run_me.sh
(this sh script will set up a vagrant virtual machine with the appropriate forwarded port and add the dduportal/boot2docker V1.3.1 box.
- create a workspace folder:
mkdir workspace
- move to your workspace folder:
cd workspace
- clone this repository :
git clone https://github.com/mohamedamjad/ASI.git
- execute the run_me.bat script:
run_me.bat
(this bat script will set up a vagrant virtual machine and add the dduportal/boot2docker V1.3.1 box.
- Now that you are in the boot2docker, go to the vagrant mount:
cd /vagrant
- execute the configure_docker.sh script:
sh configure_docker.sh
(this script will create two docker containers: postgis and geoserver the first one contains the Postgres+PostGIS image and the second one contains the Geoserver image . - this script will also automatically add a shapefile to our geodatabase using the shp2pgsql plugin.
- Fill the connection form with the appropriate IP adress (localhost), user (postgres), Password (postgres) and forwarded port (2201) . Like the screenshot bellow.
- In your public schema, you can vizualise your automatically added spatialdb table.
.
Now we will try to vizualise our shapefile from the geoserver admin web page.
- First of all we need to log in into the geoserver web interface: 127.0.0.1:2207 (my 8080 port is busy). login: admin passwd: geoserver
- to connect the geoserver container with the postgis one: Entrepôt-> Ajouter un entrepôt, and fill the form like shown in the image bellow (passwd=postgres).
.
- If everything is OK, we need to publish our geodatabase: click Publier.
.
- You'll have a new form, keep the default parameters, choose : Emprise native and valdiate the form
- Final step (Haaallelujah!!): Prévisualisation des couches-> click on the name of your layer and choose OpenLayers