Application cartographique du GAL Meuse@Campagne
Go to file
nobohan 0cc04eae61 update README 2024-01-30 11:06:33 +01:00
documentation update doc 2022-09-28 10:25:59 +02:00
fixtures correction formulaire pour les espèces 2021-09-15 10:17:05 +02:00
media Images from patch -> container media 2021-06-02 11:30:32 +02:00
nginx allow images up to 12M (fix #9) 2021-07-05 11:40:13 +02:00
patches Update vendor for Geonature for #44 (dashboard) 2024-01-18 10:46:06 +01:00
qgis #44 add demo graphs in QGIS project 2023-08-28 15:23:54 +02:00
sandbox POC of polygon drawing with Leaflet 2021-09-01 15:14:04 +02:00
utils upd utils README 2021-09-22 10:37:06 +02:00
vendor update submodule for #44 2024-01-23 11:22:13 +01:00
.dockerignore add node_modules in gitingore for speeding the docker images builds 2021-08-23 21:55:34 +02:00
.gitignore Add node_modules in gitignore 2021-05-31 23:05:39 +02:00
.gitmodules Split into docker containers 2021-05-31 15:47:23 +02:00
Dockerfile mount local code folders during development 2021-04-21 10:37:22 +02:00
Dockerfile-back #40 fix pip dependency issue with fiona and utils-flask-sqla-geo using python3.8 2023-07-17 12:32:48 +02:00
Dockerfile-front fix proper way of build the front container with custom patch files 2021-06-23 21:15:46 +02:00
Dockerfile-taxhub FIXED compilation of Dockerfile for Taxhub #54 2024-01-08 16:27:10 +01:00
Makefile Makefile: update init target 2021-04-21 10:37:40 +02:00
README.md update README 2024-01-30 11:06:33 +01:00
docker-compose.override.yml FEATURE: send email to admins when a new user subscribe #41 2023-08-16 10:46:32 +02:00
docker-compose.yml Using apache as foward (not serving files) 2021-05-31 22:12:38 +02:00
restart.sh Script to restart an container from an existing image 2021-05-19 17:21:22 +02:00

README.md

Geonature - Biommap

L'instance Geonature-Citizen de Champs-Libres.

Multi-container instructions

Installation

Clone this repo

 $ git clone git@gitea.champs-libres.be:champs-libres/biommap.git

Get the code (using git-submodule) for : citizen & taxhub.

 $ git submodule update --init --recursive

DB init

Creation of the table referentielsdb that will be used for storing data.

$ docker-compose up -d db
$ docker-compose exec db createdb -U postgres referentielsdb
$ docker-compose exec db psql -U postgres -d referentielsdb -c "CREATE SCHEMA taxonomie"
$ docker-compose exec db psql -d -U postgres -d referentielsdb -c "CREATE EXTENSION postgis"

Build the other containers

$ docker-compose up

At this stage, you still have to install Taxhub and compile the front to see the app running!

Compile the front

$ docker-compose run --rm citizen-front npm install
$ docker-compose run --rm citizen-front npm run build:i18n-ssr

Taxhub installation

$ docker-compose run taxhub bash install_db.sh
$ docker-compose up -d taxhub

nginx

Redirige de 8080 vers autres services :

   - 4000 (citizen-front)
   - 5002 (citizen-back)
   - 5000 (taxon)

Starting

For starting the application again, you may start the db container first

$ docker-compose up -d db
$ docker-compose up

Post-installation

  1. Create a user account through the application and/or in the admin
  2. Create a project, a "zone géographique", a form, a "type de site", a program (see https://gitea.champs-libres.be/champs-libres/biommap/wiki/Gestion-des-programmes)

Development

Inspect db

There is a pgweb container that allows to inspect the db, at http://localhost:8081/. Use the following credentials to connect:

  • host: db
  • un: postgres
  • pw: postgres
  • dbname: referentielsdb
  • port: 5432
  • SSL mode: disable

Front-end development

In order to interactively edit the js code, the frontend folder is mounted into the frontend container. To interactively develop the frontend code and watch the results, enter the running frontend container and launch ng serve with the following arguments (see http://imaginativethinking.ca/heck-get-connection-reset-peer-containerizing-angular-4-application/ for why the host argument is required):

docker-compose exec citizen-front bash
root@9c0fea7720a0:/home/appuser/citizen/frontend# npm run ng serve -- --host 0.0.0.0 --port 4200 --configuration=fr --poll 2000  --sourceMap=false

The app must be looked at http://localhost:4200/.

But note that for persistently-built frontend files, you must run:

docker-compose exec citizen-front bash
root@9c0fea7720a0:/home/appuser/citizen/frontend# npm run build:i18n-ssr

or npm run build:fr for speeding up.

Back-end development

When developing the app and serving it with docker-compose up, the changes should be automatically loaded (meaning, the app is watching the changes) (Note that this is not the case anymore). However, it is more practical to change the command of the backend container from command: bash start_gunicorn.sh to command: python wsgi.py in order to have some logs.

You can access a flask shell terminal with the following:

docker-compose exec citizen-back bash
appuser@5d4fc6b169b2:~/citizen/backend$ flask shell

Deploiement sur un serveur distant

0) Si on change le fichier app.config.ts

scp patches/frontend/src/conf/app.config.ts.dist user@domain.org:/path/to/app.config.ts

1) Reconstruire l'image front en local

docker-compose build citizen-front
docker login registry.gitlab.com
docker push registry.gitlab.com/champs-libres/geonature-citizen/front

Il est peut-être aussi nécessaire de faire de même pour l'image media.

docker-compose build media
docker login registry.gitlab.com
docker push registry.gitlab.com/champs-libres/geonature-citizen/media

2) Sur le serveur distant

