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
7 changes: 3 additions & 4 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ LOCKDOWN_GEONODE=False
X_FRAME_OPTIONS="SAMEORIGIN"
SESSION_ENGINE=django.contrib.sessions.backends.cached_db
SESSION_EXPIRED_CONTROL_ENABLED=True
DEFAULT_ANONYMOUS_VIEW_PERMISSION=True
DEFAULT_ANONYMOUS_DOWNLOAD_PERMISSION=True
DEFAULT_ANONYMOUS_PERMISSIONS=download

CORS_ALLOW_ALL_ORIGINS=True
GEOSERVER_CORS_ENABLED=True
Expand All @@ -147,11 +146,11 @@ GEOSERVER_CORS_ALLOWED_HEADERS=*

# Users Registration
ACCOUNT_OPEN_SIGNUP=True
ACCOUNT_EMAIL_REQUIRED=True
ACCOUNT_SIGNUP_FIELDS="['email*', 'username*', 'password1*', 'password2*']"
ACCOUNT_APPROVAL_REQUIRED=False
ACCOUNT_CONFIRM_EMAIL_ON_GET=False
ACCOUNT_EMAIL_VERIFICATION=none
ACCOUNT_AUTHENTICATION_METHOD=username_email
ACCOUNT_LOGIN_METHODS="{'email', 'username'}"
AUTO_ASSIGN_REGISTERED_MEMBERS_TO_REGISTERED_MEMBERS_GROUP_NAME=True

# OAuth2
Expand Down
47 changes: 20 additions & 27 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,32 @@
FROM geonode/geonode-base:latest-ubuntu-24.04
RUN mkdir -p /usr/src/project

RUN apt-get update -y && apt-get install curl wget unzip gnupg2 locales netcat-openbsd -y

RUN sed -i -e 's/# C.UTF-8 UTF-8/C.UTF-8 UTF-8/' /etc/locale.gen && \
locale-gen
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8

ENV LC_ALL=C.UTF-8 \
LANG=C.UTF-8
WORKDIR /usr/src/project

COPY src/tasks.py \
src/entrypoint.sh \
src/requirements.txt \
/usr/src/project/
RUN apt-get update -y && apt-get install -y --no-install-recommends \
curl \
wget \
unzip \
gnupg2 \
locales \
netcat-openbsd \
&& sed -i -e 's/# C.UTF-8 UTF-8/C.UTF-8 UTF-8/' /etc/locale.gen \
&& locale-gen \
&& apt-get autoremove --purge -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN python -m pip install --no-cache-dir -U pip setuptools wheel

COPY src/wait-for-databases.sh /usr/bin/wait-for-databases
RUN chmod +x /usr/bin/wait-for-databases
RUN chmod +x /usr/src/project/tasks.py \
&& chmod +x /usr/src/project/entrypoint.sh

COPY src/celery.sh /usr/bin/celery-commands
RUN chmod +x /usr/bin/celery-commands

COPY src/celery-cmd /usr/bin/celery-cmd
RUN chmod +x /usr/bin/celery-cmd

RUN python -m pip install -U pip setuptools wheel
RUN yes w | pip install --src /usr/src -r requirements.txt

RUN apt-get autoremove --purge &&\
apt-get clean &&\
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/bin/wait-for-databases /usr/bin/celery-commands /usr/bin/celery-cmd

COPY src/ /usr/src/project/
RUN yes w | pip install -e .
RUN chmod +x /usr/src/project/tasks.py /usr/src/project/entrypoint.sh

RUN pip install --no-cache-dir -e .

EXPOSE 8000
67 changes: 47 additions & 20 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Common Django template for GeoNode and Celery services below
x-common-django:
&default-common-django
image: ${COMPOSE_PROJECT_NAME}/geonode:${GEONODE_BASE_IMAGE_VERSION}
Expand All @@ -15,6 +14,10 @@ x-common-django:
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
memcached:
condition: service_healthy

services:

Expand All @@ -26,7 +29,7 @@ services:
dockerfile: Dockerfile
container_name: django4${COMPOSE_PROJECT_NAME}
healthcheck:
test: "curl -m 10 --fail --silent --write-out 'HTTP CODE : %{http_code}\n' --output /dev/null http://django:8000/"
test: "curl -m 10 --fail --silent --output /dev/null http://django:8000/"
start_period: 60s
interval: 60s
timeout: 10s
Expand All @@ -40,16 +43,19 @@ services:
celery:
<< : *default-common-django
container_name: celery4${COMPOSE_PROJECT_NAME}
depends_on:
django:
condition: service_healthy
environment:
- IS_CELERY=True
entrypoint: ["/usr/src/project/entrypoint.sh"]
command: "celery-cmd"
healthcheck:
test: "celery -b ${BROKER_URL} inspect ping"
start_period: 30s
interval: 30s
timeout: 10s
retries: 2

