Skip to content

Commit

Permalink
Add config and build scripts (#1)
Browse files Browse the repository at this point in the history
* Add config

* Add Makefile, Dockerfile and docker-compose.yml

* Add build workflow and readme
  • Loading branch information
matsbov authored Nov 10, 2023
1 parent 1b1d6e8 commit ee878fa
Show file tree
Hide file tree
Showing 8 changed files with 713 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build

on:
push:
branches:
- '*'
tags:
- '*'

jobs:

build:

runs-on: ubuntu-latest
steps:
- name: Checkout project sources
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Run build with Gradle Wrapper
run: ./gradlew build

- name: Upload war
uses: actions/upload-artifact@v3
with:
name: package
path: build/libs

- name: Log in to the Container registry
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}

- name: Build and push Docker image
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM tomcat:9.0-jdk11-temurin

ENV TZ=Europe/Stockholm

RUN mkdir -p /data/ala-hub/config

COPY sbdi/data/config/charts.json /data/ala-hub/config/charts.json
COPY sbdi/data/config/grouped_facets_default.json /data/ala-hub/config/grouped_facets_default.json

COPY build/libs/ala-hub-*-plain.war $CATALINA_HOME/webapps/ROOT.war
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
run:
./gradlew bootRun

run-docker:
./gradlew clean build
docker compose build --no-cache
docker compose up --detach

release:
../sbdi-install/utils/make-release.sh
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3.8'

services:

ala-hub:
image: sbdi/ala-hub-dev
build:
context: .
ports:
- 8080:8080
volumes:
- ./sbdi/data/config/ala-hub-config.properties:/data/ala-hub/config/ala-hub-config.properties
34 changes: 34 additions & 0 deletions sbdi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Ala-hub

## Setup

Create data directory at `/data/ala-hub` and populate as below (it is easiest to symlink the config files to the ones in this repo):
```
mats@xps-13:/data/ala-hub$ tree
.
└── config
├── ala-hub-config.properties -> /home/mats/src/biodiversitydata-se/ala-hub/sbdi/data/config/ala-hub-config.properties
├── charts.json -> /home/mats/src/biodiversitydata-se/ala-hub/sbdi/data/config/charts.json
└── grouped_facets_default.json -> /home/mats/src/biodiversitydata-se/ala-hub/sbdi/data/config/grouped_facets_default.json
```

## Usage

Run locally:
```
make run
```

Build and run in Docker (using Tomcat):
```
make run-docker
```

Make a release. This will create a new tag and push it. A new Docker container will be built on Github.
```
mats@xps-13:~/src/biodiversitydata-se/ala-hub (master *)$ make release
Current version: 1.0.1. Enter the new version (or press Enter for 1.0.2):
Updating to version 1.0.2
Tag 1.0.2 created and pushed.
```
259 changes: 259 additions & 0 deletions sbdi/data/config/ala-hub-config.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
# Grails settings
grails.serverURL=http://localhost:8080
grails.resources.work.dir=/data/ala-hub/cache



