Skip to content

Commit

Permalink
geonature atlas wip
Browse files Browse the repository at this point in the history
  • Loading branch information
joelclems committed May 30, 2023
1 parent cbd7e4d commit 9540f2a
Show file tree
Hide file tree
Showing 11 changed files with 156 additions and 2 deletions.
8 changes: 7 additions & 1 deletion .env.current
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ GN_VERSION="cur"

GEONATURE_BACKEND_CURRENT_IMAGE="gn_backend_${GN_VERSION}"
GEONATURE_FRONTEND_CURRENT_IMAGE="gn_frontend_${GN_VERSION}"
GEONATURE_ATLAS_CURRENT_IMAGE="gn_atlas_${GN_VERSION}"
GEONATURE_FRONTEND_CURRENT_4_MODULES_IMAGE="gn_frontend_4_${GN_VERSION}"
GEONATURE_BACKEND_CURRENT_4_MODULES_IMAGE="gn_backend_4_${GN_VERSION}"

Expand Down Expand Up @@ -38,4 +39,9 @@ GDS_GEONATURE_BACKEND_PROTOCOL="${BASE_PROTOCOL}"
GDS_GEONATURE_FRONTEND_IMAGE="${GEONATURE_FRONTEND_CURRENT_4_MODULES_IMAGE}"
GDS_GEONATURE_FRONTEND_PROTOCOL="${BASE_PROTOCOL}"
GDS_GEONATURE_FRONTEND_HOST="${HOST}:${GDS_HTTP_PORT}"
GDS_GEONATURE_FRONTEND_PREFIX="/geonature"
GDS_GEONATURE_FRONTEND_PREFIX="/geonature"

GDS_ATLAS_IMAGE="${GEONATURE_ATLAS_CURRENT_IMAGE}"
GDS_ATLAS_DOMAIN="${HOST}"
GDS_ATLAS_HOST="${HOST}:${GDS_HTTP_PORT}"
GDS_ATLAS_PREFIX="/atlas"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.env
data/apps/*/config/*
data/apps/taxhub/static/*
data/apps/atlas/custom/*
data/apps/geonature/media/*
data/db/*
!data/**/.gitkeep
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@
[submodule "gn_module_monitoring"]
path = sources/gn_module_monitoring
url = https://github.com/PnX-SI/gn_module_monitoring
[submodule "sources/GeoNature-atlas"]
path = sources/GeoNature-atlas
url = https://github.com/PnX-SI/GeoNature-atlas
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ Voir la documentation des différentes applications pour renseigner les fichiers
- Il faut au moins renseigner la variable `SECRET_KEY`.
- [fichier exemple pour UsersHub](./sources/UsersHub/config/config.py.sample)
- [fichier exemple pour TaxHub](./sources/TaxHub/apptax/config.py.sample)
<<<<<<< HEAD
- [fichier exemple pour GeoNature-atlas](./sources/GeoNature-atlas/atlas/configuration/config.py.sample)
=======
- [fichier exemple pour Geonature-atlas](./sources/GeoNature-atlas/atlas/configuration/config.py.sample )
>>>>>>> geonature atlas wip
à noter que certaines variables seront fournies en tant que variables d'environnement (voir les fichiers [docker-compose](./docker-compose.yml))

Expand Down
5 changes: 4 additions & 1 deletion build/build_geonature_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ source .env
# GEONATURE_FRONTEND_CURRENT_4_MODULES_IMAGE="gn_frontend_4_cur"
# GEONATURE_BACKEND_CURRENT_4_MODULES_IMAGE="gn_backend_4_cur"

# GN ATLAS
docker build -f sources/GeoNature-atlas/Dockerfile -t ${GEONATURE_ATLAS_CURRENT_IMAGE} sources/GeoNature-atlas/


# GN FRONTEND SOURCE
docker build -f sources/GeoNature/frontend/Dockerfile -t ${GEONATURE_FRONTEND_CURRENT_IMAGE}-source --target=source sources/GeoNature/

# GN FRONTEND NGINX
docker build -f sources/GeoNature/frontend/Dockerfile -t ${GEONATURE_FRONTEND_CURRENT_IMAGE}-nginx --target=prod-base sources/GeoNature/


# GN BACKEND WHEELS
docker build -f sources/GeoNature/backend/Dockerfile -t ${GEONATURE_BACKEND_CURRENT_IMAGE}-wheels --target=wheels sources/GeoNature/

Expand Down
Empty file added data/apps/atlas/config/.gitkeep
Empty file.
105 changes: 105 additions & 0 deletions data/apps/atlas/config/config.py.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# -*- coding:utf-8 -*-

##############################
## Fichier de configuration ##
##############################

# Connexion de l'application à la BDD
# Remplacer user, monpassachanger, IPADRESSE (localhost si la BDD est sur le même serveur que l'application),
# eventuellement le port de la BDD et le nom de la BDD avec l'utilisateur qui a des droits de lecture sur les vues de l'atlas (user_pg dans settings.ini)
database_connection = "postgresql://user:monpassachanger@IPADRESSE:5432/databaseName"

# Recharger automatiquement les templates
TEMPLATES_AUTO_RELOAD = False

#################################
#################################
### Customisation application ###
#################################
#################################

# Nom de la structure
STRUCTURE = "Nom de la structure"

# Nom de l'application
NOM_APPLICATION = "Nom de l application"