# Nginx is serving django static and media files and proxies to django and geonode
geonode:
# Nginx serving django static/media and proxies to django/geonode
nginx:
image: ${COMPOSE_PROJECT_NAME}/nginx:${NGINX_BASE_IMAGE_VERSION}
build:
context: ./docker/nginx
Expand All @@ -69,6 +75,12 @@ services:
- nginx-certificates:/geonode-certificates
- statics:/mnt/volumes/statics
restart: unless-stopped
healthcheck:
test: "if ps -o pid | grep -w 1 > /dev/null; then echo 'nginx running'; else exit 1;fi"
interval: 10s
timeout: 5s
retries: 3
start_period: 10s

# memcached service
memcached:
Expand All @@ -77,11 +89,11 @@ services:
command: memcached ${MEMCACHED_OPTIONS}
restart: unless-stopped
healthcheck:
test: nc -z 127.0.0.1 11211
test: ["CMD", "nc", "-z", "127.0.0.1", "11211"]
interval: 30s
timeout: 30s
retries: 5
start_period: 30s
timeout: 5s
retries: 3
start_period: 10s

# Gets and installs letsencrypt certificates
letsencrypt:
Expand All @@ -97,6 +109,9 @@ services:
volumes:
- nginx-certificates:/geonode-certificates
restart: unless-stopped
depends_on:
nginx:
condition: service_healthy

# Geoserver backend
geoserver:
Expand All @@ -108,11 +123,11 @@ services:
- BASE_IMAGE_VERSION=${GEOSERVER_BASE_IMAGE_VERSION}
container_name: geoserver4${COMPOSE_PROJECT_NAME}
healthcheck:
test: "curl -m 10 --fail --silent --write-out 'HTTP CODE : %{http_code}\n' --output /dev/null http://geoserver:8080/geoserver/ows"
start_period: 60s
interval: 60s
test: ["CMD", "curl", "-f", "http://geoserver:8080/geoserver/web/wicket/resource/org.geoserver.web.GeoServerBasePage/img/logo.png"]
start_period: 30s
interval: 30s
timeout: 10s
retries: 2
retries: 3
env_file:
- .env
ports:
Expand Down Expand Up @@ -143,7 +158,10 @@ services:
- geoserver-data-dir:/geoserver_data/data
restart: unless-stopped
healthcheck:
test: "ls -A '/geoserver_data/data' | wc -l"
test: ["CMD-SHELL", "[ $$(ls -A /geoserver_data/data | wc -l) -gt 0 ] || exit 1"]
interval: 10s
timeout: 5s
retries: 3

# PostGIS database.
db:
Expand All @@ -162,10 +180,13 @@ services:
- dbbackups:/pg_backups
restart: unless-stopped
healthcheck:
test: "pg_isready -d postgres -U postgres"
# uncomment to enable remote connections to postgres
#ports:
# - "5432:5432"
test: ["CMD-SHELL", "pg_isready -d postgres -U postgres"]
interval: 10s
timeout: 5s
retries: 5
# uncomment to enable remote connections to postgres
#ports:
# - "5432:5432"

# Vanilla Redis service. This is needed by celery
redis:
Expand All @@ -174,6 +195,12 @@ services:
volumes:
- redisdata:/data
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 20s
timeout: 3s
retries: 3
start_period: 5s

volumes:
statics:
Expand Down
11 changes: 0 additions & 11 deletions src/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,6 @@ invoke update
source $HOME/.bashrc
source $HOME/.override_env

echo DOCKER_API_VERSION=$DOCKER_API_VERSION
echo POSTGRES_USER=$POSTGRES_USER
echo POSTGRES_PASSWORD=$POSTGRES_PASSWORD
echo DATABASE_URL=$DATABASE_URL
echo GEODATABASE_URL=$GEODATABASE_URL
echo SITEURL=$SITEURL
echo ALLOWED_HOSTS=$ALLOWED_HOSTS
echo GEOSERVER_PUBLIC_LOCATION=$GEOSERVER_PUBLIC_LOCATION

# invoke waitfordbs

cmd="$@"

if [ ${IS_CELERY} = "true" ] || [ ${IS_CELERY} = "True" ]
Expand Down
6 changes: 3 additions & 3 deletions src/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ requires-python = ">=3.10"
license = { text = "GPL-3.0-or-later" }
keywords = ["project", "geonode", "django"]

# Equivalent modern replacement for dependency_links:
dependencies = [
"GeoNode @ git+https://github.com/GeoNode/geonode.git"
"GeoNode @ git+https://github.com/GeoNode/geonode.git@master"
]

[project.urls]
Expand All @@ -22,6 +21,7 @@ Homepage = "https://github.com/GeoNode/geonode-project"
[tool.setuptools]
include-package-data = true

# Correct package discovery layout
[tool.setuptools.packages.find]
# Equivalent to find_packages()
where = ["."]
exclude = ["tests*"]
4 changes: 0 additions & 4 deletions src/requirements.txt

This file was deleted.

Loading
Loading