Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,6 @@ OAUTH2_CLIENT_SECRET={clientsecret}
API_LOCKDOWN=False
TASTYPIE_APIKEY=

# #################
# Production and
# Monitoring
# #################
DEBUG={debug}

SECRET_KEY='{secret_key}'
Expand Down
8 changes: 0 additions & 8 deletions src/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,7 @@ echo GEODATABASE_URL=$GEODATABASE_URL
echo SITEURL=$SITEURL
echo ALLOWED_HOSTS=$ALLOWED_HOSTS
echo GEOSERVER_PUBLIC_LOCATION=$GEOSERVER_PUBLIC_LOCATION
echo MONITORING_ENABLED=$MONITORING_ENABLED
echo MONITORING_HOST_NAME=$MONITORING_HOST_NAME
echo MONITORING_SERVICE_NAME=$MONITORING_SERVICE_NAME
echo MONITORING_DATA_TTL=$MONITORING_DATA_TTL

# invoke waitfordbs

cmd="$@"

if [ ${IS_CELERY} = "true" ] || [ ${IS_CELERY} = "True" ]
then
Expand All @@ -54,7 +47,6 @@ else

if [ ${FORCE_REINIT} = "true" ] || [ ${FORCE_REINIT} = "True" ] || [ ! -e "/mnt/volumes/statics/geonode_init.lock" ]; then
invoke fixtures
invoke monitoringfixture
invoke initialized
invoke updateadmin
fi
Expand Down
167 changes: 0 additions & 167 deletions src/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,6 @@ def update(ctx):
"static_root": os.environ.get("STATIC_ROOT", "/mnt/volumes/statics/static/"),
"media_root": os.environ.get("MEDIA_ROOT", "/mnt/volumes/statics/uploaded/"),
"geoip_path": os.environ.get("GEOIP_PATH", "/mnt/volumes/statics/geoip.db"),
"monitoring": os.environ.get("MONITORING_ENABLED", False),
"monitoring_host_name": os.environ.get("MONITORING_HOST_NAME", "geonode"),
"monitoring_service_name": os.environ.get(
"MONITORING_SERVICE_NAME", "local-geonode"
),
"monitoring_data_ttl": os.environ.get("MONITORING_DATA_TTL", 7),
"geonode_geodb_passwd": os.environ.get(
"GEONODE_GEODATABASE_PASSWORD", "geonode_data"
),
Expand Down Expand Up @@ -137,41 +131,6 @@ def update(ctx):
),
pty=True,
)
ctx.run(
"echo export MONITORING_ENABLED=\
{monitoring} >> {override_fn}".format(
**envs
),
pty=True,
)
ctx.run(
"echo export MONITORING_HOST_NAME=\
{monitoring_host_name} >> {override_fn}".format(
**envs
),
pty=True,
)
ctx.run(
"echo export MONITORING_SERVICE_NAME=\
{monitoring_service_name} >> {override_fn}".format(
**envs
),
pty=True,
)
ctx.run(
"echo export MONITORING_DATA_TTL=\
{monitoring_data_ttl} >> {override_fn}".format(
**envs
),
pty=True,
)
ctx.run(
"echo export GEOIP_PATH=\
{geoip_path} >> {override_fn}".format(
**envs
),
pty=True,
)
ctx.run(
"echo export GEONODE_GEODATABASE_PASSWORD=\
{geonode_geodb_passwd} >> {override_fn}".format(
Expand Down Expand Up @@ -427,39 +386,6 @@ def collectstatic(ctx):
)


@task
def monitoringfixture(ctx):
if ast.literal_eval(os.environ.get("MONITORING_ENABLED", "False")):
print("*******************monitoring fixture********************************")
ctx.run("rm -rf /tmp/default_monitoring_apps_docker.json", pty=True)
_prepare_monitoring_fixture()
try:
ctx.run(
f"django-admin loaddata metric_data.json \
--settings={_localsettings()}",
pty=True,
)
ctx.run(
f"django-admin loaddata notifications.json \
--settings={_localsettings()}",
pty=True,
)
ctx.run(
f"django-admin loaddata /tmp/default_monitoring_apps_docker.json \
--settings={_localsettings()}",
pty=True,
)
except Exception as e:
logger.error(f"ERROR installing monitoring fixture: {str(e)}")


@task
def updategeoip(ctx):
print("**************************update geoip*******************************")
if ast.literal_eval(os.environ.get("MONITORING_ENABLED", "False")):
ctx.run(f"django-admin updategeoip --settings={_localsettings()}", pty=True)


@task
def updateadmin(ctx):
print("***********************update admin details**************************")
Expand Down Expand Up @@ -660,99 +586,6 @@ def _prepare_site_fixture():
json.dump(default_fixture, fixturefile)


def _prepare_monitoring_fixture():
# upurl = urlparse(os.environ['SITEURL'])
# net_scheme = upurl.scheme
# net_loc = upurl.netloc
pub_ip = _geonode_public_host()
print(f"Public Hostname or IP is {pub_ip}")
pub_port = _geonode_public_port()
print(f"Public PORT is {pub_port}")
try:
geonode_ip = socket.gethostbyname("geonode")
except Exception:
geonode_ip = pub_ip
try:
geoserver_ip = socket.gethostbyname("geoserver")
except Exception:
geoserver_ip = pub_ip
d = "1970-01-01 00:00:00"
default_fixture = [
{
"fields": {
"active": True,
"ip": str(geonode_ip),
"name": str(os.environ["MONITORING_HOST_NAME"]),
},
"model": "monitoring.host",
"pk": 1,
},
{
"fields": {"active": True, "ip": str(geoserver_ip), "name": "geoserver"},
"model": "monitoring.host",
"pk": 2,
},
{
"fields": {
"name": str(os.environ["MONITORING_SERVICE_NAME"]),
"url": str(os.environ["SITEURL"]),
"notes": "",
"last_check": d,
"active": True,
"host": 1,
"check_interval": "00:01:00",
"service_type": 1,
},
"model": "monitoring.service",
"pk": 1,
},
{
"fields": {
"name": "geoserver-hostgeonode",
"url": str(os.environ["SITEURL"]),
"notes": "",
"last_check": d,
"active": True,
"host": 1,
"check_interval": "00:01:00",
"service_type": 3,
},
"model": "monitoring.service",
"pk": 2,
},
{
"fields": {
"name": "geoserver-hostgeoserver",
"url": str(os.environ["GEOSERVER_PUBLIC_LOCATION"]),
"notes": "",
"last_check": d,
"active": True,
"host": 2,
"check_interval": "00:01:00",
"service_type": 4,
},
"model": "monitoring.service",
"pk": 3,
},
{
"fields": {
"name": "default-geoserver",
"url": "http://geoserver:8080/geoserver/",
"notes": "",
"last_check": d,
"active": True,
"host": 2,
"check_interval": "00:01:00",
"service_type": 2,
},
"model": "monitoring.service",
"pk": 4,
},
]
with open("/tmp/default_monitoring_apps_docker.json", "w") as fixturefile:
json.dump(default_fixture, fixturefile)


def _prepare_admin_fixture(admin_password, admin_email):
from django.contrib.auth.hashers import make_password

Expand Down
Loading