diff --git a/.gitignore b/.gitignore index 1d379cb4f..c09cf3df9 100644 --- a/.gitignore +++ b/.gitignore @@ -11,12 +11,15 @@ !/osrm/update-data.sh .calva +random-files/ + !webapp/dev/repl.clj webapp/.nrepl-port webapp/*.log webapp/target webapp/*-init.clj webapp/resources/public/js/compiled +webapp/resources/public/google*.html webapp/.cljs_rhino_repl webapp/.lein-env webapp/.lein-failures diff --git a/scripts/deploy-backend.sh b/scripts/deploy-backend.sh new file mode 100755 index 000000000..ad0ee35e5 --- /dev/null +++ b/scripts/deploy-backend.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -e + +cd /var/lipas +source .env.sh + +docker compose run --rm backend-build +docker compose run --rm backend-migrate +docker compose stop backend +docker compose up -d backend +# /usr/local/bin/docker-compose restart proxy diff --git a/scripts/deploy-frontend.sh b/scripts/deploy-frontend.sh new file mode 100755 index 000000000..ca0203e1f --- /dev/null +++ b/scripts/deploy-frontend.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e + +/cd /var/lipas +source .env.sh + +docker compose run --rm frontend-npm-deps +docker compose run --rm frontend-npm-bundle +docker compose run --rm frontend-build diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100755 index 000000000..b68a73483 --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -e + +cd /var/lipas +source .env.sh + +docker compose run --rm backend-build +docker compose run --rm backend-migrate +docker compose stop backend +docker compose up -d backend +docker compose run --rm frontend-npm-deps +docker compose run --rm frontend-npm-bundle +docker compose run --rm frontend-build +docker compose restart proxy diff --git a/scripts/index.sh b/scripts/index.sh new file mode 100755 index 000000000..4e59f16cc --- /dev/null +++ b/scripts/index.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e + +cd /var/lipas +source .env.sh +docker compose run backend-index-search +docker compose run backend-index-search --analytics + +echo TADA! diff --git a/scripts/purge-mapproxy-cache.sh b/scripts/purge-mapproxy-cache.sh new file mode 100755 index 000000000..6d3631542 --- /dev/null +++ b/scripts/purge-mapproxy-cache.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +set -e + +# Meant to be run from cron + +cd /var/lipas +source .env.sh +docker compose exec mapproxy /lipas/purge.sh diff --git a/scripts/refresh-mat-views.sh b/scripts/refresh-mat-views.sh new file mode 100755 index 000000000..c1bf697b6 --- /dev/null +++ b/scripts/refresh-mat-views.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +cd /var/lipas +source .env.sh +cat /var/lipas/scripts/refresh-mat-views.sql | /usr/bin/docker compose exec -T postgres psql -U postgres -d "lipas-legacy" diff --git a/scripts/refresh-mat-views.sql b/scripts/refresh-mat-views.sql new file mode 100644 index 000000000..e5646379a --- /dev/null +++ b/scripts/refresh-mat-views.sql @@ -0,0 +1,149 @@ +REFRESH MATERIALIZED VIEW types.lipas_1510_tekojaakentta; +REFRESH MATERIALIZED VIEW types.lipas_1520_luistelukentta; +REFRESH MATERIALIZED VIEW types.lipas_1530_kaukalo; +REFRESH MATERIALIZED VIEW types.lipas_111_kansallispuisto; +REFRESH MATERIALIZED VIEW types.lipas_1540_pikaluistelurata; +REFRESH MATERIALIZED VIEW types.lipas_107_matkailupalveluiden_alue; +REFRESH MATERIALIZED VIEW types.lipas_1120_lahiliikuntapaikka; +REFRESH MATERIALIZED VIEW types.lipas_1550_luistelureitti; +REFRESH MATERIALIZED VIEW types.lipas_108_virkistysmetsa; +REFRESH MATERIALIZED VIEW types.lipas_1560_alamakiluistelurata; +REFRESH MATERIALIZED VIEW types.lipas_112_muu_luonnonsuojelualue; +REFRESH MATERIALIZED VIEW types.lipas_1610_golfin_harjoitusalue; +REFRESH MATERIALIZED VIEW types.lipas_109_valtion_retkeilyalue; +REFRESH MATERIALIZED VIEW types.lipas_110_eramaa_alue; +REFRESH MATERIALIZED VIEW types.lipas_1110_liikuntapuisto; +REFRESH MATERIALIZED VIEW types.lipas_1320_lentopallokentta; +REFRESH MATERIALIZED VIEW types.lipas_1620_golfkentta; +REFRESH MATERIALIZED VIEW types.lipas_1330_beachvolleykentta; +REFRESH MATERIALIZED VIEW types.lipas_1310_koripallokentta; +REFRESH MATERIALIZED VIEW types.lipas_1340_pallokentta; +REFRESH MATERIALIZED VIEW types.lipas_1350_jalkapallostadion; +REFRESH MATERIALIZED VIEW types.lipas_1180_frisbeegolf_rata; +REFRESH MATERIALIZED VIEW types.lipas_1360_pesapallostadion; +REFRESH MATERIALIZED VIEW types.lipas_1370_tenniskentta_alue; +REFRESH MATERIALIZED VIEW types.lipas_1630_golfin_harjoitushalli; +REFRESH MATERIALIZED VIEW types.lipas_1210_yleisurheilun_harjoitusalue; +REFRESH MATERIALIZED VIEW types.lipas_1130_ulkokuntoilupaikka; +REFRESH MATERIALIZED VIEW types.lipas_1220_yleisurheilukentta; +REFRESH MATERIALIZED VIEW types.lipas_1380_rullakiekkokentta; +REFRESH MATERIALIZED VIEW types.lipas_2230_jalkapallohalli; +REFRESH MATERIALIZED VIEW types.lipas_2240_saliandyhalli; +REFRESH MATERIALIZED VIEW types.lipas_2250_skeittihalli; +REFRESH MATERIALIZED VIEW types.lipas_2260_sulkapallohalli; +REFRESH MATERIALIZED VIEW types.lipas_2270_squash_halli; +REFRESH MATERIALIZED VIEW types.lipas_2530_pikaluisteluhalli; +REFRESH MATERIALIZED VIEW types.lipas_2610_keilahalli; +REFRESH MATERIALIZED VIEW types.lipas_301_laavu_kota_kammi; +REFRESH MATERIALIZED VIEW types.lipas_2310_yksittainen_yleisurheilun_suorituspaikka; +REFRESH MATERIALIZED VIEW types.lipas_3220_uimaranta; +REFRESH MATERIALIZED VIEW types.lipas_4220_hiihtotunneli; +REFRESH MATERIALIZED VIEW types.lipas_3230_uimapaikka; +REFRESH MATERIALIZED VIEW types.lipas_4230_lumilautatunneli; +REFRESH MATERIALIZED VIEW types.lipas_4240_lasketteluhalli; +REFRESH MATERIALIZED VIEW types.lipas_4310_harjoitushyppyrimaki; +REFRESH MATERIALIZED VIEW types.lipas_3110_uimahalli; +REFRESH MATERIALIZED VIEW types.lipas_3240_talviuintipaikka; +REFRESH MATERIALIZED VIEW types.lipas_4110_laskettelun_suorituspaikat; +REFRESH MATERIALIZED VIEW types.lipas_4210_curlingrata; +REFRESH MATERIALIZED VIEW types.lipas_4402_latu; +REFRESH MATERIALIZED VIEW types.lipas_4403_kavelyreitti; +REFRESH MATERIALIZED VIEW types.lipas_4430_hevosreitti; +REFRESH MATERIALIZED VIEW types.lipas_4404_luontopolku; +REFRESH MATERIALIZED VIEW types.lipas_4411_maastopyorailyreitti; +REFRESH MATERIALIZED VIEW types.lipas_4440_koirahiihtolatu; +REFRESH MATERIALIZED VIEW types.lipas_4451_melontareitti; +REFRESH MATERIALIZED VIEW types.lipas_1640_ratagolf; +REFRESH MATERIALIZED VIEW types.lipas_4412_pyorailyreitti; +REFRESH MATERIALIZED VIEW types.lipas_4405_retkeilyreitti; +REFRESH MATERIALIZED VIEW types.lipas_4452_vesiretkeilyreitti; +REFRESH MATERIALIZED VIEW types.lipas_4421_moottorikelkkareitti; +REFRESH MATERIALIZED VIEW types.lipas_4422_moottorikelkkaura; +REFRESH MATERIALIZED VIEW types.lipas_4510_suunnistusalue; +REFRESH MATERIALIZED VIEW types.lipas_4630_kilpahiihtokeskus; +REFRESH MATERIALIZED VIEW types.lipas_4620_ampumahiihtokeskus; +REFRESH MATERIALIZED VIEW types.lipas_4830_jousiammuntarata; +REFRESH MATERIALIZED VIEW types.lipas_4710_ulkokiipeilyseina; +REFRESH MATERIALIZED VIEW types.lipas_4720_kiipeilykallio; +REFRESH MATERIALIZED VIEW types.lipas_4840_jousiammuntamaastorata; +REFRESH MATERIALIZED VIEW types.lipas_5110_soutustadion; +REFRESH MATERIALIZED VIEW types.lipas_4640_hiihtomaa; +REFRESH MATERIALIZED VIEW types.lipas_5120_purjehdusalue; +REFRESH MATERIALIZED VIEW types.lipas_4810_ampumarata; +REFRESH MATERIALIZED VIEW types.lipas_4820_ampumaurheilukeskus; +REFRESH MATERIALIZED VIEW types.lipas_5130_moottirveneurheilualue; +REFRESH MATERIALIZED VIEW types.lipas_5160_soudun_ja_melonnan_sisaharjoittelutila; +REFRESH MATERIALIZED VIEW types.lipas_5210_urheiluilmailualue; +REFRESH MATERIALIZED VIEW types.lipas_5370_jaaspeedway_rata; +REFRESH MATERIALIZED VIEW types.lipas_5310_moottoriurheilukeskus; +REFRESH MATERIALIZED VIEW types.lipas_5330_moottorirata; +REFRESH MATERIALIZED VIEW types.lipas_6110_ratsastuskentta; +REFRESH MATERIALIZED VIEW types.lipas_6120_ratsastusmaneesi; +REFRESH MATERIALIZED VIEW types.lipas_5340_karting_rata; +REFRESH MATERIALIZED VIEW types.lipas_5140_vesihiihtoalue; +REFRESH MATERIALIZED VIEW types.lipas_5320_moottoripyorailualue; +REFRESH MATERIALIZED VIEW types.lipas_6130_esteratsastuskentta; +REFRESH MATERIALIZED VIEW types.lipas_5350_kiihdytysrata; +REFRESH MATERIALIZED VIEW types.lipas_5360_jokamies_ja_rallicross_rata; +REFRESH MATERIALIZED VIEW types.lipas_6140_ravirata; +REFRESH MATERIALIZED VIEW types.lipas_7000_huoltorakennukset; +REFRESH MATERIALIZED VIEW types.lipas_201_kalastusalue; +REFRESH MATERIALIZED VIEW types.lipas_202_telttailu_ja_leiriytyminen; +REFRESH MATERIALIZED VIEW types.lipas_203_veneilyn_palvelupaikka; +REFRESH MATERIALIZED VIEW types.lipas_204_luontotorni; +REFRESH MATERIALIZED VIEW types.lipas_205_rantautumispaikka; +REFRESH MATERIALIZED VIEW types.lipas_206_ruoanlaittopaikka; +REFRESH MATERIALIZED VIEW types.lipas_207_opastuspiste; +REFRESH MATERIALIZED VIEW types.lipas_2110_kuntokeskus; +REFRESH MATERIALIZED VIEW types.lipas_2120_kuntosali; +REFRESH MATERIALIZED VIEW types.lipas_2130_voimailusali; +REFRESH MATERIALIZED VIEW types.lipas_2140_kamppailulajien_sali; +REFRESH MATERIALIZED VIEW types.lipas_2150_liikuntasali; +REFRESH MATERIALIZED VIEW types.lipas_2210_liikuntahalli; +REFRESH MATERIALIZED VIEW types.lipas_101_lahipuisto; +REFRESH MATERIALIZED VIEW types.lipas_102_ulkoilupuisto; +REFRESH MATERIALIZED VIEW types.lipas_2220_monitoimihalli; +REFRESH MATERIALIZED VIEW types.lipas_103_ulkoilualue; +REFRESH MATERIALIZED VIEW types.lipas_104_retkeilyalue; +REFRESH MATERIALIZED VIEW types.lipas_2280_tennishalli; +REFRESH MATERIALIZED VIEW types.lipas_106_monikayttoalue; +REFRESH MATERIALIZED VIEW types.lipas_2290_petanque_halli; +REFRESH MATERIALIZED VIEW types.lipas_1140_parkouralue; +REFRESH MATERIALIZED VIEW types.lipas_1150_skeitti_rullaluistelupaikka; +REFRESH MATERIALIZED VIEW types.lipas_1160_pyorailualue; +REFRESH MATERIALIZED VIEW types.lipas_2320_telinevoimistelutila; +REFRESH MATERIALIZED VIEW types.lipas_1170_pyorailurata; +REFRESH MATERIALIZED VIEW types.lipas_2330_poytatennistila; +REFRESH MATERIALIZED VIEW types.lipas_2340_miekkailutila; +REFRESH MATERIALIZED VIEW types.lipas_2350_tanssitila; +REFRESH MATERIALIZED VIEW types.lipas_2360_sisa_ampumarata; +REFRESH MATERIALIZED VIEW types.lipas_2370_sisakiipeilyseina; +REFRESH MATERIALIZED VIEW types.lipas_2380_parkour_sali; +REFRESH MATERIALIZED VIEW types.lipas_2510_harjoitusjaahalli; +REFRESH MATERIALIZED VIEW types.lipas_2520_kilpajaahalli; +REFRESH MATERIALIZED VIEW types.lipas_302_tupa; +REFRESH MATERIALIZED VIEW types.lipas_304_ulkoilumaja_hiihtomaja; +REFRESH MATERIALIZED VIEW types.lipas_3120_uima_allas; +REFRESH MATERIALIZED VIEW types.lipas_3130_kylpyla; +REFRESH MATERIALIZED VIEW types.lipas_3210_maauimala; +REFRESH MATERIALIZED VIEW types.lipas_4320_hyppyrimaki; +REFRESH MATERIALIZED VIEW types.lipas_4401_kuntorata; +REFRESH MATERIALIZED VIEW types.lipas_4610_ampumahiihdon_harjoittelualue; +REFRESH MATERIALIZED VIEW types.lipas_4520_hiihtosuunnistusalue; +REFRESH MATERIALIZED VIEW types.lipas_4530_pyorasuunnistusalue; +REFRESH MATERIALIZED VIEW types.lipas_5150_koskimelontakeskus; +REFRESH MATERIALIZED VIEW types.lipas_6210_koiraurheilualue; +REFRESH MATERIALIZED VIEW types.lipas_6220_koiraurheiluhalli; +REFRESH MATERIALIZED VIEW types.lipas_4401_kuntorata_3d; +REFRESH MATERIALIZED VIEW types.lipas_4402_latu_3d; +REFRESH MATERIALIZED VIEW types.lipas_4403_kavelyreitti_3d; +REFRESH MATERIALIZED VIEW types.lipas_4404_luontopolku_3d; +REFRESH MATERIALIZED VIEW types.lipas_4405_retkeilyreitti_3d; +REFRESH MATERIALIZED VIEW types.lipas_4411_maastopyorailyreitti_3d; +REFRESH MATERIALIZED VIEW types.lipas_4412_pyorailyreitti_3d; +REFRESH MATERIALIZED VIEW types.lipas_4421_moottorikelkkareitti_3d; +REFRESH MATERIALIZED VIEW types.lipas_4422_moottorikelkkaura_3d; +REFRESH MATERIALIZED VIEW types.lipas_4430_hevosreitti_3d; +REFRESH MATERIALIZED VIEW types.lipas_4440_koirahiihtolatu_3d; +REFRESH MATERIALIZED VIEW types.lipas_4451_melontareitti_3d; +REFRESH MATERIALIZED VIEW types.lipas_4452_vesiretkeilyreitti_3d; diff --git a/scripts/reindex-legacy-api.sh b/scripts/reindex-legacy-api.sh new file mode 100755 index 000000000..3b6f9759a --- /dev/null +++ b/scripts/reindex-legacy-api.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +set -e + +# Meant to be run from cron + +cd /var/lipas +source .env.sh +docker compose run --rm legacy-api-worker diff --git a/scripts/reindex.sh b/scripts/reindex.sh new file mode 100755 index 000000000..f94a17947 --- /dev/null +++ b/scripts/reindex.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +set -e + +# Meant to be run from cron + +cd /var/lipas +source .env.sh +docker compose run --rm backend-index-search --analytics diff --git a/scripts/restart-geoserver.sh b/scripts/restart-geoserver.sh new file mode 100755 index 000000000..202d7554e --- /dev/null +++ b/scripts/restart-geoserver.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +set -e + +# Meant to be run from cron + +cd /var/lipas +source .env.sh +docker compose restart geoserver diff --git a/scripts/start-services.sh b/scripts/start-services.sh new file mode 100755 index 000000000..46a1f31cf --- /dev/null +++ b/scripts/start-services.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e + +cd /var/lipas +source .env.sh + +# Force recreate of mapproxy image (kludge) +docker compose rm -f mapproxy + +# Start backend services +docker compose up -d backend mapproxy logstash kibana legacy-api geoserver worker integrations + +# Wait until critical services are ready to accept connections +timeout 120 bash -c 'until echo > /dev/tcp/localhost/8091; do sleep 0.5; done' + +# Start frontend proxy +docker compose up -d proxy diff --git a/webapp/src/clj/lipas/migrate_data.clj b/webapp/src/clj/lipas/migrate_data.clj index f54c729c2..745569bc1 100644 --- a/webapp/src/clj/lipas/migrate_data.clj +++ b/webapp/src/clj/lipas/migrate_data.clj @@ -166,6 +166,6 @@ (def search (:search system)) (def user (core/get-user db "import@lipas.fi")) (-main "--old-lipas-since" "2019-01-01T00:00:00.000Z") - (-main "--city-data" "/Users/vaotjuha/lipas/raportit/city_stats5.edn") + (-main "--city-data" "/var/lipas/lipas/random-files/city_stats5.edn") (-main "--old-lipas" "527986") - (-main "--old-lipas-edn" "/Users/vaotjuha/lipas/data_migration/missing-ids.edn")) + (-main "--old-lipas-edn" "/var/lipas/random-files/missing-ids.edn"))