Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fixes #7535] Issues with .env GEOSERVER_ADMIN_PASSWORD #9911

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ else
invoke monitoringfixture
invoke initialized
invoke updateadmin
invoke geoserverfixture
fi

invoke statics
invoke waitforgeoserver
invoke geoserverfixture
invoke waitforgeoserver

echo "Executing UWSGI server $cmd for Production"
fi
Expand Down
8 changes: 4 additions & 4 deletions geonode/local_settings.py.geoserver.sample
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ GEOSERVER_PUBLIC_LOCATION = os.getenv(
'GEOSERVER_PUBLIC_LOCATION', _default_public_location
)

OGC_SERVER_DEFAULT_USER = os.getenv(
GEOSERVER_ADMIN_USER = os.getenv(
'GEOSERVER_ADMIN_USER', 'admin'
)

OGC_SERVER_DEFAULT_PASSWORD = os.getenv(
GEOSERVER_ADMIN_PASSWORD = os.getenv(
'GEOSERVER_ADMIN_PASSWORD', 'geoserver'
)

Expand All @@ -126,8 +126,8 @@ OGC_SERVER = {
# the proxy won't work and the integration tests will fail
# the entire block has to be overridden in the local_settings
'PUBLIC_LOCATION': GEOSERVER_PUBLIC_LOCATION,
'USER': OGC_SERVER_DEFAULT_USER,
'PASSWORD': OGC_SERVER_DEFAULT_PASSWORD,
'USER': GEOSERVER_ADMIN_USER,
'PASSWORD': GEOSERVER_ADMIN_PASSWORD,
'MAPFISH_PRINT_ENABLED': True,
'PRINT_NG_ENABLED': True,
'GEONODE_SECURITY_ENABLED': True,
Expand Down
8 changes: 4 additions & 4 deletions geonode/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -997,11 +997,11 @@
'GEOSERVER_WEB_UI_LOCATION', GEOSERVER_PUBLIC_LOCATION
)

OGC_SERVER_DEFAULT_USER = os.getenv(
GEOSERVER_ADMIN_USER = os.getenv(
'GEOSERVER_ADMIN_USER', 'admin'
)

OGC_SERVER_DEFAULT_PASSWORD = os.getenv(
GEOSERVER_ADMIN_PASSWORD = os.getenv(
'GEOSERVER_ADMIN_PASSWORD', 'geoserver'
)

Expand All @@ -1021,8 +1021,8 @@
# the proxy won't work and the integration tests will fail
# the entire block has to be overridden in the local_settings
'PUBLIC_LOCATION': GEOSERVER_PUBLIC_LOCATION,
'USER': OGC_SERVER_DEFAULT_USER,
'PASSWORD': OGC_SERVER_DEFAULT_PASSWORD,
'USER': GEOSERVER_ADMIN_USER,
'PASSWORD': GEOSERVER_ADMIN_PASSWORD,
'MAPFISH_PRINT_ENABLED': ast.literal_eval(os.getenv('MAPFISH_PRINT_ENABLED', 'True')),
'PRINT_NG_ENABLED': ast.literal_eval(os.getenv('PRINT_NG_ENABLED', 'True')),
'GEONODE_SECURITY_ENABLED': ast.literal_eval(os.getenv('GEONODE_SECURITY_ENABLED', 'True')),
Expand Down
8 changes: 4 additions & 4 deletions geonode/upload/tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@
'GEOSERVER_PUBLIC_LOCATION', _default_public_location
)

OGC_SERVER_DEFAULT_USER = os.getenv(
GEOSERVER_ADMIN_USER = os.getenv(
'GEOSERVER_ADMIN_USER', 'admin'
)

OGC_SERVER_DEFAULT_PASSWORD = os.getenv(
GEOSERVER_ADMIN_PASSWORD = os.getenv(
'GEOSERVER_ADMIN_PASSWORD', 'geoserver'
)

Expand All @@ -137,8 +137,8 @@
# the proxy won't work and the integration tests will fail
# the entire block has to be overridden in the local_settings
'PUBLIC_LOCATION': GEOSERVER_PUBLIC_LOCATION,
'USER': OGC_SERVER_DEFAULT_USER,
'PASSWORD': OGC_SERVER_DEFAULT_PASSWORD,
'USER': GEOSERVER_ADMIN_USER,
'PASSWORD': GEOSERVER_ADMIN_PASSWORD,
'MAPFISH_PRINT_ENABLED': True,
'PRINT_NG_ENABLED': True,
'GEONODE_SECURITY_ENABLED': True,
Expand Down
8 changes: 4 additions & 4 deletions package/support/geonode.local_settings
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ GEOSERVER_PUBLIC_LOCATION = os.getenv(
'GEOSERVER_PUBLIC_LOCATION', '{}gs/'.format(SITEURL)
)

OGC_SERVER_DEFAULT_USER = os.getenv(
GEOSERVER_ADMIN_USER = os.getenv(
'GEOSERVER_ADMIN_USER', 'admin'
)

OGC_SERVER_DEFAULT_PASSWORD = os.getenv(
GEOSERVER_ADMIN_PASSWORD = os.getenv(
'GEOSERVER_ADMIN_PASSWORD', 'geoserver'
)

Expand All @@ -117,8 +117,8 @@ OGC_SERVER = {
# the proxy won't work and the integration tests will fail
# the entire block has to be overridden in the local_settings
'PUBLIC_LOCATION': GEOSERVER_PUBLIC_LOCATION,
'USER': OGC_SERVER_DEFAULT_USER,
'PASSWORD': OGC_SERVER_DEFAULT_PASSWORD,
'USER': GEOSERVER_ADMIN_USER,
'PASSWORD': GEOSERVER_ADMIN_PASSWORD,
'MAPFISH_PRINT_ENABLED': True,
'PRINT_NG_ENABLED': True,
'GEONODE_SECURITY_ENABLED': True,
Expand Down
19 changes: 11 additions & 8 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ def waitfordbs(ctx):

@task
def waitforgeoserver(ctx):
print("****************************geoserver********************************")
while not _rest_api_availability(f"{os.environ['GEOSERVER_LOCATION']}rest"):
print("Wait for GeoServer API availability...")
print("GeoServer is available for HTTP calls!")
_waitforgeoserver()


@task
Expand Down Expand Up @@ -251,6 +248,7 @@ def collectstatic(ctx):

@task
def geoserverfixture(ctx):
_waitforgeoserver()
print("********************geoserver fixture********************************")
_geoserver_info_provision(f"{os.environ['GEOSERVER_LOCATION']}rest/")

Expand Down Expand Up @@ -398,14 +396,13 @@ def _geonode_public_port():
return gn_pub_port


def _geoserver_info_provision(url):
from django.conf import settings
def _geoserver_info_provision(url):
from geoserver.catalog import Catalog
print("Setting GeoServer Admin Password...")
cat = Catalog(
url,
username=settings.OGC_SERVER_DEFAULT_USER,
password=settings.OGC_SERVER_DEFAULT_PASSWORD
username="admin",
password="geoserver"
)
headers = {
"Content-type": "application/xml",
Expand Down Expand Up @@ -596,3 +593,9 @@ def _prepare_admin_fixture(admin_password, admin_email):
]
with open('/tmp/django_admin_docker.json', 'w') as fixturefile:
json.dump(default_fixture, fixturefile)

def _waitforgeoserver():
print("****************************geoserver********************************")
while not _rest_api_availability(f"{os.environ['GEOSERVER_LOCATION']}rest"):
print("Wait for GeoServer API availability...")
print("GeoServer is available for HTTP calls!")