# CAS Config
serverName=http://localhost:8080
security.cas.casServerName=https://auth.biodiversitydata.se
security.cas.appServerName=http://localhost:8080
security.cas.casServerUrlPrefix=https://auth.biodiversitydata.se/cas
security.cas.casServerLoginUrl=https://auth.biodiversitydata.se/cas/login
security.cas.casServerLogoutUrl=https://auth.biodiversitydata.se/cas/logout
security.cas.loginUrl=https://auth.biodiversitydata.se/cas/login
security.cas.logoutUrl=https://auth.biodiversitydata.se/cas/logout
security.cas.uriFilterPattern=/admin.*,/alaAdmin.*,/download.*
security.cas.authenticateOnlyIfLoggedInFilterPattern=/occurrences/*,/explore/your-area,/query,/proxy/download/*,
security.cas.bypass=false
disableCAS=false

server.address=localhost
server.port=8080
server.servlet.contextPath=
# Default Locale
defaultLocale=en

# Legacy CAS properties
casProperties=casServerLoginUrl,serverName,centralServer,casServerName,uriFilterPattern,uriExclusionFilterPattern,authenticateOnlyIfLoggedInFilterPattern,casServerLoginUrlPrefix,gateway,casServerUrlPrefix,contextPath
uriFilterPattern=/admin*,/alaAdmin*,/download*
uriExclusionFilterPattern=/occurrences/shapeUpload,/images.*,/css.*,/js.*,.*json,/help/.*
authenticateOnlyIfLoggedInFilterPattern=/occurrences/*,/explore/your-area,/query,/proxy/download/*
casServerName=https://auth.biodiversitydata.se
casServerUrlPrefix=https://auth.biodiversitydata.se/cas
casServerLoginUrl=https://auth.biodiversitydata.se/cas/login
casServerLogoutUrl=https://auth.biodiversitydata.se/cas/logout

# Data Quality settings
dataquality.enabled=false
dataquality.baseUrl=https://dataquality.ala.org.au/
dataquality.learnmore_link=
dataquality.apiKey=
dataquality.warningOn=
dataquality.disableAllFiltersByDefault=false
dataquality.expandFiltersByDefault=true

# App settings
organisation.baseUrl=https://biodiversitydata.se

# skin
skin.homeUrl=https://tools.biodiversitydata.se
skin.layout=ala
skin.favicon=https://static.biodiversitydata.se/favicon.ico
skin.fluidLayout=true
skin.orgNameLong=Swedish Biodiversity Data Infrastructure
skin.orgNameShort=SBDI
skin.attribution=
skin.useAlaBie=true
skin.useAlaSpatialPortal=trye
skin.useAlaImageService=true
skin.taxaLinks.baseUrl=https://species.biodiversitydata.se/species/
skin.dataQualityLink.show=true
skin.dataQualityLink.url=
skin.dataQualityLink.text=not set
skin.exploreUrl=
supportEmail=support@biodiversitydata.se

images.images.metadataUrl=
bie.baseUrl=https://species.biodiversitydata.se
bieService.baseUrl=https://species.biodiversitydata.se/ws
bie.searchPath=/search
biocache.apiKey=bee2bf23-c554-41dc-8b18-363c59949ad7
biocache.queryContext=
biocache.baseUrl=https://records.biodiversitydata.se/ws
biocache.url=https://records.biodiversitydata.se
biocacheServiceUrl=https://records.biodiversitydata.se/ws
# bicoacheServicesUrl maintained for backwards compatibility with < biocache_hubs 5.0
biocacheServicesUrl=https://records.biodiversitydata.se/ws
biocache.downloads.extra=
biocache.ajax.useProxy=false
biocache.groupedFacetsUrl=
biocache.indexedFieldsUrl=https://records.biodiversitydata.se/ws/index/fields
collectory.baseUrl=https://collections.biodiversitydata.se
collections.baseUrl=https://collections.biodiversitydata.se
collectory.resources=https://collections.biodiversitydata.se/public/resources.json
spatial.baseUrl=https://spatial.biodiversitydata.se
spatial.baseURL=https://spatial.biodiversitydata.se
layersservice.baseUrl=https://spatial.biodiversitydata.se/ws
layersservice.url=https://spatial.biodiversitydata.se/ws
# userDetails.url is not used by the hubs but by the ala-auth plugin
userDetails.url=https://auth.biodiversitydata.se/userdetails/
# userdetails.baseUrl is used by the hubs
userdetails.baseUrl=https://auth.biodiversitydata.se/userdetails
doiService.baseUrl=https://doi.ala.org.au
logger.baseUrl=https://logger.biodiversitydata.se/service
loggerURL=https://logger.biodiversitydata.se/service
sightings.baseUrl=

# Image viewer
image.baseUrl=https://images.biodiversitydata.se
images.baseUrl=https://images.biodiversitydata.se
images.viewerUrl=https://images.biodiversitydata.se/image/viewer?imageId=
images.metadataUrl=https://images.biodiversitydata.se/image/details?imageId=
alwaysshow.imagetab=false

#spatial.params=&dynamic=true&ws=http%3A%2F%2Fsandbox.ala.org.au%2Fhubs-webapp&bs=http%3A%2F%2Fsandbox.ala.org.au%2Fbiocache-service
spatial.params=

# ROLE for access to sensitive records
clubRoleForHub=

# URL for data quality checks
dataQualityChecksUrl=https://docs.google.com/spreadsheet/pub?key=0AjNtzhUIIHeNdHJOYk1SYWE4dU1BMWZmb2hiTjlYQlE&single=true&gid=0&output=csv'

# Default view for search results
defaultListView=

# dwc values to exclude from occurrence record pages
dwc.exclude=dataHubUid,dataProviderUid,institutionUid,year,month,day,modified,left,right,provenance,preferredFlag,outlierForLayers,speciesGroups,associatedMedia,images,userQualityAssertion,speciesHabitats,duplicationType,taxonomicIssues,subspeciesID,nameMatchMetric,sounds

# Explore your area defaults
exploreYourArea.lat=62.38663
exploreYourArea.lng=16.32130
exploreYourArea.location=Sweden

# Table display
table.displayDynamicProperties=true

# Facet configuration
facets.limit=100
facets.customOrder=
facets.defaultColourBy=basis_of_record
facets.includeDynamicFacets=false
facets.exclude=state
facets.hide=
facets.include=
# facets cached affects the advanced search. Please include indexed fields that are used in drop downs
facets.cached=species_group,species_subgroup,country,institution_uid,collection_uid,data_resource_uid,institution_name,collection_name,data_resource
facets.defaultSelected=basis_of_record,taxon_name,institution_name,collection_name,data_resource,year
facets.max=16

# Mapping
map.cloudmade.key=BC9A493B41014CAABB98F0471D759707
map.defaultLatitude=62.38663
map.defaultLongitude=16.32130
map.defaultZoom=4
map.defaultFacetMapColourBy=basis_of_record
map.pointColour=df4a21
map.zoomOutsideScopedRegion=true
map.height=600
geocode.region=SE

map.minimal.url=https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png
map.overlay.url=https://spatial.biodiversitydata.se/geoserver/gwc/service/wms

mapdownloads.baseLayers.states.name=lan
mapdownloads.baseLayers.states.i18nCode=baselayer.states
mapdownloads.baseLayers.states.displayName=States & Provinces

# Google API key
google.apikey=AIzaSyAJDtEeoy7Sc9pij2TAoVnmTwA34Q-2VHk

# authorised roles
authorise.roles=

# alerts and myannotation settings
alerts.myannotation.enabled=false
alerts.baseUrl=
alerts.apiKey=

# misc
speciesList.baseURL=https://lists.biodiversitydata.se
speciesListToolUrl=https://lists.biodiversitydata.se/speciesListItem/list/
advancedTaxaField=taxa

# australia specific list paths
#stateConservationListPath.NewSouthWales=/speciesListItem/list/dr650
#stateConservationListPath.AustralianCapitalTerritory=/speciesListItem/list/dr649
#stateConservationListPath.Queensland=/speciesListItem/list/dr652
#stateConservationListPath.Victoria=/speciesListItem/list/dr655
#stateConservationListPath.WesternAustralia=/speciesListItem/list/dr2201
#stateConservationListPath.SouthAustralia=/speciesListItem/list/dr653
#stateConservationListPath.NorthernTerritory=/speciesListItem/list/dr651
#stateConservationListPath.Tasmania=/speciesListItem/list/dr654

# Header and footer
headerAndFooter.baseURL=https://static.biodiversitydata.se
headerAndFooter.version=2

ala.baseURL=https://biodiversitydata.se
bie.baseURL=https://species.biodiversitydata.se
privacyPolicy=https://docs.biodiversitydata.se/sbdi-data/sbdi-atlas-terms-of-use/privacy-policy/

# Only used by the mdba hub
ecodata.baseURL=
pdfgen.baseURL=http://pdfgen.ala.org.au
webservice.apiKey=bee2bf23-c554-41dc-8b18-363c59949ad7
mdba.basinChampions=
mdba.regions=

#Used by Preferred Species
bieApiKey=c311ae5d-4a87-4702-88f2-7373dd2e2e4d
speciesList.preferredSpeciesListDruid=
speciesList.preferredListName=
allowedImageEditingRoles=ROLE_ADMIN

# mdba config
specieslist.baseUrl=https://lists.biodiversitydata.se/ws

# Downloads
useDownloadPlugin=True
downloads.indexedDownloadUrl=https://records.biodiversitydata.se/ws/occurrences/offline/download
downloads.checklistDownloadUrl=https://records.biodiversitydata.se/ws/occurrences/facets/download
downloads.indexedFieldsUrl=https://records.biodiversitydata.se/ws/index/fields
downloads.fieldguideDownloadUrl=
fieldguide.url=
downloads.staticDownloadsUrl=
downloads.termsOfUseUrl=https://docs.biodiversitydata.se/sbdi-data/sbdi-atlas-terms-of-use
downloads.defaultDownloadFormat=dwc
downloads.dwcExtraFields=data_resource_uid
#downloads.dwcExtraFields=data_resource_uid,materialSampleID,sampleSizeUnit,sampleSizeValue,organismQuantity,organismQuantityType
downloads.legacy.defaultFields=id,data_resource_uid,data_resource,license,catalogue_number,taxon_concept_lsid,raw_taxon_name,raw_common_name,taxon_name,rank,common_name,kingdom,phylum,class,order,family,genus,species,subspecies,institution_code,collection_code,locality,raw_latitude,raw_longitude,raw_datum,latitude,longitude,datum,coordinate_precision,coordinate_uncertainty,country,state,cl959,min_elevation_d,max_elevation_d,min_depth_d,max_depth_d,individual_count,recorded_by,year,month,day,verbatim_event_date,basis_of_record,raw_basis_of_record,sex,preparations,information_withheld,data_generalizations,outlier_layer,taxonomic_kosher,geospatial_kosher
#downloads.legacy.defaultFields=id,data_resource_uid,data_resource,license,catalogue_number,taxon_concept_lsid,raw_taxon_name,raw_common_name,taxon_name,rank,common_name,kingdom,phylum,class,order,family,genus,species,subspecies,institution_code,collection_code,locality,raw_latitude,raw_longitude,raw_datum,latitude,longitude,coordinate_precision,coordinate_uncertainty,country,state,cl959,min_elevation_d,max_elevation_d,min_depth_d,max_depth_d,individual_count,recorded_by,year,month,day,verbatim_event_date,basis_of_record,raw_basis_of_record,sex,preparations,information_withheld,data_generalizations,outlier_layer,taxonomic_kosher,geospatial_kosher,materialSampleID,sampleSizeUnit,sampleSizeValue,organismQuantity,organismQuantityType
downloads.customSections.misc=qualityAssertions,miscellaneousFields

# Maximum download limit without 'largeDownloadRole' permission
maxDownloadRecords=

# The CAS role to use for large downloads
largeDownloadRole=ROLE_LARGE_DOWNLOAD

userCharts=false

doi.mintDoi=false
endpoints.enabled=false

# oidc related
security.cas.enabled=true
security.oidc.enabled=false
security.oidc.clientId=
security.oidc.secret=
security.oidc.discoveryUri=
security.jwt.enabled=false
security.jwt.discoveryUri=
security.jwt.clientId=


#websevice jwt
webservice.jwt=false
webservice.jwt-scopes=
webservice.client-id=
webservice.client-secret=

info.app.description=Swedish Biodiversity Data Infrastructure

#events cofig
events.enabled=false
events.graphql=
events.eventUrl=
userdetails.url=https://auth.biodiversitydata.se/userdetails
Loading

0 comments on commit ee878fa

Please sign in to comment.