From ef238993a8f2defcaa1488c7940433353d706765 Mon Sep 17 00:00:00 2001 From: "G. Allegri" Date: Wed, 25 Oct 2023 15:13:02 +0200 Subject: [PATCH] upgrade demo project --- .env.sample | 33 ++- .gitignore | 5 +- .override_dev_env.sample | 23 +- Dockerfile | 23 +- README.md | 20 +- create-envfile.py | 2 +- docker-build.sh | 0 docker-compose.yml | 44 +++- docker-purge.sh | 0 docker/geoserver/Dockerfile | 65 +---- docker/geoserver/README.md | 128 --------- docker/geoserver/docker-compose.yml | 53 ---- docker/geoserver/entrypoint.sh | 249 ------------------ docker/geoserver/multidump-alt.sh | 16 -- docker/geoserver/multidump.sh | 18 -- docker/geoserver/set_geoserver_auth.sh | 85 ------ docker/geoserver/tasks.py | 83 ------ .../geofence-datasource-ovr.properties.j2 | 12 - docker/geoserver_data/Dockerfile | 2 + docker/letsencrypt/Dockerfile | 20 +- docker/letsencrypt/README.md | 15 -- docker/letsencrypt/crontab | 8 - docker/letsencrypt/docker-entrypoint.sh | 52 ---- docker/nginx/50x.html | 1 - docker/nginx/Dockerfile | 20 +- docker/nginx/docker-autoreload.sh | 37 --- docker/nginx/docker-entrypoint.sh | 67 ----- docker/nginx/geonode.conf.envsubst | 134 ---------- docker/nginx/nginx.conf.envsubst | 39 --- .../nginx/nginx.https.available.conf.envsubst | 37 --- docker/postgresql/Dockerfile | 2 + geonode-stack.yml | 8 +- playbook.yml | 4 +- src/README.md | 2 +- src/celery-cmd | 2 +- src/entrypoint.sh | 6 +- .../__init__.py | 6 +- src/{geonode_master => geonode_demo}/apps.py | 4 +- .../br/backup.sh | 10 +- .../br/restore.sh | 12 +- .../br/settings_docker.ini | 4 +- .../celeryapp.py | 6 +- .../locale/.gitkeep | 0 .../settings.py | 6 +- .../static/README | 0 .../static/css/site_base.css | 0 .../static/gulpfile.js | 0 .../static/img/README | 0 .../static/img/bing_aerial_w_labels.png | Bin .../static/img/bing_canvas_dark.png | Bin .../static/img/bing_road_on_demand.png | Bin .../static/js/README | 0 .../static/less/site_base.less | 0 .../static/package.json | 4 +- .../_geonode_config.html | 0 src/{geonode_master => geonode_demo}/urls.py | 0 .../version.py | 0 src/{geonode_master => geonode_demo}/wsgi.py | 4 +- src/manage.py | 2 +- src/manage.sh | 2 +- src/monitoring-cron | 4 +- src/pavement.py | 8 +- src/paver.sh | 0 src/setup.py | 8 +- src/tasks.py | 32 ++- src/uwsgi.ini | 8 +- src/wait-for-databases.sh | 0 67 files changed, 181 insertions(+), 1254 deletions(-) mode change 100755 => 100644 create-envfile.py mode change 100755 => 100644 docker-build.sh mode change 100755 => 100644 docker-purge.sh delete mode 100644 docker/geoserver/README.md delete mode 100644 docker/geoserver/docker-compose.yml delete mode 100644 docker/geoserver/entrypoint.sh delete mode 100644 docker/geoserver/multidump-alt.sh delete mode 100644 docker/geoserver/multidump.sh delete mode 100644 docker/geoserver/set_geoserver_auth.sh delete mode 100644 docker/geoserver/tasks.py delete mode 100644 docker/geoserver/templates/geofence/geofence-datasource-ovr.properties.j2 create mode 100644 docker/geoserver_data/Dockerfile delete mode 100644 docker/letsencrypt/README.md delete mode 100644 docker/letsencrypt/crontab delete mode 100644 docker/letsencrypt/docker-entrypoint.sh delete mode 100644 docker/nginx/50x.html delete mode 100644 docker/nginx/docker-autoreload.sh delete mode 100644 docker/nginx/docker-entrypoint.sh delete mode 100644 docker/nginx/geonode.conf.envsubst delete mode 100644 docker/nginx/nginx.conf.envsubst delete mode 100644 docker/nginx/nginx.https.available.conf.envsubst create mode 100644 docker/postgresql/Dockerfile mode change 100755 => 100644 src/celery-cmd mode change 100755 => 100644 src/entrypoint.sh rename src/{geonode_master => geonode_demo}/__init__.py (86%) rename src/{geonode_master => geonode_demo}/apps.py (96%) rename src/{geonode_master => geonode_demo}/br/backup.sh (75%) mode change 100755 => 100644 rename src/{geonode_master => geonode_demo}/br/restore.sh (88%) mode change 100755 => 100644 rename src/{geonode_master => geonode_demo}/br/settings_docker.ini (78%) rename src/{geonode_master => geonode_demo}/celeryapp.py (86%) rename src/{geonode_master => geonode_demo}/locale/.gitkeep (100%) rename src/{geonode_master => geonode_demo}/settings.py (97%) rename src/{geonode_master => geonode_demo}/static/README (100%) rename src/{geonode_master => geonode_demo}/static/css/site_base.css (100%) rename src/{geonode_master => geonode_demo}/static/gulpfile.js (100%) rename src/{geonode_master => geonode_demo}/static/img/README (100%) rename src/{geonode_master => geonode_demo}/static/img/bing_aerial_w_labels.png (100%) rename src/{geonode_master => geonode_demo}/static/img/bing_canvas_dark.png (100%) rename src/{geonode_master => geonode_demo}/static/img/bing_road_on_demand.png (100%) rename src/{geonode_master => geonode_demo}/static/js/README (100%) rename src/{geonode_master => geonode_demo}/static/less/site_base.less (100%) rename src/{geonode_master => geonode_demo}/static/package.json (80%) rename src/{geonode_master => geonode_demo}/templates/geonode-mapstore-client/_geonode_config.html (100%) rename src/{geonode_master => geonode_demo}/urls.py (100%) rename src/{geonode_master => geonode_demo}/version.py (100%) rename src/{geonode_master => geonode_demo}/wsgi.py (94%) mode change 100755 => 100644 src/manage.py mode change 100755 => 100644 src/manage.sh mode change 100755 => 100644 src/paver.sh mode change 100755 => 100644 src/wait-for-databases.sh diff --git a/.env.sample b/.env.sample index 96cd4c0..77fdd3f 100644 --- a/.env.sample +++ b/.env.sample @@ -1,4 +1,4 @@ -COMPOSE_PROJECT_NAME=geonode_master +COMPOSE_PROJECT_NAME=geonode_demo # See https://github.com/containers/podman/issues/13889 # DOCKER_BUILDKIT=0 DOCKER_ENV=production @@ -7,6 +7,13 @@ DOCKER_ENV=production DOCKER_API_VERSION="1.24" BACKUPS_VOLUME_DRIVER=local +GEONODE_BASE_IMAGE_VERSION=latest +NGINX_BASE_IMAGE_VERSION=latest +LETSENCRYPT_BASE_IMAGE_VERSION=latest +GEOSERVER_BASE_IMAGE_VERSION=latest +GEOSERVER_DATA_BASE_IMAGE_VERSION=latest +POSTGRES_BASE_IMAGE_VERSION=latest + C_FORCE_ROOT=1 FORCE_REINIT=false INVOKE_LOG_STDOUT=true @@ -14,7 +21,7 @@ INVOKE_LOG_STDOUT=true # LANGUAGE_CODE=it-it # LANGUAGES=(('en-us','English'),('it-it','Italiano')) -DJANGO_SETTINGS_MODULE=geonode_master.settings +DJANGO_SETTINGS_MODULE=geonode_demo.settings GEONODE_INSTANCE_NAME=geonode # ################# @@ -22,18 +29,18 @@ GEONODE_INSTANCE_NAME=geonode # ################# POSTGRES_USER=postgres POSTGRES_PASSWORD={pgpwd} -GEONODE_DATABASE=geonode_master -GEONODE_DATABASE_USER=geonode_master +GEONODE_DATABASE=geonode_demo +GEONODE_DATABASE_USER=geonode_demo GEONODE_DATABASE_PASSWORD={dbpwd} -GEONODE_GEODATABASE=geonode_master_data -GEONODE_GEODATABASE_USER=geonode_master_data +GEONODE_GEODATABASE=geonode_demo_data +GEONODE_GEODATABASE_USER=geonode_demo_data GEONODE_GEODATABASE_PASSWORD={geodbpwd} GEONODE_DATABASE_SCHEMA=public GEONODE_GEODATABASE_SCHEMA=public DATABASE_HOST=db DATABASE_PORT=5432 -DATABASE_URL=postgis://geonode_master:{dbpwd}@db:5432/geonode_master -GEODATABASE_URL=postgis://geonode_master_data:{geodbpwd}@db:5432/geonode_master_data +DATABASE_URL=postgis://geonode_demo:{dbpwd}@db:5432/geonode_demo +GEODATABASE_URL=postgis://geonode_demo_data:{geodbpwd}@db:5432/geonode_demo_data GEONODE_DB_CONN_MAX_AGE=0 GEONODE_DB_CONN_TOUT=5 DEFAULT_BACKEND_DATASTORE=datastore @@ -177,9 +184,13 @@ CACHE_BUSTING_STATIC_ENABLED=False MEMCACHED_ENABLED=False MEMCACHED_BACKEND=django.core.cache.backends.memcached.MemcachedCache -MEMCACHED_LOCATION=127.0.0.1:11211 +MEMCACHED_LOCATION=memcached:11211 MEMCACHED_LOCK_EXPIRE=3600 MEMCACHED_LOCK_TIMEOUT=10 +# +# Options for memcached binary, e.g. -vvv to log all requests and cache hits +# +MEMCACHED_OPTIONS= MAX_DOCUMENT_SIZE=200 CLIENT_RESULTS_LIMIT=5 @@ -226,9 +237,9 @@ LDAP_GROUP_PROFILE_MEMBER_ATTR=uniqueMember # expressed in KB # CELERY__MAX_MEMORY_PER_CHILD="200000" -# ## +# ## # Note right autoscale value must coincide with worker concurrency value -# CELERY__AUTOSCALE_VALUES="15,10" +# CELERY__AUTOSCALE_VALUES="15,10" # CELERY__WORKER_CONCURRENCY="10" # ## # CELERY__OPTS="--without-gossip --without-mingle -Ofair -B -E" diff --git a/.gitignore b/.gitignore index d473a1b..4137f8f 100644 --- a/.gitignore +++ b/.gitignore @@ -67,5 +67,6 @@ local_settings.py .idea/ .vscode/ - -.env +.vagrant/ +Vagrantfile +/.env diff --git a/.override_dev_env.sample b/.override_dev_env.sample index e703ab9..a9747ac 100644 --- a/.override_dev_env.sample +++ b/.override_dev_env.sample @@ -6,14 +6,14 @@ export SITEURL=http://localhost:8000/ export ALLOWED_HOSTS="['localhost',]" export GEONODE_INSTANCE_NAME=geonode -export DJANGO_SETTINGS_MODULE=geonode_master.settings -export GEONODE_DATABASE=geonode_master +export DJANGO_SETTINGS_MODULE=geonode_demo.settings +export GEONODE_DATABASE=geonode_demo export GEONODE_DATABASE_PASSWORD=geonode -export GEONODE_GEODATABASE=geonode_master_data +export GEONODE_GEODATABASE=geonode_demo_data export GEONODE_GEODATABASE_PASSWORD=geonode -export DATABASE_URL=postgis://geonode_master:geonode@localhost:5432/geonode_master -export GEODATABASE_URL=postgis://geonode_master_data:geonode@localhost:5432/geonode_master_data +export DATABASE_URL=postgis://geonode_demo:geonode@localhost:5432/geonode_demo +export GEODATABASE_URL=postgis://geonode_demo_data:geonode@localhost:5432/geonode_demo_data export DEFAULT_BACKEND_DATASTORE=datastore export GEOSERVER_WEB_UI_LOCATION=http://localhost:8080/geoserver/ @@ -46,12 +46,17 @@ export DJANGO_EMAIL_USE_SSL=False export DEFAULT_FROM_EMAIL="GeoNode " export LOCKDOWN_GEONODE=False -export CORS_ORIGIN_ALLOW_ALL=True export X_FRAME_OPTIONS=SAMEORIGIN export SESSION_EXPIRED_CONTROL_ENABLED=True export DEFAULT_ANONYMOUS_VIEW_PERMISSION=True export DEFAULT_ANONYMOUS_DOWNLOAD_PERMISSION=True +export CORS_ALLOW_ALL_ORIGINS=True +export GEOSERVER_CORS_ENABLED=True +export GEOSERVER_CORS_ALLOWED_ORIGINS=* +export GEOSERVER_CORS_ALLOWED_METHODS=GET,POST,PUT,DELETE,HEAD,OPTIONS +export GEOSERVER_CORS_ALLOWED_HEADERS=* + export ACCOUNT_OPEN_SIGNUP=True export ACCOUNT_EMAIL_REQUIRED=True export ACCOUNT_APPROVAL_REQUIRED=False @@ -69,7 +74,6 @@ export API_LOCKDOWN=False export TASTYPIE_APIKEY= export CACHE_BUSTING_STATIC_ENABLED=False -export CACHE_BUSTING_MEDIA_ENABLED=False export MAX_DOCUMENT_SIZE=2 export CLIENT_RESULTS_LIMIT=5 @@ -80,7 +84,7 @@ export MAPBOX_ACCESS_TOKEN= export BING_API_KEY= export GOOGLE_API_KEY= -export MONITORING_ENABLED=True +export MONITORING_ENABLED=False export MONITORING_DATA_TTL=365 export USER_ANALYTICS_ENABLED=True export USER_ANALYTICS_GZIP=True @@ -94,3 +98,6 @@ export AVATAR_PROVIDERS='avatar.providers.PrimaryAvatarProvider','avatar.provide export EXIF_ENABLED=True export CREATE_LAYER=True export FAVORITE_ENABLED=True + +export DEFAULT_MAX_UPLOAD_SIZE=5368709120 +export DEFAULT_MAX_PARALLEL_UPLOADS_PER_USER=5 diff --git a/Dockerfile b/Dockerfile index 633503e..52a6967 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,18 @@ FROM geonode/geonode-base:latest-ubuntu-22.04 LABEL GeoNode development team -RUN mkdir -p /usr/src/geonode_master +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_master/ -WORKDIR /usr/src/geonode_master +COPY src /usr/src/geonode_demo/ +WORKDIR /usr/src/geonode_demo #COPY src/monitoring-cron /etc/cron.d/monitoring-cron #RUN chmod 0644 /etc/cron.d/monitoring-cron @@ -15,8 +22,8 @@ WORKDIR /usr/src/geonode_master 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_master/tasks.py \ - && chmod +x /usr/src/geonode_master/entrypoint.sh +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 @@ -24,9 +31,9 @@ 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 +# 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 +# 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 . @@ -42,4 +49,4 @@ RUN apt-get autoremove --purge &&\ 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_master/entrypoint.sh +# ENTRYPOINT /usr/src/geonode_demo/entrypoint.sh diff --git a/README.md b/README.md index bc74a50..82ada07 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Geonode_Master +# Geonode_Demo GeoNode template project. Generates a django project with GeoNode support. @@ -19,7 +19,7 @@ GeoNode template project. Generates a django project with GeoNode support. ```bash python3.10 -m venv ~/.venvs/project_name - source ~/.venvs/geonode_master/bin/activate + source ~/.venvs/geonode_demo/bin/activate pip install Django==3.2.* @@ -67,7 +67,7 @@ Available at ## Create a custom project -**NOTE**: *You can call your geonode project whatever you like **except 'geonode'**. Follow the naming conventions for python packages (generally lower case with underscores (``_``). In the examples below, replace ``geonode_master`` with whatever you would like to name your project.* +**NOTE**: *You can call your geonode project whatever you like **except 'geonode'**. Follow the naming conventions for python packages (generally lower case with underscores (``_``). In the examples below, replace ``geonode_demo`` with whatever you would like to name your project.* To setup your project follow these instructions: @@ -76,12 +76,12 @@ To setup your project follow these instructions: ```bash git clone https://github.com/GeoNode/geonode-project.git -b source /usr/share/virtualenvwrapper/virtualenvwrapper.sh - mkvirtualenv --python=/usr/bin/python3 geonode_master + mkvirtualenv --python=/usr/bin/python3 geonode_demo pip install Django==3.2.16 - django-admin startproject --template=./geonode-project -e py,sh,md,rst,json,yml,ini,env,sample,properties -n monitoring-cron -n Dockerfile geonode_master + django-admin startproject --template=./geonode-project -e py,sh,md,rst,json,yml,ini,env,sample,properties -n monitoring-cron -n Dockerfile geonode_demo - cd geonode_master + cd geonode_demo ``` 2. Create the .env file @@ -249,7 +249,7 @@ docker system prune -a ### Run a Backup ```bash -SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./geonode_master/br/backup.sh $BKP_FOLDER_NAME +SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./geonode_demo/br/backup.sh $BKP_FOLDER_NAME ``` - BKP_FOLDER_NAME: @@ -266,13 +266,13 @@ SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./geonode_master/br/backup.sh $BKP e.g.: ```bash -docker exec -it django4geonode_master sh -c 'SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./geonode_master/br/backup.sh $BKP_FOLDER_NAME' +docker exec -it django4geonode_demo sh -c 'SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./geonode_demo/br/backup.sh $BKP_FOLDER_NAME' ``` ### Run a Restore ```bash -SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./geonode_master/br/restore.sh $BKP_FOLDER_NAME +SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./geonode_demo/br/restore.sh $BKP_FOLDER_NAME ``` - BKP_FOLDER_NAME: @@ -289,7 +289,7 @@ SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./geonode_master/br/restore.sh $BK e.g.: ```bash -docker exec -it django4geonode_master sh -c 'SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./geonode_master/br/restore.sh $BKP_FOLDER_NAME' +docker exec -it django4geonode_demo sh -c 'SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./geonode_demo/br/restore.sh $BKP_FOLDER_NAME' ``` ## Recommended: Track your changes diff --git a/create-envfile.py b/create-envfile.py old mode 100755 new mode 100644 index e061201..ad7dcf4 --- a/create-envfile.py +++ b/create-envfile.py @@ -141,7 +141,7 @@ def _get_vals_to_replace(args): prog="ENV file builder", description="Tool for generate environment file automatically. The information can be passed or via CLI or via JSON file ( --file /path/env.json)", usage="python create-envfile.py localhost -f /path/to/json/file.json", - allow_abbrev=False + allow_abbrev=False, ) parser.add_argument( "--noinput", diff --git a/docker-build.sh b/docker-build.sh old mode 100755 new mode 100644 diff --git a/docker-compose.yml b/docker-compose.yml index 1ade196..39d7602 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ x-common-django: env_file: - .env volumes: - # - './src:/usr/src/geonode_master' + # - './src:/usr/src/geonode_demo' - statics:/mnt/volumes/statics - geoserver-data-dir:/geoserver_data/data - backup-restore:/backup_restore @@ -35,8 +35,8 @@ services: retries: 2 environment: - IS_CELERY=False - entrypoint: ["/usr/src/geonode_master/entrypoint.sh"] - command: "uwsgi --ini /usr/src/geonode_master/uwsgi.ini" + entrypoint: ["/usr/src/geonode_demo/entrypoint.sh"] + command: "uwsgi --ini /usr/src/geonode_demo/uwsgi.ini" # Celery worker that executes celery tasks created by Django. celery: @@ -48,13 +48,16 @@ services: condition: service_healthy environment: - IS_CELERY=True - entrypoint: ["/usr/src/geonode_master/entrypoint.sh"] + entrypoint: ["/usr/src/geonode_demo/entrypoint.sh"] command: "celery-cmd" # Nginx is serving django static and media files and proxies to django and geonode geonode: - image: geonode/nginx:1.25.2 - build: ./docker/nginx/ + build: + context: ./docker/nginx + dockerfile: Dockerfile + args: + - BASE_IMAGE_VERSION=${NGINX_BASE_IMAGE_VERSION} container_name: nginx4${COMPOSE_PROJECT_NAME} env_file: - .env @@ -69,6 +72,7 @@ services: - statics:/mnt/volumes/statics restart: unless-stopped + # memcached service memcached: image: memcached:alpine container_name: memcached4${COMPOSE_PROJECT_NAME} @@ -83,8 +87,11 @@ services: # Gets and installs letsencrypt certificates letsencrypt: - image: geonode/letsencrypt:latest - build: ./docker/letsencrypt/ + build: + context: ./docker/letsencrypt + dockerfile: Dockerfile + args: + - BASE_IMAGE_VERSION=${LETSENCRYPT_BASE_IMAGE_VERSION} container_name: letsencrypt4${COMPOSE_PROJECT_NAME} env_file: - .env @@ -94,8 +101,11 @@ services: # Geoserver backend geoserver: - image: geonode/geoserver:2.23.0 - build: ./docker/geoserver/ + build: + context: ./docker/geoserver + dockerfile: Dockerfile + args: + - 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" @@ -121,7 +131,11 @@ services: condition: service_healthy data-dir-conf: - image: geonode/geoserver_data:2.23.0 + 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: @@ -132,8 +146,12 @@ services: # PostGIS database. db: - # use geonode official postgis 13 image - image: geonode/postgis:15 + # use geonode official postgis 15 image + build: + context: ./docker/postgresql + dockerfile: Dockerfile + args: + - BASE_IMAGE_VERSION=${POSTGRES_BASE_IMAGE_VERSION} command: postgres -c "max_connections=${POSTGRESQL_MAX_CONNECTIONS}" container_name: db4${COMPOSE_PROJECT_NAME} env_file: diff --git a/docker-purge.sh b/docker-purge.sh old mode 100755 new mode 100644 diff --git a/docker/geoserver/Dockerfile b/docker/geoserver/Dockerfile index f1451c3..ea638a8 100644 --- a/docker/geoserver/Dockerfile +++ b/docker/geoserver/Dockerfile @@ -1,63 +1,2 @@ -ARG IMAGE_VERSION=9.0-jdk11-openjdk-slim-bullseye -ARG JAVA_HOME=/usr/local/openjdk-11 -FROM tomcat:$IMAGE_VERSION -LABEL GeoNode Development Team - -ARG GEOSERVER_CORS_ENABLED=False -ARG GEOSERVER_CORS_ALLOWED_ORIGINS=* -ARG GEOSERVER_CORS_ALLOWED_METHODS=GET,POST,PUT,DELETE,HEAD,OPTIONS -ARG GEOSERVER_CORS_ALLOWED_HEADERS=* -# -# Set GeoServer version and data directory -# -ENV GEOSERVER_VERSION=2.23.0 -ENV GEOSERVER_DATA_DIR="/geoserver_data/data" -ENV GEOSERVER_CORS_ENABLED=$GEOSERVER_CORS_ENABLED -ENV GEOSERVER_CORS_ALLOWED_ORIGINS=$GEOSERVER_CORS_ALLOWED_ORIGINS -ENV GEOSERVER_CORS_ALLOWED_METHODS=$GEOSERVER_CORS_ALLOWED_METHODS -ENV GEOSERVER_CORS_ALLOWED_HEADERS=$GEOSERVER_CORS_ALLOWED_HEADERS -# -# Download and install GeoServer -# -RUN apt-get update -y && apt-get install curl wget unzip -y -RUN cd /usr/local/tomcat/webapps \ - && wget --no-check-certificate --progress=bar:force:noscroll https://artifacts.geonode.org/geoserver/${GEOSERVER_VERSION}/geoserver.war -O geoserver.war \ - && unzip -q geoserver.war -d geoserver \ - && rm geoserver.war \ - && mkdir -p $GEOSERVER_DATA_DIR - -VOLUME $GEOSERVER_DATA_DIR - -# added by simonelanucara https://github.com/simonelanucara -# Optionally add JAI, ImageIO and Marlin Render for improved Geoserver performance -WORKDIR /tmp - -RUN wget --no-check-certificate https://repo1.maven.org/maven2/org/postgis/postgis-jdbc/1.3.3/postgis-jdbc-1.3.3.jar -O postgis-jdbc-1.3.3.jar && \ - wget --no-check-certificate https://maven.geo-solutions.it/org/hibernatespatial/hibernate-spatial-postgis/1.1.3.2/hibernate-spatial-postgis-1.1.3.2.jar -O hibernate-spatial-postgis-1.1.3.2.jar && \ - rm /usr/local/tomcat/webapps/geoserver/WEB-INF/lib/hibernate-spatial-h2-geodb-1.1.3.2.jar && \ - mv hibernate-spatial-postgis-1.1.3.2.jar /usr/local/tomcat/webapps/geoserver/WEB-INF/lib/ && \ - mv postgis-jdbc-1.3.3.jar /usr/local/tomcat/webapps/geoserver/WEB-INF/lib/ - - -# copy the script and perform the run of scripts from entrypoint.sh -RUN mkdir -p /usr/local/tomcat/tmp -WORKDIR /usr/local/tomcat/tmp -COPY set_geoserver_auth.sh /usr/local/tomcat/tmp -COPY entrypoint.sh /usr/local/tomcat/tmp -COPY tasks.py /usr/local/tomcat/tmp -COPY ./templates /templates -COPY multidump.sh /usr/local/tomcat/tmp -COPY multidump-alt.sh /usr/local/tomcat/tmp - -RUN chmod +x /usr/local/tomcat/tmp/set_geoserver_auth.sh \ - && chmod +x /usr/local/tomcat/tmp/entrypoint.sh - -RUN apt-get update \ - && apt-get install -y procps less \ - && apt-get install -y python3 python3-pip python3-dev - -RUN pip install j2cli invoke==2.2.0 requests==2.31.0 - -ENV JAVA_OPTS="-Djava.awt.headless=true -Dgwc.context.suffix=gwc -XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:LogFile=/var/log/jvm.log -XX:MaxPermSize=512m -XX:PermSize=256m -Xms512m -Xmx2048m -XX:+UseConcMarkSweepGC -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 -DGS-SHAPEFILE-CHARSET=UTF-8 -DGEOSERVER_CSRF_DISABLED=true -DPRINT_BASE_URL=http://geoserver:8080/geoserver/pdf -Xbootclasspath/a:/usr/local/tomcat/webapps/geoserver/WEB-INF/lib/marlin-0.9.3.jar -Dsun.java2d.renderer=org.marlin.pisces.MarlinRenderingEngine" - -CMD ["/usr/local/tomcat/tmp/entrypoint.sh"] +ARG BASE_IMAGE_VERSION +FROM geonode/geoserver:${BASE_IMAGE_VERSION} \ No newline at end of file diff --git a/docker/geoserver/README.md b/docker/geoserver/README.md deleted file mode 100644 index 352ccb2..0000000 --- a/docker/geoserver/README.md +++ /dev/null @@ -1,128 +0,0 @@ -# geoserver-docker - -[GeoServer](http://geoserver.org) is an open source server for sharing geospatial data. -This is a docker image that eases setting up a GeoServer running specifically for [GeoNode](https://github.com/GeoNode/geoserver-geonode-ext) with an additional separated data directory. - -The image is based on the official Tomcat 9 image - -## Installation - -This image is available as a [trusted build on the docker hub](https://registry.hub.docker.com/r/geonode/geoserver/), and is the recommended method of installation. -Simple pull the image from the docker hub. - -```bash -$ docker pull geonode/geoserver -``` - -Alternatively you can build the image locally - -```bash -$ git clone https://github.com/geonode/geoserver-docker.git -$ cd geoserver-docker -$ docker build -t "geonode/geoserver" . -``` - -## Quick start - -You can quick start the image using the command line - -```bash -$ docker run --name "geoserver" -v /var/run/docker.sock:/var/run/docker.sock -d -p 8080:8080 geonode/geoserver -``` - -Point your browser to `http://localhost:8080/geoserver` and login using GeoServer's default username and password: - -* Username: admin -* Password: geoserver - -## How to use different versions - -There are mainly two different versions of this image which are useful for running **GeoNode** with different authentication system types. These versions are released as specific tags for two authentication mechanisms: - -**Cookie based authn**: -- [geonode/geoserver:2.9.x](https://hub.docker.com/r/geonode/geoserver/builds/bx7ydhghnlrfnsppduyva73/) - -**Oauth2 based authn**: -- [geonode/geoserver:2.9.x-oauth2](https://hub.docker.com/r/geonode/geoserver/builds/bwca5rtexeoegzgroavftdr/) -- [geonode/geoserver:2.10.x](https://hub.docker.com/r/geonode/geoserver/builds/bjohcnc29vm69acqjrvndxf/) -- [geonode/geoserver:2.12.x](https://hub.docker.com/r/geonode/geoserver/builds/bh7pyw5atmkcljurwsnzbs7/) -- [geonode/geoserver:2.13.x](https://hub.docker.com/r/geonode/geoserver/builds/btmjctbuvrjfnnrxrs4wyrs/) -- [geonode/geoserver:2.14.x](https://hub.docker.com/r/geonode/geoserver/builds/bj53pi8he8uksz6ggvrs3wc/) - -You can declare what version to use along with the data directory tag which corresponds to the same version. - -## Configuration - -### Data volume - -This GeoServer container keeps its configuration data at `/geoserver_data/data` which is exposed as volume in the dockerfile. -The volume allows for stopping and starting new containers from the same image without losing all the data and custom configuration. - -You may want to map this volume to a directory on the host. It will also ease the upgrade process in the future. Volumes can be mounted by passing the `-v` flag to the docker run command: - -```bash --v /your/host/data/path:/geoserver_data/data -``` - -### Data volume container - -In case you are running Compose for automatically having GeoServer up and running then a data volume container will be mounted with a default preloaded *GEOSERVER_DATA_DIR* at the configuration data directory of the container. -Make sure that the image from the repository [data-docker](https://github.com/GeoNode/data-docker) is available from the [GeoNode Docker Hub](https://hub.docker.com/u/geonode/) or has been built locally: - -```bash -docker build -t geonode/geoserver_data . -``` - -#### Persistance behavior - -If you run: - -```bash -docker-compose stop -``` - -Data are retained in the *GEOSERVER_DATA_DIR* and can then be mounted in a new GeoServer instance by running again: - -```bash -docker-compose up -``` - -If you run: - -```bash -docker-compose down -``` - -Data are completely gone but you can ever start from the base GeoServer Data Directory built for Geonode. - -#### Data directory versions - -There has to be a correspondence one-to-one between the data directory version and the tag of the GeoServer image used in the Docker compose file. So at the end you can consume these images below: - -* **2.9.x**: [geonode/geoserver_data:2.9.x](https://hub.docker.com/r/geonode/geoserver_data/builds/bsus6alnddg4bc7icwymevp/) -* **2.9.x-oauth2**: [geonode/geoserver_data:2.9.x-oauth2](https://hub.docker.com/r/geonode/geoserver_data/builds/bwkxcupsunvuitzusi9gsnt/) -* **2.10.x**: [geonode/geoserver_data:2.10.x](https://hub.docker.com/r/geonode/geoserver_data/builds/b5jqhpzapkqxzyevjizccug/) -* **2.12.x**: [geonode/geoserver_data:2.12.x](https://hub.docker.com/r/geonode/geoserver_data/builds/byaaalw3lnasunpveyg3x4i/) -* **2.13.x**: [geonode/geoserver_data:2.13.x](https://hub.docker.com/r/geonode/geoserver_data/builds/bunuqzq7a7dk65iumjhkbtc/) -* **2.14.x**: [geonode/geoserver_data:2.14.x](https://hub.docker.com/r/geonode/geoserver_data/builds/blpdjzkrv7pm3stunzpn4pp/) - -### Database - -GeoServer recommends the usage of a spatial database - -#### PostGIS container (PostgreSQL + GIS Extension) - -If you want to use a [PostGIS](http://postgis.org/) container, you can link it to this image. You're free to use any PostGIS container. -An example with [kartooza/postgis](https://registry.hub.docker.com/u/kartoza/postgis/) image: - -```bash -$ docker run -d --name="postgis" kartoza/postgis -``` - -For further information see [kartooza/postgis](https://registry.hub.docker.com/u/kartoza/postgis/). - -Now start the GeoServer instance by adding the `--link` option to the docker run command: - -```bash ---link postgis:postgis -``` diff --git a/docker/geoserver/docker-compose.yml b/docker/geoserver/docker-compose.yml deleted file mode 100644 index d14b500..0000000 --- a/docker/geoserver/docker-compose.yml +++ /dev/null @@ -1,53 +0,0 @@ -version: '3.9' - -services: - - postgis: - image: geonode/postgis:13 - ports: - - "25432:5432" - volumes: - - /srv/docker/geoserver/postgis:/var/lib/postgresql - #volumes_from: - #- pgstore - healthcheck: - test: "pg_isready -d postgres -U postgres" - restart: on-failure - - geoserver: - image: geonode/geoserver:2.23.0 - build: - context: . - links: - - postgis - ports: - - "8080:8080" - volumes: - - /geoserver_data/data - environment: - - NGINX_BASE_URL=http://localhost - depends_on: - postgis: - condition: service_completed_successfully - data-dir-conf: - condition: service_healthy - healthcheck: - test: curl --fail -s http://localhost:8080/geoserver/rest/workspaces/geonode.html || exit 1 - interval: 1m30s - timeout: 10s - retries: 3 - restart: on-failure - - data-dir-conf: - image: geonode/geoserver_data:2.23.0 - container_name: geoserver_data_dir # named data container - entrypoint: sleep infinity - volumes: - - /geoserver_data/data - healthcheck: - test: "ls -A '/geoserver_data/data' | wc -l" - restart: on-failure - -volumes: - # reference to the named data container that holds the preloaded geoserver data directory - geoserver_data_dir: diff --git a/docker/geoserver/entrypoint.sh b/docker/geoserver/entrypoint.sh deleted file mode 100644 index 5c5052f..0000000 --- a/docker/geoserver/entrypoint.sh +++ /dev/null @@ -1,249 +0,0 @@ -#!/bin/bash -set -e - -source /root/.bashrc - - -INVOKE_LOG_STDOUT=${INVOKE_LOG_STDOUT:-TRUE} -invoke () { - if [ $INVOKE_LOG_STDOUT = 'true' ] || [ $INVOKE_LOG_STDOUT = 'True' ] - then - /usr/local/bin/invoke $@ - else - /usr/local/bin/invoke $@ > /usr/src/geonode/invoke.log 2>&1 - fi - echo "$@ tasks done" -} - -# control the values of LB settings if present -if [ -n "$GEONODE_LB_HOST_IP" ]; -then - echo "GEONODE_LB_HOST_IP is defined and not empty with the value '$GEONODE_LB_HOST_IP' " - echo export GEONODE_LB_HOST_IP=${GEONODE_LB_HOST_IP} >> /root/.override_env -else - echo "GEONODE_LB_HOST_IP is either not defined or empty setting the value to 'django' " - echo export GEONODE_LB_HOST_IP=django >> /root/.override_env - export GEONODE_LB_HOST_IP=django -fi - -if [ -n "$GEONODE_LB_PORT" ]; -then - echo "GEONODE_LB_HOST_IP is defined and not empty with the value '$GEONODE_LB_PORT' " - echo export GEONODE_LB_PORT=${GEONODE_LB_PORT} >> /root/.override_env -else - echo "GEONODE_LB_PORT is either not defined or empty setting the value to '8000' " - echo export GEONODE_LB_PORT=8000 >> /root/.override_env - export GEONODE_LB_PORT=8000 -fi - -if [ -n "$GEOSERVER_LB_HOST_IP" ]; -then - echo "GEOSERVER_LB_HOST_IP is defined and not empty with the value '$GEOSERVER_LB_HOST_IP' " - echo export GEOSERVER_LB_HOST_IP=${GEOSERVER_LB_HOST_IP} >> /root/.override_env -else - echo "GEOSERVER_LB_HOST_IP is either not defined or empty setting the value to 'geoserver' " - echo export GEOSERVER_LB_HOST_IP=geoserver >> /root/.override_env - export GEOSERVER_LB_HOST_IP=geoserver -fi - -if [ -n "$GEOSERVER_LB_PORT" ]; -then - echo "GEOSERVER_LB_PORT is defined and not empty with the value '$GEOSERVER_LB_PORT' " - echo export GEOSERVER_LB_PORT=${GEOSERVER_LB_PORT} >> /root/.override_env -else - echo "GEOSERVER_LB_PORT is either not defined or empty setting the value to '8000' " - echo export GEOSERVER_LB_PORT=8080 >> /root/.override_env - export GEOSERVER_LB_PORT=8080 -fi - -# If DATABASE_HOST is not set in the environment, use the default value -if [ -n "$DATABASE_HOST" ]; -then - echo "DATABASE_HOST is defined and not empty with the value '$DATABASE_HOST' " - echo export DATABASE_HOST=${DATABASE_HOST} >> /root/.override_env -else - echo "DATABASE_HOST is either not defined or empty setting the value to 'db' " - echo export DATABASE_HOST=db >> /root/.override_env - export DATABASE_HOST=db -fi - -# If DATABASE_PORT is not set in the environment, use the default value -if [ -n "$DATABASE_PORT" ]; -then - echo "DATABASE_PORT is defined and not empty with the value '$DATABASE_PORT' " - echo export DATABASE_HOST=${DATABASE_PORT} >> /root/.override_env -else - echo "DATABASE_PORT is either not defined or empty setting the value to '5432' " - echo export DATABASE_PORT=5432 >> /root/.override_env - export DATABASE_PORT=5432 -fi - -# If GEONODE_GEODATABASE_USER is not set in the environment, use the default value -if [ -n "$GEONODE_GEODATABASE" ]; -then - echo "GEONODE_GEODATABASE is defined and not empty with the value '$GEONODE_GEODATABASE' " - echo export GEONODE_GEODATABASE=${GEONODE_GEODATABASE} >> /root/.override_env -else - echo "GEONODE_GEODATABASE is either not defined or empty setting the value '${COMPOSE_PROJECT_NAME}_data' " - echo export GEONODE_GEODATABASE=${COMPOSE_PROJECT_NAME}_data >> /root/.override_env - export GEONODE_GEODATABASE=${COMPOSE_PROJECT_NAME}_data -fi - -# If GEONODE_GEODATABASE_USER is not set in the environment, use the default value -if [ -n "$GEONODE_GEODATABASE_USER" ]; -then - echo "GEONODE_GEODATABASE_USER is defined and not empty with the value '$GEONODE_GEODATABASE_USER' " - echo export GEONODE_GEODATABASE_USER=${GEONODE_GEODATABASE_USER} >> /root/.override_env -else - echo "GEONODE_GEODATABASE_USER is either not defined or empty setting the value '$GEONODE_GEODATABASE' " - echo export GEONODE_GEODATABASE_USER=${GEONODE_GEODATABASE} >> /root/.override_env - export GEONODE_GEODATABASE_USER=${GEONODE_GEODATABASE} -fi - -# If GEONODE_GEODATABASE_USER is not set in the environment, use the default value -if [ -n "$GEONODE_GEODATABASE_PASSWORD" ]; -then - echo "GEONODE_GEODATABASE_PASSWORD is defined and not empty with the value '$GEONODE_GEODATABASE_PASSWORD' " - echo export GEONODE_GEODATABASE_PASSWORD=${GEONODE_GEODATABASE_PASSWORD} >> /root/.override_env -else - echo "GEONODE_GEODATABASE_PASSWORD is either not defined or empty setting the value '${GEONODE_GEODATABASE}' " - echo export GEONODE_GEODATABASE_PASSWORD=${GEONODE_GEODATABASE} >> /root/.override_env - export GEONODE_GEODATABASE_PASSWORD=${GEONODE_GEODATABASE} -fi - -# If GEONODE_GEODATABASE_SCHEMA is not set in the environment, use the default value -if [ -n "$GEONODE_GEODATABASE_SCHEMA" ]; -then - echo "GEONODE_GEODATABASE_SCHEMA is defined and not empty with the value '$GEONODE_GEODATABASE_SCHEMA' " - echo export GEONODE_GEODATABASE_SCHEMA=${GEONODE_GEODATABASE_SCHEMA} >> /root/.override_env -else - echo "GEONODE_GEODATABASE_SCHEMA is either not defined or empty setting the value to 'public'" - echo export GEONODE_GEODATABASE_SCHEMA=public >> /root/.override_env - export GEONODE_GEODATABASE_SCHEMA=public -fi - -if [ ! -z "${GEOSERVER_JAVA_OPTS}" ] -then - echo "GEOSERVER_JAVA_OPTS is filled so I replace the value of '$JAVA_OPTS' with '$GEOSERVER_JAVA_OPTS'" - export JAVA_OPTS=${GEOSERVER_JAVA_OPTS} -fi - -# control the value of NGINX_BASE_URL variable -if [ -z `echo ${NGINX_BASE_URL} | sed 's/http:\/\/\([^:]*\).*/\1/'` ] -then - echo "NGINX_BASE_URL is empty so I'll use the default Geoserver base url" - echo "Setting GEOSERVER_LOCATION='${SITEURL}'" - echo export GEOSERVER_LOCATION=${SITEURL} >> /root/.override_env -else - echo "NGINX_BASE_URL is filled so GEOSERVER_LOCATION='${NGINX_BASE_URL}'" - echo "Setting GEOSERVER_LOCATION='${NGINX_BASE_URL}'" - echo export GEOSERVER_LOCATION=${NGINX_BASE_URL} >> /root/.override_env -fi - -if [ -n "$SUBSTITUTION_URL" ]; -then - echo "SUBSTITUTION_URL is defined and not empty with the value '$SUBSTITUTION_URL'" - echo "Setting GEONODE_LOCATION='${SUBSTITUTION_URL}' " - echo export GEONODE_LOCATION=${SUBSTITUTION_URL} >> /root/.override_env -else - echo "SUBSTITUTION_URL is either not defined or empty so I'll use the default GeoNode location " - echo "Setting GEONODE_LOCATION='http://${GEONODE_LB_HOST_IP}:${GEONODE_LB_PORT}' " - echo export GEONODE_LOCATION=http://${GEONODE_LB_HOST_IP}:${GEONODE_LB_PORT} >> /root/.override_env -fi - -# set basic tagname -TAGNAME=( "baseUrl" "authApiKey" ) - -if ! [ -f ${GEOSERVER_DATA_DIR}/security/auth/geonodeAuthProvider/config.xml ] -then - echo "Configuration file '$GEOSERVER_DATA_DIR'/security/auth/geonodeAuthProvider/config.xml is not available so it is gone to skip " -else - # backup geonodeAuthProvider config.xml - cp ${GEOSERVER_DATA_DIR}/security/auth/geonodeAuthProvider/config.xml ${GEOSERVER_DATA_DIR}/security/auth/geonodeAuthProvider/config.xml.orig - # run the setting script for geonodeAuthProvider - /usr/local/tomcat/tmp/set_geoserver_auth.sh ${GEOSERVER_DATA_DIR}/security/auth/geonodeAuthProvider/config.xml ${GEOSERVER_DATA_DIR}/security/auth/geonodeAuthProvider/ ${TAGNAME[@]} > /dev/null 2>&1 -fi - -# backup geonode REST role service config.xml -cp "${GEOSERVER_DATA_DIR}/security/role/geonode REST role service/config.xml" "${GEOSERVER_DATA_DIR}/security/role/geonode REST role service/config.xml.orig" -# run the setting script for geonode REST role service -/usr/local/tomcat/tmp/set_geoserver_auth.sh "${GEOSERVER_DATA_DIR}/security/role/geonode REST role service/config.xml" "${GEOSERVER_DATA_DIR}/security/role/geonode REST role service/" ${TAGNAME[@]} > /dev/null 2>&1 - -# set oauth2 filter tagname -TAGNAME=( "cliendId" "clientSecret" "accessTokenUri" "userAuthorizationUri" "redirectUri" "checkTokenEndpointUrl" "logoutUri" ) - -# backup geonode-oauth2 config.xml -cp ${GEOSERVER_DATA_DIR}/security/filter/geonode-oauth2/config.xml ${GEOSERVER_DATA_DIR}/security/filter/geonode-oauth2/config.xml.orig -# run the setting script for geonode-oauth2 -/usr/local/tomcat/tmp/set_geoserver_auth.sh ${GEOSERVER_DATA_DIR}/security/filter/geonode-oauth2/config.xml ${GEOSERVER_DATA_DIR}/security/filter/geonode-oauth2/ "${TAGNAME[@]}" > /dev/null 2>&1 - -# set global tagname -TAGNAME=( "proxyBaseUrl" ) - -# backup global.xml -cp ${GEOSERVER_DATA_DIR}/global.xml ${GEOSERVER_DATA_DIR}/global.xml.orig -# run the setting script for global configuration -/usr/local/tomcat/tmp/set_geoserver_auth.sh ${GEOSERVER_DATA_DIR}/global.xml ${GEOSERVER_DATA_DIR}/ ${TAGNAME[@]} > /dev/null 2>&1 - -# set correct amqp broker url -sed -i -e 's/localhost/rabbitmq/g' ${GEOSERVER_DATA_DIR}/notifier/notifier.xml - -# exclude wrong dependencies -sed -i -e 's/xom-\*\.jar/xom-\*\.jar,bcprov\*\.jar/g' /usr/local/tomcat/conf/catalina.properties - -# J2 templating for this docker image we should also do it for other configuration files in /usr/local/tomcat/tmp - -declare -a geoserver_datadir_template_dirs=("geofence") - -for template in in ${geoserver_datadir_template_dirs[*]}; do - #Geofence templates - if [ "$template" == "geofence" ]; then - cp -R /templates/$template/* ${GEOSERVER_DATA_DIR}/geofence - - for f in $(find ${GEOSERVER_DATA_DIR}/geofence/ -type f -name "*.j2"); do - echo -e "Evaluating template\n\tSource: $f\n\tDest: ${f%.j2}" - /usr/local/bin/j2 $f > ${f%.j2} - rm -f $f - done - - fi -done - -# configure CORS (inspired by https://github.com/oscarfonts/docker-geoserver) -# if enabled, this will add the filter definitions -# to the end of the web.xml -# (this will only happen if our filter has not yet been added before) -if [ "${GEOSERVER_CORS_ENABLED}" = "true" ] || [ "${GEOSERVER_CORS_ENABLED}" = "True" ]; then - if ! grep -q DockerGeoServerCorsFilter "$CATALINA_HOME/webapps/geoserver/WEB-INF/web.xml"; then - echo "Enable CORS for $CATALINA_HOME/webapps/geoserver/WEB-INF/web.xml" - sed -i "\::i\\ - \n\ - DockerGeoServerCorsFilter\n\ - org.apache.catalina.filters.CorsFilter\n\ - \n\ - cors.allowed.origins\n\ - ${GEOSERVER_CORS_ALLOWED_ORIGINS}\n\ - \n\ - \n\ - cors.allowed.methods\n\ - ${GEOSERVER_CORS_ALLOWED_METHODS}\n\ - \n\ - \n\ - cors.allowed.headers\n\ - ${GEOSERVER_CORS_ALLOWED_HEADERS}\n\ - \n\ - \n\ - \n\ - DockerGeoServerCorsFilter\n\ - /*\n\ - " "$CATALINA_HOME/webapps/geoserver/WEB-INF/web.xml"; - fi -fi - -if [ ${FORCE_REINIT} = "true" ] || [ ${FORCE_REINIT} = "True" ] || [ ! -e "${GEOSERVER_DATA_DIR}/geoserver_init.lock" ]; then - # Run async configuration, it needs Geoserver to be up and running - nohup sh -c "invoke configure-geoserver" & -fi - -# start tomcat -exec env JAVA_OPTS="${JAVA_OPTS}" catalina.sh run diff --git a/docker/geoserver/multidump-alt.sh b/docker/geoserver/multidump-alt.sh deleted file mode 100644 index cc237e1..0000000 --- a/docker/geoserver/multidump-alt.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -if [ $# -ne 3 ]; then - echo "Usage: $0 pid interval count" - exit 1 -fi - -PID=$1 -INTERVAL=$2 -COUNT=$3 - -top -bH -d $INTERVAL -n $COUNT -p $PID >> top.out 2>&1 & -for i in `seq $COUNT`; do - kill -3 $PID - sleep $INTERVAL -done diff --git a/docker/geoserver/multidump.sh b/docker/geoserver/multidump.sh deleted file mode 100644 index 21dfd2b..0000000 --- a/docker/geoserver/multidump.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -if [ $# -ne 3 ]; then - echo "Usage: $0 pid interval count" - exit 1 -fi - -PID=$1 -INTERVAL=$2 -COUNT=$3 - -top -bH -d $INTERVAL -n $COUNT -p $PID >> top.out 2>&1 & -for i in `seq $COUNT`; do - echo "stack trace $i of $COUNT" >> jstack.out - jstack -l $PID >> jstack.out - echo "--------------------" >> jstack.out - sleep $INTERVAL -done diff --git a/docker/geoserver/set_geoserver_auth.sh b/docker/geoserver/set_geoserver_auth.sh deleted file mode 100644 index 023636d..0000000 --- a/docker/geoserver/set_geoserver_auth.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/bash - -auth_conf_source="$1" -auth_conf_target="$2" -# Creating a temporary file for sed to write the changes to -temp_file="xml.tmp" -touch $temp_file - -source /root/.bashrc -source /root/.override_env - -test -z "$auth_conf_source" && echo "You must specify a source file" && exit 1 -test -z "$auth_conf_target" && echo "You must specify a target conf directory" && exit 1 - -test ! -f "$auth_conf_source" && echo "Source $auth_conf_source does not exist or is not a file" && exit 1 -test ! -d "$auth_conf_target" && echo "Target directory $auth_conf_target does not exist or is not a directory" && exit 1 - -# for debugging -echo -e "OAUTH2_API_KEY=$OAUTH2_API_KEY\n" -echo -e "OAUTH2_CLIENT_ID=$OAUTH2_CLIENT_ID\n" -echo -e "OAUTH2_CLIENT_SECRET=$OAUTH2_CLIENT_SECRET\n" -echo -e "GEOSERVER_LOCATION=$GEOSERVER_LOCATION\n" -echo -e "GEONODE_LOCATION=$GEONODE_LOCATION\n" -echo -e "GEONODE_GEODATABASE=$GEONODE_GEODATABASE\n" -echo -e "GEONODE_GEODATABASE_USER=$GEONODE_GEODATABASE_USER\n" -echo -e "GEONODE_GEODATABASE_PASSWORD=$GEONODE_GEODATABASE_PASSWORD\n" -echo -e "auth_conf_source=$auth_conf_source\n" -echo -e "auth_conf_target=$auth_conf_target\n" - -# Elegance is the key -> adding an empty last line for Mr. “sed” to pick up -echo " " >> "$auth_conf_source" - -cat "$auth_conf_source" - -tagname=( ${@:3:7} ) - -# for debugging -for i in "${tagname[@]}" -do - echo "tagname=<$i>" -done - -echo "DEBUG: Starting... [Ok]\n" - -for i in "${tagname[@]}" -do - echo "DEBUG: Working on '$auth_conf_source' for tagname <$i>" - # Extracting the value from the <$tagname> element - # echo -ne "<$i>$tagvalue" | xmlstarlet sel -t -m "//a" -v . -n - tagvalue=`grep "<$i>.*<.$i>" "$auth_conf_source" | sed -e "s/^.*<$i/<$i/" | cut -f2 -d">"| cut -f1 -d"<"` - - echo "DEBUG: Found the current value for the element <$i> - '$tagvalue'" - - # Setting new substituted value - case $i in - authApiKey) - echo "DEBUG: Editing '$auth_conf_source' for tagname <$i> and replacing its value with '$OAUTH2_API_KEY'" - newvalue=`echo -ne "$tagvalue" | sed -re "s@.*@$OAUTH2_API_KEY@"`;; - cliendId) - echo "DEBUG: Editing '$auth_conf_source' for tagname <$i> and replacing its value with '$OAUTH2_CLIENT_ID'" - newvalue=`echo -ne "$tagvalue" | sed -re "s@.*@$OAUTH2_CLIENT_ID@"`;; - clientSecret) - echo "DEBUG: Editing '$auth_conf_source' for tagname <$i> and replacing its value with '$OAUTH2_CLIENT_SECRET'" - newvalue=`echo -ne "$tagvalue" | sed -re "s@.*@$OAUTH2_CLIENT_SECRET@"`;; - proxyBaseUrl | redirectUri | userAuthorizationUri | logoutUri ) - echo "DEBUG: Editing '$auth_conf_source' for tagname <$i> and replacing its value with '$GEOSERVER_LOCATION'" - newvalue=`echo -ne "$tagvalue" | sed -re "s@^(https?://[^/]+)@${GEOSERVER_LOCATION%/}@"`;; - baseUrl | accessTokenUri | checkTokenEndpointUrl ) - echo "DEBUG: Editing '$auth_conf_source' for tagname <$i> and replacing its value with '$GEONODE_LOCATION'" - newvalue=`echo -ne "$tagvalue" | sed -re "s@^(https?://[^/]+)@${GEONODE_LOCATION%/}@"`;; - *) echo -n "an unknown variable has been found";; - esac - - echo "DEBUG: Found the new value for the element <$i> - '$newvalue'" - # Replacing element’s value with $SUBSTITUTION_URL - # echo -ne "<$i>$tagvalue" | xmlstarlet sel -t -m "//a" -v . -n - sed -e "s@<$i>$tagvalue<\/$i>@<$i>$newvalue<\/$i>@g" "$auth_conf_source" > "$temp_file" - cp "$temp_file" "$auth_conf_source" -done -# Writing our changes back to the original file ($auth_conf_source) -# no longer needed -# mv $temp_file $auth_conf_source - -echo "DEBUG: Finished... [Ok] --- Final xml file is \n" -cat "$auth_conf_source" diff --git a/docker/geoserver/tasks.py b/docker/geoserver/tasks.py deleted file mode 100644 index 5f6f9b3..0000000 --- a/docker/geoserver/tasks.py +++ /dev/null @@ -1,83 +0,0 @@ -# -*- coding: utf-8 -*- -######################################################################### -# -# Copyright (C) 2023 OSGeo -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -######################################################################### -import os -import logging -import time -import base64 -import requests -from pathlib import Path -from invoke import task - -logger = logging.getLogger(__name__) - - -@task -def configure_geoserver(ctx): - _configure_geoserver_password() - _initialized(ctx) - - -def _configure_geoserver_password(): - print( - "************************configuring Geoserver credentials*****************************" - ) - GEOSERVER_LB_PORT = os.getenv("GEOSERVER_LB_PORT", 8080) - GEOSERVER_ADMIN_USER = os.getenv("GEOSERVER_ADMIN_USER", "admin") - GEOSERVER_ADMIN_PASSWORD = os.getenv("GEOSERVER_ADMIN_PASSWORD", "geoserver") - GEOSERVER_FACTORY_PASSWORD = os.getenv("GEOSERVER_FACTORY_PASSWORD", "geoserver") - geoserver_rest_baseurl = f"http://localhost:{GEOSERVER_LB_PORT}/geoserver/rest" - basic_auth_credentials = base64.b64encode( - f"{GEOSERVER_ADMIN_USER}:{GEOSERVER_FACTORY_PASSWORD}".encode() - ).decode() - headers = { - "Content-type": "application/xml", - "Accept": "application/xml", - "Authorization": f"Basic {basic_auth_credentials}", - } - data = f""" - - {GEOSERVER_ADMIN_PASSWORD} - """ - - for _cnt in range(1, 29): - try: - response = requests.put( - f"{geoserver_rest_baseurl}/security/self/password", - data=data, - headers=headers, - ) - print(f"Response Code: {response.status_code}") - if response.status_code == 200: - print("GeoServer admin password updated SUCCESSFULLY!") - else: - logger.warning( - f"WARNING: GeoServer admin password *NOT* updated: code [{response.status_code}]" - ) - break - except Exception: - print(f"...waiting for Geoserver to pop-up...{_cnt}") - time.sleep(2) - - -def _initialized(ctx): - print("**************************init file********************************") - GEOSERVER_DATA_DIR = os.getenv("GEOSERVER_DATA_DIR", "/geoserver_data/data/") - geoserver_init_lock = Path(GEOSERVER_DATA_DIR) / "geoserver_init.lock" - ctx.run(f"date > {geoserver_init_lock}") diff --git a/docker/geoserver/templates/geofence/geofence-datasource-ovr.properties.j2 b/docker/geoserver/templates/geofence/geofence-datasource-ovr.properties.j2 deleted file mode 100644 index 0272932..0000000 --- a/docker/geoserver/templates/geofence/geofence-datasource-ovr.properties.j2 +++ /dev/null @@ -1,12 +0,0 @@ -geofenceVendorAdapter.databasePlatform=org.hibernatespatial.postgis.PostgisDialect -geofenceDataSource.driverClassName=org.postgresql.Driver -geofenceDataSource.url=jdbc:postgresql://{{ DATABASE_HOST }}:{{ DATABASE_PORT }}/{{ GEONODE_GEODATABASE }} -geofenceDataSource.username={{ GEONODE_GEODATABASE_USER }} -geofenceDataSource.password={{ GEONODE_GEODATABASE_PASSWORD }} -geofenceEntityManagerFactory.jpaPropertyMap[hibernate.default_schema]={{ GEONODE_GEODATABASE_SCHEMA }} - -# avoid hibernate transaction issues -geofenceDataSource.testOnBorrow=true -geofenceDataSource.validationQuery=SELECT 1 -geofenceEntityManagerFactory.jpaPropertyMap[hibernate.testOnBorrow]=true -geofenceEntityManagerFactory.jpaPropertyMap[hibernate.validationQuery]=SELECT 1 \ No newline at end of file diff --git a/docker/geoserver_data/Dockerfile b/docker/geoserver_data/Dockerfile new file mode 100644 index 0000000..dced1d8 --- /dev/null +++ b/docker/geoserver_data/Dockerfile @@ -0,0 +1,2 @@ +ARG BASE_IMAGE_VERSION +FROM geonode/geoserver_data:${BASE_IMAGE_VERSION} \ No newline at end of file diff --git a/docker/letsencrypt/Dockerfile b/docker/letsencrypt/Dockerfile index 3d00328..193b269 100644 --- a/docker/letsencrypt/Dockerfile +++ b/docker/letsencrypt/Dockerfile @@ -1,18 +1,2 @@ -FROM alpine:latest - -RUN apk add --no-cache certbot - -# Installing scripts -ADD docker-entrypoint.sh /docker-entrypoint.sh -RUN chmod +x /docker-entrypoint.sh - -# Installing cronjobs -ADD crontab /crontab -RUN /usr/bin/crontab /crontab && \ - rm /crontab - -# Setup the entrypoint -ENTRYPOINT ["./docker-entrypoint.sh"] - -# We run cron in foreground to update the certificates -CMD /usr/sbin/crond -f +ARG BASE_IMAGE_VERSION +FROM geonode/nginx:${BASE_IMAGE_VERSION} \ No newline at end of file diff --git a/docker/letsencrypt/README.md b/docker/letsencrypt/README.md deleted file mode 100644 index ae1bdc0..0000000 --- a/docker/letsencrypt/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Letsencrypt service for Geonode - -This service generates SSL certificates to be used by Nginx. - -## Let's Encrypt - -Upon startup, it generates one SSL certificate from Let's Encrypt using Certbot. It then starts cron (in foreground) to renew the certificates using Certbot renew. - -If for some reason getting the certificate fails, a placeholder certificate is generated. This certificate is invalid, but still allows to encrypt the data and to start the webserver. - -To avoid hitting Let's Encrypt very low rate limits when developping or doing tests, LETSENCRYPT_MODE env var can be set to "disabled" (which will completely bypass Let'sEncrypt, simulating a failure) or to "staging" (using Let'sEncrypt test certificates with higher rates). - -## Autoissued - -An auto-issued certificate is also generate to be used on the LAN if needed. It is also renewed every now and then using the same cron process than above. diff --git a/docker/letsencrypt/crontab b/docker/letsencrypt/crontab deleted file mode 100644 index 5f2c1a8..0000000 --- a/docker/letsencrypt/crontab +++ /dev/null @@ -1,8 +0,0 @@ -# +------------- minute (0 - 59) -# +------------- hour (0 - 23) -# +------------- day of month (1 - 31) -# +------------- month (1 - 12) -# +------------- day of week (0 - 6) (Sunday to Saturday; 7 is also Sunday on some systems) -# - - 0 0,12 * * * date && echo "daily " && /docker-entrypoint.sh diff --git a/docker/letsencrypt/docker-entrypoint.sh b/docker/letsencrypt/docker-entrypoint.sh deleted file mode 100644 index d1c4541..0000000 --- a/docker/letsencrypt/docker-entrypoint.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh - -# Exit script in case of error -set -e - -echo $"\n\n\n" -echo "-----------------------------------------------------" -echo "STARTING LETSENCRYPT ENTRYPOINT ---------------------" -date - -# We make the config dir -mkdir -p "/geonode-certificates/$LETSENCRYPT_MODE" - -# Do not exit script in case of error -set +e - -# We run the command -if [ "$LETSENCRYPT_MODE" == "staging" ]; then - printf "\nTrying to get STAGING certificate\n" - certbot --config-dir "/geonode-certificates/$LETSENCRYPT_MODE" certonly --webroot -w "/geonode-certificates" -d "$HTTPS_HOST" -m "$ADMIN_EMAIL" --agree-tos --non-interactive --test-cert -elif [ "$LETSENCRYPT_MODE" == "production" ]; then - printf "\nTrying to get PRODUCTION certificate\n" - certbot --config-dir "/geonode-certificates/$LETSENCRYPT_MODE" certonly --webroot -w "/geonode-certificates" -d "$HTTPS_HOST" -m "$ADMIN_EMAIL" --agree-tos --non-interactive --server https://acme-v02.api.letsencrypt.org/directory -elif [ "$LETSENCRYPT_MODE" == "disabled" ]; then - printf "\nNot trying to get certificate (because LETSENCRYPT_MODE variable is set to disabled) - and stop container\n" - exit 0 -else - printf "\nNot trying to get certificate (simulating failure, because LETSENCRYPT_MODE variable was neither staging nor production\n" - /bin/false -fi - -# If the certbot comand failed, we will create a placeholder certificate -if [ ! $? -eq 0 ]; then - # Exit script in case of error - set -e - - printf "\nFailed to get the certificates !\n" - - printf "\nWaiting 30s to avoid hitting Letsencrypt rate limits before it's even possible to react\n" - sleep 30 - - exit 1 -fi - -printf "\nCertificate have been created/renewed successfully\n" - -echo "-----------------------------------------------------" -echo "FINISHED LETSENCRYPT ENTRYPOINT ---------------------" -echo "-----------------------------------------------------" - -# Run the CMD -exec "$@" diff --git a/docker/nginx/50x.html b/docker/nginx/50x.html deleted file mode 100644 index b00ebb5..0000000 --- a/docker/nginx/50x.html +++ /dev/null @@ -1 +0,0 @@ -