# URL de l'application depuis la racine du domaine
# ex "/atlas" pour une URL: http://mon-domaine/atlas OU "" si l'application est accessible à la racine du domaine
URL_APPLICATION = ""

#################################
#################################
###### Modules activation #######
#################################
#################################

# Enable organism module : organism sheet + organism participation on species sheet
ORGANISM_MODULE = False

###########################
###### Multilingual #######
###########################

# Default language, also used when multilingual is disabled
DEFAULT_LANGUAGE = 'fr'

# Activate multilingual
MULTILINGUAL = False

# Available languages
# Don't delete, even if you disable MULTILINGUAL
# You need to add your own default language (DEFAULT_LANGUAGE) here if it's not present
# Check documentation to add another language
LANGUAGES = {
'en': {
'name' : 'English',
'flag_icon' : 'flag-icon-gb',
'months' : ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
},
'fr': {
'name' : 'Français',
'flag_icon' : 'flag-icon-fr',
'months' : ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Decembre']
},
'it': {
'name' : 'Italiano',
'flag_icon' : 'flag-icon-it',
'months' : ['Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre']
}
}

###########################
###########################
###### Cartographie #######
###########################
###########################

# Configuration des cartes (centre du territoire, couches CARTE et ORTHO, échelle par défaut...)
MAP = {
'LAT_LONG': [44.7952, 6.2287],
'FIRST_MAP': {
'url' : '//{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',
'attribution' : '&copy OpenStreetMap',
'tileName' : 'OSM'
},
'SECOND_MAP' : {'url' :'//a.tile.opentopomap.org/{z}/{x}/{y}.png',
'attribution' : '&copy OpenStreetMap-contributors, SRTM | Style: &copy OpenTopoMap (CC-BY-SA)',
'tileName' : 'OTM'
},
'ZOOM' : 10,
# Pas du slider sur les annees d'observations: 1 = pas de 1 an sur le slider
'STEP': 1,
# Couleur et épaisseur des limites du territoire
'BORDERS_COLOR': '#000000',
'BORDERS_WEIGHT': 3,
'ENABLE_SLIDER': True
}

###########################
###########################
#### Security Config #####
###########################
###########################

SECRET_KEY = 'INSERT_A_RANDOM_SECRET_KEY'
Empty file added data/apps/atlas/custom/.gitkeep
Empty file.
30 changes: 30 additions & 0 deletions docker-compose.atlas.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
services:
atlas:
image: ${GDS_ATLAS_IMAGE}
depends_on:
- postgres
- geonature-backend
environment:
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_HOST=${POSTGRES_HOST:-postgres}
- POSTGRES_PORT= ${POSTGRES_PORT:-5432}
- ATLAS_ALTITUDES=${ATLAS_ALTITUDES:-(0 500 1000 1500 2000 2500 3000 3500 4000)}
- ATLAS_TYPE_TERRITOIRE=${ATLAS_TYPE_TERRITOIRE:-'PEC'}
- ATLAS_TYPE_MAILLE=${ATLAS_TYPE_MAILLE:-'M1'}
- ATLAS_INSTALL_SCHEMA=${ATLAS_INSTALL_SCHEMA:-false}
- ATLAS_RESET_SCHEMA=${ATLAS_RESET_SCHEMA:-false}
- ATLAS_URL_APPLICATION="${GDS_ATLAS_PROTOCOL:-http}://${GDS_ATLAS_HOST}${GDS_ATLAS_PREFIX:-/atlas}"
- ATLAS_APPLICATION_ROOT="${GDS_ATLAS_PREFIX:-/atlas}"
- ATLAS_REMOTE_MEDIAS_URL="${GDS_TAXHUB_PROTOCOL:-http}://${GDS_TAXHUB_HOST}${GDS_TAXHUB_PREFIX:-/taxhub}/"
- ATLAS_TAXHUB_URL="${GDS_TAXHUB_PROTOCOL:-http}://${GDS_TAXHUB_HOST}${GDS_TAXHUB_PREFIX:-/taxhub}"
- ATLAS_REDIMENSIONNEMENT_IMAGE=${ATLAS_REDIMENSIONNEMENT_IMAGE:-true}
- ATLAS_database_connection=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT:-5432}/${POSTGRES_DB}
volumes:
- ${GDS_GEONATURE_ATLAS_CONFIG_DIRECTORY:-./data/apps/atlas/config}:/dist/config
- ${GDS_GEONATURE_ATLAS_CUSTOM_DIRECTORY:-./data/apps/atlas/custom}:/dist/static/custom
labels:
- "traefik.enable=true"
- "traefik.http.routers.atlas.rule=Host(`${GDS_ATLAS_DOMAIN}`) && PathPrefix(`${GDS_ATLAS_PREFIX:-/atlas}`)"
- "traefik.http.routers.atlas.entrypoints=web"
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ services:
- "traefik.enable=true"
- "traefik.http.routers.geonature-backend.rule=Host(`${GDS_GEONATURE_DOMAIN}`) && PathPrefix(`${GDS_GEONATURE_BACKEND_PREFIX:-/geonature/api}`)"
- "traefik.http.routers.geonature-backend.entrypoints=web"

geonature-frontend:
image: ${GDS_GEONATURE_FRONTEND_IMAGE:-ghcr.io/pnx-si/geonature-frontend:latest}
environment:
Expand Down
1 change: 1 addition & 0 deletions sources/GeoNature-atlas
Submodule GeoNature-atlas added at be25ae

0 comments on commit 9540f2a

Please sign in to comment.