Skip to content

Commit

Permalink
Merge pull request #613 from geoadmin/develop-2024-03-13
Browse files Browse the repository at this point in the history
New Release 2024-03-13-rc1
  • Loading branch information
ltclm authored Mar 11, 2024
2 parents 34d3f5f + dfaa21e commit a1cf84f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 40 deletions.
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ RUN groupadd -r geodata -g 2500 && \
useradd -u 2500 -r -g geodata -s /sbin/nologin --create-home geodata && \
# create mountpoint for Amazon EFS CSI driver
install -o geodata -g geodata -d /var/local/ && \
# create mountpoint for EFS mount in infra-vhost
# TODO: this mountpoint can be removed after the migration to k8s
install -o geodata -p geodata -d /var/lib/sphinxsearch/data/index_efs/ && \
# create mountpoint folder for infra-vhost/k8s ebs/ssd volume
install -o geodata -g geodata -d /var/lib/sphinxsearch/data/index/ && \
# change ownerships to geodata which will run the service or the maintenance scripts
Expand Down
8 changes: 4 additions & 4 deletions conf/lubis.conf.part
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ source src_ch_swisstopo_lubis_luftbilder_schraegaufnahmen : def_searchable_featu
SELECT row_number() OVER(ORDER BY ebkey asc) as id \
, concat_ws(' ',flightdate::date, ebkey::text) as label \
, 'feature' as origin \
, concat_ws(' ',flightdate::date, ebkey::text) as detail \
, concat_ws(' ',flightdate::date, ebkey::text, ebkey_old) as detail \
, 'ch.swisstopo.lubis-luftbilder_schraegaufnahmen' as layer \
, bgdi_quadindex as geom_quadindex \
, st_y(st_transform(st_centroid(the_geom),4326)) as lat \
Expand Down Expand Up @@ -81,7 +81,7 @@ source src_ch_swisstopo_lubis_luftbilder_infrarot: def_searchable_features_with_
sql_db = lubis_${DBSTAGING}
sql_query = \
SELECT row_number() OVER(ORDER BY ebkey asc) as id \
, concat(flugdatum, ' ', bildnummer, ' (', concat_ws(', ', ort, ebkey), ')' ) as label \
, concat(flugdatum, ' ', bildnummer, ' (', concat_ws(', ', ort, ebkey, ebkey_old), ')' ) as label \
, 'feature' as origin \
, remove_accents(concat_ws(' ', ebkey, ort)) as detail \
, 'ch.swisstopo.lubis-luftbilder_infrarot' as layer \
Expand Down Expand Up @@ -140,7 +140,7 @@ source src_ch_swisstopo_lubis_terrestrische_aufnahmen : def_searchable_features_
SELECT row_number() OVER(ORDER BY inventory_number asc) as id \
, lpad(bilder.inventory_number::text, 14, '0'::text) as label \
, 'feature' as origin \
, remove_accents(concat_ws(' ', inventory_number, image_number, station, operate_name, year)) as detail \
, remove_accents(concat_ws(' ', inventory_number, image_number, station, operate_name, year, inventarnummer_old)) as detail \
, 'ch.swisstopo.lubis-terrestrische_aufnahmen' as layer \
, bgdi_quadindex as geom_quadindex \
, st_y(st_transform(st_centroid(the_geom),4326)) as lat \
Expand All @@ -149,7 +149,7 @@ source src_ch_swisstopo_lubis_terrestrische_aufnahmen : def_searchable_features_
, box2d(st_transform(the_geom_hilight, 2056)) as geom_st_box2d_lv95 \
, year \
, lpad(bilder.inventory_number::text, 14, '0'::text)::text as feature_id \
FROM swisstopo_terrestrial.bilder
FROM swisstopo_terrestrial.view_bilder bilder
}

