diff --git a/Dockerfile b/Dockerfile index 1fb68b2..c98c9d7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,52 +1,32 @@ -FROM geonode/geonode-base:latest-ubuntu-24.04 -LABEL GeoNode development team +FROM geonode/geonode-base:latest-ubuntu-26.04 -RUN mkdir -p /usr/src/geonode_demo - -RUN apt-get update -y && apt-get install curl wget unzip gnupg2 locales -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 - -# add bower and grunt command -COPY src /usr/src/geonode_demo/ +ENV LC_ALL=C.UTF-8 \ + LANG=C.UTF-8 WORKDIR /usr/src/geonode_demo -#COPY src/monitoring-cron /etc/cron.d/monitoring-cron -#RUN chmod 0644 /etc/cron.d/monitoring-cron -#RUN crontab /etc/cron.d/monitoring-cron -#RUN touch /var/log/cron.log -#RUN service cron start +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/geonode_demo/tasks.py \ - && chmod +x /usr/src/geonode_demo/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 - -# Install "geonode-contribs" apps -# RUN cd /usr/src; git clone https://github.com/GeoNode/geonode-contribs.git -b master -# Install logstash and centralized dashboard dependencies -# RUN cd /usr/src/geonode-contribs/geonode-logstash; pip install --upgrade -e . \ -# cd /usr/src/geonode-contribs/ldap; pip install --upgrade -e . +RUN chmod +x /usr/bin/wait-for-databases /usr/bin/celery-commands /usr/bin/celery-cmd -RUN yes w | pip install --src /usr/src -r requirements.txt &&\ - yes w | pip install -e . +COPY src/ /usr/src/geonode_demo/ +RUN chmod +x /usr/src/geonode_demo/tasks.py /usr/src/geonode_demo/entrypoint.sh -# Cleanup apt update lists -RUN apt-get autoremove --purge &&\ - apt-get clean &&\ - rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir -e . -# Export ports EXPOSE 8000 - -# We provide no command or entrypoint as this image can be used to serve the django project or run celery tasks -# ENTRYPOINT /usr/src/geonode_demo/entrypoint.sh diff --git a/docker-compose.yml b/docker-compose.yml index ed2fbf5..5c089aa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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} @@ -15,6 +14,8 @@ x-common-django: depends_on: db: condition: service_healthy + redis: + condition: service_healthy services: @@ -26,7 +27,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 @@ -47,9 +48,15 @@ services: - IS_CELERY=True entrypoint: ["/usr/src/geonode_demo/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: image: ${COMPOSE_PROJECT_NAME}/nginx:${NGINX_BASE_IMAGE_VERSION} build: context: ./docker/nginx @@ -58,7 +65,7 @@ services: - BASE_IMAGE_VERSION=${NGINX_BASE_IMAGE_VERSION} container_name: nginx4${COMPOSE_PROJECT_NAME} env_file: - - .env + - .env${ENVIRONMENT:+_}${ENVIRONMENT:-} environment: - RESOLVER=127.0.0.11 ports: @@ -69,19 +76,12 @@ services: - nginx-certificates:/geonode-certificates - statics:/mnt/volumes/statics restart: unless-stopped - - # memcached service - memcached: - image: memcached:alpine - container_name: memcached4${COMPOSE_PROJECT_NAME} - command: memcached ${MEMCACHED_OPTIONS} - restart: on-failure healthcheck: - test: nc -z 127.0.0.1 11211 - interval: 30s - timeout: 30s - retries: 5 - start_period: 30s + 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 # Gets and installs letsencrypt certificates letsencrypt: @@ -97,6 +97,9 @@ services: volumes: - nginx-certificates:/geonode-certificates restart: unless-stopped + depends_on: + nginx: + condition: service_healthy # Geoserver backend geoserver: @@ -108,11 +111,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: @@ -125,25 +128,9 @@ services: - tmp:/tmp restart: unless-stopped depends_on: - data-dir-conf: - condition: service_healthy django: condition: service_healthy - data-dir-conf: - image: ${COMPOSE_PROJECT_NAME}/geoserver_data:${GEOSERVER_DATA_BASE_IMAGE_VERSION} - build: - context: ./docker/geoserver_data - dockerfile: Dockerfile - args: - - BASE_IMAGE_VERSION=${GEOSERVER_DATA_BASE_IMAGE_VERSION} - container_name: gsconf4${COMPOSE_PROJECT_NAME} - entrypoint: sleep infinity - volumes: - - geoserver-data-dir:/geoserver_data/data - restart: unless-stopped - healthcheck: - test: "ls -A '/geoserver_data/data' | wc -l" # PostGIS database. db: @@ -162,18 +149,27 @@ 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 RabbitMQ service. This is needed by celery + # Vanilla Redis service. This is needed by celery redis: image: redis:7-alpine container_name: redis4${COMPOSE_PROJECT_NAME} volumes: - redisdata:/data restart: unless-stopped + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 20s + timeout: 3s + retries: 3 + start_period: 5s volumes: statics: diff --git a/src/pyproject.toml b/src/pyproject.toml new file mode 100644 index 0000000..fb04212 --- /dev/null +++ b/src/pyproject.toml @@ -0,0 +1,30 @@ +[build-system] +requires = ["setuptools>=61.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "geonode_project" +version = "5.dev" +description = "GeoNode Project" +readme = "README.md" +requires-python = ">=3.10" +license = { text = "GPL-3.0-or-later" } +keywords = ["project", "geonode", "django"] + +dependencies = [ + "GeoNode @ https://github.com/GeoNode/geonode/archive/refs/heads/master.zip" +] + +[project.urls] +Homepage = "https://github.com/GeoNode/geonode-project" + +[tool.setuptools] +include-package-data = true + +# Correct package discovery layout +[tool.setuptools.packages.find] +where = ["."] +exclude = ["tests*"] + +[tool.setuptools.package-data] +"*" = ["**/thesauri/*.rdf"] \ No newline at end of file diff --git a/src/requirements.txt b/src/requirements.txt deleted file mode 100644 index 3cce082..0000000 --- a/src/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -git+https://github.com/GeoNode/geonode.git@master#egg=GeoNode -