Skip to content

Commit

Permalink
Merge pull request #170 from terrestris/include-example-plugins
Browse files Browse the repository at this point in the history
Include gis client example plugin
  • Loading branch information
dnlkoch authored Oct 29, 2024
2 parents 8465e65 + a1795d3 commit 03e371e
Show file tree
Hide file tree
Showing 10 changed files with 175 additions and 139 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ components:
- SHOGun (the backend part)
- SHOGun-Admin (the UI for handling SHOGun entities)
- SHOGun-GIS-Client (the default mapping client)
- SHOGun-GIS-Client example plugin (a dummy example plugin for demonstration purposes)

### Recommended directory structure

Expand All @@ -43,20 +44,22 @@ your-shogun-workspace-directory/
├── shogun (https://github.com/terrestris/shogun)
├── shogun-admin (https://github.com/terrestris/shogun-admin)
├── shogun-gis-client (https://github.com/terrestris/shogun-gis-client)
├── shogun-gis-client-example-plugin (https://github.com/terrestris/shogun-gis-client-example-plugin)
└── shogun-docker (this repository)
```

### Required steps for the very first start

- Check and fulfill all development notes of the child components (e.g. installing the `maven` and `node` dependencies). For the required repositories the following commands should be used:
- shogun-gis-client: npm i
- shogun-admin: npm i
- shogun: mvn clean install -DskipTests -Djib.skip=true
- shogun-docker: docker compose pull
- shogun-gis-client: `npm i`
- shogun-gis-client-example-plugin: `npm i`
- shogun-admin: `npm i`
- shogun: `mvn clean install -DskipTests -Djib.skip=true`
- shogun-docker: `docker compose pull`
- Set all required environment variables (and create a local SSL certificate) by executing `./setEnvironment.sh create` (and adjusting the values if needed).
- If you are using a different directory layout, make sure to adjust the paths in the `.env` file
- Import the initial Keycloak data, see section [Keycloak Import](#import).
- execute `chmod -R a+w shogun-solr/solr_data` to allow the solr service to write to the directory.
- Execute `chmod -R a+w shogun-solr/solr_data` to allow the solr service to write to the directory.

### Startup

Expand Down
2 changes: 2 additions & 0 deletions common-services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ services:
- shogun-admin-client-docs
shogun-client:
container_name: ${CONTAINER_NAME_PREFIX}-gis-client
shogun-client-plugins:
container_name: ${CONTAINER_NAME_PREFIX}-gis-client-plugins
shogun-admin:
container_name: ${CONTAINER_NAME_PREFIX}-admin
shogun-boot:
Expand Down
12 changes: 12 additions & 0 deletions docker-compose-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ services:
retries: 5
start_period: 5s
timeout: 10s
# shogun-client-plugins:
# extends:
# file: ./common-services.yml
# service: shogun-client-plugins
# image: your_plugin_image:1.0.0
# restart: unless-stopped
# healthcheck:
# test: wget --no-verbose --tries=1 --spider http://localhost || exit 1
# interval: 10s
# retries: 5
# start_period: 5s
# timeout: 10s
shogun-boot:
extends:
file: ./common-services.yml
Expand Down
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ services:
dockerfile: Dockerfile.dev
volumes:
- ${SHOGUN_CLIENT_DIR}:/app
shogun-client-plugins:
extends:
file: ./common-services.yml
service: shogun-client-plugins
build:
context: ${SHOGUN_CLIENT_PLUGINS_DIR}
dockerfile: Dockerfile.dev
volumes:
- ${SHOGUN_CLIENT_PLUGINS_DIR}:/app
shogun-admin:
extends:
file: ./common-services.yml
Expand Down
234 changes: 110 additions & 124 deletions docs/components.drawio

Large diffs are not rendered by default.

Binary file modified docs/components.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions setEnvironment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ set -e
SHOGUN_DIR=../shogun
SHOGUN_ADMIN_DIR=../shogun-admin
SHOGUN_CLIENT_DIR=../shogun-gis-client
SHOGUN_CLIENT_PLUGINS_DIR=../shogun-gis-client-example-plugin

# Container prefix
CONTAINER_NAME_PREFIX=shogun
Expand Down Expand Up @@ -92,6 +93,7 @@ if [ "$MODE" = "create" ]; then
echo "SHOGUN_DIR=${SHOGUN_DIR}" > $SCRIPT_DIR/$ENV_FILE
echo "SHOGUN_ADMIN_DIR=${SHOGUN_ADMIN_DIR}" >> $SCRIPT_DIR/$ENV_FILE
echo "SHOGUN_CLIENT_DIR=${SHOGUN_CLIENT_DIR}" >> $SCRIPT_DIR/$ENV_FILE
echo "SHOGUN_CLIENT_PLUGINS_DIR=${SHOGUN_CLIENT_PLUGINS_DIR}" >> $SCRIPT_DIR/$ENV_FILE

echo "CONTAINER_NAME_PREFIX=${CONTAINER_NAME_PREFIX}" >> $SCRIPT_DIR/$ENV_FILE

Expand Down
8 changes: 7 additions & 1 deletion shogun-client/config/gis-client-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,11 @@ var clientConfig = {
},
documentationButtonVisible: true,
enableFallbackConfig: false,
plugins: []
plugins: [{
name: 'ExamplePlugin',
resourcePath: '/client-plugins/index.js',
exposedPaths: [
'./FooterLinks'
]
}]
};
16 changes: 15 additions & 1 deletion shogun-nginx/dev/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,28 @@ server {
proxy_set_header X-Forwarded-Port $server_port;
}

location /client/gis-client-config.js {
location /client/gis-client-config.js {
root /usr/share/nginx/html/;

ssi on;
ssi_types application/javascript;
set $keycloakhost ${KEYCLOAK_HOST};
}

location /client-plugins/ {
proxy_pass http://shogun-client-plugins:8080/;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
}

location / {
proxy_pass http://shogun-boot:8080/;

Expand Down
18 changes: 10 additions & 8 deletions shogun-nginx/prod/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ server {
location /admin/ {
proxy_pass http://shogun-admin/;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand All @@ -107,10 +103,6 @@ server {
location /client/ {
proxy_pass http://shogun-client/;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand All @@ -126,6 +118,16 @@ server {
set $keycloakhost ${KEYCLOAK_HOST};
}

# location /client-plugins/ {
# proxy_pass http://shogun-client-plugins/;

# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Proto $scheme;
# proxy_set_header X-Forwarded-Port $server_port;
# }

location / {
proxy_pass http://shogun-boot;

Expand Down

0 comments on commit 03e371e

Please sign in to comment.