We're deploying a new version

GeoNode will be back soon, hold on!

\ No newline at end of file diff --git a/docker/nginx/Dockerfile b/docker/nginx/Dockerfile index 86ffc43..193b269 100644 --- a/docker/nginx/Dockerfile +++ b/docker/nginx/Dockerfile @@ -1,18 +1,2 @@ -FROM nginx:1.25.2-alpine - -RUN apk add --no-cache openssl inotify-tools vim - -WORKDIR /etc/nginx/ - -RUN mkdir -p /etc/nginx/html &&\ - touch /etc/nginx/html/index.html - -ADD nginx.conf.envsubst nginx.https.available.conf.envsubst ./ -ADD geonode.conf.envsubst ./sites-enabled/ - -ADD docker-autoreload.sh docker-entrypoint.sh / -ENTRYPOINT ["/docker-entrypoint.sh"] -RUN chmod +x /docker-autoreload.sh -RUN chmod +x /docker-entrypoint.sh - -CMD ["nginx", "-g", "daemon off;"] +ARG BASE_IMAGE_VERSION +FROM geonode/nginx:${BASE_IMAGE_VERSION} \ No newline at end of file diff --git a/docker/nginx/docker-autoreload.sh b/docker/nginx/docker-autoreload.sh deleted file mode 100644 index 812cc76..0000000 --- a/docker/nginx/docker-autoreload.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -# This will watch the /geonode-certificates folder and run nginx -s reload whenever there are some changes. -# We use this to reload nginx config when certificates changed. - -# inspired/copied from https://github.com/kubernetes/kubernetes/blob/master/examples/https-nginx/auto-reload-nginx.sh - -while true -do - inotifywait -e create -e modify -e delete -e move -r --exclude "\\.certbot\\.lock|\\.well-known" "/geonode-certificates/$LETSENCRYPT_MODE" - echo "Changes noticed in /geonode-certificates" - - echo "Waiting 5s for additionnal changes" - sleep 5 - - echo "Creating symbolic link for WAN host" - # for some reason, the ln -f flag doesn't work below... - rm -f /certificate_symlink - if [ -f "/geonode-certificates/$LETSENCRYPT_MODE/live/$HTTPS_HOST/fullchain.pem" ] && [ -f "/geonode-certificates/$LETSENCRYPT_MODE/live/$HTTPS_HOST/privkey.pem" ]; then - echo "Certbot certificate exists, we symlink to the live cert" - ln -sf "/geonode-certificates/$LETSENCRYPT_MODE/live/$HTTPS_HOST" /certificate_symlink - else - echo "Certbot certificate does not exist, we symlink to autoissued" - ln -sf "/geonode-certificates/autoissued" /certificate_symlink - fi - - # Test nginx configuration - nginx -t - # If it passes, we reload - if [ $? -eq 0 ] - then - echo "Configuration valid, we reload..." - nginx -s reload - else - echo "Configuration not valid, we do not reload." - fi -done diff --git a/docker/nginx/docker-entrypoint.sh b/docker/nginx/docker-entrypoint.sh deleted file mode 100644 index e6bec7a..0000000 --- a/docker/nginx/docker-entrypoint.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh - -# Exit script in case of error -set -e - -echo $"\n\n\n" -echo "-----------------------------------------------------" -echo "STARTING NGINX ENTRYPOINT ---------------------------" -date - -# We make the config dir -mkdir -p "/geonode-certificates/$LETSENCRYPT_MODE" - -echo "Creating autoissued certificates for HTTP host" -if [ ! -f "/geonode-certificates/autoissued/privkey.pem" ] || [[ $(find /geonode-certificates/autoissued/privkey.pem -mtime +365 -print) ]]; then - echo "Autoissued certificate does not exist or is too old, we generate one" - mkdir -p "/geonode-certificates/autoissued/" - openssl req -x509 -nodes -days 1825 -newkey rsa:2048 -keyout "/geonode-certificates/autoissued/privkey.pem" -out "/geonode-certificates/autoissued/fullchain.pem" -subj "/CN=${HTTP_HOST:-HTTPS_HOST}" -else - echo "Autoissued certificate already exists" -fi - -echo "Creating symbolic link for HTTPS certificate" -# for some reason, the ln -f flag doesn't work below... -# TODO : not DRY (reuse same scripts as docker-autoreload.sh) -rm -f /certificate_symlink -if [ -f "/geonode-certificates/$LETSENCRYPT_MODE/live/$HTTPS_HOST/fullchain.pem" ] && [ -f "/geonode-certificates/$LETSENCRYPT_MODE/live/$HTTPS_HOST/privkey.pem" ]; then - echo "Certbot certificate exists, we symlink to the live cert" - ln -sf "/geonode-certificates/$LETSENCRYPT_MODE/live/$HTTPS_HOST" /certificate_symlink -else - echo "Certbot certificate does not exist, we symlink to autoissued" - ln -sf "/geonode-certificates/autoissued" /certificate_symlink -fi - -if [ -z "${HTTPS_HOST}" ]; then - HTTP_SCHEME="http" -else - HTTP_SCHEME="https" -fi - -export HTTP_SCHEME=${HTTP_SCHEME:-http} -export GEONODE_LB_HOST_IP=${GEONODE_LB_HOST_IP:-django} -export GEONODE_LB_PORT=${GEONODE_LB_PORT:-8000} -export GEOSERVER_LB_HOST_IP=${GEOSERVER_LB_HOST_IP:-geoserver} -export GEOSERVER_LB_PORT=${GEOSERVER_LB_PORT:-8080} - -echo "Replacing environement variables" -envsubst '\$HTTP_HOST \$HTTPS_HOST \$HTTP_SCHEME \$GEONODE_LB_HOST_IP \$GEONODE_LB_PORT \$GEOSERVER_LB_HOST_IP \$GEOSERVER_LB_PORT \$RESOLVER' < /etc/nginx/nginx.conf.envsubst > /etc/nginx/nginx.conf -envsubst '\$HTTP_HOST \$HTTPS_HOST \$HTTP_SCHEME \$GEONODE_LB_HOST_IP \$GEONODE_LB_PORT \$GEOSERVER_LB_HOST_IP \$GEOSERVER_LB_PORT \$RESOLVER' < /etc/nginx/nginx.https.available.conf.envsubst > /etc/nginx/nginx.https.available.conf -envsubst '\$HTTP_HOST \$HTTPS_HOST \$HTTP_SCHEME \$GEONODE_LB_HOST_IP \$GEONODE_LB_PORT \$GEOSERVER_LB_HOST_IP \$GEOSERVER_LB_PORT' < /etc/nginx/sites-enabled/geonode.conf.envsubst > /etc/nginx/sites-enabled/geonode.conf - -echo "Enabling or not https configuration" -if [ -z "${HTTPS_HOST}" ]; then - echo "" > /etc/nginx/nginx.https.enabled.conf -else - ln -sf /etc/nginx/nginx.https.available.conf /etc/nginx/nginx.https.enabled.conf -fi - -echo "Loading nginx autoreloader" -sh /docker-autoreload.sh & - -echo "-----------------------------------------------------" -echo "FINISHED NGINX ENTRYPOINT ---------------------------" -echo "-----------------------------------------------------" - -# Run the CMD -exec "$@" diff --git a/docker/nginx/geonode.conf.envsubst b/docker/nginx/geonode.conf.envsubst deleted file mode 100644 index 1176ce2..0000000 --- a/docker/nginx/geonode.conf.envsubst +++ /dev/null @@ -1,134 +0,0 @@ -include /etc/nginx/mime.types; - -# This is the main geonode conf -charset utf-8; - -# max upload size -client_max_body_size 100G; -client_body_buffer_size 256K; -client_body_timeout 600s; -large_client_header_buffers 4 64k; - -proxy_connect_timeout 600; -proxy_send_timeout 600; -proxy_read_timeout 600; -uwsgi_read_timeout 600; -send_timeout 600; - -fastcgi_hide_header Set-Cookie; - -etag on; - -# compression -gzip on; -gzip_vary on; -gzip_proxied any; -gzip_http_version 1.1; -gzip_disable "MSIE [1-6]\."; -gzip_buffers 16 8k; -gzip_min_length 1100; -gzip_comp_level 6; -gzip_types - text/css - text/javascript - text/xml - text/plain - application/xml - application/xml+rss - application/javascript - application/x-javascript - application/json; - -# GeoServer -location /geoserver { - # Using a variable is a trick to let Nginx start even if upstream host is not up yet - # (see https://sandro-keil.de/blog/2017/07/24/let-nginx-start-if-upstream-host-is-unavailable-or-down/) - set $upstream $GEOSERVER_LB_HOST_IP:$GEOSERVER_LB_PORT; - - proxy_set_header X-Forwarded-Host $host; - proxy_set_header X-Forwarded-Server $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-Proto $HTTP_SCHEME; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_hide_header X-Frame-Options; - proxy_pass http://$upstream; - proxy_http_version 1.1; - proxy_redirect http://$upstream $HTTP_SCHEME://$HTTP_HOST; - proxy_request_buffering off; - client_max_body_size 0; -} - -# GeoNode -location /static/ { - alias /mnt/volumes/statics/static/; - - location ~* \.(?:html|js|jpg|jpeg|gif|png|css|tgz|gz|rar|bz2|doc|pdf|ppt|tar|wav|bmp|ttf|rtf|swf|ico|flv|txt|woff|woff2|svg|xml)$ { - gzip_static always; - expires 30d; - access_log off; - add_header Pragma "public"; - add_header Cache-Control "max-age=31536000, public"; - } -} - -location /uploaded/ { - alias /mnt/volumes/statics/uploaded/; - - location ~* \.(?:html|js|jpg|jpeg|gif|png|css|tgz|gz|rar|bz2|doc|pdf|ppt|tar|wav|bmp|ttf|rtf|swf|ico|flv|txt|woff|woff2|svg|xml)$ { - gzip_static always; - expires 30d; - access_log off; - add_header Pragma "public"; - add_header Cache-Control "max-age=31536000, public"; - } -} - -location / { - # Using a variable is a trick to let Nginx start even if upstream host is not up yet - # (see https://sandro-keil.de/blog/2017/07/24/let-nginx-start-if-upstream-host-is-unavailable-or-down/) - set $upstream $GEONODE_LB_HOST_IP:$GEONODE_LB_PORT; - - if ($request_method = OPTIONS) { - add_header Access-Control-Allow-Methods "GET, POST, PUT, PATCH, OPTIONS"; - add_header Access-Control-Allow-Headers "Authorization, Content-Type, Accept"; - add_header Access-Control-Allow-Credentials true; - add_header Content-Length 0; - add_header Content-Type text/plain; - add_header Access-Control-Max-Age 1728000; - return 200; - } - - add_header Access-Control-Allow-Credentials false; - add_header Access-Control-Allow-Headers "Content-Type, Accept, Authorization, Origin, User-Agent"; - add_header Access-Control-Allow-Methods "GET, POST, PUT, PATCH, OPTIONS"; - - proxy_redirect off; - proxy_set_header Host $host; - proxy_set_header Origin $HTTP_SCHEME://$host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-Host $server_name; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $HTTP_SCHEME; - proxy_hide_header X-Frame-Options; - proxy_request_buffering off; - - # uwsgi_params - include /etc/nginx/uwsgi_params; - - proxy_pass http://$upstream; - # uwsgi_pass $upstream; - - # when a client closes the connection then keep the channel to uwsgi open. Otherwise uwsgi throws an IOError - uwsgi_ignore_client_abort on; - uwsgi_request_buffering off; - - location ~* \.(?:js|jpg|jpeg|gif|png|tgz|gz|rar|bz2|doc|pdf|ppt|tar|wav|bmp|ttf|rtf|swf|ico|flv|woff|woff2|svg|xml)$ { - gzip_static always; - expires 30d; - access_log off; - add_header Pragma "public"; - add_header Cache-Control "max-age=31536000, public"; - } -} diff --git a/docker/nginx/nginx.conf.envsubst b/docker/nginx/nginx.conf.envsubst deleted file mode 100644 index b606520..0000000 --- a/docker/nginx/nginx.conf.envsubst +++ /dev/null @@ -1,39 +0,0 @@ -# NOTE : $VARIABLES are env variables replaced by entrypoint.sh using envsubst -# not to be mistaken for nginx variables (also starting with $, but usually lowercase) - -worker_processes auto; - -events { - -} - -http { - server_names_hash_bucket_size 64; - - # Allow Nginx to resolve Docker host names (see https://sandro-keil.de/blog/2017/07/24/let-nginx-start-if-upstream-host-is-unavailable-or-down/) - resolver $RESOLVER; # it seems rancher uses 169.254.169.250 instead of 127.0.0.11 which works well in docker-compose (see /etc/resolv.conf) - - # https - listens on specific name - this uses letsencrypt cert - # this includes a symlink that links either to nginx.https.available.conf if https in enabled - # or to an empty file if https is disabled. - include nginx.https.enabled.conf; - - # http - listens to specific HTTP_HOST only - this is not encrypted (not ideal but admissible on LAN for instance) - # even if not used (HTTP_HOST empty), we must keep it as it's used for internal API calls between django and geoserver - # TODO : do not use unencrypted connection even on LAN, but is it possible to have browser not complaining about unknown authority ? - server { - listen 80; - server_name $HTTP_HOST 127.0.0.1; - - include sites-enabled/*.conf; - } - - # Default server closes the connection (we can connect only using HTTP_HOST and HTTPS_HOST) - server { - listen 80 default_server; - listen 443; - server_name _; - return 444; - } - -} diff --git a/docker/nginx/nginx.https.available.conf.envsubst b/docker/nginx/nginx.https.available.conf.envsubst deleted file mode 100644 index fcd1cb3..0000000 --- a/docker/nginx/nginx.https.available.conf.envsubst +++ /dev/null @@ -1,37 +0,0 @@ -# NOTE : $VARIABLES are env variables replaced by entrypoint.sh using envsubst -# not to be mistaken for nginx variables (also starting with $, but usually lowercase) - -# This file is to be included in the main nginx.conf configuration if HTTPS_HOST is set -ssl_session_cache shared:SSL:10m; -ssl_session_timeout 10m; - -# this is the actual HTTPS host -server { - listen 443 ssl; - server_name $HTTPS_HOST; - keepalive_timeout 70; - - ssl_certificate /certificate_symlink/fullchain.pem; - ssl_certificate_key /certificate_symlink/privkey.pem; - ssl_protocols TLSv1 TLSv1.1 TLSv1.2; - ssl_ciphers HIGH:!aNULL:!MD5; - - include sites-enabled/*.conf; -} - -# if we try to connect from http, we redirect to https -server { - listen 80; - server_name $HTTPS_HOST $HTTP_HOST; # TODO : once geoserver supports relative urls, we should allow access though both HTTP and HTTPS at the same time and hence remove HTTP_HOST from this line - - # Except for let's encrypt challenge - location /.well-known { - alias /geonode-certificates/.well-known; - include /etc/nginx/mime.types; - } - - # Redirect to https - location / { - return 302 https://$HTTPS_HOST$request_uri; # TODO : we should use 301 (permanent redirect, but not practical for debug) - } -} diff --git a/docker/postgresql/Dockerfile b/docker/postgresql/Dockerfile new file mode 100644 index 0000000..1c7d2fb --- /dev/null +++ b/docker/postgresql/Dockerfile @@ -0,0 +1,2 @@ +ARG BASE_IMAGE_VERSION +FROM geonode/postgis:${BASE_IMAGE_VERSION} \ No newline at end of file diff --git a/geonode-stack.yml b/geonode-stack.yml index c1a4487..ed1e647 100644 --- a/geonode-stack.yml +++ b/geonode-stack.yml @@ -7,7 +7,7 @@ x-common-django: env_file: - .env volumes: - # - '.:/usr/src/geonode_master' + # - '.:/usr/src/geonode_demo' - statics:/mnt/volumes/statics - geoserver-data-dir:/geoserver_data/data - backup-restore:/backup_restore @@ -41,8 +41,8 @@ services: start_period: 60s environment: IS_CELERY: 'False' - entrypoint: ["/usr/src/geonode_master/entrypoint.sh"] - command: "uwsgi --ini /usr/src/geonode_master/uwsgi.ini" + entrypoint: ["/usr/src/geonode_demo/entrypoint.sh"] + command: "uwsgi --ini /usr/src/geonode_demo/uwsgi.ini" # Celery worker that executes celery tasks created by Django. celery: @@ -52,7 +52,7 @@ services: - django environment: - IS_CELERY=True - entrypoint: ["/usr/src/geonode_master/entrypoint.sh"] + entrypoint: ["/usr/src/geonode_demo/entrypoint.sh"] command: "celery-cmd" # Nginx is serving django static and media files and proxies to django and geonode diff --git a/playbook.yml b/playbook.yml index 7511793..8a4fc92 100644 --- a/playbook.yml +++ b/playbook.yml @@ -2,11 +2,11 @@ hosts: production remote_user: ubuntu vars: - app_name: geonode_master + app_name: geonode_demo github_user: geonode server_name: 0.0.0.0 deploy_user: ubuntu - code_repository: https://github.com/-----/geonode_master.git" # e.g., "https://github.com/GeoNode/geonode_master.git" + code_repository: https://github.com/-----/geonode_demo.git" # e.g., "https://github.com/GeoNode/geonode_demo.git" branch_name: master virtualenv_dir: "/home/ubuntu/.venvs" site_url: "http://localhost:8000/" # The public url of the GeoNode instance diff --git a/src/README.md b/src/README.md index d87bd22..4e6dd14 100644 --- a/src/README.md +++ b/src/README.md @@ -1 +1 @@ -# Geonode_Master +# Geonode_Demo diff --git a/src/celery-cmd b/src/celery-cmd old mode 100755 new mode 100644 index a1c7fbd..a600163 --- a/src/celery-cmd +++ b/src/celery-cmd @@ -3,7 +3,7 @@ # Luca Pasquali CELERY_BIN=${CELERY_BIN:-"$(which celery||echo celery)"} CELERY_APP=${CELERY_APP:-"geonode.celery_app:app"} -CELERY__STATE_DB=${CELERY__STATE_DB:-"/mnt/volumes/statics/worker.state"} +CELERY__STATE_DB=${CELERY__STATE_DB:-"/mnt/volumes/statics/worker@%h.state"} # expressed in KB CELERY__MAX_MEMORY_PER_CHILD=${CELERY__MAX_MEMORY_PER_CHILD:-"200000"} CELERY__AUTOSCALE_VALUES=${CELERY__AUTOSCALE_VALUES:-"15,10"} diff --git a/src/entrypoint.sh b/src/entrypoint.sh old mode 100755 new mode 100644 index dbc93f1..8659305 --- a/src/entrypoint.sh +++ b/src/entrypoint.sh @@ -9,12 +9,12 @@ invoke () { then /usr/local/bin/invoke $@ else - /usr/local/bin/invoke $@ > /usr/src/geonode_master/invoke.log 2>&1 + /usr/local/bin/invoke $@ > /usr/src/geonode_demo/invoke.log 2>&1 fi echo "$@ tasks done" } -# Start cron services +# Start cron service service cron restart echo $"\n\n\n" @@ -69,6 +69,6 @@ echo "-----------------------------------------------------" echo "FINISHED DJANGO ENTRYPOINT --------------------------" echo "-----------------------------------------------------" -# Run the CMD +# Run the CMD echo "got command $cmd" exec $cmd diff --git a/src/geonode_master/__init__.py b/src/geonode_demo/__init__.py similarity index 86% rename from src/geonode_master/__init__.py rename to src/geonode_demo/__init__.py index af390fa..7da0efd 100644 --- a/src/geonode_master/__init__.py +++ b/src/geonode_demo/__init__.py @@ -23,10 +23,10 @@ __version__ = (4, 2, 0, "dev", 0) -default_app_config = "geonode_master.apps.AppConfig" +default_app_config = "geonode_demo.apps.AppConfig" def get_version(): - import geonode_master.version + import geonode_demo.version - return geonode_master.version.get_version(__version__) + return geonode_demo.version.get_version(__version__) diff --git a/src/geonode_master/apps.py b/src/geonode_demo/apps.py similarity index 96% rename from src/geonode_master/apps.py rename to src/geonode_demo/apps.py index 5c8173c..bdb0f7c 100644 --- a/src/geonode_master/apps.py +++ b/src/geonode_demo/apps.py @@ -33,8 +33,8 @@ def run_setup_hooks(*args, **kwargs): class AppConfig(BaseAppConfig): - name = "geonode_master" - label = "geonode_master" + name = "geonode_demo" + label = "geonode_demo" def ready(self): super(AppConfig, self).ready() diff --git a/src/geonode_master/br/backup.sh b/src/geonode_demo/br/backup.sh old mode 100755 new mode 100644 similarity index 75% rename from src/geonode_master/br/backup.sh rename to src/geonode_demo/br/backup.sh index c7e6670..0a92b6e --- a/src/geonode_master/br/backup.sh +++ b/src/geonode_demo/br/backup.sh @@ -1,7 +1,7 @@ #!/bin/sh # ########################################################## # Run a backup -# SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./geonode_master/br/backup.sh $BKP_FOLDER_NAME +# SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./geonode_demo/br/backup.sh $BKP_FOLDER_NAME # - BKP_FOLDER_NAME: # Default value = backup_restore # Shared Backup Folder name. @@ -14,14 +14,14 @@ # Target Server URL, the one which must be synched. # # e.g.: -# docker exec -it django4geonode_master sh -c 'SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./geonode_master/br/backup.sh $BKP_FOLDER_NAME' +# docker exec -it django4geonode_demo sh -c 'SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./geonode_demo/br/backup.sh $BKP_FOLDER_NAME' # ########################################################## # Exit script in case of error set -e echo "-----------------------------------------------------" -echo "STARTING geonode_master BACKUP $(date)" +echo "STARTING geonode_demo BACKUP $(date)" echo "-----------------------------------------------------" if [ "$1" != "" ]; then @@ -30,9 +30,9 @@ else BKP_FOLDER_NAME="backup_restore" fi -cd /usr/src/geonode_master/ +cd /usr/src/geonode_demo/ -./manage.sh backup -i -f -c $PWD/geonode_master/br/settings_docker.ini --backup-dir /$BKP_FOLDER_NAME/ +./manage.sh backup -i -f -c $PWD/geonode_demo/br/settings_docker.ini --backup-dir /$BKP_FOLDER_NAME/ BKP_FILE_LATEST=$(find /$BKP_FOLDER_NAME/*.zip -type f -exec stat -c '%Y %n' {} \; | sort -nr | awk 'NR==1,NR==1 {print $2}') BKP_FILE_NAME=$(echo $BKP_FILE_LATEST | tail -n 1 | grep -oP -m 1 "\/$BKP_FOLDER_NAME\/\K.*" | sed 's|.zip||') diff --git a/src/geonode_master/br/restore.sh b/src/geonode_demo/br/restore.sh old mode 100755 new mode 100644 similarity index 88% rename from src/geonode_master/br/restore.sh rename to src/geonode_demo/br/restore.sh index be9aaa7..1738d87 --- a/src/geonode_master/br/restore.sh +++ b/src/geonode_demo/br/restore.sh @@ -1,7 +1,7 @@ #!/bin/sh # ########################################################## # Run a restore -# SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./geonode_master/br/restore.sh $BKP_FOLDER_NAME +# SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./geonode_demo/br/restore.sh $BKP_FOLDER_NAME # - BKP_FOLDER_NAME: # Default value = backup_restore # Shared Backup Folder name. @@ -14,14 +14,14 @@ # Target Server URL, the one which must be synched. # # e.g.: -# docker exec -it django4geonode_master sh -c 'SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./geonode_master/br/restore.sh $BKP_FOLDER_NAME' +# docker exec -it django4geonode_demo sh -c 'SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./geonode_demo/br/restore.sh $BKP_FOLDER_NAME' # ########################################################## # Exit script in case of error set -e echo "-----------------------------------------------------" -echo "STARTING geonode_master RESTORE $(date)" +echo "STARTING geonode_demo RESTORE $(date)" echo "-----------------------------------------------------" if [ "$1" != "" ]; then @@ -41,7 +41,7 @@ else echo "$SOURCE_URL --> $TARGET_URL" fi -cd /usr/src/geonode_master/ +cd /usr/src/geonode_demo/ echo "-----------------------------------------------------" echo " 1. BACKUP $TARGET_URL" @@ -49,7 +49,7 @@ echo "-----------------------------------------------------" NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) mkdir /$BKP_FOLDER_NAME/$NEW_UUID/ -SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./geonode_master/br/backup.sh $BKP_FOLDER_NAME/$NEW_UUID +SOURCE_URL=$SOURCE_URL TARGET_URL=$TARGET_URL ./geonode_demo/br/backup.sh $BKP_FOLDER_NAME/$NEW_UUID echo "-----------------------------------------------------" echo " 2. CHECK BACKUP.md5 $TARGET_URL" @@ -93,5 +93,5 @@ fi echo "-----------------------------------------------------" echo " - Original Backup of $TARGET_URL --> /$BKP_FOLDER_NAME/$NEW_UUID/" -echo "FINISHED geonode_master RESTORE $(date)" +echo "FINISHED geonode_demo RESTORE $(date)" echo "-----------------------------------------------------" diff --git a/src/geonode_master/br/settings_docker.ini b/src/geonode_demo/br/settings_docker.ini similarity index 78% rename from src/geonode_master/br/settings_docker.ini rename to src/geonode_demo/br/settings_docker.ini index 9284b77..b51f720 100644 --- a/src/geonode_master/br/settings_docker.ini +++ b/src/geonode_demo/br/settings_docker.ini @@ -13,5 +13,5 @@ dumprasterdata = yes # data_layername_exclude_filter = {comma separated list of layernames, optionally with glob syntax} e.g.: tuscany_*,italy [fixtures] -apps = contenttypes,auth,people,groups,account,guardian,admin,actstream,announcements,avatar,base,documents,geoserver,invitations,pinax_notifications,layers,maps,oauth2_provider,harvesting,services,sites,socialaccount,taggit,tastypie,upload,user_messages,geonode_themes,geoapps,favorite,geonode_client -dumps = contenttypes,auth,people,groups,account,guardian,admin,actstream,announcements,avatar,base,documents,geoserver,invitations,pinax_notifications,layers,maps,oauth2_provider,harvesting,services,sites,socialaccount,taggit,tastypie,upload,user_messages,geonode_themes,geoapps,favorite,geonode_client +apps = contenttypes,auth,people,groups,account,guardian,admin,actstream,announcements,avatar,base,documents,geoserver,invitations,pinax_notifications,harvesting,services,layers,maps,oauth2_provider,sites,socialaccount,taggit,tastypie,upload,user_messages,geonode_themes,geoapps,favorite,geonode_client +dumps = contenttypes,auth,people,groups,account,guardian,admin,actstream,announcements,avatar,base,documents,geoserver,invitations,pinax_notifications,harvesting,services,layers,maps,oauth2_provider,sites,socialaccount,taggit,tastypie,upload,user_messages,geonode_themes,geoapps,favorite,geonode_client diff --git a/src/geonode_master/celeryapp.py b/src/geonode_demo/celeryapp.py similarity index 86% rename from src/geonode_master/celeryapp.py rename to src/geonode_demo/celeryapp.py index 0ee7564..74413c1 100644 --- a/src/geonode_master/celeryapp.py +++ b/src/geonode_demo/celeryapp.py @@ -23,9 +23,9 @@ import os from celery import Celery -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "geonode_master.settings") +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "geonode_demo.settings") -app = Celery("geonode_master") +app = Celery("geonode_demo") # Using a string here means the worker will not have to # pickle the object when using Windows. @@ -33,6 +33,6 @@ app.autodiscover_tasks() -@app.task(bind=True, name="geonode_master.debug_task", queue="default") +@app.task(bind=True, name="geonode_demo.debug_task", queue="default") def debug_task(self): print("Request: {!r}".format(self.request)) diff --git a/src/geonode_master/locale/.gitkeep b/src/geonode_demo/locale/.gitkeep similarity index 100% rename from src/geonode_master/locale/.gitkeep rename to src/geonode_demo/locale/.gitkeep diff --git a/src/geonode_master/settings.py b/src/geonode_demo/settings.py similarity index 97% rename from src/geonode_master/settings.py rename to src/geonode_demo/settings.py index d20697f..beef427 100644 --- a/src/geonode_master/settings.py +++ b/src/geonode_demo/settings.py @@ -30,7 +30,7 @@ from urlparse import urlparse, urlunparse # Load more settings from a file called local_settings.py if it exists try: - from geonode_master.local_settings import * + from geonode_demo.local_settings import * # from geonode.local_settings import * except ImportError: from geonode.settings import * @@ -38,13 +38,13 @@ # # General Django development settings # -PROJECT_NAME = "geonode_master" +PROJECT_NAME = "geonode_demo" # add trailing slash to site url. geoserver url will be relative to this if not SITEURL.endswith("/"): SITEURL = "{}/".format(SITEURL) -SITENAME = os.getenv("SITENAME", "geonode_master") +SITENAME = os.getenv("SITENAME", "geonode_demo") # Defines the directory that contains the settings file as the LOCAL_ROOT # It is used for relative settings elsewhere. diff --git a/src/geonode_master/static/README b/src/geonode_demo/static/README similarity index 100% rename from src/geonode_master/static/README rename to src/geonode_demo/static/README diff --git a/src/geonode_master/static/css/site_base.css b/src/geonode_demo/static/css/site_base.css similarity index 100% rename from src/geonode_master/static/css/site_base.css rename to src/geonode_demo/static/css/site_base.css diff --git a/src/geonode_master/static/gulpfile.js b/src/geonode_demo/static/gulpfile.js similarity index 100% rename from src/geonode_master/static/gulpfile.js rename to src/geonode_demo/static/gulpfile.js diff --git a/src/geonode_master/static/img/README b/src/geonode_demo/static/img/README similarity index 100% rename from src/geonode_master/static/img/README rename to src/geonode_demo/static/img/README diff --git a/src/geonode_master/static/img/bing_aerial_w_labels.png b/src/geonode_demo/static/img/bing_aerial_w_labels.png similarity index 100% rename from src/geonode_master/static/img/bing_aerial_w_labels.png rename to src/geonode_demo/static/img/bing_aerial_w_labels.png diff --git a/src/geonode_master/static/img/bing_canvas_dark.png b/src/geonode_demo/static/img/bing_canvas_dark.png similarity index 100% rename from src/geonode_master/static/img/bing_canvas_dark.png rename to src/geonode_demo/static/img/bing_canvas_dark.png diff --git a/src/geonode_master/static/img/bing_road_on_demand.png b/src/geonode_demo/static/img/bing_road_on_demand.png similarity index 100% rename from src/geonode_master/static/img/bing_road_on_demand.png rename to src/geonode_demo/static/img/bing_road_on_demand.png diff --git a/src/geonode_master/static/js/README b/src/geonode_demo/static/js/README similarity index 100% rename from src/geonode_master/static/js/README rename to src/geonode_demo/static/js/README diff --git a/src/geonode_master/static/less/site_base.less b/src/geonode_demo/static/less/site_base.less similarity index 100% rename from src/geonode_master/static/less/site_base.less rename to src/geonode_demo/static/less/site_base.less diff --git a/src/geonode_master/static/package.json b/src/geonode_demo/static/package.json similarity index 80% rename from src/geonode_master/static/package.json rename to src/geonode_demo/static/package.json index b1409f3..81750ba 100644 --- a/src/geonode_master/static/package.json +++ b/src/geonode_demo/static/package.json @@ -1,8 +1,8 @@ { - "name": "geonode_master", + "name": "geonode_demo", "version": "0.0.1", "author": "GeoNode Developers", - "description": "Static code and assets for geonode_master", + "description": "Static code and assets for geonode_demo", "contributors": [ { } diff --git a/src/geonode_master/templates/geonode-mapstore-client/_geonode_config.html b/src/geonode_demo/templates/geonode-mapstore-client/_geonode_config.html similarity index 100% rename from src/geonode_master/templates/geonode-mapstore-client/_geonode_config.html rename to src/geonode_demo/templates/geonode-mapstore-client/_geonode_config.html diff --git a/src/geonode_master/urls.py b/src/geonode_demo/urls.py similarity index 100% rename from src/geonode_master/urls.py rename to src/geonode_demo/urls.py diff --git a/src/geonode_master/version.py b/src/geonode_demo/version.py similarity index 100% rename from src/geonode_master/version.py rename to src/geonode_demo/version.py diff --git a/src/geonode_master/wsgi.py b/src/geonode_demo/wsgi.py similarity index 94% rename from src/geonode_master/wsgi.py rename to src/geonode_demo/wsgi.py index 3f9d103..ae7f6c1 100644 --- a/src/geonode_master/wsgi.py +++ b/src/geonode_demo/wsgi.py @@ -19,7 +19,7 @@ ######################################################################### """ -WSGI config for geonode_master project. +WSGI config for geonode_demo project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable @@ -35,7 +35,7 @@ """ import os -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "geonode_master.settings") +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "geonode_demo.settings") # This application object is used by any WSGI server configured to use this # file. This includes Django's development server, if the WSGI_APPLICATION diff --git a/src/manage.py b/src/manage.py old mode 100755 new mode 100644 index 7c82b15..fdb4345 --- a/src/manage.py +++ b/src/manage.py @@ -27,5 +27,5 @@ if __name__ == "__main__": from django.core.management import execute_from_command_line - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "geonode_master.settings") + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "geonode_demo.settings") execute_from_command_line(sys.argv) diff --git a/src/manage.sh b/src/manage.sh old mode 100755 new mode 100644 index 37be5b8..910c06b --- a/src/manage.sh +++ b/src/manage.sh @@ -1,2 +1,2 @@ . $HOME/.override_env -/usr/bin/python /usr/src/geonode_master/manage.py $@ +/usr/bin/python /usr/src/geonode_demo/manage.py $@ diff --git a/src/monitoring-cron b/src/monitoring-cron index ac53f4e..02fafc1 100644 --- a/src/monitoring-cron +++ b/src/monitoring-cron @@ -1,3 +1,3 @@ -# */1 * * * * /usr/src/geonode_master/manage.sh collect_metrics -n -t xml >> /var/log/cron.log 2>&1 -# 0 * * * * /usr/src/geonode_master/manage.sh dispatch_metrics >> /var/log/cron.log 2>&1 +# */1 * * * * /usr/src/geonode_demo/manage.sh collect_metrics -n -t xml >> /var/log/cron.log 2>&1 +# 0 * * * * /usr/src/geonode_demo/manage.sh dispatch_metrics >> /var/log/cron.log 2>&1 # An empty line is required at the end of this file for a valid cron file. diff --git a/src/pavement.py b/src/pavement.py index 3b49d7c..5732bcb 100644 --- a/src/pavement.py +++ b/src/pavement.py @@ -54,9 +54,9 @@ from setuptools.command import easy_install try: - from geonode_master.local_settings import * + from geonode_demo.local_settings import * except ImportError: - from geonode_master.settings import * + from geonode_demo.settings import * try: from paver.path import pushd @@ -975,8 +975,8 @@ def _reset(): path = os.path.join(settings.PROJECT_ROOT, "development.db") sh(f"rm -rf {path}") - sh("rm -rf geonode_master/development.db") - sh("rm -rf geonode_master/uploaded/*") + sh("rm -rf geonode_demo/development.db") + sh("rm -rf geonode_demo/uploaded/*") _configure_data_dir() diff --git a/src/paver.sh b/src/paver.sh old mode 100755 new mode 100644 diff --git a/src/setup.py b/src/setup.py index f494a3b..eab1969 100644 --- a/src/setup.py +++ b/src/setup.py @@ -29,11 +29,11 @@ def read(*rnames): setup( - name="geonode_master", + name="geonode_demo", version="4.0.0", author="", author_email="", - description="geonode_master, based on GeoNode", + description="geonode_demo, based on GeoNode", long_description=(read("README.md")), # Full list of classifiers can be found at: # http://pypi.python.org/pypi?%3Aaction=list_classifiers @@ -41,8 +41,8 @@ def read(*rnames): "Development Status :: 1 - Planning", ], license="GPL", - keywords="geonode_master geonode django", - url="https://github.com/geonode_master/geonode_master", + keywords="geonode_demo geonode django", + url="https://github.com/geonode_demo/geonode_demo", packages=find_packages(), dependency_links=["git+https://github.com/GeoNode/geonode.git#egg=geonode"], include_package_data=True, diff --git a/src/tasks.py b/src/tasks.py index 848ec56..55692d6 100644 --- a/src/tasks.py +++ b/src/tasks.py @@ -498,6 +498,7 @@ def _docker_host_ip(): ) return ip_list[0] + def _is_valid_ip(ip): try: ipaddress.IPv4Address(ip) @@ -505,6 +506,7 @@ def _is_valid_ip(ip): except Exception as e: return False + def _container_exposed_port(component, instname): port = "80" try: @@ -531,27 +533,31 @@ def _container_exposed_port(component, instname): def _update_db_connstring(): - user = os.getenv("GEONODE_DATABASE", "geonode") - pwd = os.getenv("GEONODE_DATABASE_PASSWORD", "geonode") - dbname = os.getenv("GEONODE_DATABASE", "geonode") - dbhost = os.getenv("DATABASE_HOST", "db") - dbport = os.getenv("DATABASE_PORT", 5432) - connstr = f"postgis://{user}:{pwd}@{dbhost}:{dbport}/{dbname}" + connstr = os.getenv("DATABASE_URL", None) + if not connstr: + user = os.getenv("GEONODE_DATABASE_USER", "geonode") + pwd = os.getenv("GEONODE_DATABASE_PASSWORD", "geonode") + dbname = os.getenv("GEONODE_DATABASE", "geonode") + dbhost = os.getenv("DATABASE_HOST", "db") + dbport = os.getenv("DATABASE_PORT", 5432) + connstr = f"postgis://{user}:{pwd}@{dbhost}:{dbport}/{dbname}" return connstr def _update_geodb_connstring(): - geouser = os.getenv("GEONODE_GEODATABASE", "geonode_data") - geopwd = os.getenv("GEONODE_GEODATABASE_PASSWORD", "geonode_data") - geodbname = os.getenv("GEONODE_GEODATABASE", "geonode_data") - dbhost = os.getenv("DATABASE_HOST", "db") - dbport = os.getenv("DATABASE_PORT", 5432) - geoconnstr = f"postgis://{geouser}:{geopwd}@{dbhost}:{dbport}/{geodbname}" + geoconnstr = os.getenv("GEODATABASE_URL", None) + if not geoconnstr: + geouser = os.getenv("GEONODE_GEODATABASE_USER", "geonode_data") + geopwd = os.getenv("GEONODE_GEODATABASE_PASSWORD", "geonode_data") + geodbname = os.getenv("GEONODE_GEODATABASE", "geonode_data") + dbhost = os.getenv("DATABASE_HOST", "db") + dbport = os.getenv("DATABASE_PORT", 5432) + geoconnstr = f"postgis://{geouser}:{geopwd}@{dbhost}:{dbport}/{geodbname}" return geoconnstr def _localsettings(): - settings = os.getenv("DJANGO_SETTINGS_MODULE", "geonode_master.settings") + settings = os.getenv("DJANGO_SETTINGS_MODULE", "geonode_demo.settings") return settings diff --git a/src/uwsgi.ini b/src/uwsgi.ini index 41bb365..4813190 100644 --- a/src/uwsgi.ini +++ b/src/uwsgi.ini @@ -4,8 +4,8 @@ http-socket = 0.0.0.0:8000 logto = /var/log/geonode.log # pidfile = /tmp/geonode.pid -chdir = /usr/src/geonode_master/ -module = geonode_master.wsgi:application +chdir = /usr/src/geonode_demo/ +module = geonode_demo.wsgi:application strict = false master = true @@ -16,7 +16,7 @@ die-on-term = true ; Shutdown when receiving SIGTERM (default need-app = true thunder-lock = true -touch-reload = /usr/src/geonode_master/geonode_master/wsgi.py +touch-reload = /usr/src/geonode_demo/geonode_demo/wsgi.py buffer-size = 32768 harakiri = 600 ; forcefully kill workers after 600 seconds @@ -40,7 +40,7 @@ cheaper-busyness-max = 70 ; Above this threshold, spawn new workers cheaper-busyness-backlog-alert = 16 ; Spawn emergency workers if more than this many requests are waiting in the queue cheaper-busyness-backlog-step = 2 ; How many emergency workers to create if there are too many requests in the queue -# cron = -1 -1 -1 -1 -1 sh -c '/usr/src/geonode_master/manage.sh collect_metrics -n -t xml'; +# cron = -1 -1 -1 -1 -1 sh -c '/usr/src/geonode_demo/manage.sh collect_metrics -n -t xml'; # cron = 0 0 -1 -1 -1 sh -c 'find /backup_restore/ -type f -mtime +30 -exec rm -f {} \;' # Remove backup files older than 30 days except the most recent 3 files (a backup is composed by 3 files) cron = 0 0 -1 -1 -1 sh -c 'find /backup_restore/ -maxdepth 1 -type f -mtime +30 -printf "%T@ %p\n" | sort -n | head -n -3 | awk "{ print $2 }" | xargs -r rm' diff --git a/src/wait-for-databases.sh b/src/wait-for-databases.sh old mode 100755 new mode 100644