2

I've been working on my WebGIS service for several weeks. For this I have written a script that creates 10 docker containers according to the microservice principle. I install these services on a virtual root server with Ubuntu 18.04 LTS 64bit.

I use this guide as a basis: https://github.com/qwc-services/qwc-docker/

And secondly: https://github.com/qgis/qwc2-demo-app/blob/master/doc/QWC2_Documentation.md#quick-start

Unfortunately I can not run "qwc2-demo-app" on localhost: 8088. If I run "yarn start" under ~ / root / qwc-docker / qwc2-demo-app I can use the Demoapp under the standard port: 8081 with demo map. But the service should run productively on port 8088.

I'm asking for help, I'm an absolute GIS beginner, but am looking to get involved as quickly as possible. So far I could find nothing in the Google search or the numerous GIT instructions that helps me. Incidentally, I'm from Germany and don‘t use my school English that often.

Here is my bash script to check:

#!/bin/bash
#start under "/root" on a new "Ubuntu 18.04 LTS 64-Bit"
###Configuration###
scriptversion=3.5
dockerComposeVersion=1.24.1
pgAdminUser=VARIABLE
pgAdminPasswort=VARIABLE
qwc_configdb_name=qwc_demo
qwc_configdb_user=qwc_admin
qwc_configdb_pw=qwc_admin
qwc_geodb_name=qwc_demo
qwc_geodb_name_user=qwc_service_write
qwc_geodb_name_pw=qwc_service_write
qwc_webmapping_name=qwc_demo
qwc_webmapping_user=qgis_server
qwc_webmapping_pw=qgis_server
qwc_qgis_server_projectname=project.qgs
my_ip_adress=VARIABLE
#########################################################################################################
echo ""
echo "################################### WebGIS-Script V$scriptversion ###################################"
echo ""
echo "UPDATE UBUNTU..."
read -n 1 k
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
apt-get update -y
#########################################################################################################
echo "INSTALL IMPORTENT TOOLS..."
read -n 1 k
apt-get install apt-transport-https ca-certificates curl software-properties-common -y
apt-get install git unzip npm yarn net-tools -y
#########################################################################################################
echo "INSTALL DOCKER..."
read -n 1 k
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
apt-get update -y
apt-cache policy docker-ce
apt-get install docker-ce -y
systemctl enable docker
systemctl start docker
# echo "Docker INFO..."
# read -n 1 k
# docker info
#########################################################################################################
echo "CLONEN QWC-DOCKER FROM GITHUB..."
read -n 1 k
git clone --recursive https://github.com/qwc-services/qwc-docker.git
#########################################################################################################
echo "INSTALL DOCKER-COMPOSE $dockerComposeVersion..."
read -n 1 k
curl -L https://github.com/docker/compose/releases/download/$dockerComposeVersion/docker-compose-`uname -s`-`uname -m` > /bin/docker-compose
chmod +x /bin/docker-compose
cd qwc-docker
cp docker-compose-example.yml docker-compose.yml
#########################################################################################################
echo "GENERATE SERVICE FOR DOCKER-COMPOSE..."
read -n 1 k
echo -e "[Unit]
Description=Docker Compose Application Service
Requires=docker.service
After=docker.service

[Service]
Type=oneshot
RemainAfterExit=yes
WorkingDirectory=/root/qwc-docker/
ExecStart=/bin/docker-compose up -d
ExecStop=/bin/docker-compose down
TimeoutStartSec=0

