diff --git a/.env.example b/.env.example
new file mode 100644
index 0000000..0997dd3
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,224 @@
+###################################
+# PARAMETRES DE PERSONALISATION D'UNE INSTANCE
+###################################
+
+# Les principaux paramètres utiles pour configurer une instance sont placés dans cette section
+
+# version des application (cf docs/changelog.md pour voir les versions précises des applications)
+GDS_VERSION="current"
+GDS_REPOSITORY="ghcr.io/pnx-si"
+
+# IMAGES APPS
+USERSHUB_IMAGE=ghcr.io/pnx-si/usershub:2.3.4
+TAXHUB_IMAGE=ghcr.io/pnx-si/taxhub:1.12.1
+ATLAS_IMAGE=ghcr.io/pnx-si/geonature-atlas:1.60
+GEONATURE_FRONTEND_IMAGE=ghcr.io/pnx-si/geonature-frontend-extra:0.1.0
+GEONATURE_BACKEND_IMAGE=ghcr.io/pnx-si/geonature-backend-extra:0.1.0
+
+# Nom de domaine
+DOMAIN="mondomaine.org"
+
+# prefixe pour le nom des container
+PROJECT_NAME=gds
+CONTAINER_NAME_PREFIX=${PROJECT_NAME}-
+TRAEFIK_NETWORK_NAME=traefik_${PROJECT_NAME}
+
+# prefixe pour les url des applications
+APPLICATIONS_PREFIX=""
+
+# répertoire de base pour les volumes des services (data + config)
+VOLUME_DATA_DIRECTORY=./data
+ASSETS_DIRECTORY=./assets
+
+# accès base de données
+POSTGRES_USER="geonatadmin"
+POSTGRES_PASSWORD="geonatpasswd"
+POSTGRES_HOST="postgres"
+POSTGRES_DB="geonature2db"
+POSTGRES_PORT=5432
+
+# accès pgadmin
+PGADMIN_DEFAULT_EMAIL=geon@tu.re
+PGADMIN_DEFAULT_PASSWORD=geonature
+
+# flask apps secret keys
+GEONATURE_SECRET_KEY="LKJSKJSKDJKJZLKJDZ_GEONATURE"
+USERSHUB_SECRET_KEY="KJMLIHNILJUKGJNJH?GJ_USERSHUB"
+TAXHUB_SECRET_KEY="MLKMZL?/Z? CLIJEZFE/.?_TAXHUB"
+ATLAS_SECRET_KEY="OJLKJLKKKJKJJLKJK_ATLAS"
+
+# initialisation base de données
+GEONATURE_SKIP_POPULATE_DB=true
+ATLAS_INSTALL_SCHEMA=false
+ATLAS_RESET_SCHEMA=false
+
+# proxy
+HTTP_PROXY=""
+HTTPS_PROXY=""
+
+
+####################################
+# PARAMETRES GLOBAUX
+####################################
+
+# - utilisateur docker
+DOCKER_UID=
+DOCKER_GID=
+
+# - accès bdd flask sqlalchemy
+SQLALCHEMY_DATABASE_URI="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}"
+
+# - volumes
+VOLUME_DATA_SERVICES_DIRECTORY="${VOLUME_DATA_DIRECTORY}/services"
+VOLUME_DATA_STORAGE_DIRECTORY="${VOLUME_DATA_DIRECTORY}/storage"
+
+
+####################################
+# PARAMETRES PRODUCTION
+####################################
+
+# - labels
+TRAEFIK_RESOLVER="letsencrypt"
+TRAEFIK_TLS=true
+
+# url et nom de domaine
+BASE_PROTOCOL="https"
+HOST="${DOMAIN}"
+BASE_URL=${BASE_PROTOCOL}://${HOST}
+
+# healthcheck interval
+GEONATURE_BACKEND_HEALTHCHECK_INTERVAL="30s"
+ATLAS_HEALTHCHECK_INTERVAL="30s"
+
+####################################
+# SERVICES
+####################################
+
+# - redis
+
+REDIS_IMAGE=redis:7-alpine
+REDIS_CONTAINER_NAME=${CONTAINER_NAME_PREFIX}redis
+REDIS_VOLUME_DATA_DIRECTORY=${VOLUME_DATA_STORAGE_DIRECTORY}/redis
+
+
+# - postgres
+
+POSTGRES_IMAGE=postgis/postgis:15-3.3
+POSTGRES_CONTAINER_NAME=${CONTAINER_NAME_PREFIX}postgres
+POSTGRES_VOLUME_DATA_DIRECTORY=${VOLUME_DATA_STORAGE_DIRECTORY}/postgres
+POSTGRES_VOLUME_BACKUP_DIRECTORY=${VOLUME_DATA_SERVICES_DIRECTORY}/postgres/backup
+POSTGRES_VOLUME_SCRIPTS_DIRECTORY=${ASSETS_DIRECTORY}/postgres/scripts
+POSTGRES_VOLUME_INIT_DB_DIRECTORY=${ASSETS_DIRECTORY}/postgres/init_db
+POSTGRES_SHM_SIZE=1000000000
+
+
+# - pgadmin
+
+PGADMIN_DOMAIN="${DOMAIN}"
+PGADMIN_HOST=${PGADMIN_DOMAIN}
+PGADMIN_BASE_URL=${BASE_PROTOCOL}://${PGADMIN_HOST}
+
+PGADMIN_IMAGE=dpage/pgadmin4:7.5
+PGADMIN_CONTAINER_NAME=${CONTAINER_NAME_PREFIX}pg_admin
+PGADMIN_VOLUME_DATA_DIRECTORY="${VOLUME_DATA_STORAGE_DIRECTORY}/pgadmin"
+PGADMIN_PREFIX="${APPLICATIONS_PREFIX}/admin4pg"
+
+# - taxhub
+
+TAXHUB_DOMAIN=${DOMAIN}
+TAXHUB_HOST=${TAXHUB_DOMAIN}
+TAXHUB_BASE_URL=${BASE_PROTOCOL}://${TAXHUB_HOST}
+
+TAXHUB_CONTAINER_NAME=${CONTAINER_NAME_PREFIX}taxhub
+TAXHUB_VOLUME_CONFIG_DIRECTORY="${VOLUME_DATA_SERVICES_DIRECTORY}/taxhub/config"
+TAXHUB_VOLUME_MEDIA_DIRECTORY="${VOLUME_DATA_SERVICES_DIRECTORY}/taxhub/media"
+TAXHUB_PREFIX="${APPLICATIONS_PREFIX}/taxhub"
+TAXHUB_API_PREFIX="${TAXHUB_PREFIX}/api"
+TAXHUB_URL_APPLICATION="${TAXHUB_BASE_URL}${TAXHUB_PREFIX}"
+TAXHUB_API_ENDPOINT="${TAXHUB_BASE_URL}${TAXHUB_API_PREFIX}"
+TAXHUB_APPLICATION_ROOT="${TAXHUB_PREFIX}"
+TAXHUB_SQLALCHEMY_DATABASE_URI="${SQLALCHEMY_DATABASE_URI}"
+TAXHUB_SETTINGS=config.py
+
+
+# - usershub
+
+USERSHUB_DOMAIN=${DOMAIN}
+USERSHUB_HOST=${USERSHUB_DOMAIN}
+USERSHUB_BASE_URL=${BASE_PROTOCOL}://${USERSHUB_HOST}
+
+USERSHUB_CONTAINER_NAME=${CONTAINER_NAME_PREFIX}usershub
+USERSHUB_VOLUME_CONFIG_DIRECTORY="${VOLUME_DATA_SERVICES_DIRECTORY}/usershub/config"
+USERSHUB_PREFIX="${APPLICATIONS_PREFIX}/usershub"
+USERSHUB_URL_APPLICATION="${USERSHUB_BASE_URL}${USERSHUB_PREFIX}"
+USERSHUB_SQLALCHEMY_DATABASE_URI="${SQLALCHEMY_DATABASE_URI}"
+USERSHUB_SETTINGS=config.py
+USERSHUB_ACTIVATE_APP=true
+USERSHUB_ACTIVATE_API=true
+USERSHUB_COOKIE_EXPIRATION=3600
+
+
+# - geonature
+
+GEONATURE_DOMAIN=${DOMAIN}
+GEONATURE_HOST=${GEONATURE_DOMAIN}
+GEONATURE_BASE_URL=${BASE_PROTOCOL}://${GEONATURE_HOST}
+
+# - geonature-frontend
+
+
+GEONATURE_FRONTEND_CONTAINER_NAME=${CONTAINER_NAME_PREFIX}geonature-frontend
+GEONATURE_FRONTEND_PREFIX="${APPLICATIONS_PREFIX}/geonature"
+
+
+# - geonature-backend (+ geonature-worker)
+
+GEONATURE_BACKEND_CONTAINER_NAME=${CONTAINER_NAME_PREFIX}geonature-backend
+GEONATURE_WORKER_CONTAINER_NAME=${CONTAINER_NAME_PREFIX}geonature-worker
+GEONATURE_VOLUME_CONFIG_DIRECTORY="${VOLUME_DATA_SERVICES_DIRECTORY}/geonature/config"
+GEONATURE_VOLUME_DATA_DIRECTORY="${VOLUME_DATA_SERVICES_DIRECTORY}/geonature/data"
+GEONATURE_VOLUME_MEDIA_DIRECTORY="${VOLUME_DATA_SERVICES_DIRECTORY}/geonature/media"
+GEONATURE_VOLUME_CUSTOM_DIRECTORY="${VOLUME_DATA_SERVICES_DIRECTORY}/geonature/custom"
+GEONATURE_BACKEND_PREFIX="${APPLICATIONS_PREFIX}/geonature/api"
+GEONATURE_URL_APPLICATION="${GEONATURE_BASE_URL}${GEONATURE_FRONTEND_PREFIX}"
+GEONATURE_API_ENDPOINT="${GEONATURE_BASE_URL}${GEONATURE_BACKEND_PREFIX}"
+GEONATURE_SQLALCHEMY_DATABASE_URI="${SQLALCHEMY_DATABASE_URI}"
+GEONATURE_API_TAXHUB="${TAXHUB_API_ENDPOINT}"
+GEONATURE_CONFIG_FILE="/dist/config/geonature_config.toml"
+GEONATURE_CELERY__broker_url="redis://redis"
+GEONATURE_CELERY__result_backend="redis://redis"
+
+GEONATURE_SRID_LOCAL=2154
+GEONATURE_ADD_SAMPLE_DATA=false
+GEONATURE_INSTALL_BDC_STATUTS=true
+GEONATURE_INSTALL_SIG_LAYERS=true
+GEONATURE_INSTALL_GRID_LAYER=true
+GEONATURE_INSTALL_REF_SENSITIVITY=true
+GEONATURE_INSTALL_DEFAULT_DEM=false
+GEONATURE_INSTALL_VECTORISE_DEM=false
+GEONATURE_INSTALL_USERSHUB=true
+GEONATURE_INSTALL_USERSHUB_SAMPLES=true
+GEONATURE_INSTALL_TAXHUB=true
+GEONATURE_INSTALL_TAXHUB_SAMPLES=true
+
+
+# - atlas
+
+ATLAS_DOMAIN=${DOMAIN}
+ATLAS_HOST=${ATLAS_DOMAIN}
+ATLAS_BASE_URL=${BASE_PROTOCOL}://${ATLAS_HOST}
+
+ATLAS_CONTAINER_NAME=${CONTAINER_NAME_PREFIX}atlas
+ATLAS_VOLUME_CONFIG_DIRECTORY="${VOLUME_DATA_SERVICES_DIRECTORY}/atlas/config" # dossier de configuration atlas
+ATLAS_VOLUME_CUSTOM_DIRECTORY="${VOLUME_DATA_SERVICES_DIRECTORY}/atlas/custom" # dossier custom atlas
+ATLAS_PREFIX="${APPLICATIONS_PREFIX}/atlas"
+ATLAS_URL_APPLICATION=${ATLAS_BASE_URL}${ATLAS_PREFIX}
+ATLAS_SQLALCHEMY_DATABASE_URI="${SQLALCHEMY_DATABASE_URI}"
+ATLAS_APPLICATION_ROOT=${ATLAS_PREFIX}
+ATLAS_REMOTE_MEDIAS_URL=${TAXHUB_URL_APPLICATION}/
+ATLAS_TAXHUB_URL=${TAXHUB_URL_APPLICATION}
+ATLAS_REDIMENSIONNEMENT_IMAGE=true
+
+ATLAS_ALTITUDES="(0 500 1000 1500 2000 2500 3000 3500 4000)"
+ATLAS_TYPE_TERRITOIRE="'PEC'"
+ATLAS_TYPE_MAILLE="'M1'"
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
new file mode 100644
index 0000000..e1dd009
--- /dev/null
+++ b/.github/workflows/docker.yml
@@ -0,0 +1,190 @@
+name: Docker
+
+on:
+ push:
+ branches:
+ - main
+ - develop
+ - current
+ pull_request:
+ branches:
+ - develop
+ release:
+ types: [published]
+
+jobs:
+ tests:
+ name: Build containers and process tests
+ runs-on: ubuntu-latest
+ env:
+ DOCKER_BUILDKIT: 1
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ submodules: True
+
+ - name: copy cur environment
+ run: |
+ ./scripts/init_env_file.sh .env.example settings.ini.test .env
+
+ - name: Copy config samples
+ run: |
+ ./scripts/init_applications_config.sh .env
+
+ # - name: Build all images
+ # run: |
+ # ./scripts/build_geonature_all.sh .env
+
+
+ - name: Networks
+ run: |
+ docker network create traefik_gds
+
+ - name: Lauch docker compose
+ run: |
+ docker compose up -d
+
+ - name: Save Logs in temp file
+ run: |
+ docker compose logs -f > /tmp/docker_compose.log &
+
+ - name: test containers running
+ uses: nick-fields/retry@v2
+ with:
+ timeout_seconds: 120
+ max_attempts: 10
+ retry_wait_seconds: 30
+ command: |
+ docker compose ps
+ nb_services_running=$(docker compose ps --services --filter 'status=running' | wc -l)
+ nb_services_healthy=$(docker compose ps | grep '(healthy)'| wc -l)
+ echo nb_services_running $nb_services_running
+ echo nb_services_healthy $nb_services_healthy
+ [ "$nb_services_running" = "9" ] || exit 1
+ [ "$nb_services_healthy" = "7" ] || exit 1
+
+ # - name: test app response
+ # run: |
+ # ./scripts/test_docker_url.sh .env
+
+ - name: test reload
+ run: |
+ ./scripts/test_docker_reload.sh .env
+
+ - name: Log if fail
+ if: ${{ failure() }}
+ run: |
+ docker compose logs
+ cat /tmp/docker_compose.log
+ docker compose ps
+
+ # publish:
+ # name: Build and publish dockerimages
+ # if: ${{ github.event_name != 'pull_request' }}
+ # runs-on: ubuntu-latest
+ # # needs: tests
+ # steps:
+ # - name: Checkout
+ # uses: actions/checkout@v3
+ # with:
+ # submodules: True
+
+ # - name: Git Sumbodule Update
+ # run: |
+ # cur=$(pwd)
+ # for app in "GeoNature" "GeoNature-atlas" "UsersHub" "TaxHub"; do
+ # cd ./sources/${app}
+ # git submodule init
+ # git submodule update
+ # cd $cur
+ # done
+
+ # - name: Set Environnement variables
+ # run: |
+ # scripts/init_env.sh >> $GITHUB_ENV
+
+ # - name: Set up Docker Buildx
+ # uses: docker/setup-buildx-action@v2
+
+ # - name: Login to GHCR
+ # uses: docker/login-action@v2
+ # if: github.event_name != 'pull_request'
+ # with:
+ # registry: ghcr.io
+ # username: ${{ github.actor }}
+ # password: ${{ secrets.GITHUB_TOKEN }}
+
+ # - name: Build and export geonature backend wheels image
+ # id: build-wheels
+ # uses: docker/build-push-action@v4
+ # with:
+ # context: ./sources/GeoNature
+ # file: ./sources/GeoNature/backend/Dockerfile
+ # target: wheels
+ # push: true
+ # tags: "${{ env.GN_BACKEND_TAGS }}-wheels"
+ # labels: ${{ env.GN_LABELS }}
+
+ # - name: Build and export geonature backend image (+ 4 modules)
+ # id: build-prod
+ # uses: docker/build-push-action@v4
+ # with:
+ # context: .
+ # file: ./build/Dockerfile-geonature-backend
+ # target: prod-extra
+ # push: true
+ # tags: "${{ env.GN_BACKEND_TAGS }}"
+ # labels: ${{ env.GN_LABELS }}
+ # build-args: GEONATURE_BACKEND_IMAGE=${{env.GN_BACKEND_IMAGE}}
+
+ # - name: Build and export frontend source
+ # uses: docker/build-push-action@v4
+ # with:
+ # context: ./sources/GeoNature
+ # file: ./sources/GeoNature/frontend/Dockerfile
+ # target: source
+ # tags: "${{env.GN_FRONTEND_TAGS}}-source"
+ # push: true
+
+ # - name: Build and export frontend nginx
+ # uses: docker/build-push-action@v4
+ # with:
+ # context: ./sources/GeoNature
+ # file: ./sources/GeoNature/frontend/Dockerfile
+ # target: prod-base
+ # tags: "${{env.GN_FRONTEND_TAGS}}-nginx"
+ # push: true
+
+ # - name: Build and export frontend + 4 modules
+ # uses: docker/build-push-action@v4
+ # with:
+ # context: .
+ # file: ./build/Dockerfile-geonature-frontend
+ # tags: "${{env.GN_FRONTEND_TAGS}}"
+ # build-args: GEONATURE_FRONTEND_IMAGE=${{env.GN_FRONTEND_IMAGE}}
+ # push: true
+
+ # - name: Build and export Usershub
+ # uses: docker/build-push-action@v4
+ # with:
+ # context: ./sources/UsersHub
+ # file: ./sources/UsersHub/Dockerfile
+ # tags: "${{env.UH_TAGS}}"
+ # push: true
+
+ # - name: Build and export TaxHub
+ # uses: docker/build-push-action@v4
+ # with:
+ # context: ./sources/TaxHub
+ # file: ./sources/TaxHub/Dockerfile
+ # tags: "${{env.TH_TAGS}}"
+ # push: true
+
+ # - name: Build and export GeoNature-atlas
+ # uses: docker/build-push-action@v4
+ # with:
+ # context: ./sources/GeoNature-atlas
+ # file: ./sources/GeoNature-atlas/Dockerfile
+ # tags: "${{env.ATLAS_TAGS}}"
+ # push: true
diff --git a/.gitignore b/.gitignore
index 205336c..930bc16 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,48 +1,35 @@
-
-# Created by https://www.gitignore.io/api/vim,visualstudiocode
-# Edit at https://www.gitignore.io/?templates=vim,visualstudiocode
-
-### Vim ###
-# Swap
-[._]*.s[a-v][a-z]
-[._]*.sw[a-p]
-[._]s[a-rt-v][a-z]
-[._]ss[a-gi-z]
-[._]sw[a-p]
-
-# Session
-Session.vim
-Sessionx.vim
-
-# Temporary
-.netrwhist
-*~
-# Auto-generated tag files
-tags
-# Persistent undo
-[._]*.un~
-
-### VisualStudioCode ###
-.vscode/*
-!.vscode/settings.json
-!.vscode/tasks.json
-!.vscode/launch.json
-!.vscode/extensions.json
-
-### VisualStudioCode Patch ###
-# Ignore all local history of files
-.history
-
-# End of https://www.gitignore.io/api/vim,visualstudiocode
-
.env
+*.save
+
+# data/services/ pour
+# les config
+# les repertoires custom et statics
+data/services/services.tar.gz
+data/services/traefik/certs/*
+data/services/postgres/backup/*
+data/services/geonature/config/*
+data/services/geonature/custom/*
+data/services/geonature/data/*
+data/services/geonature/media/*/*
+data/services/geonature/media/celerybeat-schedule.db
+data/services/taxhub/static/*
+data/services/taxhub/config/*
+data/services/taxhub/media/*
+data/services/usershub/config/*
+data/services/atlas/custom/*
+data/services/atlas/config/*
+
+# data/storage/ pour
+# les données bdd postgres
+# les données pgadmin
+data/storage/postgres
+data/storage/pgadmin/*
+data/storage/redis
+
+projects/*
+
+*.ini
+
+!**/.gitkeep
+docker-compose.override.yml
-dist
-settings.ini
-
-**/*.sql
-**/*.zip
-pgdata/**
-!pgdata/.gitkeep
-geonature_common/**
-!geonature_common/.gitkeep
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..30e08cc
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,26 @@
+[submodule "sources/GeoNature"]
+ path = sources/GeoNature
+ url = https://github.com/PnX-SI/GeoNature.git
+ branch = feat/docker2
+[submodule "sources/UsersHub"]
+ path = sources/UsersHub
+ url = https://github.com/PnX-SI/UsersHub.git
+[submodule "sources/TaxHub"]
+ path = sources/TaxHub
+ url = https://github.com/PnX-SI/TaxHub.git
+[submodule "sources/GeoNature-atlas"]
+ path = sources/GeoNature-atlas
+ url = https://github.com/PnX-SI/GeoNature-atlas.git
+ branch = feat/docker
+[submodule "sources/gn_module_import"]
+ path = sources/gn_module_import
+ url = https://github.com/PnX-SI/gn_module_import.git
+[submodule "sources/gn_module_export"]
+ path = sources/gn_module_export
+ url = https://github.com/PnX-SI/gn_module_export.git
+[submodule "sources/gn_module_dashboard"]
+ path = sources/gn_module_dashboard
+ url = https://github.com/PnX-SI/gn_module_dashboard.git
+[submodule "sources/gn_module_monitoring"]
+ path = sources/gn_module_monitoring
+ url = https://github.com/PnX-SI/gn_module_monitoring.git
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index f288702..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,674 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- 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 .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
diff --git a/README.md b/README.md
index 5f89f9f..ac2b70e 100644
--- a/README.md
+++ b/README.md
@@ -1,263 +1,167 @@
-# GeoNature-docker
+# GeoNature Docker Services
-Utilisation de Docker pour le déploiement de GeoNature dans le cadre d'un hébergement mutualisé (plusieurs instances GeoNature hébergées par sur un serveur commun).
+Dockerisation de geonature et d'application associées
-## Contributeurs
+## Les services
-Ce _portage_ de GeoNature sous Docker a été réalisé par le [BRGM](https://www.brgm.fr) dans le cadre de la convention BRGM/OFB.
+ - `postgres`
+ - `usershub`
+ - `taxhub`
+ - `geonature-backend`
+ - `geonature-frontend`
+ - `geonature-worker`: peut reprendre certaine tâches de geonature (import, export, mail, etc...)
+ - `redis`
-## Projets liés
+- `traefik`
-### Applications
-
-* [PnX-SI](https://github.com/PnX-SI) / [UsersHub](https://github.com/PnX-SI/UsersHub)
-* [PnX-SI](https://github.com/PnX-SI) / [TaxHub](https://github.com/PnX-SI/TaxHub)
-* [PnX-SI](https://github.com/PnX-SI) / [GeoNature](https://github.com/PnX-SI/GeoNature)
-* [PnX-SI](https://github.com/PnX-SI) / [GeoNature-atlas](https://github.com/PnX-SI/GeoNature-atlas)
-
-### Autres composants
-
-* [kartoza](https://github.com/kartoza) / [docker-postgis](https://github.com/kartoza/docker-postgis) : Base de données PostgreSQL + PostGIS
-* [pgAdmin](https://hub.docker.com/r/dpage/pgadmin4/) : Application d'interfaçage avec la base de données
-* [nginX](https://hub.docker.com/_/nginx/) : Reverse Proxy
-
-## Architecture
-
-```mermaid
- graph TD
- classDef label stroke-width:0;
- classDef node fill:white,stroke:black;
- nginx(nginX);
- pgadmin(PGAdmin);
- app(Geonature App);
- db(Geonature DB);
- nginx -- 80 --> pgadmin
- nginx -- "5000 (GeoNature)" --> app
- nginx -- "5001 (UsersHub)" --> app
- nginx -- "5002 (TaxHUb)" --> app
- nginx -- "8080 (Atlas)" --> app
- pgadmin -- 5432 --> db
- app -- 5432 --> db
```
-
-## Installation
-
-### Prérequis/Informations initiales
-
-#### Dépendances
-
-Ce projet nécessite l'installation préalable de:
-* [docker](https://docs.docker.com/engine/install/)
-* [git](https://git-scm.com/download/linux)
-* [docker-compose](https://docs.docker.com/compose/install/)
-
-_Dans notre exemple nous utiliserons un certain nombre d'assertions._
-
-* Le répertoire `/applications` est la base de notre environnement de travail.
-* Le répertoire `/applications/projets` contiendra les différents instances de GeoNature.
-* Le répertoire `/applications/geonature` contiendra le contenu du dépôt git de _GeoNature_.
-* Le répertoire `/applications/administration` contiendra les différents outils d'administration.
-
-#### Dépôt geonature
-
-* Dans le dépôt git, la branche à utiliser est `main`.
-* Dans le dépôt git, les sources sont dans le répertoire racine (celui où est situé ce `README.md`).
-
-### Etapes d'installation
-
-#### Cloner le dépôt _GeoNature-docker_ sur la machine
-
-
-```bash
-mkdir -p /applications
-
-cd /applications
-
-git clone https://github.com/PnX-SI/GeoNature-docker.git geonature
-
-### Actuellement le bon contenu est dans la branche "main", il faut donc se mettre dessus (si vous venez de checkout, ce sera le cas directement).
-cd geonature
-git checkout main
+SERVICE PORTS
+geonature-backend 8000/tcp
+geonature-frontend 80/tcp
+geonature-worker 8000/tcp
+postgres 0.0.0.0:5435->5432/tcp, :::5435->5432/tcp
+redis 6379/tcp
+taxhub 5000/tcp
+traefik 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:8889->8080/tcp, :::80->80/tcp, :::443->443/tcp, :::8889->8080/tcp
+usershub 5001/tcp
```
-#### Construire l'image GeoNature (facultatif)
-_Cette étape est facultative si l'image peut-être récupérée d'un registre Docker ou bien si le CI/CD du projet est mis en place._
+![Schéma des services](docs/schema_services_0.1.png)
-```bash
-### Dans le répertoire _app__, il faut adapter le nom du tag
-docker build --force-rm -t geonature:geonature-verified app/
-```
-#### Créer un répertoire pour le GeoNature que l'on veut déployer, par exemple en spécifiant votre domaine (remplacer `` par le nom de votre choix).
+## Utilisation
-```bash
-mkdir -p /applications/projets/
-```
+- rapatrier le dépôt
+- se placer dans le répertoire du dépôt
+- créer un fichier `.env` (copier ou s'inspirer des fichiers `.env` exemples)
+- créer les fichiers de configuration (vous pouver copier les fichiers de config *vide* d'un seul coup avec la commande `./scrits/init_applications_config.sh`)
+- lancer les dockers avec la commande `docker compose up -d`
+- les logs sont accessibles avec la commande `docker compose logs -f` ou `docker compose -f `
-#### Copier l'environnement
+## Configuration
-```bash
-cp /applications/geonature/env.sample /applications/projets//.env
-cp /applications/geonature/docker-compose.yaml /applications/projets//
-```
+Il y a deux moyen pour configurer les applications: les fichiers de configuration et les variables d'environnement.
-#### Editer l'environnement
+### Dossiers et fichiers
-```bash
-vim /applications/projets//.env
-```
+Par défaut, la structure des fichiers est la suivante
-_Exemple de configuration (dans cet exemple, une image déjà présente est utilisé, si vous avez construit l'image docker par vous même, indiquez ici son tag):_
-
-```properties
-POSTGRES_DB=geonature
-POSTGRES_USER=geonature_user
-POSTGRES_PASS=geonature
-PGDATA_DIR=/applications/projets/geonature.brgm-rec.fr/pgdata
-BOOTSTRAP_DIR=/applications/geonature/bootstrap_files
-GEONATURE_COMMON_DIR=/applications/projets/geonature.brgm-rec.fr/geonature_common
-GEONATURE_DOMAIN=geonature.brgm-rec.fr
-GEONATURE_PROTOCOL=https
-GEONATURE_IMAGE=geonature:geonature-verified
-NGINX_CONF=/applications/geonature/nginx.conf
-HTTP_PROXY=http://someproxy.loc.al:port
-PGADMIN_DEFAULT_EMAIL=user@domain.geonature_com
-PGADMIN_DEFAULT_PASSWORD=SuperSecret
-```
+``` bash
+./data
+ - services/ # fichiers de config, custom, medias, backup, etc ... des application
+ # destinés à être accessible et/ou modifiable par les utilisateur/administrateurs
-#### Créer le réseau permettant de gérer le _reverse proxy_
+ - geonature/
+ - config/ # dossier de configuration contenant `geonature_config.toml`, `occtax_config.toml`, etc...
+ - custom/ # dossier `custom` de geonature (surcharge le dossier `static`)
+ - media/ # dossier `media` de geonature
+ - data/ # dossier `data` (peux contenir les fichiers pour les données des référentiels (taxref, ref_geo, ref_nomenclature, etc....))
-```bash
-docker network create rpx_net
-```
+ - usershub/
+ - config/ # dossier contenant le fichier config.py
-#### Copier le répertoire _nginx-proxy_ où on veut gérer le proxy
+ - taxhub/
+ - config/ # dossier contenant le fichier config.py
+ - media/ # dossier des médias de taxhub
-```bash
-mkdir -p /applications/administration
+ - atlas
+ - config/ # dossier contenant le fichier config.py
+ - custom/ # dossier `custom de l'atlas (contient le style, les templates, les scripts js, etc...)
-cp nginx-proxy /applications/administration/nginx-proxy
+ - postgres
+ - backup/ # contient les fichier de sauvegarde de la bdd
+ - storage # stockage des dossiers nécessaire pour le fonctionnement
+ - postgres # dossier contenant la bdd
+ - pgadmin # ...
```
-#### Installer le service nginx-proxy
-
-_Vous pouvez aussi aller lire la documentation dans le répertoire nginx-proxy._
-
-```bash
-cp /applications/administration/nginx-proxy/nginx-proxy.service /etc/systemd/system
-systemctl daemon-reload
-systemctl enable nginx-proxy --now
-```
+Voir la documentation des différentes applications pour renseigner les fichiers de configuration
-#### Installer le service geonature
+- [fichier exemple pour GeoNature](./sources/GeoNature/config/geonature_config.toml.sample)
+- [fichier exemple pour UsersHub](./sources/UsersHub/config/config.py.sample)
+- [fichier exemple pour TaxHub](./sources/TaxHub/apptax/config.py.sample)
+- [fichier exemple pour GeoNature-atlas](./sources/GeoNature-atlas/atlas/configuration/config.py.sample)
-```bash
-### Copie de l'Unit
-cp /applications/geonature/geonature.service /etc/systemd/system/
+à noter que certaines variables seront fournies en tant que variables d'environnement (dans le fichier `.env` par exemple) (voir les fichiers [docker-compose](./docker-compose.yml))
-### Edition de l'Unit (au moins deux parties à modifier ##Geonature##)
-vim /etc/systemd/system/geonature.service
+comme par exemple:
+ - `URL_APPLICATION`
+ - `SQLALCHEMY_DATABASE_URI`
+ - `SECRET_KEY`
+### Variables d'environnement
-### Activation du service
-systemctl daemon-reload
-systemctl enable geonature --now
-```
+Ces variable peuvent être définie dans un fichier `.env`.
-## Mise à jour de la configuration
+#### Configuration des applications
-### Installer un module
+Il est possible de passer par les variables d'environnemnt pour configurer les applications.
-L'installation des modules se fait indépendamment dans chacune des instance. Il faut pour cela se connecter terminal du conteneur. Suivez ensuite la démarche habituelle d'installation du module. Ici un exemple avec le module [gn_module_dashboard](https://github.com/PnX-SI/gn_module_dashboard).
+Par exemple toutes les variables préfixée par `GEONATURE_` seront traduite par un configuration de l'application GéoNature (`USERSHUB_` pour usershub, et `TAXHUB_` pour taxhub) (voir https://flask.palletsprojects.com/en/2.2.x/api/#flask.Config.from_prefixed_env).
-```bash
-docker ps
-# On récupère le nom ou le hash du container de geonature pour lancer un exec dessus
-docker exec -it /bin/bash
+Par exemple:
+- `GEONATURE_SQLALCHEMY_DATABASE_URI` pour `app.config['SQLALCHEMY_DATABASE_URI']`
+- `GEONATURE_CELERY__broker_url` pour `app.config['GEONATURE_CELERY']['broker_url]`
-mkdir -p /geonature/gn_modules
-cd /geonature/gn_modules
+#### Configuration des services
-# Téléchargement, décompression et configuration du module
-wget https://github.com/PnX-SI/gn_module_dashboard/archive/0.2.0.zip
-unzip 0.2.0.zip
-mv gn_module_dashboard_0.2.0 gn_module_dashboard
+Voir les fichiers d'exemple:
-# Finalisation de l'installation du module
-# On initialize l'environnement virtuel python de GeoNature
-source /geonature/geonature/backend/venv/bin/activate
-# On installe le module GeoNature avec la commande : geonature install_gn_module
-geonature install_gn_module /geonature/gn_modules/gn_module_dashboard dashboard
+- [configuration de développement](./.env.dev.exemple)
-```
+- [configuration de production](./.env.prod.exemple)
-### Changement d'URL de l'application
+##### Quelques variables essentielles
-Si vous avez besoin de changer l'URL de l'application (changement de DNS, ou bien passage de http à https), il ne suffit pas de modifier le `.env` pour que celà fonctionne. En effet, les fichiers de configuration de l'application étant transformés pour le front et dans une moindre mesure pour la partie Python, il faut aussi modifier ces fichiers là.
+- `GDS_VERSION`: Version de GeoNature-Docker-services (donne la version des applications) (voir le fichier [changelog](./docs/changelog.md) pour le détails des versions des applications)
-#### Dans tous les cas
+- `DOMAIN`: nom de domaine des applications
-Modifiez le `.env` pour mettre à jour l'URL et le protocole. Ce fichier est quand même réutilisé pour créer les `settings.ini` des différentes applications.
+- `PROJECT_NAME`: (gds) nom du projet, se repercute sur le nom des container et des réseaux, peut être utile dans le cas de plusieurs instances hébergées sur un même serveur
-#### Configuration UsersHub
+- `APPLICATIONS_PREFIX`: preffixe de l'url de l'application (s'il n'est pas à la racine du nom de domaine)
-Modifiez le fichier `geonature_common/usershub/config/config.py` en remplaçant la valeur de la variable `URL_APPLICATION`.
+- `POSTGRES_USER`, `POSTGRES_PASSWORD`, `POSTGRES_HOST`, `POSTGRES_DB`, `POSTGRES_PORT`: paramètres d'accès à la bdd
-#### Configuration TaxHub
+## Package et versionnement
-_Taxhub_ n'utilise que le fichier `settings.ini`.
+Une actions permet la publication d'image dockers sur les packages du dépôt.
-#### Configuration GeoNature
+- `gds-geonature-backend:` (Geonature + 4 modules)
+- `gds-geonature-frontend:` (Geonature + 4 modules)
-Modifier le fichier `geonature_common/geonature/config/geonature_config.toml` en remplaçant les valeurs pour `URL_APPLICATION`, `API_ENDPOINT` et `API_TAXHUB`.
+La valeur de `VERSION` peut être:
-Ensuite, il faut lancer la mise à jour de la configuration à l'application.
+- `current`: branche *travail en cours*
+- `develop`: branche *develop* (un peu plus stable que current)
+- `main`: correspond à la dernière release
+- `1.1`: version releasée (voir le fichier [changelog](./docs/changelog.md) pour avoir le détails des applicaitons et des modules.
-```bash
-docker ps
-# On récupère le nom ou le hash du container de geonature pour lancer un exec dessus
-docker exec -it /bin/bash
-# Les commande suivantes sont à exécuter dans le container
-# On va dans le Frontend
-cd /geonature/geonature/frontend
-# On active npm (via nvm)
-nvm install
-nvm use
-# On va dans le Backend
-cd /geonature/geonature/backend
-# On active le venv Python et on lance la commande de mise à jour de la configuration
-source venv/bin/activate
-geonature update_configuration
-deactivate
-# On peut ensuite sortir du container (via CTRL+D ou autre)
-```
-#### Configuration Atlas
+### Liens utiles
+## Geonature
-_Atlas_ n'utilise que le fichier `settings.ini`.
+https://github.com/PnX-SI/GeoNature
-### Charger un dump
+- [`Dockerfile` backend](https://github.com/PnX-SI/GeoNature/blob/master/backend/Dockerfile)
+- [`Dockerfile` frontend](https://github.com/PnX-SI/GeoNature/blob/master/frontend/Dockerfile)
-#### Création de la base
+- [`Dockerfile` backend + 4 modules](./build/Dockerfile-geonature-backend)
+- [`Dockerfile` frontend + 4 modules](./build/Dockerfile-geonature-frontend)
-La base doit être créée avant côté PGAdmin.
-Il faut penser à ajouter les extensions _postgis_ et _postgis_raster_ **avant** de lancer la restauration.
+## UsersHub
-#### Upload du dump
+https://github.com/PnX-SI/UsersHub
-Le dump doit être placé sur le serveur.
+- [`Dockerfile`](https://github.com/PnX-SI/UsersHub/blob/master/Dockerfile)
-* Copier le dump dans `/applications/projet/votreprojetgeonature/geonature_common/dbdump`
-Il faut ensuite aller dans le container de _PGAdmin_ pour copier le dump dans le répertoire qui va bien (_A noter, il pourrait probablement être possible de monter un volume sur le répertoire qui va bien_).
+#### TaxHub
-* Se connecter au container `docker exec -it votreprojetgeonature_pgadmin_1_xxxxxxx /bin/sh`
-* Déplacer le dump `cp /geonature/geonature_common/dbdump/votre.dump /var/lib/pgadmin/storage/user_domain.com/`
+https://github.com/PnX-SI/Taxhub
-#### Lancement de la restauration
+- [`Dockerfile`](https://github.com/PnX-SI/TaxHub/blob/master/Dockerfile)
-Dans PGAdmin, sur votre nouvelle base, choisissez l'option _Restore_, choisissez le fichier (attention à bien afficher tous les types de fichiers). Dans les _Restore options_, cochez les _Do not save_ _Owner_ et _Privilege_.
-_Il peut y avoir quelques erreurs, vérifiez si elles sont graves ou non (les erreurs de création de comptes ne sont pas graves)._
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..8a9ecc2
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+0.0.1
\ No newline at end of file
diff --git a/app/Dockerfile b/app/Dockerfile
deleted file mode 100644
index 7584a3e..0000000
--- a/app/Dockerfile
+++ /dev/null
@@ -1,49 +0,0 @@
-FROM debian:buster
-
-LABEL maintainer="BRGM"
-
-RUN dpkg-divert --local --rename --add /sbin/initctl
-
-RUN DEBIAN_FRONTEND=noninteractive apt-get -y update \
- && apt-get -y upgrade \
- && apt-get -y install gnupg2 wget ca-certificates rpl pwgen sudo supervisor \
- python3 python3-dev python3-setuptools python3-pip libpq-dev \
- libgdal-dev python-gdal python-virtualenv build-essential \
- python3-wheel python3-cffi libcairo2 libpango-1.0-0 libpangocairo-1.0-0 \
- libgdk-pixbuf2.0-0 libffi-dev shared-mime-info \
- postgresql-client logrotate wait-for-it \
- locales locales-all unzip git libsm6 libxext6 libxrender-dev \
- curl software-properties-common \
- && ln -s /usr/bin/pip3 /usr/local/bin/pip \
- && apt-get clean
-
-RUN locale-gen fr_FR.UTF-8
-ENV LANG fr_FR.UTF-8
-ENV LANGUAGE fr_FR:fr
-ENV LC_ALL fr_FR.UTF-8
-
-RUN pip3 install --upgrade pip virtualenv virtualenvwrapper
-ADD ./utils.lib.sh /usr/local/
-
-ADD ./launch_app.sh /
-RUN chmod a+rx /launch_app.sh /usr/local/utils.lib.sh
-
-RUN mkdir /home/geonatureadmin \
- && useradd -s /bin/bash -G sudo geonatureadmin \
- && chown -R geonatureadmin. /home/geonatureadmin
-
-RUN echo "geonatureadmin ALL = (ALL) NOPASSWD: ALL" > /etc/sudoers.d/geonatureadmin
-
-ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf
-
-RUN mkdir /geonature /bootstrap_files /mnt_bootstrap_files && chown geonatureadmin. /geonature /bootstrap_files
-VOLUME /geonature
-VOLUME /mnt_bootstrap_files
-
-USER geonatureadmin
-
-RUN cp /etc/skel/.bashrc /etc/skel/.bash_logout /etc/skel/.profile /home/geonatureadmin/ \
- && pip install MarkupSafe==1.0
-RUN wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
-
-ENTRYPOINT ["/launch_app.sh"]
diff --git a/app/README.md b/app/README.md
deleted file mode 100644
index 53ba2df..0000000
--- a/app/README.md
+++ /dev/null
@@ -1,14 +0,0 @@
-# Geonature > app
-
-## How to build this Dockerfile ?
-
-Just be sure you are in this directory, and then:
-
-```bash
-GEONATURE_IMAGE_NAME="geonature:` with a valid version number...
-
-If you have a private Docker registry, you can also push it.
diff --git a/app/launch_app.sh b/app/launch_app.sh
deleted file mode 100644
index 81e89a7..0000000
--- a/app/launch_app.sh
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/bash
-script_home_dir=/geonature
-mnt_bootstrap_dir=/mnt_bootstrap_files
-bootstrap_dir=/bootstrap_files
-geonature_user=geonatureadmin
-cd $script_home_dir
-
-verbose=1
-
-. /usr/local/utils.lib.sh
-# . config/settings.ini
-
-BASE_DIR=$(readlink -e "${0%/*}")
-
-_verbose_echo "${green}launch_app - ${nocolor}Droits sur le répertoire ${script_home_dir}"
-sudo chown -R ${geonature_user}. ${script_home_dir}
-
-_verbose_echo "${green}launch_app - ${nocolor}Attente de la base de données..."
-wait_for_restart db:5432
-
-## Start supervisor
-_verbose_echo "${green}launch_app - ${nocolor}Copie de la conf de supervisor (si existe)"
-mkdir -p ${script_home_dir}/sysfiles/supervisor
-sudo cp ${script_home_dir}/sysfiles/supervisor/*.conf /etc/supervisor/conf.d/
-
-_verbose_echo "${green}launch_app - ${nocolor}Copie des scripts du volume vers ${bootstrap_dir} et droits"
-sudo cp -R ${mnt_bootstrap_dir}/* ${bootstrap_dir}/
-sudo chmod -R a+rx ${bootstrap_dir}
-
-_verbose_echo "${green}launch_app - ${nocolor}Vérifie si on doit lancer supervisor en tâche de fond"
-if [[ ! -f /$script_home_dir/sysfiles/usershub_installed ]] || [[ ! -f /$script_home_dir/sysfiles/taxhub_installed ]] || [[ ! -f /$script_home_dir/sysfiles/geonature_installed ]] || [[ ! -f /$script_home_dir/sysfiles/atlas_installed ]]; then
- _verbose_echo "${green}launch_app - ${nocolor}Lancement de supervisor en tâche de fond"
- sudo /usr/bin/supervisord &
-
- _verbose_echo "${green}launch_app - ${nocolor}Vérification des installations des applications"
- if [[ ! -f /$script_home_dir/sysfiles/usershub_installed ]]; then
- _verbose_echo "${green}launch_app - ${nocolor}Installation d'Usershub nécessaire"
- /bin/bash ${bootstrap_dir}/scripts/uh-install.sh
- fi
- if [[ ! -f /$script_home_dir/sysfiles/taxhub_installed ]]; then
- _verbose_echo "${green}launch_app - ${nocolor}Installation de TaxHub nécessaire"
- /bin/bash ${bootstrap_dir}/scripts/th-install.sh
- fi
- if [[ ! -f /$script_home_dir/sysfiles/geonature_installed ]]; then
- _verbose_echo "${green}launch_app - ${nocolor}Installation de GeoNature nécessaire"
- /bin/bash ${bootstrap_dir}/scripts/gn-install.sh
- fi
- if [[ ! -f /$script_home_dir/sysfiles/atlas_installed ]]; then
- _verbose_echo "${green}launch_app - ${nocolor}Installation d'Atlas nécessaire"
- /bin/bash ${bootstrap_dir}/scripts/ga-install.sh
- fi
- _verbose_echo "${green}launch_app - ${nocolor}Arrêt de supervisor en tâche de fond"
- sudo supervisorctl stop all
- sleep 5
- sudo supervisorctl shutdown
- sleep 5
-fi
-
-if [[ ! -z $1 ]]; then
- _verbose_echo "${green}launch_app - ${nocolor}Lancement d'un bash"
- /bin/bash -c $1
-else
- _verbose_echo "${green}launch_app - ${nocolor}Relacement de supervisor en tâche principale"
- sudo /usr/bin/supervisord
-fi
diff --git a/app/supervisord.conf b/app/supervisord.conf
deleted file mode 100644
index 54296b8..0000000
--- a/app/supervisord.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-[supervisord]
-nodaemon=true
diff --git a/app/utils.lib.sh b/app/utils.lib.sh
deleted file mode 100644
index d94ff15..0000000
--- a/app/utils.lib.sh
+++ /dev/null
@@ -1,154 +0,0 @@
-#!/bin/bash
-
-## This is meant to be used as a lib, nothing is actually executable in here
-
-## a few usefull vars
-## Colors
-blue='\e[0;34m'
-green='\e[0;32m'
-orange='\e[0;33m'
-red='\e[0;31m'
-nocolor='\e[0m'
-
-## exit status codes
-STATUS_OK=0
-STATUS_WARN=1
-STATUS_CRITICAL=2
-
-## Verbose function
-function _verbose
-{
- if [[ $verbose -eq 1 ]]; then
- no_log=0
- if [[ -z $log_file ]]; then
- echo -e "${orange}Warning: log file undefined${nocolor}"
- exit $STATUS_WARN
- fi
- if [[ ! -f ${log_file} ]]; then
- mkdir -p $(dirname $log_file)
- touch $log_file
- fi
- if [[ ! -w ${log_file} ]]; then
- echo -e "${orange}Warning: cannot write to ${log_file}${nocolor}"
- no_log=1
- fi
- if [[ $no_log -eq 1 ]]; then
- _verbose_echo $1
- else
-
- echo -e $1 | tee -a $log_file
- fi
- fi
-}
-## verbose (echo only)
-function _verbose_echo
-{
- if [[ $verbose -eq 1 ]]; then
- echo -e $1
- fi
-}
-
-## double check that a tcp port is open to connection
-function wait_for_restart
-{
- service_connection=$1
- if [[ "x$1" = "x" ]]; then
- service_connection='localhost:22'
- fi
- timeout=$2
- if [[ "x$2" = "x" ]]; then
- timeout=300
- fi
- sleep_time=$3
- if [[ "x$3" = "x" ]]; then
- sleep_time=5s
- fi
-
- wait-for-it -t ${timeout} ${service_connection}
- if [[ $? -ne 0 ]]; then
- exit 1
- fi
- _verbose_echo "Waiting ${sleep_time} before checking again"
- sleep $sleep_time
- wait-for-it -t ${timeout} ${service_connection}
- if [[ $? -ne 0 ]]; then
- exit 1
- fi
-}
-
-## Downloader function
-function downloader
-{
- ## finding destination directory create it if not found
- dest_dir="/data"
- if [[ ! -z $1 ]]; then
- dest_dir=$1
- fi
- mkdir -p $dest_dir
- ## overriding file list name if provided
- if [[ ! -z $2 && -f $2 ]]; then
- file_list=$2
- else
- file_list="${dest_dir}/download-list.txt"
- fi
- ## should we auto unzip zipped files
- auto_unzip=1
- if [[ ! -z $3 && $3 -eq 1 ]]; then
- auto_unzip=0
- fi
-
- if [[ ! -f $file_list ]]; then
- exit $STATUS_WARN
- fi
-
- ## looping on file list
- for item in $(cat ${file_list} | grep -v '^#'); do
-
- i=${item##*/}
- ## if item doesnot exists: download it
- if [ ! -f "${dest_dir}/$i" ]; then
- _verbose "Download $item to ${dest_dir}/$i"
- wget -q $item -P ${dest_dir}
- else
- _verbose "${dest_dir}/$i already exists"
- fi
-
- ## auto unzip if necessary and wanted
- if [[ $auto_unzip -eq 1 ]]; then
- filename=$(basename -- "$item")
- extension="${filename##*.}"
- filename="${filename%.*}"
-
- if [[ $extension = 'zip' && ! -f "${dest_dir}/$i.unzipped" ]]; then
- unzip -nq ${dest_dir}/$i -d ${dest_dir}
- touch "${dest_dir}/$i.unzipped"
- fi
- fi
- done
-}
-
-# Do we need the proxy
-function enable_proxy
-{
- if [[ ${USE_PROXY} -eq 1 ]]; then
- export http_proxy=${PROXY_ADDRESS}
- export https_proxy=${PROXY_ADDRESS}
- export HTTP_PROXY=${PROXY_ADDRESS}
- export HTTPS_PROXY=${PROXY_ADDRESS}
- fi
-}
-
-# wait for a file to be written
-function wait_for_file
-{
- file_to_wait=$1
- wait_message="Waiting for ${file_to_wait}"
- repeat_timer=30
- if [[ ! -z $2 ]]; then
- repeat_timer=$2
- fi
- if [[ ! -z $3 ]]; then
- wait_message=$3
- fi
- while [ ! -f $file_to_wait ]; do sleep $repeat_timer; echo "${wait_message}"; done
-}
diff --git a/assets/atlas/healthcheck.sh b/assets/atlas/healthcheck.sh
new file mode 100755
index 0000000..cd5fa9e
--- /dev/null
+++ b/assets/atlas/healthcheck.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+# docker healthcheck ATLAS
+url_test=http://localhost:8080${ATLAS_APPLICATION_ROOT}/
+if [ ! -f /tmp/container_healthy ]; then
+ curl --noproxy localhost -f "${url_test}" || exit 1
+ touch /tmp/container_healthy
+fi
\ No newline at end of file
diff --git a/assets/geonature/entrypoint_worker.sh b/assets/geonature/entrypoint_worker.sh
new file mode 100755
index 0000000..56901c9
--- /dev/null
+++ b/assets/geonature/entrypoint_worker.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+pip install watchdog || true
+$@
\ No newline at end of file
diff --git a/assets/geonature/healthcheck_backend.sh b/assets/geonature/healthcheck_backend.sh
new file mode 100755
index 0000000..2b375b1
--- /dev/null
+++ b/assets/geonature/healthcheck_backend.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+# docker healthcheck GN backend
+
+url_test=http://localhost:8000${GEONATURE_BACKEND_PREFIX}/gn_commons/config
+if [ ! -f /tmp/container_healthy ]; then
+ curl --noproxy localhost -f "${url_test}" || exit 1
+ touch /tmp/container_healthy
+fi
diff --git a/assets/geonature/healthcheck_frontend.sh b/assets/geonature/healthcheck_frontend.sh
new file mode 100755
index 0000000..1006d2e
--- /dev/null
+++ b/assets/geonature/healthcheck_frontend.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+# docker healthcheck GN frontend
+url_test=http://localhost:80${NGINX_LOCATION}/
+if [ ! -f /tmp/container_healthy ]; then
+ curl --noproxy localhost -f "${url_test}" || exit 1
+ touch /tmp/container_healthy
+fi
\ No newline at end of file
diff --git a/assets/postgres/init_db/add_pg_extensions.sql b/assets/postgres/init_db/add_pg_extensions.sql
new file mode 100644
index 0000000..1fac8f7
--- /dev/null
+++ b/assets/postgres/init_db/add_pg_extensions.sql
@@ -0,0 +1,20 @@
+CREATE EXTENSION IF NOT EXISTS "hstore";
+CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
+CREATE EXTENSION IF NOT EXISTS "pg_trgm";
+CREATE EXTENSION IF NOT EXISTS "unaccent";
+
+-- postgis
+
+CREATE EXTENSION IF NOT EXISTS "postgis";
+
+-- check if postgis_raster is available
+DO
+$$
+BEGIN
+ IF EXISTS (
+ SELECT name FROM PG_CATALOG.PG_AVAILABLE_EXTENSIONS WHERE name = 'postgis_raster'
+ ) THEN
+ CREATE EXTENSION IF NOT EXISTS "postgis_raster";
+ END IF;
+END
+$$
\ No newline at end of file
diff --git a/assets/postgres/scripts/backup.sh b/assets/postgres/scripts/backup.sh
new file mode 100755
index 0000000..97774b0
--- /dev/null
+++ b/assets/postgres/scripts/backup.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+#
+# Crée un dump de la base geonature
+# Renseigne le fichier log avec la date de backup
+# et la taille du fichier non compressé
+
+echo "+-------------------------------+"
+echo "| Database backup |"
+echo "+-------------------------------+"
+
+# - 1 )logs (start)
+log_file_global=/backup/backup.log
+
+date_start=$(date '+%Y-%m-%d_%H-%M-%S')
+date_jour=$(date '+%Y-%m-%d_%H-%M-%S')
+log_line_start="${date_start} -> ... (en cours)"
+echo $log_line_start >> $log_file_global
+
+
+# - 2 )creation du backup
+
+backup_file=/backup/geonature_backup.sql
+
+export PGPASSWORD=${POSTGRES_PASS}
+pg_dump --format=plain \
+ --create \
+ --no-owner --no-acl \
+ -d ${POSTGRES_DB} -h localhost -U ${POSTGRES_USER} \
+ > $backup_file
+
+# - compression du backup
+tar cvfz ${backup_file}_${date_jour}.tar.gz ${backup_file}
+
+# - on regarde la taille du backup non compressé (pour les logs)
+size_h_backup=$(ls -lh $backup_file | awk '{print $5}')
+size_backup=$(ls -l $backup_file | awk '{print $5}')
+
+# - suppression du fichier non compressé
+rm ${backup_file}
+
+# - 3) log (end)
+date_end=$(date '+%Y-%m-%d_%H-%M-%S')
+log_line_end="${date_start} -> ${date_end} : $size_h_backup ($size_backup)"
+sed -i "s/${log_line_start}.*/${log_line_end}/" $log_file_global
+tail -n 1 $log_file_global
+
+# rotation des fichiers
+# on garde les 5 derniers dumps ?
+files_to_remove=$(ls /backup/geonature_backup* | sort -r | awk 'NR > 5 { print $1}')
+
+if [ ! -z "${files_to_remove}" ]; then
+ echo rm ${files_to_remove}
+ rm ${files_to_remove}
+fi
\ No newline at end of file
diff --git a/assets/postgres/scripts/docker_healthcheck.sh b/assets/postgres/scripts/docker_healthcheck.sh
new file mode 100755
index 0000000..a6bf03f
--- /dev/null
+++ b/assets/postgres/scripts/docker_healthcheck.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+if [ ! -f /tmp/container_healthy ]; then
+ export PGPASSWORD=${POSTGRES_PASSWORD}
+ # test if pg_trgm is installed
+ psql -d ${POSTGRES_DB} -U ${POSTGRES_USER} -c "SELECT similarity('a', 'b')" || exit 1;
+ touch /tmp/container_healthy
+fi
+exit 0
+
diff --git a/assets/postgres/scripts/refresh_atlas.sh b/assets/postgres/scripts/refresh_atlas.sh
new file mode 100755
index 0000000..dcf9d9f
--- /dev/null
+++ b/assets/postgres/scripts/refresh_atlas.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# Met à jour la vue de l'atlas
+# Et renseigne les logs sur la bonne execution de la tâche
+
+echo "+--------------------------------------+"
+echo "| atlas.refresh_materialized_view_data |"
+echo "+--------------------------------------+"
+
+date_start=$(date '+%Y-%m-%d_%H-%M-%S')
+
+# - fichiers de logs
+log_file_global=/backup/refresh_atlas.log
+
+log_line_start="${date_start} -> ... (en cours)"
+echo $log_line_start >> $log_file_global
+
+# - détails de l'action en cours
+log_file_detail=/backup/refresh_atlas_${date_start}.log
+
+# requete sql atlas.refresh_materialized_view_data();
+
+export PGPASSWORD=${POSTGRES_PASS}
+psql -U ${POSTGRES_USER} -d ${POSTGRES_DB} -h localhost -c "SELECT atlas.refresh_materialized_view_data();" > $log_file_detail 2>&1
+
+if grep 'ERR' $log_file_detail; then
+ echo fail
+ result="fail"
+else
+ rm -f $log_file_detail
+fi
+
+# log de fin de l'action
+
+date_end=$(date '+%Y-%m-%d_%H-%M-%S')
+log_line_end="${date_start} -> ${date_end} ${result}"
+sed -i "s/${log_line_start}.*/${log_line_end}/" $log_file_global
diff --git a/assets/taxhub/healthcheck.sh b/assets/taxhub/healthcheck.sh
new file mode 100755
index 0000000..8c264b6
--- /dev/null
+++ b/assets/taxhub/healthcheck.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+# docker healthcheck TH
+url_test=http://localhost:5000${TAXHUB_APPLICATION_ROOT}/
+if [ ! -f /tmp/container_healthy ]; then
+ curl --noproxy localhost -f "${url_test}" || exit 1
+ touch /tmp/container_healthy
+fi
\ No newline at end of file
diff --git a/assets/usershub/healthcheck.sh b/assets/usershub/healthcheck.sh
new file mode 100755
index 0000000..d869f90
--- /dev/null
+++ b/assets/usershub/healthcheck.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+# docker healthcheck UH
+url_test=http://localhost:5001${USERSHUB_APPLICATION_ROOT}/login
+if [ ! -f /tmp/container_healthy ]; then
+ curl --noproxy localhost -f "${url_test}" || exit 1
+ touch /tmp/container_healthy
+fi
\ No newline at end of file
diff --git a/bootstrap_files/ga.settings.ini b/bootstrap_files/ga.settings.ini
deleted file mode 100644
index 04305a3..0000000
--- a/bootstrap_files/ga.settings.ini
+++ /dev/null
@@ -1,161 +0,0 @@
-
-# GeoNature-atlas
-# PostgreSQL database settings
-#.................................
-
-# Effacer la base de données existante lors de l'installation
-drop_apps_db=false
-
-# Host de la base de données de l'application
-db_host=db
-
-# Port pour base de données de l'application
-db_port=5432
-
-# Nom de la base de données de l'application
-db_name=${POSTGRES_DB}
-
-# Nom de l'utilisateur BDD, utilisé par l'application, lecteur des vues matérialisées uniquement
-user_pg=${POSTGRES_USER}
-
-# Nom du propriétaire de la BDD, utilisé pour créer et mettre à jour la BDD
-owner_atlas=${POSTGRES_USER}
-
-# Password de l'utilisateur de l'application
-user_pg_pass=${POSTGRES_PASS}
-
-# Password du propriétaire de la BDD
-owner_atlas_pass=${POSTGRES_PASS}
-
-# GeoNature-atlas est-il connecté à une BDD GeoNature ?
-geonature_source=true
-# Version de GeoNature utilisée 1 ou 2
-geonature_version=2
-# Est-ce que l'atlas utilise une BDD GeoNature distante (en FDW) ou non (local) ?
-# true : base de données distante
-geonature_fdw=false
-
-################################################
-##### CONNEXION A LA BDD GEONATURE SOURCE ######
-################################################
-# Necessaire uniquement si on veut se connecter à la BDD source GeoNature en foreign data wrapper
-# Si vous n'utilisez pas GeoNature, vous pouvez vous inspirer du fichier data/atlas_geonature.sql
-# pour vous connecter à une autre BDD mère
-
-# Host de la BDD GeoNature source
-db_source_host=db
-
-# Port de la BDD GeoNature source
-db_source_port=5432
-
-# Nom de la BDD GeoNature source
-db_source_name=geonature
-
-# Nom de l'utilisateur atlas dans la BDD GeoNature source (lecture seule)
-atlas_source_user=geonature
-
-# Pass de l'utilisateur atlas dans la BDD GeoNature source (lecture seule)
-atlas_source_pass=geonature
-
-
-#############################
-### Données GEOGRAPHIQUES ###
-#############################
-
-# L'atlas est-il en lien avec le référentiel géographique de GeoNature v2 (ref_geo) ?
-use_ref_geo_gn2=true
-
-########### Si ref_geo = true ############
-
-# Voir la colonne type_code de la table ref_geo.bib_areas_type
-# Indiquer le code des entités géographiques du ref_geo qui correspondent respectivement aux mailles et aux limites de votre territoire
-# Les données doivent préalablement être présentes dans le ref_geo
-type_maille="'M1'"
-type_territoire="'PEC'"
-
-########### Si ref_geo = False #############
-
-#### COMMUNES ####
-
-# Creer la table des communes à partir d'un shapefile ?
-# Si false, modifiez la creation de 'atlas.vm_communes' dans data/atlas.sql
-import_commune_shp=true
-
-# Chemin et nom des colonnes du SHP des communes du territoire. Laisser tel quel (en modifiant uniquement MYUSERLINUX)
-# pour utiliser les communes du PnEcrins par défaut
-communes_shp=/home/`whoami`/atlas/data/ref/communes.shp
-colonne_insee=insee
-colonne_nom_commune=nom_com
-
-#### TERRITOIRE ####
-
-# Chemin vers le SHP de l'emprise du territoire
-limit_shp=/home/`whoami`/atlas/data/ref/territoire.shp
-
-##### MAILLES #####
-
-# Mon territoire se situe en métropole ? Dans ce cas, on utilise les mailles fournies par l'INPN
-metropole=true
-
-# Choisissez alors la taille de vos mailles à utiliser (en km) / Valeurs possibles 1, 5 ou 10
-taillemaille=5
-
-# Si 'metropole=false', rajoutez dans le dossier /data/ref un SHP des mailles de votre territoire et renseignez son chemin
-chemin_custom_maille=/home/`whoami`/atlas/data/ref/custom_maille.shp
-
-# Altitudes
-# lister les valeurs des classes d'altitudes
-# si non spécifié les valeurs par défaut seront (0 500 1000 1500 2000 2500 3000 3500 4000)
-altitudes=(0 500 1000 1500 2000 2500 3000 3500 4000)
-
-############################
-### Données TAXONOMIQUES ###
-############################
-
-# Installer le schéma taxonomie de TaxHub dans la BDD de GeoNature-atlas ? (false si geonature_source=true car le schéma taxonomie est installé en FDW)
-install_taxonomie=false
-
-# Version de TaxHub à utiliser pour installer le schéma taxonomie
-# GeoNature-atlas 1.4.0 est compatible avec les versions de Taxhub superieur ou égale à 1.3.2
-# Numéro de version conseillée et testée : 1.6.3
-taxhub_release=1.6.3
-
-#### ID DES TYPES DES ATTRIBUTS DECRIVANT LES TAXONS DANS atlas.vm_cor_taxon_attribut --
-## !! si changement: modifier également dans main/configuration/config.py
-attr_desc=100
-attr_commentaire=101
-attr_milieu=102
-attr_chorologie=103
-
-# Paramètre pour la vue atlas.vm_taxons_plus_observes
-# Especes les plus observées sur la periode 'moins X jour, plus X jours par rapport à la date du jour, toutes années confondues'
-# 15 jours par défaut
-time=15
-
-##################################################
-########## Paramatre administrateur avancé #######
-##################################################
-
-# Ne modifier que si vous savez ce que vous faites
-
-#######################
-### Supervisor settings
-#######################
-
-app_name=atlas
-
-#####################
-### Gunicorn settings
-#####################
-
-gun_num_workers=4
-gun_host=0.0.0.0
-gun_port=8080
-
-####################
-### Python settings
-####################
-
-venv_dir=venv
-# L'atlas est compatible avec Python 3, préferez donc l'utilisation de Python 3.X
-python_executable=/usr/bin/python3
diff --git a/bootstrap_files/gn.settings.ini b/bootstrap_files/gn.settings.ini
deleted file mode 100644
index c7f163a..0000000
--- a/bootstrap_files/gn.settings.ini
+++ /dev/null
@@ -1,108 +0,0 @@
-# Langue du serveur
-# valeur possible : fr_FR.UTF-8, en_US.utf8
-# locale -a pour voir la liste des locales disponible
-my_local=fr_FR.UTF-8
-
-# URL Configuration
-###################
-
-# URL of the server must end with /
-my_url=${GEONATURE_PROTOCOL}://${GEONATURE_DOMAIN}/
-
-
-# PostgreSQL Configuration
-##########################
-
-# Drop eventual existing database during installation
-drop_apps_db=false
-
-# DB host
-# Attention les scripts d'installation automatique (install_db.sh et install_all.sh) ne fonctionneront
-# que si votre BDD est installée en local (localhost). Si vous souhaitez installer votre BDD sur un autre serveur,
-# les scripts n'auront pas les droits suffisants pour créer la BDD sur un autre serveur et cela devra être fait manuellement.
-db_host=db
-
-# PostgreSQL port
-db_port=5432
-
-# GeoNature database name
-db_name=${POSTGRES_DB}
-
-# GeoNature database owner username
-user_pg=${POSTGRES_USER}
-
-# GeoNature database owner password
-user_pg_pass=${POSTGRES_PASS}
-
-# Local projection SRID
-srid_local=2154
-
-# default language (locale)
-# availaible language value : fr
-default_language=fr
-
-# Permet l'installation des couches SIG des communes
-# Seules les couches de métropole en 2154 sont fournies (false conseillé hors métropole)
-install_sig_layers=true
-
-# Installe les grilles INPN (1, 5 et 10km)
-install_grid_layer=true
-
-# Install default French DEM (Mainland France only - BD alti 250m))
-install_default_dem=true
-
-# Vectorise dem raster for more performance. This will increse installation duration and take more disk space
-vectorise_dem=false
-
-# Insert sample data (available only in Mainland France with srid_local=2154 ; false otherwise)
-add_sample_data=true
-
-#### Modules GeoNature ####
-
-# Installer le module validation
-install_module_validation=true
-# Installer le module Occurrence d'habitat
-install_module_occhab=true
-
-
-# Taxonomy, Users and Nomenclatures configuration
-#################################################
-
-# Les scripts SQL de création des schémas 'utilisateurs', 'taxonomie' et 'nomenclature' de GeoNature sont téléchargés depuis le dépôt github des projets UsersHub et TaxHub
-# Les trois paramètres ci-dessous visent à indiquer dans quelle version (release, branche ou tag) les scripts doivent être récupérés
-
-# Est ce que le schéma utilisateurs doit être installé ? (mettre à 'non' que si vos avez un schéma utilisateur dans une autre BDD et que vous avez déjàmis en place un mecanisme de foreign data wrapper)
-install_usershub_schema=true
-# Définir dans quelle version de UsersHub (release, branche ou tag) prendre le code SQL permettant la création du schéma utilisateurs de la base de données de GeoNature
-usershub_release=2.1.3
-
-# Définir dans quelle version de TaxHub (release, branche ou tag) prendre le code SQL permettant la création du schéma taxonomie de la base de données de GeoNature
-taxhub_release=1.7.3
-
-# Définir dans quelle version de Habref-api-module (release, branche ou tag) prendre le code SQL permettant la création du schéma ref_habitats de la base de données de GeoNature
-habref_api_release=0.1.4
-
-# Définir dans quelle version du sous-module des nomenclatures (release, branche ou tag) prendre le code SQL permettant la création du schéma 'ref_nomenclatures' de la base de données GeoNature
-nomenclature_release=1.3.4
-
-#Proxy - si le serveur sur lequel se trouve GeoNature se trouve derrière un proxy
-# laisser vide si vous n'avez pas de proxy
-proxy_http=
-proxy_https=
-
-
-#Configuration python
-###########################
-python_path=/usr/bin/python3
-
-
-#####################
-### Gunicorn settings
-#####################
-
-app_name=geonature2
-venv_dir=venv
-gun_num_workers=4
-gun_host=0.0.0.0
-gun_port=8000
-gun_timeout=30
diff --git a/bootstrap_files/scripts/ga-install.sh b/bootstrap_files/scripts/ga-install.sh
deleted file mode 100644
index 908ac83..0000000
--- a/bootstrap_files/scripts/ga-install.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash
-
-script_home_dir=/geonature
-bootstrap_dir=/bootstrap_files
-verbose=1
-
-GA_VERSION="1.4.1"
-export GA_HOME=${script_home_dir}/atlas
-
-. /usr/local/utils.lib.sh
-
-cd $script_home_dir
-
-_verbose_echo "${orange}Début d'installation de Géonature Atlas!${nocolor}"
-
-## Geonature Atlas
-wget -q "https://github.com/PnX-SI/GeoNature-atlas/archive/${GA_VERSION}.zip"
-unzip -q "${GA_VERSION}.zip"
-mv GeoNature-atlas-${GA_VERSION} ${GA_HOME}/
-cp ${bootstrap_dir}/ga.settings.ini ${GA_HOME}/atlas/configuration/settings.ini
-
-
-
-## Install Geonature Atlas
-cd ${GA_HOME}/
-mkdir -p log var/log
-touch test.log
-
-
-
-
-cp ${bootstrap_dir}/scripts/ga-install_db.sh .
-/bin/bash ./ga-install_db.sh
-
-./install_app.sh
-
-sudo cp /etc/supervisor/conf.d/*.conf ${script_home_dir}/sysfiles/supervisor/
-touch ${script_home_dir}/sysfiles/atlas_installed
-
-_verbose_echo "${orange}Fin d'installation de Géonature Atlas!${nocolor}"
diff --git a/bootstrap_files/scripts/ga-install_db.sh b/bootstrap_files/scripts/ga-install_db.sh
deleted file mode 100644
index 3015da6..0000000
--- a/bootstrap_files/scripts/ga-install_db.sh
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/bash
-
-. /usr/local/utils.lib.sh
-
-verbose=1
-mkdir -p ${GA_HOME}/tmp/atlas
-
-#include user config = settings.ini
-. ${GA_HOME}/atlas/configuration/settings.ini
-
-LOG_DIR=${GA_HOME}/var/log
-
-export PGPASSWORD=$user_pg_pass
-
-cd ${GA_HOME}
-
-_verbose_echo "${green}GeoNature-Atlas - ${nocolor}Création du schéma atlas..."
-psql -h $db_host -U $user_pg -d $db_name -c "CREATE SCHEMA atlas;" &>> $LOG_DIR/install_db.log
-_verbose_echo "${green}GeoNature-Atlas - ${nocolor}Création du schéma synthese..."
-psql -h $db_host -U $user_pg -d $db_name -c "CREATE SCHEMA synthese;" &>> $LOG_DIR/install_db.log
-
-_verbose_echo "${green}GeoNature-Atlas - ${nocolor}Création de vues de remplacement du FDW dans synthese..."
-psql -h $db_host -U $user_pg -d $db_name -c "CREATE VIEW synthese.t_nomenclatures AS SELECT * FROM ref_nomenclatures.t_nomenclatures;" &>> $LOG_DIR/install_db.log
-psql -h $db_host -U $user_pg -d $db_name -c "CREATE VIEW synthese.bib_nomenclatures_types AS SELECT * FROM ref_nomenclatures.bib_nomenclatures_types;" &>> $LOG_DIR/install_db.log
-psql -h $db_host -U $user_pg -d $db_name -c "CREATE VIEW synthese.synthese AS SELECT * FROM gn_synthese.synthese;" &>> $LOG_DIR/install_db.log
-psql -h $db_host -U $user_pg -d $db_name -c "CREATE VIEW synthese.cor_area_synthese AS SELECT * FROM gn_synthese.cor_area_synthese;" &>> $LOG_DIR/install_db.log
-
-_verbose_echo "${green}GeoNature-Atlas - ${nocolor}Creation des table géographiques à partir du schéma ref_geo de la base geonature"
-psql -h $db_host -U $user_pg -d $db_name -v type_maille=$type_maille -v type_territoire=$type_territoire -f data/gn2/atlas_ref_geo.sql &>> $LOG_DIR/install_db.log
-
-# Conversion des limites du territoire en json (de la génération de fichier pour ??? dans l'install de la base???)
-
-_verbose_echo "${green}GeoNature-Atlas - ${nocolor}Création de la structure de la BDD..."
-psql -h $db_host -U $user_pg -d $db_name -f data/gn2/atlas_synthese.sql &>> $LOG_DIR/install_db.log
-
-_verbose_echo "${green}GeoNature-Atlas - ${nocolor}Création des vues materialisées"
-cp data/atlas.sql tmp/atlas/atlas.sql
-sed -i "s/WHERE id_attribut IN (100, 101, 102, 103);$/WHERE id_attribut IN (${attr_desc}, ${attr_commentaire}, ${attr_milieu}, ${attr_chorologie});/g" tmp/atlas/atlas.sql
-sed -i "s/date - 15$/date - $time/g" tmp/atlas/atlas.sql
-sed -i "s/date + 15$/date - $time/g" tmp/atlas/atlas.sql
-
-_verbose_echo "${green}GeoNature-Atlas - ${nocolor}Customisation de l'altitude"
-insert=""
-for i in "${!altitudes[@]}"
-do
- if [ $i -gt 0 ];
- then
- let max=${altitudes[$i]}-1
- sql="INSERT INTO atlas.bib_altitudes VALUES ($i,${altitudes[$i-1]},$max);"
- insert="${insert}\n${sql}"
- fi
-done
-sed -i "s/INSERT_ALTITUDE/${insert}/g" tmp/atlas/atlas.sql
-psql -h $db_host -U $user_pg -d $db_name -f tmp/atlas/atlas.sql &>> $LOG_DIR/install_db.log
-
-_verbose_echo "${green}GeoNature-Atlas - ${nocolor}Création de la VM des observations de chaque taxon par mailles..."
-psql -h $db_host -U $user_pg -d $db_name -f data/observations_mailles.sql &>> $LOG_DIR/install_db.log
-
-# TODO: Read only user
diff --git a/bootstrap_files/scripts/gn-install.sh b/bootstrap_files/scripts/gn-install.sh
deleted file mode 100644
index ae7b4a5..0000000
--- a/bootstrap_files/scripts/gn-install.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash
-
-script_home_dir=/geonature
-bootstrap_dir=/bootstrap_files
-verbose=1
-
-GN_VERSION="2.5.5"
-export GN_HOME=${script_home_dir}/geonature
-
-. /usr/local/utils.lib.sh
-
-cd $script_home_dir
-
-_verbose_echo "${orange}Début d'installation de Geonature!${nocolor}"
-
-## GeoNature
-wget -q "https://github.com/PnX-SI/GeoNature/archive/${GN_VERSION}.zip"
-unzip -q "${GN_VERSION}.zip"
-mv GeoNature-${GN_VERSION} ${GN_HOME}/
-cp ${bootstrap_dir}/gn.settings.ini ${GN_HOME}/config/settings.ini
-
-
-
-## Install Geonature
-cd ${GN_HOME}
-mkdir -p log var/log tmp
-touch test.log
-touch var/log/gn_errors.log
-
-cd install
-cp ${bootstrap_dir}/scripts/raster.zip .
-cp ${bootstrap_dir}/scripts/gn-install_db.sh .
-/bin/bash ./gn-install_db.sh
-
-./install_app.sh
-
-sudo cp /etc/supervisor/conf.d/*.conf ${script_home_dir}/sysfiles/supervisor/
-touch ${script_home_dir}/sysfiles/geonature_installed
-
-_verbose_echo "${orange}Fin d'installation de Geonature!${nocolor}"
\ No newline at end of file
diff --git a/bootstrap_files/scripts/gn-install_db.sh b/bootstrap_files/scripts/gn-install_db.sh
deleted file mode 100644
index d010c79..0000000
--- a/bootstrap_files/scripts/gn-install_db.sh
+++ /dev/null
@@ -1,232 +0,0 @@
-#!/bin/bash
-
-. /usr/local/utils.lib.sh
-
-verbose=1
-mkdir -p ${GN_HOME}/tmp/{geonature,taxhub,nomenclatures,usershub}
-
-#include user config = settings.ini
-. ${GN_HOME}/config/settings.ini
-
-LOG_DIR=${GN_HOME}/var/log
-
-export PGPASSWORD=$user_pg_pass
-
-cd ${GN_HOME}
-
-# Mise en place de la structure de la base et des données permettant son fonctionnement avec l'application
-_verbose_echo "${green}Geonature - ${nocolor}Mise en place de la structure de la base et des données permettant son fonctionnement avec l'application"
-cp data/grant.sql tmp/geonature/grant.sql
-sed -i "s/MYPGUSER/$user_pg/g" tmp/geonature/grant.sql
-psql -h $db_host -U $user_pg -d $db_name -f tmp/geonature/grant.sql &>> $LOG_DIR/install_db.log
-
-_verbose_echo "${green}Geonature - ${nocolor}Creating 'public' functions..."
-psql -h $db_host -U $user_pg -d $db_name -f data/core/public.sql &>> $LOG_DIR/install_db.log
-
-# insert geonature data for usershub
-psql -h $db_host -U $user_pg -d $db_name -f data/utilisateurs/adds_for_usershub.sql &>> $LOG_DIR/install_db.log
-
-_verbose_echo "${green}Geonature - ${nocolor}Download and extract habref file..."
-if [ ! -d 'tmp/habref/' ]
-then
- mkdir tmp/habref
-fi
-if [ ! -f 'tmp/habref/HABREF_50.zip' ]
-then
- wget -q https://geonature.fr/data/inpn/habitats/HABREF_50.zip -P tmp/habref
-else
- _verbose_echo "${green}Geonature - ${nocolor} HABREF_40.zip exists"
-fi
-unzip -q tmp/habref/HABREF_50.zip -d tmp/habref
-
-wget -q https://raw.githubusercontent.com/PnX-SI/Habref-api-module/$habref_api_release/src/pypn_habref_api/data/habref.sql -P tmp/habref
-wget -q https://raw.githubusercontent.com/PnX-SI/Habref-api-module/$habref_api_release/src/pypn_habref_api/data/data_inpn_habref.sql -P tmp/habref
-
-# sed to replace /tmp/taxhub to ~//tmp.taxhub
-sed -i 's#'/tmp/habref'#'${GN_HOME}/tmp/habref'#g' tmp/habref/data_inpn_habref.sql
-
-_verbose_echo "${green}Geonature - ${nocolor}Creating 'habitat' schema..."
-psql -h $db_host -U $user_pg -d $db_name -f tmp/habref/habref.sql &>> $LOG_DIR/install_db.log
-
-_verbose_echo "${green}Geonature - ${nocolor}Inserting INPN habitat data..."
-psql -h $db_host -U $user_pg -d $db_name -f tmp/habref/data_inpn_habref.sql &>> $LOG_DIR/install_db.log
-
-_verbose_echo "${green}Geonature - ${nocolor}Getting 'nomenclature' schema creation scripts..."
-wget -q https://raw.githubusercontent.com/PnX-SI/Nomenclature-api-module/$nomenclature_release/data/nomenclatures.sql -P tmp/nomenclatures
-wget -q https://raw.githubusercontent.com/PnX-SI/Nomenclature-api-module/$nomenclature_release/data/data_nomenclatures.sql -P tmp/nomenclatures
-wget -q https://raw.githubusercontent.com/PnX-SI/Nomenclature-api-module/$nomenclature_release/data/nomenclatures_taxonomie.sql -P tmp/nomenclatures
-wget -q https://raw.githubusercontent.com/PnX-SI/Nomenclature-api-module/$nomenclature_release/data/data_nomenclatures_taxonomie.sql -P tmp/nomenclatures
-
-_verbose_echo "${green}Geonature - ${nocolor}Creating 'nomenclatures' schema"
-
-psql -h $db_host -U $user_pg -d $db_name -f tmp/nomenclatures/nomenclatures.sql &>> $LOG_DIR/install_db.log
-psql -h $db_host -U $user_pg -d $db_name -f tmp/nomenclatures/nomenclatures_taxonomie.sql &>> $LOG_DIR/install_db.log
-
-_verbose_echo "${green}Geonature - ${nocolor}Inserting 'nomenclatures' data..."
-
-sed -i "s/MYDEFAULTLANGUAGE/$default_language/g" tmp/nomenclatures/data_nomenclatures.sql
-psql -h $db_host -U $user_pg -d $db_name -f tmp/nomenclatures/data_nomenclatures.sql &>> $LOG_DIR/install_db.log
-psql -h $db_host -U $user_pg -d $db_name -f tmp/nomenclatures/data_nomenclatures_taxonomie.sql &>> $LOG_DIR/install_db.log
-
-_verbose_echo "${green}Geonature - ${nocolor}Creating 'commons' schema..."
-cp data/core/commons.sql tmp/geonature/commons.sql
-sed -i "s/MYLOCALSRID/$srid_local/g" tmp/geonature/commons.sql
-psql -h $db_host -U $user_pg -d $db_name -f tmp/geonature/commons.sql &>> $LOG_DIR/install_db.log
-
-_verbose_echo "${green}Geonature - ${nocolor}Creating 'meta' schema..."
-psql -h $db_host -U $user_pg -d $db_name -f data/core/meta.sql &>> $LOG_DIR/install_db.log
-
-_verbose_echo "${green}Geonature - ${nocolor}Creating 'ref_geo' schema..."
-cp data/core/ref_geo.sql tmp/geonature/ref_geo.sql
-sed -i "s/MYLOCALSRID/$srid_local/g" tmp/geonature/ref_geo.sql
-psql -h $db_host -U $user_pg -d $db_name -f tmp/geonature/ref_geo.sql &>> $LOG_DIR/install_db.log
-
-if [ "$install_sig_layers" = true ];
-then
- _verbose_echo "${green}Geonature - ${nocolor}Insert default French municipalities (IGN admin-express)"
- if [ ! -f 'tmp/geonature/communes_fr_admin_express_2020-02.zip' ]
- then
- wget -q http://geonature.fr/data/ign/communes_fr_admin_express_2020-02.zip -P tmp/geonature
- else
- _verbose_echo "${green}Geonature - ${nocolor}tmp/geonature/communes_fr_admin_express_2020-02.zip already exist"
- fi
- unzip -q tmp/geonature/communes_fr_admin_express_2020-02.zip -d tmp/geonature
-
- # L'utilisateur geonatadmin n'existe pas et entraine une erreur (non bloquante) inutile.
- sed -i "s/geonatadmin/$user_pg/g" tmp/geonature/fr_municipalities.sql
- psql -h $db_host -U $user_pg -d $db_name -f tmp/geonature/fr_municipalities.sql &>> $LOG_DIR/install_db.log
-
- _verbose_echo "${green}Geonature - ${nocolor}Restore $user_pg owner"
- psql -h $db_host -U $user_pg -d $db_name -c "ALTER TABLE ref_geo.temp_fr_municipalities OWNER TO $user_pg;" &>> $LOG_DIR/install_db.log
- _verbose_echo "${green}Geonature - ${nocolor}Insert data in l_areas and li_municipalities tables"
- psql -h $db_host -U $user_pg -d $db_name -f data/core/ref_geo_municipalities.sql &>> $LOG_DIR/install_db.log
- _verbose_echo "${green}Geonature - ${nocolor}Drop french municipalities temp table"
- psql -h $db_host -U $user_pg -d $db_name -c "DROP TABLE ref_geo.temp_fr_municipalities;" &>> $LOG_DIR/install_db.log
-
- _verbose_echo "${green}Geonature - ${nocolor}Insert departements"
- if [ ! -f 'tmp/geonature/departement_admin_express_2020-02.zip' ]
- then
- wget -q http://geonature.fr/data/ign/departement_admin_express_2020-02.zip -P tmp/geonature
- else
- _verbose_echo "${green}Geonature - ${nocolor}tmp/geonature/departement_admin_express_2020-02.zip already exist"
- fi
- unzip tmp/geonature/departement_admin_express_2020-02.zip -d tmp/geonature
-
- sed -i "s/geonatadmin/$user_pg/g" tmp/geonature/fr_departements.sql
- psql -h $db_host -U $user_pg -d $db_name -f tmp/geonature/fr_departements.sql &>> $LOG_DIR/install_db.log
-
- _verbose_echo "${green}Geonature - ${nocolor}Restore $user_pg owner"
- psql -h $db_host -U $user_pg -d $db_name -c "ALTER TABLE ref_geo.temp_fr_departements OWNER TO $user_pg;" &>> $LOG_DIR/install_db.log
- _verbose_echo "${green}Geonature - ${nocolor}Insert data in l_areas table"
- psql -h $db_host -U $user_pg -d $db_name -f data/core/ref_geo_departements.sql &>> $LOG_DIR/install_db.log
- _verbose_echo "${green}Geonature - ${nocolor}Drop french departements temp table"
- psql -h $db_host -U $user_pg -d $db_name -c "DROP TABLE ref_geo.temp_fr_departements;" &>> $LOG_DIR/install_db.log
-fi
-
-if [ "$install_grid_layer" = true ];
-then
- _verbose_echo "${green}Geonature - ${nocolor}Insert INPN grids"
- if [ ! -f 'tmp/geonature/inpn_grids.zip' ]
- then
- wget -q https://geonature.fr/data/inpn/layers/2020/inpn_grids.zip -P tmp/geonature
- else
- _verbose_echo "${green}Geonature - ${nocolor}tmp/geonature/inpn_grids.zip already exist"
- fi
- unzip -q tmp/geonature/inpn_grids.zip -d tmp/geonature
- sed -i 's#^COPY#\\COPY#g' tmp/geonature/inpn_grids.sql
- _verbose_echo "${green}Geonature - ${nocolor}Insert grid layers... (This may take a few minutes)"
- psql -h $db_host -U $user_pg -d $db_name -f tmp/geonature/inpn_grids.sql &>> $LOG_DIR/install_db.log
- _verbose_echo "${green}Geonature - ${nocolor}Restore $user_pg owner"
- psql -h $db_host -U $user_pg -d $db_name -c "ALTER TABLE ref_geo.temp_grids_1 OWNER TO $user_pg;" &>> $LOG_DIR/install_db.log
- psql -h $db_host -U $user_pg -d $db_name -c "ALTER TABLE ref_geo.temp_grids_5 OWNER TO $user_pg;" &>> $LOG_DIR/install_db.log
- psql -h $db_host -U $user_pg -d $db_name -c "ALTER TABLE ref_geo.temp_grids_10 OWNER TO $user_pg;" &>> $LOG_DIR/install_db.log
- _verbose_echo "${green}Geonature - ${nocolor}Insert data in l_areas and li_grids tables"
- psql -h $db_host -U $user_pg -d $db_name -f data/core/ref_geo_grids.sql &>> $LOG_DIR/install_db.log
-fi
-
-if [ "$install_default_dem" = true ];
-then
- _verbose_echo "${green}Geonature - ${nocolor}Insert default French DEM (IGN 250m BD alti)"
-
- ### Ne fonctionne pas sur notre image docker ==> Solution de rechange...
- # if [ ! -f 'tmp/geonature/BDALTIV2_2-0_250M_ASC_LAMB93-IGN69_FRANCE_2017-06-21.zip' ]
- # then
- # wget -q http://geonature.fr/data/ign/BDALTIV2_2-0_250M_ASC_LAMB93-IGN69_FRANCE_2017-06-21.zip -P tmp/geonature
- # else
- # echo "tmp/geonature/BDALTIV2_2-0_250M_ASC_LAMB93-IGN69_FRANCE_2017-06-21.zip already exist"
- # fi
- # unzip -q tmp/geonature/BDALTIV2_2-0_250M_ASC_LAMB93-IGN69_FRANCE_2017-06-21.zip -d tmp/geonature
- # #gdalwarp -t_srs EPSG:$srid_local tmp/geonature/BDALTIV2_250M_FXX_0098_7150_MNT_LAMB93_IGN69.asc tmp/geonature/dem.tif &>> $LOG_DIR/install_db.log
- # raster2pgsql -s $srid_local -c -C -I -M -d -t 5x5 tmp/geonature/BDALTIV2_250M_FXX_0098_7150_MNT_LAMB93_IGN69.asc ref_geo.dem|psql -h $db_host -U $user_pg -d $db_name &>> $LOG_DIR/install_db.log
- ### Solution de rechange... on génère le sql ailleurs et on l'importe ici...
- unzip -q install/raster.zip
- psql -h $db_host -U $user_pg -d $db_name -f raster.sql &>> $LOG_DIR/install_db.log
- rm -f raster.sql install/raster.zip
-
- #echo "Refresh DEM spatial index. This may take a few minutes..."
- psql -h $db_host -U $user_pg -d $db_name -c "REINDEX INDEX ref_geo.dem_st_convexhull_idx;" &>> $LOG_DIR/install_db.log
- if [ "$vectorise_dem" = true ];
- then
- _verbose_echo "${green}Geonature - ${nocolor}Vectorisation of DEM raster. This may take a few minutes..."
- psql -h $db_host -U $user_pg -d $db_name -c "INSERT INTO ref_geo.dem_vector (geom, val) SELECT (ST_DumpAsPolygons(rast)).* FROM ref_geo.dem;" &>> $LOG_DIR/install_db.log
-
- _verbose_echo "${green}Geonature - ${nocolor}Refresh DEM vector spatial index. This may take a few minutes..."
- psql -h $db_host -U $user_pg -d $db_name -c "REINDEX INDEX ref_geo.index_dem_vector_geom;" &>> $LOG_DIR/install_db.log
- fi
-fi
-
-_verbose_echo "${green}Geonature - ${nocolor}Creating 'imports' schema..."
-psql -h $db_host -U $user_pg -d $db_name -f data/core/imports.sql &>> $LOG_DIR/install_db.log
-
-_verbose_echo "${green}Geonature - ${nocolor}Creating 'synthese' schema..."
-cp data/core/synthese.sql tmp/geonature/synthese.sql
-sed -i "s/MYLOCALSRID/$srid_local/g" tmp/geonature/synthese.sql
-psql -h $db_host -U $user_pg -d $db_name -f tmp/geonature/synthese.sql &>> $LOG_DIR/install_db.log
-psql -h $db_host -U $user_pg -d $db_name -f data/core/synthese_default_values.sql &>> $LOG_DIR/install_db.log
-
-_verbose_echo "${green}Geonature - ${nocolor}Creating commons view depending of synthese"
-psql -h $db_host -U $user_pg -d $db_name -f data/core/commons_synthese.sql &>> $LOG_DIR/install_db.log
-
-_verbose_echo "${green}Geonature - ${nocolor}Creating 'exports' schema..."
-psql -h $db_host -U $user_pg -d $db_name -f data/core/exports.sql &>> $LOG_DIR/install_db.log
-
-_verbose_echo "${green}Geonature - ${nocolor}Creating 'monitoring' schema..."
-psql -h $db_host -U $user_pg -d $db_name -v MYLOCALSRID=$srid_local -f data/core/monitoring.sql &>> $LOG_DIR/install_db.log
-
-_verbose_echo "${green}Geonature - ${nocolor}Creating 'permissions' schema"
-psql -h $db_host -U $user_pg -d $db_name -f data/core/permissions.sql &>> $LOG_DIR/install_db.log
-
-_verbose_echo "${green}Geonature - ${nocolor}Insert 'permissions' data"
-psql -h $db_host -U $user_pg -d $db_name -f data/core/permissions_data.sql &>> $LOG_DIR/install_db.log
-
-psql -h $db_host -U $user_pg -d $db_name -f data/core/sensitivity.sql &>> $LOG_DIR/install_db.log
-
-_verbose_echo "${green}Geonature - ${nocolor}Insert 'gn_sensitivity' data"
-if [ ! -f 'tmp/geonature/referentiel_donnees_sensibles_v13.csv' ]
- then
- wget -q https://geonature.fr/data/inpn/sensitivity/referentiel_donnees_sensibles_v13.csv -P tmp/geonature
- mv tmp/geonature/referentiel_donnees_sensibles_v13.csv tmp/geonature/referentiel_donnees_sensibles.csv
- else
- _verbose_echo "${green}Geonature - ${nocolor}tmp/geonature/referentiel_donnees_sensibles_v13.csv already exist"
-fi
-cp data/core/sensitivity_data.sql tmp/geonature/sensitivity_data.sql
-sed -i 's#'/tmp/geonature'#'${GN_HOME}/tmp/geonature'#g' tmp/geonature/sensitivity_data.sql
-_verbose_echo "${green}Geonature - ${nocolor}Insert 'gn_sensitivity' data... (This may take a few minutes)"
-psql -h $db_host -U $user_pg -d $db_name -f tmp/geonature/sensitivity_data.sql &>> $LOG_DIR/install_db.log
-
-#Installation des données exemples
-if [ "$add_sample_data" = true ];
-then
- _verbose_echo "${green}Geonature - ${nocolor}Inserting sample datasets..."
- psql -h $db_host -U $user_pg -d $db_name -f data/core/meta_data.sql &>> $LOG_DIR/install_db.log
-fi
-
-# if [ "$install_default_dem" = true ];
-# then
-# rm tmp/geonature/BDALTIV2_250M_FXX_0098_7150_MNT_LAMB93_IGN69.asc
-# rm tmp/geonature/IGNF_BDALTIr_2-0_ASC_250M_LAMB93_IGN69_FRANCE.html
-# fi
-
-# # Suppression des fichiers : on ne conserve que les fichiers compressés
-# echo "Cleaning files..."
-# find ${GN_HOME}/tmp ! -name "*.zip" -exec rm -f {} +
diff --git a/bootstrap_files/scripts/th-install.sh b/bootstrap_files/scripts/th-install.sh
deleted file mode 100644
index 47efcdf..0000000
--- a/bootstrap_files/scripts/th-install.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash
-
-script_home_dir=/geonature
-bootstrap_dir=/bootstrap_files
-verbose=1
-
-TH_VERSION="1.7.3"
-export TH_HOME=${script_home_dir}/taxhub
-
-. /usr/local/utils.lib.sh
-
-cd $script_home_dir
-
-_verbose_echo "${orange}Début d'installation de TaxHub!${nocolor}"
-
-## TaxHub
-wget -q "https://github.com/PnX-SI/TaxHub/archive/${TH_VERSION}.zip"
-unzip -q "${TH_VERSION}.zip"
-mv TaxHub-${TH_VERSION} ${TH_HOME}/
-cp ${bootstrap_dir}/th.settings.ini ${TH_HOME}/settings.ini
-
-. ${TH_HOME}/settings.ini
-
-## Install TaxHub
-cd ${TH_HOME}
-mkdir -p log var/log
-touch var/log/tets.log
-
-
-
-
-cp ${bootstrap_dir}/scripts/th-install_db.sh .
-/bin/bash ./th-install_db.sh
-
-./install_app.sh
-
-sudo cp /etc/supervisor/conf.d/*.conf ${script_home_dir}/sysfiles/supervisor/
-touch ${script_home_dir}/sysfiles/taxhub_installed
-
-_verbose_echo "${orange}Fin d'installation de TaxHub!${nocolor}"
diff --git a/bootstrap_files/scripts/th-install_db.sh b/bootstrap_files/scripts/th-install_db.sh
deleted file mode 100644
index 421ec9f..0000000
--- a/bootstrap_files/scripts/th-install_db.sh
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/bin/bash
-
-. /usr/local/utils.lib.sh
-
-verbose=1
-mkdir -p ${TH_HOME}/{tmp/taxhub,var/log/installdb}
-
-#include user config = settings.ini
-. ${TH_HOME}/settings.ini
-
-LOG_DIR=${TH_HOME}/var/log
-
-export PGPASSWORD=$user_pg_pass
-
-cd ${TH_HOME}
-
-_verbose_echo "${green}Taxhub - ${nocolor}Création de la structure de la base..."
-psql -h $db_host -U $user_pg -d $db_name -f data/taxhubdb.sql &> $LOG_DIR/installdb/install_db.log
-
-_verbose_echo "${green}Taxhub - ${nocolor}Décompression des fichiers du taxref..."
-
-array=( TAXREF_INPN_v13.zip ESPECES_REGLEMENTEES_v11.zip LR_FRANCE_20160000.zip BDC_STATUTS_13.zip )
-for i in "${array[@]}"
-do
- if [ ! -f '${TH_HOME}/tmp/taxhub/'$i ]
- then
- wget -q http://geonature.fr/data/inpn/taxonomie/$i -P ${TH_HOME}/tmp/taxhub
- unzip -q ${TH_HOME}/tmp/taxhub/$i -d ${TH_HOME}/tmp/taxhub
- else
- _verbose_echo $i exists
- fi
-done
-
-_verbose_echo "${green}Taxhub - ${nocolor}Insertion des données taxonomiques de l'inpn... (cette opération peut être longue)"
-cd ${TH_HOME}
-sed -i "s#/tmp#${TH_HOME}/tmp#g" data/inpn/data_inpn_taxhub.sql
-psql -h $db_host -U $user_pg -d $db_name -f data/inpn/data_inpn_taxhub.sql &>> $LOG_DIR/installdb/install_db.log
-
-_verbose_echo "${green}Taxhub - ${nocolor}Création de la vue représentant la hierarchie taxonomique..."
-psql -h $db_host -U $user_pg -d $db_name -f data/materialized_views.sql &>> $LOG_DIR/installdb/install_db.log
-
-_verbose_echo "${green}Taxhub - ${nocolor}Insertion de données de base"
-psql -h $db_host -U $user_pg -d $db_name -f data/taxhubdata.sql &>> $LOG_DIR/installdb/install_db.log
-
-if $insert_geonatureatlas_data
-then
- _verbose_echo "${green}Taxhub - ${nocolor}Insertion de données nécessaires à GeoNature-atlas"
- psql -h $db_host -U $user_pg -d $db_name -f data/taxhubdata_atlas.sql &>> $LOG_DIR/installdb/install_db.log
-fi
-
-if $insert_attribut_example
-then
- _verbose_echo "${green}Taxhub - ${nocolor}Insertion d'un exemple d'attribut"
- psql -h $db_host -U $user_pg -d $db_name -f data/taxhubdata_example.sql &>> $LOG_DIR/installdb/install_db.log
-fi
-
-if $insert_taxons_example
-then
- _verbose_echo "${green}Taxhub - ${nocolor}Insertion de 8 taxons exemple"
- psql -h $db_host -U $user_pg -d $db_name -f data/taxhubdata_taxons_example.sql &>> $LOG_DIR/installdb/install_db.log
-fi
-
-if $insert_geonaturev1_data
-then
- _verbose_echo "${green}Taxhub - ${nocolor}Insertion de données nécessaires à GeoNature V1"
- psql -h $db_host -U $user_pg -d $db_name -f data/taxhubdata_geonaturev1.sql &>> $LOG_DIR/installdb/install_db.log
-fi
-
-if $insert_geonaturev1_data && $insert_taxons_example
-then
- _verbose_echo "${green}Taxhub - ${nocolor}Insertion des 8 taxons exemple aux listes nécessaires à GeoNature V1"
- psql -h $db_host -U $user_pg -d $db_name -f data/taxhubdata_taxons_example_geonaturev1.sql &>> $LOG_DIR/installdb/install_db.log
-fi
-
-_verbose_echo "${green}Taxhub - ${nocolor}Modification du schema 'utilisateurs'"
-psql -h $db_host -U $user_pg -d $db_name -f data/adds_for_usershub.sql &>> $LOG_DIR/installdb/install_db.log
-psql -h $db_host -U $user_pg -d $db_name -f data/adds_for_usershub_views.sql &>> $LOG_DIR/installdb/install_db.log
diff --git a/bootstrap_files/scripts/uh-install.sh b/bootstrap_files/scripts/uh-install.sh
deleted file mode 100644
index df6dee2..0000000
--- a/bootstrap_files/scripts/uh-install.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash
-
-script_home_dir=/geonature
-bootstrap_dir=/bootstrap_files
-verbose=1
-
-UH_VERSION="2.1.3"
-export UH_HOME=${script_home_dir}/usershub
-
-. /usr/local/utils.lib.sh
-
-cd $script_home_dir
-
-_verbose_echo "${orange}Début d'installation de UsersHub!${nocolor}"
-
-## UserHub
-wget -q "https://github.com/PnX-SI/UsersHub/archive/${UH_VERSION}.zip"
-unzip -q "${UH_VERSION}.zip"
-mv UsersHub-${UH_VERSION} ${UH_HOME}/
-cp ${bootstrap_dir}/uh.settings.ini ${UH_HOME}/config/settings.ini
-
-. ${UH_HOME}/config/settings.ini
-
-## Install UserHub
-cd ${UH_HOME}/
-mkdir -p log var/log
-touch var/log/test.log
-
-
-
-
-cp ${bootstrap_dir}/scripts/uh-install_db.sh .
-/bin/bash ./uh-install_db.sh
-
-./install_app.sh
-
-sudo cp /etc/supervisor/conf.d/*.conf ${script_home_dir}/sysfiles/supervisor/
-touch ${script_home_dir}/sysfiles/usershub_installed
-
-_verbose_echo "${orange}Fin d'installation de UsersHub!${nocolor}"
diff --git a/bootstrap_files/scripts/uh-install_db.sh b/bootstrap_files/scripts/uh-install_db.sh
deleted file mode 100644
index cb13b72..0000000
--- a/bootstrap_files/scripts/uh-install_db.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-
-. /usr/local/utils.lib.sh
-
-verbose=1
-mkdir -p ${UH_HOME}/{tmp/usershub,var/log/installdb}
-
-#include user config = settings.ini
-. ${UH_HOME}/config/settings.ini
-
-LOG_DIR=${UH_HOME}/var/log
-
-export PGPASSWORD=$user_pg_pass
-
-cd ${UH_HOME}
-
-_verbose_echo "${green}Usershub - ${nocolor}Création du schéma utilisateur..."
-psql -h $db_host -U $user_pg -d $db_name -f data/usershub.sql &>> $LOG_DIR/installdb/install_db.log
-if $insert_minimal_data
- then
- ## Insert minimal data
- _verbose_echo "${green}Usershub - ${nocolor}Insertion des données minimum..."
- psql -h $db_host -U $user_pg -d $db_name -f data/usershub-data.sql &>> $LOG_DIR/installdb/install_db.log
-fi
-if $insert_sample_data
- then
- ## Insert sample data
- _verbose_echo "${green}Usershub - ${nocolor}Insertion des données exemples..."
- psql -h $db_host -U $user_pg -d $db_name -f data/usershub-dataset.sql &>> $LOG_DIR/installdb/install_db.log
-fi
diff --git a/bootstrap_files/th.settings.ini b/bootstrap_files/th.settings.ini
deleted file mode 100644
index 7ab16aa..0000000
--- a/bootstrap_files/th.settings.ini
+++ /dev/null
@@ -1,70 +0,0 @@
-##########################################
-###### TAXHUB installation settings ######
-##########################################
-
-app_name=taxhub
-
-#######################
-### Python settings ###
-#######################
-
-venv_dir=venv
-python_path=/usr/bin/python3
-
-###########################
-### PostgreSQL settings ###
-###########################
-
-# Drop eventual existing database during installation
-drop_apps_db=false
-
-# DB host
-db_host=db
-
-# PostgreSQL port
-db_port=5432
-
-# Database name
-db_name=${POSTGRES_DB}
-
-# Database owner username
-user_pg=${POSTGRES_USER}
-
-# Database owner password
-user_pg_pass=${POSTGRES_PASS}
-
-### Users schema localisation
-# Possible values : 'local' or 'foreign'
-# 'local' means that the 'utilisateurs' schema has to be installed in TaxHub database.
-# 'foreign' means that the 'utilisateurs' schema is in another database. An FDW schema will be created on it.
-# Nota : foreign requires UsersHub to be already installed
-usershub_release=uhv2
-users_schema=local
-
-### UsersHub relation settings - Required if users_schema=foreign
-usershub_host=localhost
-usershub_db=geonature
-usershub_port=5432
-usershub_user=geonature
-usershub_pass=geonature
-
-###############
-### Options ###
-###############
-
-# Insert GeoNature-atlas data (theme & attributs)
-insert_geonatureatlas_data=true
-# Insert an example of attribute (Migrateur)
-insert_attribut_example=false
-# Insert 8 examples of taxons and add it to the Occtax list
-insert_taxons_example=true
-# Insert GeoNature V1 required data (1 theme, 2 attributes & 18 lists)
-insert_geonaturev1_data=false
-
-#########################
-### Gunicorn settings ###
-#########################
-
-gun_num_workers=4
-gun_host=0.0.0.0
-gun_port=5000
diff --git a/bootstrap_files/uh.settings.ini b/bootstrap_files/uh.settings.ini
deleted file mode 100644
index 9e0402e..0000000
--- a/bootstrap_files/uh.settings.ini
+++ /dev/null
@@ -1,45 +0,0 @@
-###########################
-### PostgreSQL settings ###
-###########################
-
-# Effacer la base de donnée existante lors de l'installation
-drop_apps_db=false
-# Host de la base de données de l'application
-db_host=db
-# Port du serveur PostgreSQL
-pg_port=5432
-# Nom de la base de données de l'application
-db_name=${POSTGRES_DB}
-# Nom de l'utilisateur propriétaire de la BDD de l'application
-user_pg=${POSTGRES_USER}
-# User propriétaire de la BDD de l'application
-user_pg_pass=${POSTGRES_PASS}
-# Intégrer les données minimales (Applications et tags)
-insert_minimal_data=true
-# Intégrer les données exemple (Role, groupe, organismes et correspondances)
-insert_sample_data=true
-
-############################
-### Application settings ###
-############################
-
-# URL de l'application
-url_application=${GEONATURE_PROTOCOL}://${GEONATURE_DOMAIN}/usershub
-
-
-#######################
-### Python settings ###
-#######################
-
-# Notice: n'est compatible qu'avec python3
-python_path=/usr/bin/python3
-
-#########################
-### Gunicorn settings ###
-#########################
-
-app_name=usershub2
-venv_dir=venv
-gun_num_workers=4
-gun_host=0.0.0.0
-gun_port=5001
diff --git a/build/Dockerfile-geonature-backend b/build/Dockerfile-geonature-backend
new file mode 100644
index 0000000..4d58684
--- /dev/null
+++ b/build/Dockerfile-geonature-backend
@@ -0,0 +1,42 @@
+ARG GEONATURE_BACKEND_IMAGE
+
+FROM python:3.11-bookworm AS build
+
+ENV PIP_ROOT_USER_ACTION=ignore
+RUN --mount=type=cache,target=/root/.cache \
+ pip install --upgrade pip setuptools wheel
+
+
+FROM build AS build-import
+WORKDIR /build/
+COPY ./sources/gn_module_import .
+RUN python setup.py bdist_wheel
+
+FROM build AS build-export
+WORKDIR /build/
+COPY ./sources/gn_module_export .
+RUN python setup.py bdist_wheel
+
+FROM build AS build-dashboard
+WORKDIR /build/
+COPY ./sources/gn_module_dashboard .
+RUN python setup.py bdist_wheel
+
+FROM build AS build-monitoring
+WORKDIR /build/
+COPY ./sources/gn_module_monitoring .
+RUN python setup.py bdist_wheel
+
+FROM ${GEONATURE_BACKEND_IMAGE}-wheels AS prod-extra
+
+WORKDIR /dist/geonature
+RUN --mount=type=cache,target=/var/cache/apt \
+ --mount=type=cache,target=/var/lib/apt \
+ apt-get update && apt-get install -y libproj-dev proj-bin
+COPY --from=build-import /build/dist/*.whl .
+COPY --from=build-export /build/dist/*.whl .
+COPY --from=build-dashboard /build/dist/*.whl .
+COPY --from=build-monitoring /build/dist/*.whl .
+RUN --mount=type=cache,target=/root/.cache \
+ pip install *.whl sentry_sdk[flask] watchdog
+RUN rm -f *.whl
diff --git a/build/Dockerfile-geonature-frontend b/build/Dockerfile-geonature-frontend
new file mode 100644
index 0000000..937b134
--- /dev/null
+++ b/build/Dockerfile-geonature-frontend
@@ -0,0 +1,33 @@
+# syntax=docker/dockerfile:1.2
+
+ARG GEONATURE_FRONTEND_IMAGE
+FROM ${GEONATURE_FRONTEND_IMAGE}-source AS source-extra
+
+WORKDIR /build/external_modules/import
+COPY ./sources/gn_module_import/frontend/ .
+RUN --mount=type=cache,target=/root/.npm \
+ npm ci --omit=dev --omit=peer
+
+WORKDIR /build/external_modules/exports
+COPY ./sources/gn_module_export/frontend/ .
+RUN --mount=type=cache,target=/root/.npm \
+ npm ci --omit=dev --omit=peer
+
+WORKDIR /build/external_modules/dashboard
+COPY ./sources/gn_module_dashboard/frontend/ .
+RUN --mount=type=cache,target=/root/.npm \
+ npm ci --omit=dev --omit=peer
+
+WORKDIR /build/external_modules/monitorings
+COPY ./sources/gn_module_monitoring/frontend/ .
+RUN --mount=type=cache,target=/root/.npm \
+ npm ci --omit=dev --omit=peer
+
+FROM source-extra AS build-extra
+
+WORKDIR /build/
+RUN npm run build
+
+FROM ${GEONATURE_FRONTEND_IMAGE}-nginx AS prod-extra
+
+COPY --from=build-extra /build/dist /usr/share/nginx/html
diff --git a/data/services/atlas/config/.gitkeep b/data/services/atlas/config/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/data/services/atlas/custom/.gitkeep b/data/services/atlas/custom/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/data/services/geonature/config/.gitkeep b/data/services/geonature/config/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/data/services/geonature/custom/.gitkeep b/data/services/geonature/custom/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/data/services/geonature/data/.gitkeep b/data/services/geonature/data/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/data/services/geonature/media/attachments/.gitkeep b/data/services/geonature/media/attachments/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/data/services/geonature/media/geopackages/.gitkeep b/data/services/geonature/media/geopackages/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/data/services/geonature/media/mobile/.gitkeep b/data/services/geonature/media/mobile/.gitkeep
new file mode 100644
index 0000000..8837739
--- /dev/null
+++ b/data/services/geonature/media/mobile/.gitkeep
@@ -0,0 +1,2 @@
+*.json
+*.apk
\ No newline at end of file
diff --git a/data/services/geonature/media/monitorings/.gitkeep b/data/services/geonature/media/monitorings/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/data/services/geonature/media/pdf/.gitkeep b/data/services/geonature/media/pdf/.gitkeep
new file mode 100644
index 0000000..a136337
--- /dev/null
+++ b/data/services/geonature/media/pdf/.gitkeep
@@ -0,0 +1 @@
+*.pdf
diff --git a/data/services/geonature/media/shapefiles/.gitkeep b/data/services/geonature/media/shapefiles/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/data/services/postgres/backup/.gitkeep b/data/services/postgres/backup/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/data/services/taxhub/config/.gitkeep b/data/services/taxhub/config/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/data/services/taxhub/media/.gitkeep b/data/services/taxhub/media/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/data/services/traefik/certs/.gitkeep b/data/services/traefik/certs/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/data/services/traefik/config/.gitkeep b/data/services/traefik/config/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/data/services/traefik/config/dynamic.dev.yaml b/data/services/traefik/config/dynamic.dev.yaml
new file mode 100644
index 0000000..e69de29
diff --git a/data/services/traefik/config/dynamic.prod.yaml b/data/services/traefik/config/dynamic.prod.yaml
new file mode 100644
index 0000000..0992964
--- /dev/null
+++ b/data/services/traefik/config/dynamic.prod.yaml
@@ -0,0 +1,6 @@
+http:
+ middlewares:
+ https-redirectscheme:
+ redirectScheme:
+ scheme: https
+ permanent: true
diff --git a/data/services/traefik/config/traefik.dev.yaml b/data/services/traefik/config/traefik.dev.yaml
new file mode 100644
index 0000000..cff3262
--- /dev/null
+++ b/data/services/traefik/config/traefik.dev.yaml
@@ -0,0 +1,28 @@
+log:
+ level: DEBUG
+ format: common
+
+providers:
+ docker:
+ endpoint: "unix:///var/run/docker.sock"
+ watch: true
+ exposedByDefault: false
+ swarmMode: false
+ constraints: Label(`traefik.constraint-label`, `gds`)
+ file:
+ filename: /dynamic.yaml
+
+api:
+ dashboard: true
+ debug: false
+ insecure: true
+
+entryPoints:
+ web:
+ address: ":80"
+ http:
+ tls: false
+ websecure:
+ address: ":443"
+ http:
+ tls: false
diff --git a/data/services/traefik/config/traefik.prod.yaml b/data/services/traefik/config/traefik.prod.yaml
new file mode 100644
index 0000000..538af77
--- /dev/null
+++ b/data/services/traefik/config/traefik.prod.yaml
@@ -0,0 +1,36 @@
+global:
+ sendAnonymousUsage: false
+
+log:
+ level: INFO
+ format: common
+
+providers:
+ docker:
+ endpoint: "unix:///var/run/docker.sock"
+ watch: true
+ exposedByDefault: false
+ swarmMode: false
+ file:
+ filename: /dynamic.yaml
+
+api:
+ dashboard: true
+ debug: false
+ insecure: true
+
+entryPoints:
+ web:
+ address: ":80"
+ websecure:
+ address: ":443"
+
+certificatesResolvers:
+ letsencrypt:
+ acme:
+ caserver: "https://acme-staging-v02.api.letsencrypt.org/directory"
+ email: "geon@tu.re"
+ storage: "/certs/acme.json"
+ httpChallenge:
+ entryPoint: web
+
diff --git a/data/services/usershub/config/.gitkeep b/data/services/usershub/config/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/data/storage/.gitkeep b/data/storage/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/data/storage/pgadmin/.gitkeep b/data/storage/pgadmin/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/db/Dockerfile b/db/Dockerfile
deleted file mode 100644
index df0557a..0000000
--- a/db/Dockerfile
+++ /dev/null
@@ -1 +0,0 @@
-FROM kartoza/postgis::11.0-2.5
diff --git a/db/README.md b/db/README.md
deleted file mode 100644
index 45f5d16..0000000
--- a/db/README.md
+++ /dev/null
@@ -1,19 +0,0 @@
-# Geonature > db
-
-## How to build this Dockerfile ?
-
-Just be sure you are in this directory, and then:
-
-```bash
-docker build --force-rm -t kartoza/postgis::11.0-2.5 .
-```
-
-If you have a private Docker registry, you can also push it.
-
-## Why don't we use the image from dockerhub?
-
-The image from DockerHub is not stable, and the creator (kartoza) just reuse the tags from time to time (so with the same image name/tags, we have different behaviour). To avoir that, we (in BRGM) have just froozen a version at a moment of a time and saved it to our internal registry.
-
-## Why don't we create a clean/fresh image?
-
-Well... just by lack of time... But it's in the pipe.
diff --git a/docker-compose.yml b/docker-compose.yml
index 402ad2d..9c4e532 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,59 +1,371 @@
-version: '3.7'
+version: "3.9"
+
+x-defaults: &defaults
+ user: ${DOCKER_UID}:${DOCKER_GID}
+
+x-env-defaults: &env-defaults
+
+x-geonature-backend-defaults: &geonature-backend-defaults
+ environment:
+ - http_proxy=${HTTP_PROXY}
+ - https_proxy=${HTTPS_PROXY}
+ - GEONATURE_SQLALCHEMY_DATABASE_URI=${GEONATURE_SQLALCHEMY_DATABASE_URI}
+ - GEONATURE_URL_APPLICATION=${GEONATURE_URL_APPLICATION}
+ - GEONATURE_API_ENDPOINT=${GEONATURE_API_ENDPOINT}
+ - GEONATURE_BACKEND_PREFIX=${GEONATURE_BACKEND_PREFIX}
+ - GEONATURE_API_TAXHUB=${GEONATURE_API_TAXHUB}
+ - GEONATURE_CONFIG_FILE=${GEONATURE_CONFIG_FILE}
+ - GEONATURE_CELERY__broker_url=${GEONATURE_CELERY__broker_url}
+ - GEONATURE_CELERY__result_backend=${GEONATURE_CELERY__result_backend}
+ - GEONATURE_SECRET_KEY=${GEONATURE_SECRET_KEY}
+ - GEONATURE_SKIP_POPULATE_DB=${GEONATURE_SKIP_POPULATE_DB}
+ - srid_local=${GEONATURE_SRID_LOCAL}
+ - add_sample_data=${GEONATURE_ADD_SAMPLE_DATA}
+ - install_bdc_statuts=${GEONATURE_INSTALL_BDC_STATUTS}
+ - install_sig_layers=${GEONATURE_INSTALL_SIG_LAYERS}
+ - install_grid_layer=${GEONATURE_INSTALL_GRID_LAYER}
+ - install_ref_sensitivity=${GEONATURE_INSTALL_REF_SENSITIVITY}
+ - install_default_dem=${GEONATURE_INSTALL_DEFAULT_DEM}
+ - vectorise_dem=${GEONATURE_INSTALL_VECTORISE_DEM}
+ - usershub=${GEONATURE_INSTALL_USERSHUB}
+ - usershub_samples=${GEONATURE_INSTALL_USERSHUB_SAMPLES}
+ - taxhub=${GEONATURE_INSTALL_TAXHUB}
+ - taxhub_samples=${GEONATURE_INSTALL_TAXHUB_SAMPLES}
+ - C_FORCE_ROOT=false
networks:
- geonat:
+ default:
driver: bridge
- rpx_net:
+ traefik:
+ name: $TRAEFIK_NETWORK_NAME
external: true
- name: rpx_net
services:
- pgadmin:
- image: dpage/pgadmin4:4.27
- environment:
- - PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL}
- - PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD}
+
+ redis:
networks:
- - geonat
+ - default
+ image: ${REDIS_IMAGE}
+ container_name: ${REDIS_CONTAINER_NAME}
+ volumes:
+ - ${REDIS_VOLUME_DATA_DIRECTORY}:/data
+ logging:
+ options:
+ tag: ${REDIS_CONTAINER_NAME}
+ healthcheck:
+ test: ["CMD", "redis-cli", "ping"]
+ interval: 10s
+ timeout: 5s
+ retries: 5
- db:
- image: kartoza/postgis:11.0-2.5
+ postgres:
+ networks:
+ - default
+ image: ${POSTGRES_IMAGE}
+ shm_size: ${POSTGRES_SHM_SIZE}
+ container_name: ${POSTGRES_CONTAINER_NAME}
environment:
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- - POSTGRES_PASS=${POSTGRES_PASS}
- - ALLOW_IP_RANGE=0.0.0.0/0
- - POSTGRES_MULTIPLE_EXTENSIONS=postgis,hstore,"uuid-ossp","pg_trgm","postgis_raster"
- - EXTRA_CONF=datestyle='ISO, DMY'
+ - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
+ - POSTGRES_PORT=${POSTGRES_PORT}
+ command: >
+ -c work_mem=256MB
+ -c maintenance_work_mem=256MB
+ -c max_wal_size=1GB
volumes:
- - ${PGDATA_DIR}:/var/lib/postgresql
- - ${GEONATURE_COMMON_DIR}:/geonature
+ - ${POSTGRES_VOLUME_INIT_DB_DIRECTORY}:/docker-entrypoint-initdb.d/
+ - ${POSTGRES_VOLUME_DATA_DIRECTORY}:/var/lib/postgresql/data
+ - ${POSTGRES_VOLUME_BACKUP_DIRECTORY}:/backup
+ - ${POSTGRES_VOLUME_SCRIPTS_DIRECTORY}:/scripts
+ healthcheck:
+ test: ["CMD", "pg_isready", "-d", "${POSTGRES_DB}", "-U", "${POSTGRES_USER}", "-h", "localhost"]
+ interval: 10s
+ timeout: 5s
+ retries: 5
+ logging:
+ options:
+ tag: ${POSTGRES_CONTAINER_NAME}
+
+ pgadmin:
networks:
- - geonat
+ - default
+ - traefik
+ depends_on:
+ postgres:
+ condition: service_healthy
+ image: ${PGADMIN_IMAGE}
+ container_name: ${PGADMIN_CONTAINER_NAME}
+ environment:
+ - PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL}
+ - PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD}
+ - SCRIPT_NAME=${PGADMIN_PREFIX}
+ volumes:
+ - ${PGADMIN_VOLUME_DATA_DIRECTORY}:/var/lib/pgadmin
+ labels:
+ - "traefik.enable=true"
+ - "traefik.http.routers.${PGADMIN_CONTAINER_NAME}-http.rule=Host(`${PGADMIN_DOMAIN}`) && PathPrefix(`${PGADMIN_PREFIX}`)"
+ - "traefik.http.routers.${PGADMIN_CONTAINER_NAME}-http.entrypoints=web"
+ - "traefik.http.routers.${PGADMIN_CONTAINER_NAME}-http.middlewares=https-redirectscheme@file"
+ - "traefik.http.routers.${PGADMIN_CONTAINER_NAME}-https.rule=Host(`${PGADMIN_DOMAIN}`) && PathPrefix(`${PGADMIN_PREFIX}`)"
+ - "traefik.http.routers.${PGADMIN_CONTAINER_NAME}-https.entrypoints=websecure"
+ - "traefik.http.routers.${PGADMIN_CONTAINER_NAME}-https.tls=${TRAEFIK_TLS}"
+ - "traefik.http.routers.${PGADMIN_CONTAINER_NAME}-https.tls.certresolver=${TRAEFIK_RESOLVER}"
+ - "traefik.docker.network=${TRAEFIK_NETWORK_NAME}"
+ logging:
+ options:
+ tag: ${PGADMIN_CONTAINER_NAME}
- geonature:
- image: ${GEONATURE_IMAGE}
+ usershub:
+ <<: *defaults
+ networks:
+ - default
+ - traefik
+ depends_on:
+ geonature-backend:
+ condition: service_healthy
+ image: ${USERSHUB_IMAGE}
+ container_name: ${USERSHUB_CONTAINER_NAME}
volumes:
- - ${GEONATURE_COMMON_DIR}:/geonature
- - ${BOOTSTRAP_DIR}:/mnt_bootstrap_files
+ - ${USERSHUB_VOLUME_CONFIG_DIRECTORY}:/dist/config/
+ - ${ASSETS_DIRECTORY}/usershub:/assets
+ environment:
+ - http_proxy=${HTTP_PROXY}
+ - https_proxy=${HTTPS_PROXY}
+ - USERSHUB_URL_APPLICATION=${USERSHUB_URL_APPLICATION}
+ - USERSHUB_APPLICATION_ROOT=${USERSHUB_PREFIX}
+ - USERSHUB_SQLALCHEMY_DATABASE_URI=${USERSHUB_SQLALCHEMY_DATABASE_URI}
+ - USERSHUB_SECRET_KEY=${USERSHUB_SECRET_KEY}
+ - USERSHUB_SETTINGS=${USERSHUB_SETTINGS}
+ - USERSHUB_ACTIVATE_APP=${USERSHUB_ACTIVATE_APP}
+ - USERSHUB_ACTIVATE_API=${USERSHUB_ACTIVATE_API}
+ - USERSHUB_COOKIE_EXPIRATION=${USERSHUB_COOKIE_EXPIRATION}
+ labels:
+ - "traefik.enable=true"
+ - "traefik.http.routers.${USERSHUB_CONTAINER_NAME}-http.rule=Host(`${USERSHUB_DOMAIN}`) && PathPrefix(`${USERSHUB_PREFIX}`)"
+ - "traefik.http.routers.${USERSHUB_CONTAINER_NAME}-http.entrypoints=web"
+ - "traefik.http.routers.${USERSHUB_CONTAINER_NAME}-http.middlewares=https-redirectscheme@file"
+ - "traefik.http.routers.${USERSHUB_CONTAINER_NAME}-https.rule=Host(`${USERSHUB_DOMAIN}`) && PathPrefix(`${USERSHUB_PREFIX}`)"
+ - "traefik.http.routers.${USERSHUB_CONTAINER_NAME}-https.entrypoints=websecure"
+ - "traefik.http.routers.${USERSHUB_CONTAINER_NAME}-https.tls=${TRAEFIK_TLS}"
+ - "traefik.http.routers.${USERSHUB_CONTAINER_NAME}-https.tls.certresolver=${TRAEFIK_RESOLVER}"
+ - "traefik.docker.network=${TRAEFIK_NETWORK_NAME}"
+ command:
+ - gunicorn
+ - app.app:create_app()
+ - --bind=0.0.0.0:5001
+ - --reload
+ - --reload-extra-file=config/config.py
+ healthcheck:
+ test: ["CMD-SHELL", "/assets/healthcheck.sh"]
+ interval: 5s
+ timeout: 10s
+ retries: 10
+ logging:
+ options:
+ tag: ${USERSHUB_CONTAINER_NAME}
+
+ taxhub:
+ <<: *defaults
+ networks:
+ - default
+ - traefik
+ depends_on:
+ geonature-backend:
+ condition: service_healthy
+ image: ${TAXHUB_IMAGE}
+ container_name: ${TAXHUB_CONTAINER_NAME}
+ volumes:
+ - ${TAXHUB_VOLUME_CONFIG_DIRECTORY}:/dist/config
+ - ${TAXHUB_VOLUME_MEDIA_DIRECTORY}:/dist/static/medias
+ - ${ASSETS_DIRECTORY}/taxhub:/assets
environment:
- - GEONATURE_PROTOCOL=${GEONATURE_PROTOCOL}
- - GEONATURE_DOMAIN=${GEONATURE_DOMAIN}
- - POSTGRES_DB=${POSTGRES_DB}
- - POSTGRES_USER=${POSTGRES_USER}
- - POSTGRES_PASS=${POSTGRES_PASS}
- http_proxy=${HTTP_PROXY}
- - https_proxy=${HTTP_PROXY}
+ - https_proxy=${HTTPS_PROXY}
+ - TAXHUB_APPLICATION_ROOT=${TAXHUB_PREFIX}
+ - TAXHUB_SQLALCHEMY_DATABASE_URI=${TAXHUB_SQLALCHEMY_DATABASE_URI}
+ - TAXHUB_SECRET_KEY=${TAXHUB_SECRET_KEY}
+ - TAXHUB_SETTINGS=${TAXHUB_SETTINGS}
+ labels:
+ - "traefik.enable=true"
+ - "traefik.http.routers.${TAXHUB_CONTAINER_NAME}-http.rule=Host(`${TAXHUB_DOMAIN}`) && PathPrefix(`${TAXHUB_PREFIX}`)"
+ - "traefik.http.routers.${TAXHUB_CONTAINER_NAME}-http.entrypoints=web"
+ - "traefik.http.routers.${TAXHUB_CONTAINER_NAME}-http.middlewares=https-redirectscheme@file"
+ - "traefik.http.routers.${TAXHUB_CONTAINER_NAME}-https.rule=Host(`${TAXHUB_DOMAIN}`) && PathPrefix(`${TAXHUB_PREFIX}`)"
+ - "traefik.http.routers.${TAXHUB_CONTAINER_NAME}-https.entrypoints=websecure"
+ - "traefik.http.routers.${TAXHUB_CONTAINER_NAME}-https.tls=${TRAEFIK_TLS}"
+ - "traefik.http.routers.${TAXHUB_CONTAINER_NAME}-https.tls.certresolver=${TRAEFIK_RESOLVER}"
+ - "traefik.docker.network=${TRAEFIK_NETWORK_NAME}"
+ healthcheck:
+ test: ["CMD-SHELL", "/assets/healthcheck.sh"]
+ interval: 10s
+ timeout: 10s
+ retries: 10
+ start_period: 5s
+ logging:
+ options:
+ tag: ${TAXHUB_CONTAINER_NAME}
+
+ geonature-worker:
+ <<: *geonature-backend-defaults
networks:
- - geonat
+ - default
+ depends_on:
+ redis:
+ condition: service_started
+ geonature-backend:
+ condition: service_healthy
+ image: ${GEONATURE_BACKEND_IMAGE}
+ container_name: ${GEONATURE_WORKER_CONTAINER_NAME}
+ volumes:
+ - ${GEONATURE_VOLUME_CONFIG_DIRECTORY}:/dist/config/
+ - ${GEONATURE_VOLUME_MEDIA_DIRECTORY}:/dist/media
+ - ${ASSETS_DIRECTORY}/geonature:/assets
+ entrypoint: [/assets/entrypoint_worker.sh]
+ command: watchmedo auto-restart -d /dist/config/ -p geonature_config.toml -- celery -A geonature.celery_app:app worker --beat --schedule-filename=/dist/media/celerybeat-schedule.db
+ logging:
+ options:
+ tag: ${GEONATURE_WORKER_CONTAINER_NAME}
+
+ geonature-frontend:
+ image: ${GEONATURE_FRONTEND_IMAGE}
+ networks:
+ - traefik
+ container_name: ${GEONATURE_FRONTEND_CONTAINER_NAME}
+ environment:
+ - NGINX_LOCATION=${GEONATURE_FRONTEND_PREFIX}
+ - API_ENDPOINT="${GEONATURE_API_ENDPOINT}"
+ volumes:
+ - ${ASSETS_DIRECTORY}/geonature:/assets
+ labels:
+ - "traefik.enable=true"
+ - "traefik.docker.network=${TRAEFIK_NETWORK_NAME}"
- rpx:
- image: nginx:1.17-alpine
+ - "traefik.http.middlewares.${GEONATURE_FRONTEND_CONTAINER_NAME}-redirect.redirectregex.regex=^https://${GEONATURE_DOMAIN}/?$"
+ - "traefik.http.middlewares.${GEONATURE_FRONTEND_CONTAINER_NAME}-redirect.redirectregex.replacement=https://${GEONATURE_DOMAIN}/geonature/"
+ - "traefik.http.middlewares.${GEONATURE_FRONTEND_CONTAINER_NAME}-redirect.redirectregex.permanent=true"
+
+ - "traefik.http.routers.${GEONATURE_FRONTEND_CONTAINER_NAME}-http.entrypoints=web"
+ - "traefik.http.routers.${GEONATURE_FRONTEND_CONTAINER_NAME}-http.rule=Host(`${GEONATURE_DOMAIN}`) && PathPrefix(`${GEONATURE_FRONTEND_PREFIX}`)"
+ - "traefik.http.routers.${GEONATURE_FRONTEND_CONTAINER_NAME}-http.rule=Host(`${GEONATURE_DOMAIN}`) && PathPrefix(`/`)"
+ - "traefik.http.routers.${GEONATURE_FRONTEND_CONTAINER_NAME}-http.middlewares=https-redirectscheme@file"
+
+ - "traefik.http.routers.${GEONATURE_FRONTEND_CONTAINER_NAME}-https.entrypoints=websecure"
+ - "traefik.http.routers.${GEONATURE_FRONTEND_CONTAINER_NAME}-https.rule=Host(`${GEONATURE_DOMAIN}`) && PathPrefix(`${GEONATURE_FRONTEND_PREFIX}`)"
+ - "traefik.http.routers.${GEONATURE_FRONTEND_CONTAINER_NAME}-https.rule=Host(`${GEONATURE_DOMAIN}`) && PathPrefix(`/`)"
+ - "traefik.http.routers.${GEONATURE_FRONTEND_CONTAINER_NAME}-https.tls=${TRAEFIK_TLS}"
+ - "traefik.http.routers.${GEONATURE_FRONTEND_CONTAINER_NAME}-https.tls.certresolver=${TRAEFIK_RESOLVER}"
+ - "traefik.http.routers.${GEONATURE_FRONTEND_CONTAINER_NAME}-https.middlewares=${GEONATURE_FRONTEND_CONTAINER_NAME}-redirect"
+
+ healthcheck:
+ test: ["CMD", "/assets/healthcheck_frontend.sh"]
+ interval: 2s
+ timeout: 10s
+ retries: 10
+ start_period: 0s
+ logging:
+ options:
+ tag: ${GEONATURE_FRONTEND_CONTAINER_NAME}
+
+ geonature-backend:
+ <<: *geonature-backend-defaults
+ networks:
+ - traefik
+ - default
+ depends_on:
+ redis:
+ condition: service_started
+ postgres:
+ condition: service_healthy
+ command:
+ - "gunicorn"
+ - "geonature:create_app()"
+ - "--name=geonature"
+ - "--workers=2"
+ - "--threads=2"
+ - "--access-logfile=-"
+ - "--bind=0.0.0.0:8000"
+ - "--reload"
+ - "--reload-extra-file=${GEONATURE_CONFIG_FILE}"
+ image: ${GEONATURE_BACKEND_IMAGE}
+ container_name: ${GEONATURE_BACKEND_CONTAINER_NAME}
volumes:
- - ${NGINX_CONF}:/etc/nginx/conf.d/default.conf
- - ${GEONATURE_COMMON_DIR}:/geonature
+ - ${GEONATURE_VOLUME_CONFIG_DIRECTORY}:/dist/config
+ - ${GEONATURE_VOLUME_DATA_DIRECTORY}:/dist/data
+ - ${GEONATURE_VOLUME_MEDIA_DIRECTORY}:/dist/media
+ - ${GEONATURE_VOLUME_CUSTOM_DIRECTORY}:/dist/custom
+ - ${ASSETS_DIRECTORY}/geonature:/assets
+ labels:
+ - "traefik.enable=true"
+ - "traefik.http.routers.${GEONATURE_BACKEND_CONTAINER_NAME}-http.rule=Host(`${GEONATURE_DOMAIN}`) && PathPrefix(`${GEONATURE_BACKEND_PREFIX}`)"
+ - "traefik.http.routers.${GEONATURE_BACKEND_CONTAINER_NAME}-http.entrypoints=web"
+ - "traefik.http.routers.${GEONATURE_BACKEND_CONTAINER_NAME}-http.middlewares=https-redirectscheme@file"
+ - "traefik.http.routers.${GEONATURE_BACKEND_CONTAINER_NAME}-https.rule=Host(`${GEONATURE_DOMAIN}`) && PathPrefix(`${GEONATURE_BACKEND_PREFIX}`)"
+ - "traefik.http.routers.${GEONATURE_BACKEND_CONTAINER_NAME}-https.entrypoints=websecure"
+ - "traefik.http.routers.${GEONATURE_BACKEND_CONTAINER_NAME}-https.tls=${TRAEFIK_TLS}"
+ - "traefik.http.routers.${GEONATURE_BACKEND_CONTAINER_NAME}-https.tls.certresolver=${TRAEFIK_RESOLVER}"
+ - "traefik.docker.network=${TRAEFIK_NETWORK_NAME}"
+ healthcheck:
+ test: ["CMD-SHELL", "/assets/healthcheck_backend.sh"]
+ interval: ${GEONATURE_BACKEND_HEALTHCHECK_INTERVAL}
+ timeout: 10s
+ retries: 30
+ start_period: 5s
+ logging:
+ options:
+ tag: ${GEONATURE_BACKEND_CONTAINER_NAME}
+
+ atlas:
+ <<: *defaults
networks:
- - geonat
- - rpx_net
+ - default
+ - traefik
+ depends_on:
+ geonature-backend:
+ condition: service_healthy
+ image: ${ATLAS_IMAGE}
+ container_name: ${ATLAS_CONTAINER_NAME}
environment:
- - "VIRTUAL_HOST=${GEONATURE_DOMAIN}"
+ - http_proxy=${HTTP_PROXY}
+ - https_proxy=${HTTPS_PROXY}
+ - POSTGRES_DB=${POSTGRES_DB}
+ - POSTGRES_USER=${POSTGRES_USER}
+ - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
+ - POSTGRES_HOST=${POSTGRES_HOST}
+ - POSTGRES_PORT= ${POSTGRES_PORT}
+ - ATLAS_ALTITUDES=${ATLAS_ALTITUDES}
+ - ATLAS_TYPE_TERRITOIRE=${ATLAS_TYPE_TERRITOIRE}
+ - ATLAS_TYPE_MAILLE=${ATLAS_TYPE_MAILLE}
+ - ATLAS_INSTALL_SCHEMA=${ATLAS_INSTALL_SCHEMA}
+ - ATLAS_RESET_SCHEMA=${ATLAS_RESET_SCHEMA}
+ - ATLAS_URL_APPLICATION=${ATLAS_URL_APPLICATION}
+ - ATLAS_APPLICATION_ROOT=${ATLAS_PREFIX}
+ - ATLAS_REMOTE_MEDIAS_URL=${ATLAS_REMOTE_MEDIAS_URL}
+ - ATLAS_TAXHUB_URL=${ATLAS_REMOTE_MEDIAS_URL}
+ - ATLAS_REDIMENSIONNEMENT_IMAGE=${ATLAS_REDIMENSIONNEMENT_IMAGE}
+ - ATLAS_SECRET_KEY=${ATLAS_SECRET_KEY}
+ - ATLAS_SQLALCHEMY_DATABASE_URI=${ATLAS_SQLALCHEMY_DATABASE_URI}
+ - ATLAS_TEMPLATES_AUTO_RELOAD=true
+ volumes:
+ - ${ATLAS_VOLUME_CONFIG_DIRECTORY}:/dist/config
+ - ${ATLAS_VOLUME_CUSTOM_DIRECTORY}:/dist/static/custom
+ - ${ASSETS_DIRECTORY}/atlas:/assets
+ labels:
+ - "traefik.enable=true"
+ - "traefik.http.routers.${ATLAS_CONTAINER_NAME}-http.rule=Host(`${ATLAS_DOMAIN}`) && PathPrefix(`${ATLAS_PREFIX}`)"
+ - "traefik.http.routers.${ATLAS_CONTAINER_NAME}-http.entrypoints=web"
+ - "traefik.http.routers.${ATLAS_CONTAINER_NAME}-http.middlewares=https-redirectscheme@file"
+ - "traefik.http.routers.${ATLAS_CONTAINER_NAME}-https.rule=Host(`${ATLAS_DOMAIN}`) && PathPrefix(`${ATLAS_PREFIX}`)"
+ - "traefik.http.routers.${ATLAS_CONTAINER_NAME}-https.entrypoints=websecure"
+ - "traefik.http.routers.${ATLAS_CONTAINER_NAME}-https.tls=${TRAEFIK_TLS}"
+ - "traefik.http.routers.${ATLAS_CONTAINER_NAME}-https.tls.certresolver=${TRAEFIK_RESOLVER}"
+ - "traefik.docker.network=${TRAEFIK_NETWORK_NAME}"
+ healthcheck:
+ test: ["CMD-SHELL", "/assets/healthcheck.sh"]
+ interval: ${ATLAS_HEALTHCHECK_INTERVAL}
+ timeout: 10s
+ retries: 20
+ start_period: 0s
+ logging:
+ options:
+ tag: ${ATLAS_CONTAINER_NAME}
diff --git a/env.sample b/env.sample
deleted file mode 100644
index f57090a..0000000
--- a/env.sample
+++ /dev/null
@@ -1,13 +0,0 @@
-POSTGRES_DB=geonature
-POSTGRES_USER=geonature
-POSTGRES_PASS=geonature
-PGDATA_DIR=/applications/projets/geonature.brgm-rec.fr/pgdata
-BOOTSTRAP_DIR=/applications/geonature/bootstrap_files
-GEONATURE_COMMON_DIR=/applications/projets/geonature.brgm-rec.fr/geonature_common
-GEONATURE_DOMAIN=geonature.brgm-rec.fr
-GEONATURE_PROTOCOL=https
-GEONATURE_IMAGE=geonature:2.x.x
-NGINX_CONF=/applications/geonature/nginx.conf
-HTTP_PROXY=http://someproxy.url/youneedtouse/or/nothingotherwise
-PGADMIN_DEFAULT_EMAIL=user@domain.geonature_com
-PGADMIN_DEFAULT_PASSWORD=SuperSecret
\ No newline at end of file
diff --git a/geonature.service b/geonature.service
deleted file mode 100644
index fabe118..0000000
--- a/geonature.service
+++ /dev/null
@@ -1,17 +0,0 @@
-[Unit]
-Description=##Geonature##
-Requires=docker.service
-After=docker.service
-Wants=nginx-proxy.service
-
-[Service]
-Restart=always
-RemainAfterExit=yes
-WorkingDirectory=/applications/projets/##geonature##
-
-ExecStart=/usr/local/bin/docker-compose -f /applications/geonature/docker-compose.yml -p ##geonature## up
-
-ExecStop=/usr/local/bin/docker-compose -f /applications/geonature/docker-compose.yml -p ##geonature## down
-
-[Install]
-WantedBy=multi-user.target
diff --git a/geonature_common/.gitkeep b/geonature_common/.gitkeep
deleted file mode 100644
index c5821d9..0000000
--- a/geonature_common/.gitkeep
+++ /dev/null
@@ -1 +0,0 @@
-# oh please keep me i'm alone
diff --git a/nginx-proxy/.gitignore b/nginx-proxy/.gitignore
deleted file mode 100644
index 97bef87..0000000
--- a/nginx-proxy/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-certificates/**
-!certificates/.gitkeep
diff --git a/nginx-proxy/README.md b/nginx-proxy/README.md
deleted file mode 100644
index 457b11a..0000000
--- a/nginx-proxy/README.md
+++ /dev/null
@@ -1,40 +0,0 @@
-# Automatique Nginx reverse proxy
-
-Based on Jason Wilder's work on Nginx proxy running with docker-gen [Nginx-proxy](https://hub.docker.com/r/jwilder/nginx-proxy).
-
-## Installation
-
-On a Docker server (only standalone, this won't support Swarm or Kubernetes):
-
-```shell
-cp nginx-proxy/nginx-proxy.service /etc/systemd/system
-systemctl daemon-reload
-systemctl enable nginx-proxy --now
-```
-
-## Usage
-
-On a Docker service you want to reverse proxy automatically, add an environment variable "`VIRTUAL_HOST`" and add it to the rpx_net network
-
-```yaml
-# disclaimer, a lot have been trimmed down from a normal docker-compose.yml file in this example.
-# [...]
-services:
-# [...]
- web:
- image: nexus.brgm.fr:18444/bgrm/mywebimage:my-meaningfull-tag
- environment:
- - "VIRTUAL_HOST=mywebapplication.brgm.fr"
- # [...]
- networks:
- - rpx_net
- # [...]
-
-networks:
- rpx_net:
- external: true
- name: rpx_net
-# [...]
-```
-
-If the container only exposes one TCP port (or uses standard http/https ports) it will be automatically configured. If the container expose multiple "outlandish" ports, please specify the one that should be used as per the documentation: [Nginx-proxy](https://github.com/nginx-proxy/nginx-proxy).
diff --git a/nginx-proxy/certificates/.gitkeep b/nginx-proxy/certificates/.gitkeep
deleted file mode 100644
index d5c7475..0000000
--- a/nginx-proxy/certificates/.gitkeep
+++ /dev/null
@@ -1 +0,0 @@
-# keep me please
diff --git a/nginx-proxy/docker-compose.yaml b/nginx-proxy/docker-compose.yaml
deleted file mode 100644
index fc0f239..0000000
--- a/nginx-proxy/docker-compose.yaml
+++ /dev/null
@@ -1,19 +0,0 @@
-version: '3.7'
-
-networks:
- rpx_net:
- name: rpx_net
- driver: bridge
-
-services:
- proxy:
- image: jwilder/nginx-proxy:alpine
- networks:
- - rpx_net
- volumes:
- - "/var/run/docker.sock:/tmp/docker.sock:ro"
- - "/applications/administration/nginx-proxy/certificates/:/etc/nginx/certs"
- ports:
- - "80:80"
- - "443:443"
- restart: unless-stopped
diff --git a/nginx-proxy/nginx-proxy.service b/nginx-proxy/nginx-proxy.service
deleted file mode 100644
index 787805a..0000000
--- a/nginx-proxy/nginx-proxy.service
+++ /dev/null
@@ -1,16 +0,0 @@
-[Unit]
-Description=Reverse proxy Nginx
-Requires=docker.service
-After=docker.service
-
-[Service]
-Restart=always
-RemainAfterExit=yes
-WorkingDirectory=/applications/administration/nginx-proxy
-
-ExecStart=/usr/local/bin/docker-compose -f /applications/administration/nginx-proxy/docker-compose.yaml up
-
-ExecStop=/usr/local/bin/docker-compose -f /applications/administration/nginx-proxy/docker-compose.yaml down
-
-[Install]
-WantedBy=multi-user.target
diff --git a/nginx.conf b/nginx.conf
deleted file mode 100644
index 86ff93a..0000000
--- a/nginx.conf
+++ /dev/null
@@ -1,71 +0,0 @@
- server {
- listen 80;
- server_name localhost;
-
- server_tokens off;
-
- gzip on;
- gzip_types
- text/css
- text/plain
- text/javascript
- application/javascript
- application/json
- application/x-javascript
- application/xml
- application/xml+rss
- application/xhtml+xml
- application/x-font-ttf
- application/x-font-opentype
- application/vnd.ms-fontobject
- image/svg+xml
- image/x-icon
- application/rss+xml
- application/atom_xml;
- gzip_min_length 512;
-
- location /admin4pg/ {
- proxy_set_header X-Script-Name /admin4pg;
- proxy_set_header Host $host;
- proxy_pass http://pgadmin:80/;
- proxy_redirect off;
- }
-
- resolver 127.0.0.11;
-
- set $uhupstream geonature:5001;
- rewrite ^/usershub$ /usershub/ redirect;
- location ~* ^/usershub/(.*) {
- proxy_pass http://$uhupstream/$1$is_args$args;
- }
-
- set $thupstream geonature:5000;
- rewrite ^/taxhub$ /taxhub/ redirect;
- location ~* ^/taxhub/(.*) {
- proxy_pass http://$thupstream/$1$is_args$args;
- }
-
- set $gnupstream geonature:8000;
- rewrite ^/geonature/api$ /geonature/api/ redirect;
- location ~* ^/geonature/api/(.*) {
- proxy_pass http://$gnupstream/$1$is_args$args;
- }
-
- rewrite ^/geonature$ /geonature/ redirect;
- location /geonature/ {
- alias /geonature/geonature/frontend/dist/;
- try_files $uri$args $uri$args/ $uri $uri/ /geonature/index.html;
- }
-
- set $gaupstream geonature:8080;
- rewrite ^/atlas$ /atlas/ redirect;
- location ~* ^/atlas/(.*) {
- proxy_pass http://$gaupstream/$1$is_args$args;
- }
-
- location / {
- return 301 http://$host/geonature/;
- # return 301 https://$host/geonature/;
- }
-
- }
diff --git a/pgdata/.gitkeep b/pgdata/.gitkeep
deleted file mode 100644
index 9ce7372..0000000
--- a/pgdata/.gitkeep
+++ /dev/null
@@ -1 +0,0 @@
-# keepme please
diff --git a/rproxy/.env.example b/rproxy/.env.example
new file mode 100644
index 0000000..6c22561
--- /dev/null
+++ b/rproxy/.env.example
@@ -0,0 +1,16 @@
+HOST=xxxxxxxxxxxxxxxx
+
+NETWORK_TRAEFIK_GN_1=traefik_pag_dev
+NETWORK_TRAEFIK_GN_2=traefik_for_dev
+
+HTTP_PROXY=xxxxxxxxxxxxxxxxxxx
+HTTPS_PROXY=xxxxxxxxxxxxxxxxxxx
+NO_PROXY=xxxxxxxxxxxxxxxxxxxxxxx
+
+#############################################
+
+TRAEFIK_CONFIG_PATH=./conf/traefik.yaml
+TRAEFIK_DYNAMIC_CONFIG_PATH=./conf/dynamic.yaml
+TRAEFIK_LETSENCRIPT_PATH=./letsencrypt
+
+
diff --git a/rproxy/.gitignore b/rproxy/.gitignore
new file mode 100644
index 0000000..dcfac94
--- /dev/null
+++ b/rproxy/.gitignore
@@ -0,0 +1,2 @@
+letsencrypt/
+.env
\ No newline at end of file
diff --git a/rproxy/conf/dynamic.yaml b/rproxy/conf/dynamic.yaml
new file mode 100644
index 0000000..c995105
--- /dev/null
+++ b/rproxy/conf/dynamic.yaml
@@ -0,0 +1,7 @@
+http:
+ middlewares:
+ https-redirectscheme:
+ redirectScheme:
+ scheme: https
+ permanent: true
+
diff --git a/rproxy/conf/traefik.yaml b/rproxy/conf/traefik.yaml
new file mode 100644
index 0000000..395140e
--- /dev/null
+++ b/rproxy/conf/traefik.yaml
@@ -0,0 +1,40 @@
+global:
+ sendAnonymousUsage: false
+ CheckNewVersion: false
+
+log:
+ level: INFO
+ format: common
+
+accessLog: {}
+
+providers:
+ docker:
+ endpoint: "unix:///var/run/docker.sock"
+ watch: true
+ exposedByDefault: false
+ swarmMode: false
+ network: "rpx_net"
+ file:
+ filename: /dynamic.yaml
+
+api:
+ dashboard: true
+ debug: false
+ insecure: true
+
+entryPoints:
+ web:
+ address: ":80"
+ websecure:
+ address: ":443"
+
+certificatesResolvers:
+ letsencrypt:
+ acme:
+ email: "geon@tu.re"
+ storage: "/letsencrypt/acme.json"
+ httpChallenge:
+ entryPoint: web
+ # for dev
+ # caServer: https://acme-staging-v02.api.letsencrypt.org/directory
diff --git a/rproxy/docker-compose.yml b/rproxy/docker-compose.yml
new file mode 100644
index 0000000..09420ce
--- /dev/null
+++ b/rproxy/docker-compose.yml
@@ -0,0 +1,52 @@
+version: '3.7'
+
+networks:
+ rpx_net:
+ name: rpx_net
+ driver: bridge
+ # Déclaration des réseaux externes de chaque instance Geonature
+ traefik_gn_1:
+ external: true
+ name: ${NETWORK_TRAEFIK_GN_1}
+ traefik_gn_2:
+ external: true
+ name: ${NETWORK_TRAEFIK_GN_2}
+
+services:
+ rproxy:
+ image: traefik:v2.10.4
+ container_name: rproxy
+ networks:
+ - rpx_net
+ # Connexion aux réseaux externes des instances Geonature
+ - traefik_gn_1
+ - traefik_gn_2
+ ports:
+ - "80:80"
+ - "8080:8080"
+ - "443:443"
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock
+ - ${TRAEFIK_CONFIG_PATH}:/traefik.yaml
+ - ${TRAEFIK_DYNAMIC_CONFIG_PATH}:/dynamic.yaml
+ - ${TRAEFIK_LETSENCRIPT_PATH}:/letsencrypt
+ environment:
+ - HTTP_PROXY=${HTTP_PROXY}
+ - HTTPS_PROXY=${HTTP_PROXY}
+ - NO_PROXY=${NO_PROXY}
+ labels:
+ - "traefik.enable=true"
+ # Autoriser les réseaux 193.56.4.0/24 (Renater.4), 192.168.220.0/22 (VPN SSL Fortinet), 192.168.216.0/22 (VPN IPSEC Fortinet), 172.17.0.0/23 (DSI 802.1X)
+# - "traefik.http.middlewares.brgm-ipwhitelist.ipwhitelist.sourcerange=193.56.4.0/24, 192.168.220.0/22, 192.168.216.0/22, 172.17.0.0/23"
+ - "traefik.http.routers.traefik-http.rule=Host(`${HOST}`)"
+ - "traefik.http.routers.traefik-http.entrypoints=web"
+ - "traefik.http.routers.traefik-http.service=api@internal"
+# - "traefik.http.routers.traefik-http.middlewares=brgm-ipwhitelist@docker, https-redirectscheme@file"
+ - "traefik.http.routers.traefik-http.middlewares=https-redirectscheme@file"
+ - "traefik.http.routers.traefik-https.rule=Host(`${HOST}`)"
+ - "traefik.http.routers.traefik-https.entrypoints=websecure"
+ - "traefik.http.routers.traefik-https.service=api@internal"
+# - "traefik.http.routers.traefik-https.middlewares=brgm-ipwhitelist@docker"
+ - "traefik.http.routers.traefik-https.tls=true"
+ - "traefik.http.routers.traefik-https.tls.certresolver=letsencrypt"
+
diff --git a/rproxy/getNomReseau.sh b/rproxy/getNomReseau.sh
new file mode 100755
index 0000000..f12673a
--- /dev/null
+++ b/rproxy/getNomReseau.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+if [ "$1" == "" ]; then
+ echo
+ echo "Indiquer en paramètre le fichier .env à utiliser pour récupérer la variable TRAEFIK_NETWORK_NAME"
+ echo
+ exit 1
+fi
+
+if [ ! -e $1 ]; then
+ echo
+ echo "Le fichier ($1) est introuvable !!!"
+ echo
+ exit 1
+fi
+
+source $1
+echo
+echo "Nom du réseau : $TRAEFIK_NETWORK_NAME"
+echo
+
diff --git a/rpx/Dockerfile b/rpx/Dockerfile
deleted file mode 100644
index a419cd7..0000000
--- a/rpx/Dockerfile
+++ /dev/null
@@ -1 +0,0 @@
-FROM nginx:1.17-alpine
diff --git a/rpx/README.md b/rpx/README.md
deleted file mode 100644
index b66ee3f..0000000
--- a/rpx/README.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# Geonature > rpx
-
-## How to build this Dockerfile ?
-
-Just be sure you are in this directory, and then:
-
-```bash
-docker build --force-rm -t nginx:1.17-alpine .
-```
-
-If you have a private Docker registry, you can also push it.
-
-## Why don't we use the image from dockerhub?
-
-We use internally a CI/CD mechanism to push the created image to our internal registry, and this Dockerfile is just here for that.
diff --git a/scripts/build_geonature_all.sh b/scripts/build_geonature_all.sh
new file mode 100755
index 0000000..d882610
--- /dev/null
+++ b/scripts/build_geonature_all.sh
@@ -0,0 +1,72 @@
+# script docker GN all
+set -xeof pipefail
+
+source $1
+current_dir="$(pwd)"
+
+# BUILD des applications
+
+# - ATLAS
+
+docker build -f sources/GeoNature-atlas/Dockerfile -t ${ATLAS_IMAGE} sources/GeoNature-atlas/
+
+
+# - USERSHUB
+
+# chargement des sous modules git
+cd sources/UsersHub
+git submodule init
+git submodule update
+cd ${current_dir}
+
+docker build -f sources/UsersHub/Dockerfile -t ${USERSHUB_IMAGE} sources/UsersHub/
+
+
+# - TAXHUB
+
+# chargement des sous modules git
+cd sources/TaxHub
+git submodule init
+git submodule update
+cd ${current_dir}
+
+docker build -f sources/TaxHub/Dockerfile -t ${TAXHUB_IMAGE} sources/TaxHub/
+
+
+# - GEONATURE
+
+# chargement des sous modules git
+cd sources/GeoNature
+git submodule init
+git submodule update
+cd ${current_dir}
+
+# - FRONTEND
+
+# - SOURCES
+
+docker build -f sources/GeoNature/frontend/Dockerfile -t ${GEONATURE_FRONTEND_IMAGE}-source --target=source sources/GeoNature/
+
+# - NGINX
+
+docker build -f sources/GeoNature/frontend/Dockerfile -t ${GEONATURE_FRONTEND_IMAGE}-nginx --target=prod-base sources/GeoNature/
+
+# - APP + 4 MODULES
+
+docker build \
+ --build-arg GEONATURE_FRONTEND_IMAGE=${GEONATURE_FRONTEND_IMAGE} \
+ -f ./build/Dockerfile-geonature-frontend \
+ -t ${GEONATURE_FRONTEND_IMAGE} .
+
+# - BACKEND
+
+# - WHEELS
+
+docker build -f sources/GeoNature/backend/Dockerfile -t ${GEONATURE_BACKEND_IMAGE}-wheels --target=wheels sources/GeoNature/
+
+# - APP
+
+docker build \
+ --build-arg GEONATURE_BACKEND_IMAGE=${GEONATURE_BACKEND_IMAGE} \
+ -f ./build/Dockerfile-geonature-backend \
+ -t ${GEONATURE_BACKEND_IMAGE} .
diff --git a/scripts/check_env.sh b/scripts/check_env.sh
new file mode 100755
index 0000000..d7a1ecf
--- /dev/null
+++ b/scripts/check_env.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# test
+# si GeoNature-Docker-Service est une release
+# on souhaite vérifier que toutes les source sont aussi des releases
+
+ALL_SOURCE_IS_TAG=[ ${GN_IS_TAG} = true ] \
+ && [ ${GN_MODULE_MONITORING_IS_TAG} = true ] \
+ && [ ${GN_MODULE_IMPORT_IS_TAG} = true ] \
+ && [ ${GN_MODULE_DASHBOARD_IS_TAG} = true ] \
+ && [ ${GN_MODULE_EXPORT_IS_TAG} = true ]
+
+# si GDS est sur un tag mais pas tous les autres -> erreur
+if [[ ${GDS_IS_TAG} = true && ! ( ${ALL_SOURCE_IS_TAG} ) ]]; then
+ exit 1
+else
+ exit 0
+fi
\ No newline at end of file
diff --git a/scripts/cron.sh b/scripts/cron.sh
new file mode 100755
index 0000000..408bcff
--- /dev/null
+++ b/scripts/cron.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+projet_dir=$(dirname "$0")/..
+cd "$projet_dir"
+
+# raffraichissement des vues de l'atlas
+docker compose exec postgres /bin/sh /scripts/refresh_atlas.sh
+
+# backup de la bdd
+docker compose exec postgres /bin/sh /scripts/backup.sh
+
+# backup des fichier des services (sauf backup de la base)
+rm -f data/services/services.tar.gz
+tar --exclude 'geonature_backup*' --exclude 'services.tar.gz' -zcvf ./services.tar.gz data/services/
+mv services.tar.gz data/services/services.tar.gz
+
diff --git a/scripts/get_git_version.sh b/scripts/get_git_version.sh
new file mode 100644
index 0000000..c945078
--- /dev/null
+++ b/scripts/get_git_version.sh
@@ -0,0 +1,40 @@
+# args
+# - $1 dir: repertoire du dépôt
+# - $2 preffix: preffixe pour la variable c'env (GN_ ou GN_MODULE_MONITORNING)
+#
+# récupère les infos sur
+# - le tags du dépôt
+# - le nom de la branche
+# - la version lu depuis le fichier VERSION
+#
+# crée 3 variables d'environnement
+# - ${preffix}_GIT_VERSION
+# - ${preffix}_IS_TAG
+# - ${preffix}_FILE_VERSION
+
+
+dir=$1
+preffix=$2
+
+cur=$(pwd)
+cd $dir
+
+GIT_TAG=$(git describe --exact-match --tags $(git log -n1 --pretty='%h'))
+GIT_BRANCH=$(git branch --show-current)
+FILE_VERSION=$(cat VERSION)
+
+if [[ ! -z "${GIT_BRANCH}" ]]; then
+ assign_git_version="export ${preffix}_GIT_VERSION=${GIT_BRANCH}; export ${preffix}_IS_TAG=false";
+
+elif [[ (! -z "${GIT_TAG}") ]]; then
+ assign_git_version="export ${preffix}_GIT_VERSION=${GIT_TAG}; export ${preffix}_IS_TAG=true";
+else
+ assign_git_version="export ${preffix}_GIT_VERSION=''; export ${preffix}_IS_TAG=false"
+fi
+
+eval $assign_git_version
+
+assign_file_version="export ${preffix}_FILE_VERSION=${FILE_VERSION}"
+eval $assign_file_version
+
+cd $cur
diff --git a/scripts/init_applications_config.sh b/scripts/init_applications_config.sh
new file mode 100755
index 0000000..5291034
--- /dev/null
+++ b/scripts/init_applications_config.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+env_file=$1
+
+[[ -z "${env_file}" ]] && echo "Veuillez entrer un fichier de configuration (.env)" && exit 1
+[[ ! -f "${env_file}" ]] && echo "Le fichier de configuration ${env_file} n'a pas été trouvé" && exit 1
+
+source ${env_file}
+
+touch ${GEONATURE_VOLUME_CONFIG_DIRECTORY}/geonature_config.toml
+touch ${TAXHUB_VOLUME_CONFIG_DIRECTORY}/config.py
+touch ${USERSHUB_VOLUME_CONFIG_DIRECTORY}/config.py
+touch ${ATLAS_VOLUME_CONFIG_DIRECTORY}/config.py
+
+mkdir -p ${PGADMIN_VOLUME_DATA_DIRECTORY}
+sudo chown -R 5050:5050 ${PGADMIN_VOLUME_DATA_DIRECTORY}
diff --git a/scripts/init_env.sh b/scripts/init_env.sh
new file mode 100755
index 0000000..1c8a7c6
--- /dev/null
+++ b/scripts/init_env.sh
@@ -0,0 +1,77 @@
+#!/bin/bash
+
+# destiné à l'action docker.yml
+
+
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
+REPOSITORY_DIR=$(dirname "${SCRIPT_DIR}")
+
+# récupération des infos git
+. $SCRIPT_DIR/get_git_version.sh . GDS
+. $SCRIPT_DIR/get_git_version.sh ./sources/GeoNature GN
+. $SCRIPT_DIR/get_git_version.sh ./sources/gn_module_monitoring GN_MODULE_MONITORING
+. $SCRIPT_DIR/get_git_version.sh ./sources/gn_module_export GN_MODULE_EXPORT
+. $SCRIPT_DIR/get_git_version.sh ./sources/gn_module_import GN_MODULE_IMPORT
+. $SCRIPT_DIR/get_git_version.sh ./sources/gn_module_dashboard GN_MODULE_DASHBOARD
+
+cd $REPOSITORY_DIR/
+
+
+# [ ${GDS_IS_TAG} = true ] && IMAGE_VERSION="${GDS_GIT_VERSION}__${GN_GIT_VERSION}" || IMAGE_VERSION="${GDS_GIT_VERSION}"
+IMAGE_VERSION="${GDS_GIT_VERSION}"
+[ ${GDS_IS_TAG} = true ] && LATEST_TAG=", latest" || LATEST_TAG=""
+
+GN_IMAGE_NAME=ghcr.io/pnx-si/gdx-geonature
+
+GN_FRONTEND_IMAGE=$(echo "${GN_IMAGE_NAME}-frontend:${GDS_GIT_VERSION}" | tr '[:upper:]' '[:lower:]')
+GN_FRONTEND_TAGS="${GN_FRONTEND_IMAGE}${LATEST_TAG}"
+
+GN_BACKEND_IMAGE=$(echo "${GN_IMAGE_NAME}-backend:${GDS_GIT_VERSION}" | tr '[:upper:]' '[:lower:]')
+GN_BACKEND_TAGS="${GN_BACKEND_IMAGE}${LATEST_TAG}"
+
+GN_DESCRIPTION="GDS ${GDS_GIT_VERSION} GeoNature ${GN_GIT_VERSION}, MONITORING ${GN_MODULE_MONITORING_GIT_VERSION}, IMPORT ${GN_MODULE_IMPORT_VERSION}, EXPORT ${GN_MODULE_EXPORT_GIT_VERSION}, DASHBOARD ${GN_MODULE_DASHBOARD_GIT_VERSION}"
+
+UH_IMAGE_NAME=ghcr.io/pnx-si/gdx-usershub
+UH_IMAGE=$(echo "${UH_IMAGE_NAME}:${GDS_GIT_VERSION}" | tr '[:upper:]' '[:lower:]')
+UH_TAGS="${UH_IMAGE}${LATEST_TAG}"
+
+TH_IMAGE_NAME=ghcr.io/pnx-si/gdx-taxhub
+TH_IMAGE=$(echo "${TH_IMAGE_NAME}:${GDS_GIT_VERSION}" | tr '[:upper:]' '[:lower:]')
+TH_TAGS="${TH_IMAGE}${LATEST_TAG}"
+
+ATLAS_IMAGE_NAME=ghcr.io/pnx-si/gdx-atlas
+ATLAS_IMAGE=$(echo "${ATLAS_IMAGE_NAME}:${GDS_GIT_VERSION}" | tr '[:upper:]' '[:lower:]')
+ATLAS_TAGS="${ATLAS_IMAGE}${LATEST_TAG}"
+
+BUILD_DATE=$(date -Iseconds)
+
+GN_LABELS="org.opencontainers.image.url=https://github.com/PnX-SI/GeoNature-Docker-services
+org.opencontainers.image.created=${BUILD_DATE}
+org.opencontainers.image.source=https://github.com/PnX-SI/GeoNature
+org.opencontainers.image.version=${GN_GIT_VERSION}
+org.opencontainers.image.vendor=https://github.com/PnX-SI
+"
+
+echo "GDS_IS_TAG=$GDS_IS_TAG"
+echo "GN_IS_TAG=$GN_IS_TAG"
+echo "GN_MODULE_MONITORING_IS_TAG=$GN_MODULE_MONITORING_IS_TAG"
+echo "GN_MODULE_EXPORT_IS_TAG=$GN_MODULE_EXPORT_IS_TAG"
+echo "GN_MODULE_IMPORT_IS_TAG=$GN_MODULE_IMPORT_IS_TAG"
+echo "GN_MODULE_DASHBOARD_IS_TAG=$GN_MODULE_DASHBOARD_IS_TAG"
+
+echo "GN_FRONTEND_IMAGE=$GN_FRONTEND_IMAGE"
+echo "GN_FRONTEND_TAGS=$GN_FRONTEND_TAGS"
+
+echo "GN_BACKEND_IMAGE=$GN_BACKEND_IMAGE"
+echo "GN_BACKEND_TAGS=$GN_BACKEND_TAGS"
+
+echo "GN_DESCRIPTION=$GN_DESCRIPTION"
+echo "GN_LABELS=$GN_LABELS"
+echo "BUILD_DATE=$BUILD_DATE"
+
+echo "UH_TAGS=$UH_TAGS"
+echo "TH_TAGS=$TH_TAGS"
+echo "ATLAS_TAGS=$ATLAS_TAGS"
+
+
+. $SCRIPT_DIR/check_env.sh
\ No newline at end of file
diff --git a/scripts/init_env_file.sh b/scripts/init_env_file.sh
new file mode 100755
index 0000000..5aac465
--- /dev/null
+++ b/scripts/init_env_file.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+# init_env_file.sh .env.example settings.ini .env
+
+set -e
+
+template_file=$1
+settings_file=$2
+output_file=$3
+
+sep="&" # separator for sed
+
+cp $template_file $output_file
+
+# https://stackoverflow.com/1521462/looping-through-the-content-of-a-file-in-bash
+while IFS= read -r line || [ -n "$line" ]; do
+ # skip comment
+ [[ $line =~ ^#.* ]] && continue
+ var_name=${line%%=*}
+ [[ -z "$var_name" ]] && continue
+ sed -i "s${sep}${var_name}=.*${sep}${line}${sep}" $output_file
+ grep "^${var_name}=" ${output_file} || (echo "il n'y a pas de correspondance pour la variable ${var_name}" && exit 1)
+ grep "^${var_name}=.*xxxx" ${output_file} && (echo "Il faut donner une valeur à la variable ${var_name}" && exit 1) || true
+done < ${settings_file}
diff --git a/scripts/init_secret_keys.sh b/scripts/init_secret_keys.sh
new file mode 100755
index 0000000..84c7fcc
--- /dev/null
+++ b/scripts/init_secret_keys.sh
@@ -0,0 +1,8 @@
+file_path=$1
+
+APPS="GEONATURE ATLAS USERSHUB TAXHUB"
+
+for app in $(echo $APPS); do
+ sed -i "s/${app}_SECRET_KEY=.*/${app}_SECRET_KEY=\"$(uuidgen)\"/" $file_path
+ grep "${app}_SECRET_KEY=" $file_path
+done
\ No newline at end of file
diff --git a/scripts/mep.sh b/scripts/mep.sh
new file mode 100644
index 0000000..c63657d
--- /dev/null
+++ b/scripts/mep.sh
@@ -0,0 +1,68 @@
+###
+# script mise en place instance
+###
+
+# env
+project_name=geonature.pyrenees-parcnational.fr
+projects_directory=/applications/projets
+project_path=${projects_directory}/${project_name}
+git_repo=https://github.com/PnX-SI/Geonature-Docker-PNX
+git_branch=current
+
+# repertoire projet
+git clone -b ${git_branch} ${git_repo} ${project_path}
+
+# proxy (ou copie)
+cp -r ${project_path}/rproxy ${projects_directory}/rproxy
+# ln pour dev ?
+# ln -s ${project_path}/rproxy ${projects_directory}/rproxy
+
+#
+cd ${projects_directory}/rproxy
+# creer unfichier settings.ini
+# avec HOST, NETWORK_TRAEFIK_GN_1, NETWORK_TRAEFIK_GN_2, HTTP_PROXY, etc ....
+${project_path}/script/init_env_file.sh .env.exemple pag_dev.ini .env
+
+# creer les reseaux
+eval $(grep NETWORK_TRAEFIK_GN_1 ${projects_directory}/rproxy/.env)
+eval $(grep NETWORK_TRAEFIK_GN_2 ${projects_directory}/rproxy/.env)
+docker network create rpx_net
+docker network create $NETWORK_TRAEFIK_GN_1
+docker network create $NETWORK_TRAEFIK_GN_2
+
+# lancement du proxy (TODO faire service)
+docker compose up -d
+
+
+# instance
+cd $project_path
+cp settings.ini.exemple settings.ini
+./scripts/init_secret_keys.sh settings.ini
+# créer un fichier settings.ini avec
+# DOMAIN PROJECT_NAME PGADMIN_DEFAULT_EMAIL PGADMIN_DEFAULT_PASSWORD SECRET...
+# HTTP_PROXY HTTPS_PROXY
+${project_path}/scripts/init_env_file.sh .env.example settings.ini .env
+
+
+${project_path}/scripts/init_applications_config.sh .env
+# rappatrier les fichiers dans data
+
+# bdd (voir autre doc)
+
+# donner les droits à l'utilisateur geonature pour le ftp
+chown -R 1000:1000 ./data/services/
+# configurer admin4pg
+# se deconnecter puis reconnecter et tester
+
+
+# mettre en place les crons
+cron_script=${projects_directory}/nigth_cron.sh # à adapter si besoin de day_cron
+touch $cron_script
+chmod 775 $cron_script
+echo "sh ${project_path}/scripts/cron.sh" >> $cron_script
+#(crontab -l 2>/dev/null; echo "* 0 * * * ${scron_script}") | crontab -
+crontab -e
+* 0 * * * sh /applications/projets/night_cron.sh
+* 12 * * * sh /applications/projets/day_cron.sh
+
+# ftp
\ No newline at end of file
diff --git a/scripts/test_docker_reload.sh b/scripts/test_docker_reload.sh
new file mode 100755
index 0000000..fa72da6
--- /dev/null
+++ b/scripts/test_docker_reload.sh
@@ -0,0 +1,13 @@
+source $1
+error=""
+
+./scripts/init_applications_config.sh $1
+sleep 5s
+docker compose logs geonature-backend | grep "Worker reloading" || error="${error} geonature-backend"
+docker compose logs usershub | grep "Worker reloading" || error="${error} usershub"
+docker compose logs taxhub | grep "Worker reloading" || error="${error} taxhub"
+docker compose logs atlas | grep "Worker reloading" || error="${error} atlas"
+docker compose logs geonature-worker | grep "worker: Warm shutdown" || error="${error} geonature-worker"
+
+# check error
+[ ! -z "$error" ] && echo "erreur reload ${error}" && exit 1 || exit 0
diff --git a/scripts/test_docker_url.sh b/scripts/test_docker_url.sh
new file mode 100755
index 0000000..fb2fdaa
--- /dev/null
+++ b/scripts/test_docker_url.sh
@@ -0,0 +1,42 @@
+source $1
+error=""
+
+# GEONATURE FRONTEND
+url_test="${GEONATURE_URL_APPLICATION}/"
+res=$(curl -o /dev/null --silent --head --write-out '%{http_code}\n' "${url_test}")
+echo "$url_test -> $res"
+[ "$res" = "200" ] || error=1
+
+# GEONATURE BACKEND
+url_test="${GEONATURE_API_ENDPOINT}/gn_commons/config"
+res=$(curl -o /dev/null --silent --head --write-out '%{http_code}\n' "${url_test}")
+echo "$url_test -> $res"
+[ "$res" = "200" ] || error=1
+
+# USERSHUB
+url_test="${USERSHUB_URL_APPLICATION}/login"
+res=$(curl -o /dev/null --silent --head --write-out '%{http_code}\n' "${url_test}")
+echo "$url_test -> $res"
+[ "$res" = "200" ] || error=1
+
+# TAXHUB
+url_test="${TAXHUB_URL_APPLICATION}/"
+res=$(curl -o /dev/null --silent --head --write-out '%{http_code}\n' "${url_test}")
+echo "$url_test -> $res"
+[ "$res" = "200" ] || error=1
+
+# ATLAS
+url_test="${ATLAS_URL_APPLICATION}/"
+res=$(curl -o /dev/null --silent --head --write-out '%{http_code}\n' "${url_test}")
+echo "$url_test -> $res"
+[ "$res" = "200" ] || error=1
+
+# PGADMIN
+url_test="${BASE_URL}${PGADMIN_PREFIX}/login?next=%2Fpgadmin%2F"
+res=$(curl -o /dev/null --silent --head --write-out '%{http_code}\n' "${url_test}")
+echo "$url_test -> $res"
+[ "$res" = "200" ] || error=1
+
+
+# check error
+[ ! -z "$error" ] && exit 1 || exit 0
diff --git a/settings.ini.exemple b/settings.ini.exemple
new file mode 100644
index 0000000..42df019
--- /dev/null
+++ b/settings.ini.exemple
@@ -0,0 +1,31 @@
+# images docker
+
+USERSHUB_IMAGE=ghcr.io/pnx-si/usershub:2.3.4
+TAXHUB_IMAGE=ghcr.io/pnx-si/taxhub:1.12.1
+ATLAS_IMAGE=ghcr.io/pnx-si/geonature-atlas:1.60
+GEONATURE_FRONTEND_IMAGE=ghcr.io/pnx-si/geonature-frontend-extra:0.2.0
+GEONATURE_BACKEND_IMAGE=ghcr.io/pnx-si/geonature-backend-extra:0.2.0
+POSTGRES_IMAGE=postgis/postgis:15-3.3
+
+DOMAIN="geonatu.re"
+ATLAS_DOMAIN="atlas-geonatu.re"
+ATLAS_PREFIX="/"
+
+PROJECT_NAME=parc_dev
+
+PGADMIN_DEFAULT_EMAIL="xxxxxxxxxxxxxx"
+PGADMIN_DEFAULT_PASSWORD="xxxxxxxxxxxxx"
+
+HTTP_PROXY="xxxxxxxxxxxxxxxxxxx"
+HTTPS_PROXY="xxxxxxxxxxxxxxxxxxxxx"
+
+POSTGRES_USER="geonatadmin"
+POSTGRES_PASSWORD="geonatpasswd"
+POSTGRES_HOST="postgres"
+POSTGRES_DB="geonature2db"
+POSTGRES_PORT=5432
+
+GEONATURE_SECRET_KEY="xxxxx"
+USERSHUB_SECRET_KEY="xxxxx"
+TAXHUB_SECRET_KEY="xxxxx"
+ATLAS_SECRET_KEY="xxxxx"
\ No newline at end of file
diff --git a/settings.ini.test b/settings.ini.test
new file mode 100644
index 0000000..d97b37d
--- /dev/null
+++ b/settings.ini.test
@@ -0,0 +1,3 @@
+# settings.ini.test
+GEONATURE_SKIP_POPULATE_DB=false
+ATLAS_INSTALL_SCHEMA=true
diff --git a/sources/GeoNature b/sources/GeoNature
new file mode 160000
index 0000000..fedbf33
--- /dev/null
+++ b/sources/GeoNature
@@ -0,0 +1 @@
+Subproject commit fedbf33c1b95b8947632e08fd5734c3fee767469
diff --git a/sources/GeoNature-atlas b/sources/GeoNature-atlas
new file mode 160000
index 0000000..eb90f3c
--- /dev/null
+++ b/sources/GeoNature-atlas
@@ -0,0 +1 @@
+Subproject commit eb90f3c030233bdc846c26ff494bac245bc20023
diff --git a/sources/TaxHub b/sources/TaxHub
new file mode 160000
index 0000000..4855eec
--- /dev/null
+++ b/sources/TaxHub
@@ -0,0 +1 @@
+Subproject commit 4855eec69b698eda65dfcf24643e7e6ad99c8ebb
diff --git a/sources/UsersHub b/sources/UsersHub
new file mode 160000
index 0000000..bc3bcfb
--- /dev/null
+++ b/sources/UsersHub
@@ -0,0 +1 @@
+Subproject commit bc3bcfb3e0ec7c76c322294b817c14cc4938e851
diff --git a/sources/gn_module_dashboard b/sources/gn_module_dashboard
new file mode 160000
index 0000000..97ae2d3
--- /dev/null
+++ b/sources/gn_module_dashboard
@@ -0,0 +1 @@
+Subproject commit 97ae2d388f476fa129f320be1ea59178e73f8ae7
diff --git a/sources/gn_module_export b/sources/gn_module_export
new file mode 160000
index 0000000..30433d4
--- /dev/null
+++ b/sources/gn_module_export
@@ -0,0 +1 @@
+Subproject commit 30433d41c9bbf9672e09e5b86caa705708a4837c
diff --git a/sources/gn_module_import b/sources/gn_module_import
new file mode 160000
index 0000000..87470e5
--- /dev/null
+++ b/sources/gn_module_import
@@ -0,0 +1 @@
+Subproject commit 87470e5f8f3361201d5364e31c315f650b8a8f6a
diff --git a/sources/gn_module_monitoring b/sources/gn_module_monitoring
new file mode 160000
index 0000000..2e97e65
--- /dev/null
+++ b/sources/gn_module_monitoring
@@ -0,0 +1 @@
+Subproject commit 2e97e652f2079f5dda1bd14d7b72208a0fa42b20