geonode icon indicating copy to clipboard operation
geonode copied to clipboard

Advanced Installation instructions (Docker) not working

Open GuiAlDuS opened this issue 2 years ago • 7 comments

Expected Behavior

Running Geonode

Actual Behavior

502 Bad Gateway error when accessing it remotely (forwarding port 80 between virtual machine and host)

Also getting the following errors on the virtual machine terminal: django4geonode | GeoServer connection error is HTTPConnectionPool(host='geoserver', port=8080): Max retries exceeded with url: /geoserver/rest (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f915cca6f80>: Failed to establish a new connection: [Errno 99] Cannot assign requested address'))

and

django4geonode | GeoServer HTTP error is 404 Client Error: for url: http://geoserver:8080/geoserver/rest

Steps to Reproduce the Problem

  1. All the steps in the current GeoNode Advanced Installation: Docker documentation. I copy-pasted the commands, using a clean Ubuntu Server 20.04.4 installation
  2. Tested both with: docker-compose build --no-cache docker-compose up -d and docker-compose up --build but still got the same error.

Specifications

  • GeoNode version: current version (3.2.1)
  • Installation method (manual, GeoNode Docker, SPCGeoNode Docker): GeoNode Docker
  • Platform: Ubuntu Server 20.04 .4 LTS on a virtual machine
  • Additional details: I followed all the steps on https://docs.geonode.org/en/master/install/advanced/core/index.html#docker

GuiAlDuS avatar Jun 16 '22 19:06 GuiAlDuS

I ended up with the same issue with Ubuntu Server 20.04, Ubuntu Desktop 22.04 and Ubuntu Desktop 18.04. Any progress at your end @GuiAlDuS ?

bulbulrizwan avatar Jul 05 '22 12:07 bulbulrizwan

I looks like the GeoServer container is not working. Probably related to this issue https://github.com/GeoNode/geonode-project/pull/343

afabiani avatar Jul 05 '22 13:07 afabiani

I ended up with the same issue with Ubuntu Server 20.04, Ubuntu Desktop 22.04 and Ubuntu Desktop 18.04. Any progress at your end @GuiAlDuS ?

No improvement. I was in a hurry so I ended up installing only GeoServer :(

GuiAlDuS avatar Jul 11 '22 15:07 GuiAlDuS

I have a similar problem and discovered that if I pass the complete .env file to the geoserver container then it fails, but if I pass a selection of environment variables then it starts properly.

Its worth mentioning that I'm using podman instead of docker, but it shouldn't really make any difference.

Here are my two startup scripts and the corresponding logs:

first the one that fails, where I pass the whole environment file:

#!/bin/bash

__dir=$(dirname $(realpath $0))
ENV_FILE=$__dir/environment
image=geonode/geoserver:2.19.6
container=geonode-geoserver

podman rm -i $container

podman run \
    --env-file=$ENV_FILE \
    --name=$container \
    --pod=geonode-pod \
    --rm \
    --volume=geonode_backup_restore:/backup_restore \
    --volume=geonode_data:/data \
    --volume=geonode_geoserver_data_dir:/geoserver_data/data \
    --volume=geonode_statics:/mnt/volumes/statics \
    --volume=geonode_tmp:/tmp \
    $image

and its output where there is a very cryptic NoClassDefFoundError.

And next the one that works, where I pass individual variables:

#!/bin/bash

__dir=$(dirname $(realpath $0))
ENV_FILE=$__dir/environment
image=geonode/geoserver:2.19.6
container=geonode-geoserver

podman rm -i $container

podman run \
    --env=DOCKER_HOST_IP=127.0.0.1 \
    --env=NGINX_HOST=127.0.0.1 \
    --env=NGINX_PORT=80 \
    --env=DATABASE_HOST=127.0.0.1 \
    --env=DATABASE_PORT=5432 \
    --env=GEONODE_DATABASE=geonode \
    --env=GEONODE_GEODATABASE=geonode_data \
    --env=GEONODE_GEODATABASE_PASSWORD=geonode_data \
    --env=GEONODE_GEODATABASE_SCHEMA=public \
    --env=GEOSERVER_JAVA_OPTS="-Djava.awt.headless=true -Xms2G -Xmx4G -XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:LogFile=/var/log/jvm.log -XX:PerfDataSamplingInterval=500 -XX:SoftRefLRUPolicyMSPerMB=36000 -XX:-UseGCOverheadLimit -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:ParallelGCThreads=4 -Dfile.encoding=UTF8 -Djavax.servlet.request.encoding=UTF-8 -Djavax.servlet.response.encoding=UTF-8 -Duser.timezone=GMT -Dorg.geotools.shapefile.datetime=false -DGEOSERVER_CSRF_DISABLED=true -DPRINT_BASE_URL=http://127.0.0.1:8080/geoserver/pdf -DALLOW_ENV_PARAMETRIZATION=true -Xbootclasspath/a:/usr/local/tomcat/webapps/geoserver/WEB-INF/lib/marlin-0.9.3-Unsafe.jar -Dsun.java2d.renderer=org.marlin.pisces.MarlinRenderingEngine" \
    --name=$container \
    --pod=geonode-pod \
    --rm \
    --volume=geonode_backup_restore:/backup_restore \
    --volume=geonode_data:/data \
    --volume=geonode_geoserver_data_dir:/geoserver_data/data \
    --volume=geonode_statics:/mnt/volumes/statics \
    --volume=geonode_tmp:/tmp \
    $image

and its output with no errors (and I can go to the browser and open localhost:8080 and see a geoserver installation).

The environment file is almost exactly the same as the original from the 3.3.x branch except for a few host adjustments because I'm using a podman pod.

categulario avatar Jul 31 '22 05:07 categulario

Hello, maybe you can investigate if some env variables are different or need to be wrapped in '' To do this you can debug doing docker exec -it my-container env in the --env-file container and in the --env one and do the diff among the two lists

xmichele avatar Jul 31 '22 13:07 xmichele

I did as you proposed @xmichele and found out that the [relevant] difference between the two is how the GEOSERVER_JAVA_OPTS variable gets passed to the container.

In the working container its value is unquoted (as displayed by the env command) while in the failing container the value is quoted:

# Faliing
GEOSERVER_JAVA_OPTS="-Djava.awt.headless=true -Xms2G -Xmx4G -XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:LogFile=/var/log/jvm.log -XX:PerfDataSamplingInterval=500 -XX:SoftRefLRUPolicyMSPerMB=36000 -XX:-UseGCOverheadLimit -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:ParallelGCThreads=4 -Dfile.encoding=UTF8 -Djavax.servlet.request.encoding=UTF-8 -Djavax.servlet.response.encoding=UTF-8 -Duser.timezone=GMT -Dorg.geotools.shapefile.datetime=false -DGEOSERVER_CSRF_DISABLED=true -DPRINT_BASE_URL=http://127.0.0.1:8080/geoserver/pdf -DALLOW_ENV_PARAMETRIZATION=true -Xbootclasspath/a:/usr/local/tomcat/webapps/geoserver/WEB-INF/lib/marlin-0.9.3-Unsafe.jar -Dsun.java2d.renderer=org.marlin.pisces.MarlinRenderingEngine"

# Working
GEOSERVER_JAVA_OPTS=-Djava.awt.headless=true -Xms2G -Xmx4G -XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:LogFile=/var/log/jvm.log -XX:PerfDataSamplingInterval=500 -XX:SoftRefLRUPolicyMSPerMB=36000 -XX:-UseGCOverheadLimit -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:ParallelGCThreads=4 -Dfile.encoding=UTF8 -Djavax.servlet.request.encoding=UTF-8 -Djavax.servlet.response.encoding=UTF-8 -Duser.timezone=GMT -Dorg.geotools.shapefile.datetime=false -DGEOSERVER_CSRF_DISABLED=true -DPRINT_BASE_URL=http://127.0.0.1:8080/geoserver/pdf -DALLOW_ENV_PARAMETRIZATION=true -Xbootclasspath/a:/usr/local/tomcat/webapps/geoserver/WEB-INF/lib/marlin-0.9.3-Unsafe.jar -Dsun.java2d.renderer=org.marlin.pisces.MarlinRenderingEngine

(the two have the same values except for the quotes).

Looking at the repository I see that all of .env, .env_dev .env_local and .env_test have the values quoted. Should we unquote them?

categulario avatar Aug 27 '22 15:08 categulario

Ok, according to the docker docs the quotes will become part of the value, so we must remove them.

categulario avatar Aug 27 '22 15:08 categulario

Will there be an option to run a pre built 4.x container from docker hub soon ? (without needing to clone the repo i mean)

gotjoshua avatar Oct 07 '22 16:10 gotjoshua