... | ... | @@ -10,7 +10,42 @@ The **GG-Server** manages the applicartion business logic and the [database](htt |
|
|
|
|
|
Both server and client components are packaged as Docker images and designed for container deployment on Windows, Linux and macos hosts. This makes it easy for IT department to deploy, manage, backup and upgrade individual components automatically. Containers can run on different hosts as long as they are able to communicate on designated ports. Only the HTTPS port is exposed to the outside world.
|
|
|
|
|
|
Following, are the installation instructions for the server and the client.
|
|
|
Following, are the installation instructions for the database, server and the client.
|
|
|
|
|
|
|
|
|
|
|
|
# SQL Server
|
|
|
|
|
|
You can use an existing GRIN-Global MSSQL database, or setup and run MSSQL Express service as a Docker container. A docker volume is where the server will persist data between service restarts.
|
|
|
|
|
|
|
|
|
```bash
|
|
|
# Create a volume for MSSQL data
|
|
|
docker volume create mssql-ggce-data
|
|
|
|
|
|
# Start MSSQL Express
|
|
|
docker run --name 'mssql-ggce' \
|
|
|
-e 'ACCEPT_EULA=Y' \
|
|
|
-e 'SA_PASSWORD=YourStrong@Passw0rd' \
|
|
|
-e 'MSSQL_PID=Express' \
|
|
|
-e 'TZ=UTC' \
|
|
|
-v mssql-ggce-data:/var/opt/mssql \
|
|
|
mcr.microsoft.com/mssql/server:2019-latest
|
|
|
|
|
|
# Connect to the database engine
|
|
|
docker exec -it mssql-ggce \
|
|
|
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'YourStrong@Passw0rd'
|
|
|
```
|
|
|
|
|
|
Create a **blank** `ggce` database with `SQL_Latin1_General_CP1_CI_AS` collation
|
|
|
(case-insensitive, accent-sensitive):
|
|
|
|
|
|
```sql
|
|
|
CREATE DATABASE ggce COLLATE SQL_Latin1_General_CP1_CI_AS
|
|
|
GO
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
# GG-CE Server
|
|
|
|
... | ... | @@ -127,106 +162,11 @@ Once you can connect to your GG-CE Server, navigate to the Admin section and: |
|
|
|
|
|
Consider installing [GG-CE Web](https://gitlab.croptrust.org/grin-global/grin-global-ui).
|
|
|
|
|
|
## Migrating from GRIN-Global
|
|
|
|
|
|
TBD
|
|
|
|
|
|
## Database setup with Docker
|
|
|
|
|
|
You can use an existing GRIN-Global MSSQL database, or setup and run MSSQL Express service as a Docker container. A docker volume is where the server will persist data between service restarts.
|
|
|
|
|
|
|
|
|
```bash
|
|
|
# Create a volume for MSSQL data
|
|
|
docker volume create mssql-ggce-data
|
|
|
|
|
|
# Start MSSQL Express
|
|
|
docker run --name 'mssql-ggce' \
|
|
|
-e 'ACCEPT_EULA=Y' \
|
|
|
-e 'SA_PASSWORD=YourStrong@Passw0rd' \
|
|
|
-e 'MSSQL_PID=Express' \
|
|
|
-e 'TZ=UTC' \
|
|
|
-v mssql-ggce-data:/var/opt/mssql \
|
|
|
mcr.microsoft.com/mssql/server:2019-latest
|
|
|
|
|
|
# Connect to the database engine
|
|
|
docker exec -it mssql-ggce \
|
|
|
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'YourStrong@Passw0rd'
|
|
|
```
|
|
|
|
|
|
Create a **blank** `ggce` database with `SQL_Latin1_General_CP1_CI_AS` collation
|
|
|
(case-insensitive, accent-sensitive):
|
|
|
|
|
|
```sql
|
|
|
CREATE DATABASE ggce COLLATE SQL_Latin1_General_CP1_CI_AS
|
|
|
GO
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## For developers
|
|
|
|
|
|
Most IDEs will resolve project modules automatically. From the command
|
|
|
line, you may want to start with
|
|
|
|
|
|
```sh
|
|
|
# Build and locally install current modules
|
|
|
mvn install
|
|
|
```
|
|
|
|
|
|
Then `cd server` to the server module.
|
|
|
|
|
|
Copy the `myconfig.properties.example` to `myconfig.properties` in
|
|
|
the project folder. Update the configuration options to connect to
|
|
|
your MSSQL _gringlobal_ database:
|
|
|
|
|
|
```properties
|
|
|
db.url=jdbc:sqlserver://localhost:1433;DatabaseName=gringlobal
|
|
|
db.username=sa
|
|
|
db.password=sa1
|
|
|
```
|
|
|
|
|
|
Start the embedded web server from the terminal:
|
|
|
|
|
|
```bash
|
|
|
# Switch to server module
|
|
|
cd server/
|
|
|
mvn -DskipTests=true jetty:run
|
|
|
```
|
|
|
|
|
|
Start the Curator Tool. Add a new GRIN-Global server with display name
|
|
|
_java_ and server name (or IP Address) `localhost:8080`.
|
|
|
|
|
|
Skip "Test Server Address".
|
|
|
|
|
|
Connect to the _java_ server and enjoy the Curator Tool.
|
|
|
|
|
|
### Database configuration
|
|
|
|
|
|
Update environment variables or the `myconfig.properties` file to configure
|
|
|
the JDBC driver and Hibernate dialect. The example below configures GRIN-Global
|
|
|
Server to run against MariaDB or mysql server:
|
|
|
|
|
|
```properties
|
|
|
db.dataviewSql=mysql
|
|
|
db.url=jdbc:mysql://localhost/gringlobal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false&serverTimezone=UTC
|
|
|
db.driverClassName=com.mysql.cj.jdbc.Driver
|
|
|
hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
|
|
|
db.username=root
|
|
|
db.password=
|
|
|
db.showSql=false
|
|
|
```
|
|
|
|
|
|
|
|
|
## License and Disclaimer
|
|
|
|
|
|
This software is licensed under the Apache License, Version 2.0 (the "License").
|
|
|
|
|
|
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
See the License for the specific language governing permissions and
|
|
|
limitations under the License.
|
|
|
|
|
|
# GRIN-Global Client
|
|
|
|
... | ... | @@ -323,46 +263,141 @@ docker image pull dockerhub.croptrust.org/grin-global/grin-global-ui/gg-ce-web:e |
|
|
```
|
|
|
|
|
|
|
|
|
## Development environment
|
|
|
|
|
|
`node >=14.16.0` and `yarn >=1.21.1` are required. See below for installation
|
|
|
instructions.
|
|
|
# GG-CE Deployment
|
|
|
|
|
|
Run `yarn install` in the project root directory.
|
|
|
GG-CE is packaged as Docker images and designed for container deployment on Windows, Linux and macos hosts. This makes it easy for IT department to deploy, manage, backup and upgrade individual components automatically.
|
|
|
|
|
|
In case of build errors please run `yarn --check-files --ignore-scripts` in the project root directory.
|
|
|
![production-environment](images/production-environment.png)
|
|
|
|
|
|
Containers can run on different hosts as long as they are able to communicate on designated ports. Only the HTTPS port is exposed to the outside world.
|
|
|
|
|
|
### Running dev server with hot reload
|
|
|
## Use Traefik to run the containers
|
|
|
|
|
|
To start the web application with live-reload server and work on the application,
|
|
|
run `yarn run start:dev` in _workspaces/ui-express_ module directory
|
|
|
Please note that you must configure `grin-global-server` docker container as documented at https://gitlab.croptrust.org/grin-global/grin-global-server#configuration.
|
|
|
|
|
|
This starts the _webpack-dev-server_ on port 3000: <http://localhost:3000/>
|
|
|
1. The name or IP address of the MSSQL server
|
|
|
2. Username and password for the MSSQL
|
|
|
3. The name or IP address where **GG-CE Server** will be accessible
|
|
|
4. The frontend URL of the **GG-CE Web** service will be accessible
|
|
|
|
|
|
#### `docker run`
|
|
|
|
|
|
### Running SSR server
|
|
|
Setting environment variables with `docker run` CLI command is done with the `-e "NAME=VALUE"` argument:
|
|
|
|
|
|
To start express server with server side rendering and test application as in staging environment
|
|
|
`yarn run start:prod` in _workspaces/ui-express_ module directory
|
|
|
```plaintext
|
|
|
docker run [OTHER FLAGS] -e "DB_URL=jdbc:sqlserver://DATABASE_SERVER:1433;DatabaseName=DATABASE" -e "DB_USERNAME=ggce" -e "DB_PASSWORD=somepassword" [OTHER FLAGS] dockerhub.croptrust.org/grin-global/grin-global-server:v2021.8
|
|
|
```
|
|
|
|
|
|
This starts the express server on port 3000: <http://localhost:3000/>
|
|
|
### Compose file
|
|
|
|
|
|
Setting environment variables in the compose file:
|
|
|
|
|
|
```yaml
|
|
|
version: '3'
|
|
|
services:
|
|
|
ggce-server:
|
|
|
image: dockerhub.croptrust.org/grin-global/grin-global-server:2021.8
|
|
|
environment:
|
|
|
# Database connection
|
|
|
- DB_URL=jdbc:sqlserver://DATABASE_SERVER:1433;DatabaseName=DATABASE
|
|
|
- DB_USERNAME=USERNAME
|
|
|
- DB_PASSWORD=PASSWORD
|
|
|
# Host names and URLs
|
|
|
- HOST_NAME=ggceserver.mydomain
|
|
|
- BASE_URL=http://ggceserver.mydomain
|
|
|
- FRONTEND_URL=http://ggceweb.mydomain
|
|
|
...
|
|
|
```
|
|
|
|
|
|
### Running tests
|
|
|
Your Traefik labels are OK.
|
|
|
|
|
|
To start test `yar run test` in root directory, or `yarn run test` in _workspaces/ui-core_ module directory
|
|
|
`grin-global-server` with HTTPS requires a few more tweaks:
|
|
|
|
|
|
This starts jest test runner with code coverage statistics
|
|
|
```yaml
|
|
|
environment:
|
|
|
- HOST_NAME=ggceserver.mydomain
|
|
|
- BASE_URL=https://ggceserver.mydomain
|
|
|
- HOST_NAMEANDPORT=ggceserver.mydomain:443
|
|
|
- BASE_COOKIESECURE=true
|
|
|
```
|
|
|
|
|
|
Relevant `gg-ce-web` configuration is documented at https://gitlab.croptrust.org/grin-global/grin-global-ui#running-gg-ce-web:
|
|
|
|
|
|
## License and Disclaimer
|
|
|
```yaml
|
|
|
ggce-ui:
|
|
|
image: dockerhub.croptrust.org/grin-global/grin-global-ui/gg-ce-web:2021.8
|
|
|
environment:
|
|
|
- API_URL=http://ggceserver.mydomain
|
|
|
- ORIGIN=http://ggceweb.mydomain
|
|
|
...
|
|
|
```
|
|
|
|
|
|
### All system options
|
|
|
|
|
|
This software is licensed under the Apache License, Version 2.0 (the "License").
|
|
|
**GG-CE** accepts a number of system configuration options. The full list and their default values are listed in [`application.properties`](https://gitlab.croptrust.org/grin-global/grin-global-server/-/blob/v2021.8/server/src/main/resources/application.properties) for `v2021.8`.
|
|
|
|
|
|
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
|
Default database connection parameters, for example, are:
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
See the License for the specific language governing permissions and
|
|
|
limitations under the License. |
|
|
```properties
|
|
|
# Connection to MSSQL
|
|
|
db.url=jdbc:sqlserver://localhost:1433;DatabaseName=gringlobal
|
|
|
db.username=sa
|
|
|
db.password=sa1
|
|
|
```
|
|
|
|
|
|
Any of the properties can be configured using **environment** variables. Please convert the property name to uppercase and replace **.** with **_**: `db.url` becomes `DB_URL`.
|
|
|
|
|
|
### Sample compose file
|
|
|
|
|
|
```yaml
|
|
|
version: '3'
|
|
|
|
|
|
services:
|
|
|
ggce-server:
|
|
|
image: dockerhub.croptrust.org/grin-global/grin-global-server:2021.8
|
|
|
environment:
|
|
|
# Database connection
|
|
|
- DB_URL=jdbc:sqlserver://35.221.232.153:1433;DatabaseName=gringlobal
|
|
|
- DB_USERNAME=SA
|
|
|
- DB_PASSWORD=*****************
|
|
|
# Host names and URLs
|
|
|
- HOST_NAME=gserver.worldveg.org
|
|
|
- BASE_URL=http://gserver.worldveg.org
|
|
|
- FRONTEND_URL=http://gclient.worldveg.org
|
|
|
restart: always
|
|
|
networks:
|
|
|
- web
|
|
|
logging:
|
|
|
options:
|
|
|
max-size: "100k"
|
|
|
max-file: "3"
|
|
|
labels:
|
|
|
- "traefik.docker.network=web"
|
|
|
- "traefik.enable=true"
|
|
|
- "traefik.basic.frontend.rule=Host:gserver.worldveg.org"
|
|
|
- "traefik.basic.port=8080"
|
|
|
- "traefik.basic.protocol=http"
|
|
|
|
|
|
ggce-ui:
|
|
|
image: dockerhub.croptrust.org/grin-global/grin-global-ui/gg-ce-web:2021.8
|
|
|
environment:
|
|
|
- API_URL=http://gserver.worldveg.org
|
|
|
- ORIGIN=http://gclient.worldveg.org
|
|
|
restart: always
|
|
|
networks:
|
|
|
- web
|
|
|
logging:
|
|
|
options:
|
|
|
max-size: "100k"
|
|
|
max-file: "3"
|
|
|
labels:
|
|
|
- "traefik.docker.network=web"
|
|
|
- "traefik.enable=true"
|
|
|
- "traefik.basic.frontend.rule=Host:gclient.worldveg.org"
|
|
|
- "traefik.basic.port=3000"
|
|
|
- "traefik.basic.protocol=http"
|
|
|
networks:
|
|
|
web:
|
|
|
external: true
|
|
|
``` |