diff --git a/README.md b/README.md index dfd13754673e764e16199b3c075a5d40bff75759..a19929e1d88bf5b892b4ed55d1d2fd955800bcb5 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,13 @@ ## Description -`agrometinfo-www` is one of the AgroMetInfo components to display the web site with: +`agrometinfo-www` is the component of the AgroMetInfo the web site to display maps. -* static content (documentation), -* maps. +The static web site is developed at <https://forgemia.inra.fr/agroclim/agrometinfo/documentation>. ## Development & deployment -See [documentation](src/site/markdown/index.md). +See [documentation](src/site/markdown/index.md), available online at <https://agroclim.pages.mia.inra.fr/agrometinfo/www/>. Documentation is handled by `maven-site-plugin`. diff --git a/src/site/markdown/index.md b/src/site/markdown/index.md index be5bd643a966269e67e53d959fc29959c703f3ca..f0811b221cdd65f9d6e5721d345affe81a4c76b4 100644 --- a/src/site/markdown/index.md +++ b/src/site/markdown/index.md @@ -2,10 +2,9 @@ ## Description -`agrometinfo-www` is one of the [AgroMetInfo](https://forgemia.inra.fr/agroclim/agrometinfo/) components to: +`agrometinfo-www` is the component of the AgroMetInfo the web site to display maps. -* static content (documentation), -* maps. +The static web site is developed at <https://forgemia.inra.fr/agroclim/agrometinfo/documentation>. See [*MADR* decision log](adr/index.html). @@ -15,40 +14,40 @@ See [*MADR* decision log](adr/index.html). 1. Create role with a password (here `agrometinfo`): ``` -sudo -u postgres psql -c "CREATE USER agrometinfo PASSWORD 'agrometinfo'" -``` + sudo -u postgres psql -c "CREATE USER agrometinfo PASSWORD 'agrometinfo'" + ``` 2. Create the database `` -sudo -u postgres createdb agrometinfo --encoding=UTF8 --lc-collate=fr_FR.UTF-8 --lc-ctype=fr_FR.UTF-8 --owner=agrometinfo -``` + sudo -u postgres createdb agrometinfo --encoding=UTF8 --lc-collate=fr_FR.UTF-8 --lc-ctype=fr_FR.UTF-8 --owner=agrometinfo + ``` 3. Adjust `pg_hba.conf` if needed 4. Add the password to `~/.pgpass` if wanted ``` -localhost:5432:agrometinfo:agrometinfo:agrometinfo -``` + localhost:5432:agrometinfo:agrometinfo:agrometinfo + ``` 4. Create the schema: ``` -psql -h localhost -U agrometinfo -d agrometinfo -c 'CREATE SCHEMA "agrometinfo"' -export PGOPTIONS="--search_path=agrometinfo" -psql -h localhost -U agrometinfo -d agrometinfo -1 -f sql/schema.types.postgresql.sql -psql -h localhost -U agrometinfo -d agrometinfo -1 -f sql/schema.tables.sql -``` + psql -h localhost -U agrometinfo -d agrometinfo -c 'CREATE SCHEMA "agrometinfo"' + export PGOPTIONS="--search_path=agrometinfo" + psql -h localhost -U agrometinfo -d agrometinfo -1 -f sql/schema.types.postgresql.sql + psql -h localhost -U agrometinfo -d agrometinfo -1 -f sql/schema.tables.sql + ``` 5. Add initialization data: ``` -export PGOPTIONS="--search_path=agrometinfo" -cd sql/ -psql -h localhost -U agrometinfo -d agrometinfo -1 -f init_data.postgresql.sql -``` + export PGOPTIONS="--search_path=agrometinfo" + cd sql/ + psql -h localhost -U agrometinfo -d agrometinfo -1 -f init_data.postgresql.sql + ``` 6. Grant permissions to SEASON ``` -GRANT USAGE ON SCHEMA agrometinfo TO season; -GRANT SELECT ON TABLE indicator TO season; -GRANT ALL ON TABLE dailyvalue TO season; -GRANT SELECT ON TABLE period TO season; -GRANT SELECT ON TABLE normalvalue TO season; -GRANT SELECT ON SEQUENCE dailyvalue_id_seq TO season; -GRANT ALL ON SEQUENCE dailyvalue_id_seq TO season; -``` + GRANT USAGE ON SCHEMA agrometinfo TO season; + GRANT SELECT ON TABLE indicator TO season; + GRANT ALL ON TABLE dailyvalue TO season; + GRANT SELECT ON TABLE period TO season; + GRANT SELECT ON TABLE normalvalue TO season; + GRANT SELECT ON SEQUENCE dailyvalue_id_seq TO season; + GRANT ALL ON SEQUENCE dailyvalue_id_seq TO season; + ``` ### Package @@ -101,23 +100,36 @@ with `~/.m2/settings.xml` with something like: - Configure `context.xml` for the embedded Tomcat. ```xml - <Resource - name="jdbc/agrometinfo" - auth="Container" - driverClassName="org.postgresql.Driver" - initialSize="2" - maxTotal="10" - maxIdle="5" - maxWaitMillis="1000" - testOnBorrow="true" - testOnReturn="true" - testWhileIdle="true" - timeBetweenEvictionRunsMillis="5000" - type="javax.sql.DataSource" - url="jdbc:postgresql://127.0.0.1:5432/season?ApplicationName=AgroMetInfo&currentSchema=agrometinfo" - username="agrometinfo" - password="agrometinfo" - validationQuery="select 1" /> + <Parameter name="agrometinfo.app.email" value="agrometinfoXXXX@inrae.fr" /> + <Parameter name="agrometinfo.app.url" value="http://localhost:8080/www-server/" /> + <Parameter name="agrometinfo.environment" value="dev" /> <!-- dev / preprod / prod --> + <Parameter name="agrometinfo.log.email" value="agrometinfoXXXX@inrae.fr" /> + <Parameter name="agrometinfo.smtp.host" value="smtp.inrae.fr" /> + <Parameter name="agrometinfo.smtp.port" value="587" /> + <Parameter name="agrometinfo.smtp.user" value="agrometinfoXXXX" /> + <Parameter name="agrometinfo.smtp.password" value="XXXX" /> + <Parameter name="sava.key" value="XXXX" /> + <Parameter name="sava.pass" value="XXXX" /> + <Resource + name="jdbc/agrometinfo" + auth="Container" + driverClassName="org.postgresql.Driver" + initialSize="2" + maxTotal="10" + maxIdle="5" + maxWaitMillis="1000" + minEvictableIdleTimeMillis="60000" + minIdle="2" + removeAbandonedOnBorrow="true" + removeAbandonedOnMaintenance="true" + removeAbandonedTimeout="60" + testOnBorrow="true" + timeBetweenEvictionRunsMillis="30000" + type="javax.sql.DataSource" + url="jdbc:postgresql://127.0.0.1:5432/agrometinfo?ApplicationName=AgroMetInfo" + username="agrometinfo" + password="agrometinfo" + validationQuery="select 1" /> ``` If CodeServer fails to launch, use the script diff --git a/www-server/src/main/tomcat10xconf/context.xml b/www-server/src/main/tomcat10xconf/context.xml index 86025c7d1402c7fe82f5b0a0057fc77824da0d3f..0125add0eb0816392f8009aa47c0fd9ad67f8627 100644 --- a/www-server/src/main/tomcat10xconf/context.xml +++ b/www-server/src/main/tomcat10xconf/context.xml @@ -9,6 +9,8 @@ <Parameter name="agrometinfo.smtp.port" value="587" /> <Parameter name="agrometinfo.smtp.user" value="agrometinfoXXXX" /> <Parameter name="agrometinfo.smtp.password" value="XXXX" /> + <Parameter name="sava.key" value="XXXX" /> + <Parameter name="sava.pass" value="XXXX" /> <Resource name="jdbc/agrometinfo" auth="Container" @@ -17,10 +19,13 @@ maxTotal="10" maxIdle="5" maxWaitMillis="1000" + minEvictableIdleTimeMillis="60000" + minIdle="2" + removeAbandonedOnBorrow="true" + removeAbandonedOnMaintenance="true" + removeAbandonedTimeout="60" testOnBorrow="true" - testOnReturn="true" - testWhileIdle="true" - timeBetweenEvictionRunsMillis="5000" + timeBetweenEvictionRunsMillis="30000" type="javax.sql.DataSource" url="jdbc:postgresql://127.0.0.1:5432/agrometinfo?ApplicationName=AgroMetInfo" username="agrometinfo"