6 Commits

7 changed files with 119 additions and 148 deletions

View File

@@ -1,5 +1,4 @@
FROM debian:buster-slim
# todo utiliser image python3 ?
FROM python:3.8-slim-buster
## install dependencies
RUN apt-get update && \
@@ -21,8 +20,7 @@ RUN echo "appuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
COPY vendor/GeoNature-citizen/ /home/appuser/citizen/
# patches
#COPY patches/back/requirements.txt /home/appuser/citizen/backend/requirements.txt #use the requirements from the GnC repo
COPY patches/back/default_config.toml /home/appuser/citizen/config/default_config.toml
COPY patches/back/default_config.toml /home/appuser/citizen/config/config.toml
COPY patches/settings.ini /home/appuser/citizen/config/settings.ini
COPY patches/back/wsgi.py /home/appuser/citizen/backend/wsgi.py
COPY patches/back/server.py /home/appuser/citizen/backend/server.py
@@ -33,6 +31,8 @@ USER appuser
WORKDIR /home/appuser/citizen/backend/
RUN mkdir /home/appuser/citizen/media/
ENV VIRTUAL_ENV=/home/appuser/citizen/backend/venv2/
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

104
README
View File

@@ -1,104 +0,0 @@
TODO FUSION entre README & README.md
# gl-geonature
L'instance Geonature-Citizen de Champs-Libres.
# Installation développeur (docker-compose )
## Multiple containers
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"
```
### Taxhub
```
$ docker-compose run taxhub bash install_db.sh
$ docker-compose up -d taxhub
```
#### CREATION / Compiation du JS de Taxhub
##### Mise à jour de nppm.
```
$ docker-compose exec -u root taxhub bash
taxhub $ npm install npm@latest -g # mise à jour de npm
```
#### Compilation du code
```
$ docker-compose exec taxhub bash
taxhub $ cd static
taxhub $ cp app/constants.js.sample app/constants.js
taxhub $ npm install
```
### Citizen-front
```
$ 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
```
### Citizen-back
```
docker-compose up -d citizen-front
```
### Apache
Redigie de 8080 vers autres services :
- 4000 (citizen-front)
- 5002 (citizen-back)
- 5000 (taxon)
## Single container (depreciated)
### Creation DB (pour single container)
docker-compose exec db createdb -U postgres citizen
docker-compose exec db psql -U postgres -d citizen -c "CREATE SCHEMA taxonomie"
ref_geo
docker-compose exec db psql -d -U postgres -d citizen -c "CREATE EXTENSION postgis"
$ 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
### Remise en route du service
$ docker-compose up -d
$ docker-compose exec citizen sh install/restart.sh
# Documentation :
$ make doc

View File

@@ -41,13 +41,14 @@ services:
- ./vendor/GeoNature-citizen/backend/var/log/:/home/appuser/citizen/backend/var/log/
- ./patches/settings.ini:/home/appuser/citizen/config/settings.ini
- ./patches/settings.ini:/home/appuser/citizen/backend/config/settings.ini
- ./patches/back/default_config.toml:/home/appuser/citizen/config/default_config.toml
- ./patches/back/default_config.toml:/home/appuser/citizen/config/config.toml
- ./patches/back/start_gunicorn.sh:/home/appuser/citizen/backend/start_gunicorn.sh
- ./patches/back/wsgi.py:/home/appuser/citizen/backend/wsgi.py
- ./patches/back/server.py:/home/appuser/citizen/backend/server.py
ports:
- "5002:5002"
command: bash start_gunicorn.sh
#command: bash start_gunicorn.sh
command: python wsgi.py
taxhub:
build:
dockerfile: ./Dockerfile-taxhub

View File

@@ -1,35 +0,0 @@
certifi==2019.6.16
chardet==3.0.4
Click==7.0
colorlog==4.0.2
flasgger==0.9.3
Flask==1.1.1
Flask-Admin==1.5.3
Flask-CKEditor==0.4.3
Flask-Cors==3.0.8
Flask-JWT-Extended==3.21.0
Flask-SQLAlchemy==2.4.0
GeoAlchemy2==0.6.3
geojson==2.5.0
gunicorn==20.0.4
idna==2.8
itsdangerous==1.1.0
Jinja2==2.10.1
jsonschema==2.6.0
MarkupSafe==1.1.1
mistune==0.8.4
passlib==1.7.1
psycopg2-binary==2.8.3
PyJWT==1.7.1
PyYAML==5.1.2
requests==2.22.0
Shapely==1.7.1
six==1.12.0
SQLAlchemy==1.3.7
toml==0.10.0
urllib3==1.25.3
Werkzeug==0.15.5
WTForms==2.2.1
gunicorn==20.0.4
httplib2==0.19.0
xlwt==1.3.0

View File

@@ -96,7 +96,7 @@ def get_app(config, _app=None, with_external_mods=True, url_prefix="/api"):
from gncitizen.core.users.routes import users_api
from gncitizen.core.commons.routes import commons_api
from gncitizen.core.observations.routes import obstax_api
from gncitizen.core.ref_geo.routes import geo_api
#from gncitizen.core.ref_geo.routes import geo_api
from gncitizen.core.badges.routes import badges_api
from gncitizen.core.taxonomy.routes import taxo_api
from gncitizen.core.sites.routes import sites_api
@@ -104,7 +104,7 @@ def get_app(config, _app=None, with_external_mods=True, url_prefix="/api"):
app.register_blueprint(users_api, url_prefix=url_prefix)
app.register_blueprint(commons_api, url_prefix=url_prefix)
app.register_blueprint(obstax_api, url_prefix=url_prefix)
app.register_blueprint(geo_api, url_prefix=url_prefix)
#app.register_blueprint(geo_api, url_prefix=url_prefix)
app.register_blueprint(badges_api, url_prefix=url_prefix)
app.register_blueprint(taxo_api, url_prefix=url_prefix)
app.register_blueprint(sites_api, url_prefix=url_prefix + "/sites")

View File

@@ -0,0 +1,109 @@
import { AppConfig } from './app.config';
import { MAP_CONFIG as MapConfig } from './map.config';
export const DefaulConfig = {
// Default MainConfig
appName: 'GeoNature-citizen',
API_ENDPOINT: 'http://localhost:5002/api',
API_TAXHUB: 'http://localhost:5000/api',
API_CITY: 'https://nominatim.openstreetmap.org/reverse',
HCAPTCHA_SITE_KEY: null,
FRONTEND: {
PROD_MOD: true,
MULTILINGUAL: false,
DISPLAY_FOOTER: true,
DISPLAY_TOPBAR: true,
DISPLAY_SIDEBAR: true,
DISPLAY_STATS: true,
DISPLAY_BADGES: true,
NEW_OBS_FORM_MODAL_VERSION: true,
},
META: {
keywords: 'biodiversite enquetes participatif observations',
},
about: true,
URL_APPLICATION: 'http://127.0.0.1:4200',
REWARDS: true,
termsOfUse: {
fr: 'assets/cgu.pdf',
en: 'assets/termsOfUse.pdf',
},
signup: 'optional', // never|optional|always
email_contact: false,
platform_intro: {
fr: 'Bienvenue<br /> sur GeoNature Citizen',
en: 'Welcome<br /> on GeoNature Citizen',
},
platform_teaser: {
fr: 'Hae duae provinciae bello quondam piratico catervis mixtae praedonum a Servilio pro consule missae sub iugum factae sunt vectigales. et hae quidem regiones velut in prominenti terrarum lingua positae ob orbe eoo monte Amano disparantur.',
en: 'Hae duae provinciae bello quondam piratico catervis mixtae praedonum a Servilio pro consule missae sub iugum factae sunt vectigales. et hae quidem regiones velut in prominenti terrarum lingua positae ob orbe eoo monte Amano disparantur.',
},
platform_participate: {
fr: 'PARTICIPER AU PROGRAMME',
en: 'PARTICIPATE',
},
programs_label: {
fr: 'Programmes',
en: 'Surveys',
},
program_label: {
fr: 'Le programme',
en: 'Survey',
},
program_share_an_observation: {
fr: 'PARTAGER UNE OBSERVATION',
en: 'SHARE AN OBSERVATION',
},
program_add_an_observation: {
fr: 'AJOUTER UNE OBSERVATION',
en: 'CONTRIBUTE AN OBSERVATION',
},
program_allow_email_contact: {
fr: "J'accepte que mon adresse e-mail puisse être utilisée pour recontacter à propos de mon observation",
en: 'I agree that my e-mail address can be used to recontact about my observation',
},
taxonDisplayImageWhenUnique: true,
taxonSelectInputThreshold: 7,
taxonAutocompleteInputThreshold: 12,
taxonAutocompleteFields: [
'nom_complet',
'nom_vern',
'nom_vern_eng',
'cd_nom',
],
taxonDisplaySciName: true,
program_list_observers_names: true,
program_list_sort: '-timestamp_create',
details_espece_url: '<url_inpn_or_atlas>/cd_nom/', // !! gardez bien le cd_nom/ dans l'url
registration_message: 'Vous inscrire vous permet de gérer vos observations',
imageUpload: {
maxHeight: 1440,
maxWidth: 1440,
quality: 0.9,
},
// Default MapConfig
DEFAULT_PROVIDER: 'OpenStreetMapOrg',
BASEMAPS: [
{
name: 'OpenStreetMapOrg',
maxZoom: 19,
layer: '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
subdomains: 'abc',
attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Tiles style by <a href="https://www.hotosm.org/" target="_blank">Humanitarian OpenStreetMap Team</a> hosted by <a href="https://openstreetmap.fr/" target="_blank">OpenStreetMap France</a>',
},
],
CENTER: [46.52863469527167, 2.43896484375],
ZOOM_LEVEL: 6,
ZOOM_LEVEL_RELEVE: 15,
NEW_OBS_POINTER: 'assets/pointer-blue2.png',
OBS_POINTER: 'assets/pointer-green.png',
LOCATE_CONTROL_TITLE: {
fr: 'Me localiser',
en: 'Show me where i am',
},
};
export const MainConfig = { ...DefaulConfig, ...AppConfig, ...MapConfig };
export default MainConfig;