## INDICES
Expand Down
4 changes: 2 additions & 2 deletions conf/stopo.conf.part
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ source src_ch_swisstopo_vd_ortschaftenverzeichnis_plz : def_searchable_features
{
sql_db = stopo_${DBSTAGING}
sql_query = \
SELECT bgdi_id::int as id \
SELECT os_uuid::int as id \
, 'feature' as origin \
, remove_accents(concat_ws(' ', plz, langtext)) as detail \
, 'ch.swisstopo-vd.ortschaftenverzeichnis_plz' as layer \
Expand All @@ -88,7 +88,7 @@ source src_ch_swisstopo_vd_ortschaftenverzeichnis_plz : def_searchable_features
, box2d(st_transform(the_geom, 2056)) as geom_st_box2d_lv95 \
, plz::text as label \
, os_uuid::text as feature_id \
FROM vd.gabmo_plz
FROM vd.amtovz_ortschaften
}

source src_ch_swisstopo_vec200_names_namedlocation : def_searchable_features
Expand Down
11 changes: 1 addition & 10 deletions scripts/docker-cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,7 @@ green='\e[0;32m'
NC='\e[0m' # No Color

SPHINXINDEX_VOLUME="/var/lib/sphinxsearch/data/index/"
SPHINXINDEX_EFS="/var/lib/sphinxsearch/data/index_efs/"
K8S_EFS="/var/local/geodata/service-sphinxsearch/${DBSTAGING}/index/"

# TODO: This switch can be removed after the migration to k8s
# in k8s we have to use /var/local/ as mountpoint for the index files from geodata efs
# /var/local/geodata/service-sphinxsearch/${DBSTAGING}/index/
if [ -d "${K8S_EFS}" ]; then
echo "service is running on k8s, index files have been found on ${K8S_EFS}."
SPHINXINDEX_EFS="${K8S_EFS}"
fi
SPHINXINDEX_EFS="/var/local/geodata/service-sphinxsearch/${DBSTAGING}/index/"

# remove lock files in volume
rm ${SPHINXINDEX_VOLUME}*.spl 2> /dev/null || :
Expand Down
22 changes: 1 addition & 21 deletions scripts/index-sync-rotate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
# executed as cronjob every 15 minutes
# shellcheck disable=SC2068
set -eu
SPHINX_EFS="/var/lib/sphinxsearch/data/index_efs/"
K8S_EFS="/var/local/geodata/service-sphinxsearch/${DBSTAGING}/index/"
SPHINX_EFS="/var/local/geodata/service-sphinxsearch/${DBSTAGING}/index/"

SPHINX_VOLUME="/var/lib/sphinxsearch/data/index/"
SPHINXCONFIG="/etc/sphinxsearch/sphinx.conf"
Expand Down Expand Up @@ -36,7 +35,6 @@ RSYNC_INCLUDE="/tmp/include.txt"
# .spp
# .sps


json_logger() {
log_level=$1
timestamp=$(date --utc +%FT%T.%3NZ)
Expand Down Expand Up @@ -79,22 +77,6 @@ exlock_now() { _lock xn; } # obtain an exclusive lock immediately or fai
exlock_now || { echo "locked" | json_logger INFO; exit 1; }
echo "start" | json_logger INFO

# TODO: This switch can be removed after the migration to k8s
# in k8s we have to use /var/local/ as mountpoint for the index files from geodata efs
# /var/local/geodata/service-sphinxsearch/${DBSTAGING}/index/
set_efs_source() {
# input:
# ${SPHINX_EFS} mountpoint of efs index files
# 
# output: SPHINX_EFS
# if the index files are available on the k8s mountpoint, the k8s mountpoint will be used
# as efs index source
if [ -d "${K8S_EFS}" ]; then
echo "service is running on k8s, index files have been found on ${K8S_EFS}." | json_logger INFO
SPHINX_EFS="${K8S_EFS}"
fi
}

check_if_efs_index_is_ready() {
# input:
# $1: index name
Expand Down Expand Up @@ -159,8 +141,6 @@ check_if_local_index_is_ready() {
return ${ready}
}

set_efs_source

# loop through all indexes from sphinx config and sync them if the have been fully updated on efs
for sphinx_index in ${SPHINX_INDEXES[@]}; do
# create include-from file from sphinx config for selective rsync from EFS -> LOCAL
Expand Down

0 comments on commit a1cf84f

Please sign in to comment.