[Install]
WantedBy=multi-user.target" > /etc/systemd/system/docker-compose.service
systemctl daemon-reload
systemctl enable docker-compose
#########################################################################################################
cd ~/qwc-docker/
echo "CLONE QWC2 FROM GITHUB..."
read -n 1 k
git clone --recursive https://github.com/qgis/qwc2-demo-app.git
#########################################################################################################
cd ~/qwc-docker/qwc2-demo-app/
echo "INSTALL YARN..."
read -n 1 k
yarn install
yarn start &
sleep 240
#########################################################################################################
clear
echo "IMPORT OWN LOGOS..."
read -n 1 k
cd ~/qwc-docker/qwc2-demo-app/assets/img/
mv logo.svg logo.svg.old
mv logo-mobile.svg logo-mobile.svg.old
mv ~/logo.svg logo.svg
mv ~/logo-mobile.svg logo-mobile.svg
#########################################################################################################
echo "IMPORT OWN QGIS-PROJECT..."
read -n 1 k
mv ~/qwc-docker/volumes/qgs-resources/qwc_demo.qgs ~/qwc-docker/volumes/qgs-resources/qwc_demo.qgs.old
mv ~/$qwc_qgis_server_projectname ~/qwc-docker/volumes/qgs-resources/qwc_demo.qgs
#########################################################################################################
echo "START YARN PROD..."
read -n 1 k
cd ~/qwc-docker/qwc2-demo-app/
yarn prod
#########################################################################################################
SRCDIR=~/qwc-docker/qwc2-demo-app/ DSTDIR=~/qwc-docker/volumes
cd $SRCDIR && \
cp -r assets $DSTDIR/qwc2 && \
cp -r translations/data.* $DSTDIR/qwc2/ && \
cp dist/QWC2App.js $DSTDIR/qwc2/dist/ && \
cp index.html $DSTDIR/qwc2/ && \
sed -e '/proxyServiceUrl/d' \
  -e 's!permalinkServiceUrl":\s*".*"!permalinkServiceUrl": "/permalink"!' \
  -e 's!elevationServiceUrl":\s*".*"!elevationServiceUrl": "/elevation"!' \
  -e 's!searchServiceUrl":\s*".*"!searchServiceUrl": "/search"!' \
  -e 's!editServiceUrl":\s*".*"!editServiceUrl": "/data"!' \
  -e 's!authServiceUrl":\s*".*"!authServiceUrl": "/auth"!' \
  -e 's!mapInfoService":\s*".*"!mapInfoService": "/mapinfo"!' \
  -e 's!featureReportService":\s*".*"!featureReportService": "/document"!' \
  -e 's!{"key": "Login", "icon": "img/login.svg"}!{{ login_logout_item }}!g' \
  config.json > $DSTDIR/qwc2/config.json
#########################################################################################################
echo "THEMESCONFIG GO LIVE..."
read -n 1 k
cp ~/qwc-docker/volumes/qwc2/themesConfig-example.json ~/qwc-docker/volumes/qwc2/themesConfig.json
#########################################################################################################
echo "BUILD DOCKER COMPOSE..."
read -n 1 k
cd ~/qwc-docker/qwc2-demo-app/
docker-compose build
#########################################################################################################
echo "WRITE POSTGIS CONFIGFILE..."
read -n 1 k
cd ~/qwc-docker/postgis/
cat >>pg_service.conf <<EOS
[qwc_configdb]
host=localhost
port=5439
dbname=$qwc_configdb_name
user=$qwc_configdb_user
password=$qwc_configdb_pw
sslmode=disable

[qwc_geodb]
host=localhost
port=5439
dbname=$qwc_geodb_name
user=$qwc_geodb_name_user
password=$qwc_geodb_name_pw
sslmode=disable

[qwc_webmapping]
host=localhost
port=5439
dbname=$qwc_webmapping_name
user=$qwc_webmapping_user
password=$qwc_webmapping_pw
sslmode=disable
EOS
#########################################################################################################
echo "START DOCKER COMPOSE SERVICE..."
read -n 1 k
systemctl start docker-compose #docker-compose up -d
#########################################################################################################
cd ~/qwc-docker/qwc2-demo-app/
echo "RUN PORTAINER ON PORT 9000..."
read -n 1 k
docker volume create portainer_data
docker run -d -p 8000:8000 -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer --restart always
docker pull portainer/portainer
docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer
#########################################################################################################
echo "RUN PGADMIN ON PORT 5444..."
read -n 1 k
docker pull dpage/pgadmin4
docker run -p 5444:80 \
 -e "PGADMIN_DEFAULT_EMAIL=$pgAdminUser" \
 -e "PGADMIN_DEFAULT_PASSWORD=$pgAdminPasswort" \
 -d dpage/pgadmin4 --restart always
#########################################################################################################
# echo "FIREWALL CLOSE FOR OTHERS..."
# read -n 1 k
# iptables -I INPUT \! --src $my_ip_adress -m tcp -p tcp --dport 8081 -j DROP
#########################################################################################################
echo "END!"
3
  • Hello and welcome to GIS SE. Well what yarn start does it only starts a local webapp, so you can access it only locally. What you should do is yarn run <folder_name_that_will_be_created>. Maybe try reading more here: gis.stackexchange.com/questions/270049/…
    – Piskr
    Aug 14 '19 at 11:56
  • Yes, "yarn run prod" and "yarn prod" does the same. But it's ok I using now "yarn run prod". Currently I am testing my entire configuration on a local Ubuntu. Then I can check whether the problem lies with the hoster or if I have possibly forgotten to open a port.
    – jangis
    Aug 15 '19 at 14:57
  • Ok, good luck! I'll rewrite the comment into an answer, and if it solved your problem you can check it :)
    – Piskr
    Aug 16 '19 at 6:24
1

I think the problem lies within the command:

yarn start

Because the command only runs the site locally, so it's not accessible across the network. You should try using the command:

yarn run <some_foldername>

(You can omit the <some_foldername> for the same result) This will produce a folder with your app, ready to be served across the network, with your clients.

You can read some more about this similar problem here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.