docker pull registry.gitlab.com/champs-libres/geonature-citizen/front
# Rebuild of the front
docker-compose run --rm citizen-front npm run build:i18n-ssr
# Restart the containers
docker-compose up -d db
docker-compose up -d

Troubleshooting

Attention, lorsqu'on envoie des images sur le serveur (avec docker push), celles-ci peuvent être très volumineuses! Il faut vérifier la capacité du serveur (avec df), inspecter les images existantes (docker image ls) et supprimer les anciennes images (docker rmi ...).

Single-container instructions (deprecated)

Installation

$ git submodule update --init --recursive $ docker-compose up -d $ docker-compose exec citizen install/install_app.sh

note: les credentials pour accéder au backend se trouvent dans /home/appuser/citizen/config

Développement

Mise à jour de GeoNature

Certaines modifications sont faites sur le fork de GeoNature-citizen. Pour télécharger la dernièer version, faire:

$ git submodule foreach git pull git@github.com:Champs-Libres/GeoNature-citizen.git champs-libres

Remise en route du service

$ docker-compose up -d $ docker-compose exec citizen sh install/restart.sh

Documentation

$ make doc

Builder le front (pour production) (avant de pouvoir faire le docker up)

$ docker-compose run --rm citizen-front npm install
$ docker-compose run --rm citizen-front npm run build:i18n-ssr
$ docker-compose up -d citizen-front

$ docker-compose exec citizen-front bash appuser@ab136184159a:~/citizen/$ cd frontend appuser@ab136184159a:~/citizen/frontend$ npm run ng build -- --configuration=fr --prod


### Modifier la config du front end

- faire des modifications dans `patches/frontend/conf`
- Builder le front (cfr commande ci-dessus)
- arrêter le container et remise en route du service (cfr commande ci-desssus)

### Modifier les images (e.g., image de fond)

Certaines images sont servies sur api/media, d'autres dans assets!
#### 1) Les images servies sur api/media/

- changer les fichiers dans `patches/frontend/src/assets/`
- copier ces fichiers dans le dossier `media`:

$ docker-compose exec citizen bash appuser@ab136184159a:~/citizen/$ cp -r frontend/src/assets/* media


- arrêter le container et remise en route du service (cfr commande ci-desssus)

#### 2) Les images servies sur assets/

- changer les fichiers dans `patches/frontend/src/assets/`
- Builder le front (cfr commande ci-dessus)
- arrêter le container et remise en route du service (cfr commande ci-desssus)

## Utilisation et configuration

- Interface admin: http://localhost:8080/api/admin
- UN: citizen
- PW: voir le password généré à la fin de l'installation!
### Création d'un programme

La création d'un programme n'est pas encore documentée dans la doc officielle. Remplir les formulaires dans l'admin.

Notes:

- Dans zone géographique, il faut rentrer un fichier geojson. Les limites de la commune de wasseiges peuvent être retrouvées via http://overpass-turbo.eu/s/15qX ou dans `fixtures/geojson/`.

### Création d'un utilisateur

La création d'un utilisateur n'est pas encore documentée dans la doc officielle. On peut s'enregistrer sur le site. Néanmoins, sans serveur SMTP, l'envoi de l'email de confirmation ne fonctionne pas. Il faut alors manuellement **activer** l'utilisateur dans l'admin.