Skip to content
Snippets Groups Projects
Commit dad8c821 authored by Riccardo Boero's avatar Riccardo Boero :innocent:
Browse files

Updated docker base image and fixed SB credentials propagation.

parent cbdf6d7a
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,6 @@ Added:
- license
- changelog
- contributing
- 2023 EU NUTS population data
Fixed:
- updated docker base image
......
FROM mariadb:11.1
FROM mariadb:11.4
# copy directories with scripts
COPY inputs/update_sys.sh /root/inputs/update_sys.sh
......
#!/bin/bash
# Function to display help
function show_help() {
echo "Usage: $0 <host> <user> <password>"
echo ""
echo "This script sets up the database and loads the data."
echo ""
echo "Arguments:"
echo " host Database host"
echo " user Database user"
echo " password Database password"
}
# Check if help is requested
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
show_help
exit 0
fi
# Check if all three parameters are provided
if [[ $# -ne 3 ]]; then
echo "Error: Missing arguments."
show_help
exit 1
fi
# Assign parameters to variables
HOST=$1
USER=$2
PASSWORD=$3
# create database
./inputs/setup_db.sh
......
#!/bin/bash
# Assign parameters to variables
HOST=$1
USER=$2
PASSWORD=$3
echo "*** Dump database:"
mkdir -p ./dump
mariadb-dump -h "" -u "root" -p --databases FACT_mine > ./dump/db_mine.sql
mariadb-dump -h "$HOST" -u "$USER" -p"$PASSWORD" --databases FACT_mine > ./dump/db_mine.sql
echo "*** Drop database:"
mariadb -h "" -u "root" -p < inputs/sql/drop_db.sql
mariadb -h "$HOST" -u "$USER" -p"$PASSWORD" < inputs/sql/drop_db.sql
#!/bin/bash
#!/bin/bash
# Assign parameters to variables
HOST=$1
USER=$2
PASSWORD=$3
# geology
mkdir -p ./temp
wget -O ./temp/temp.zip -N "https://ftp.maps.canada.ca/pub/nrcan_rncan/publications/STPublications_PublicationsST/223/223767/of_5529.zip"
unzip -d ./temp/ ./temp/temp.zip
ogr2ogr -f MySQL MySQL:FACT_mine,host=,user=root,password= ./temp/data/ArcMap9_ArcReader9/AllThemesMerged/gen.shp -nln geology -update -overwrite -lco engine=Aria -t_srs EPSG:4326
ogr2ogr -f MySQL MySQL:FACT_mine,host=$HOST,user=$USER,password=$PASSWORD ./temp/data/ArcMap9_ArcReader9/AllThemesMerged/gen.shp -nln geology -update -overwrite -lco engine=Aria -t_srs EPSG:4326
chmod -R u+w temp/
sudo rm -r ./temp
......@@ -15,7 +20,7 @@ do
mkdir -p ./temp
wget -O ./temp/temp.zip -N "https://mrdata.usgs.gov/${m}/${m}-csv.zip"
unzip -d ./temp/ ./temp/temp.zip
ogr2ogr -f MySQL MySQL:FACT_mine,host=,user=root,password= ./temp/${m}/${m}.shp -nln ${m} -update -overwrite -lco engine=Aria -t_srs EPSG:4326
ogr2ogr -f MySQL MySQL:FACT_mine,host=$HOST,user=$USER,password=$PASSWORD ./temp/${m}/${m}.shp -nln ${m} -update -overwrite -lco engine=Aria -t_srs EPSG:4326
chmod -R u+w temp/
rm -r ./temp
done
......@@ -24,6 +29,6 @@ done
mkdir -p ./temp
wget -O ./temp/temp.zip -N "https://www.sciencebase.gov/catalog/file/get/594d3c8ee4b062508e39b332?name=PP1802_CritMin_Shapefiles.zip"
unzip -d ./temp/ ./temp/temp.zip
ogr2ogr -f MySQL MySQL:FACT_mine,host=,user=root,password= ./temp/PP1802_CritMin_pts.shp -nln global_selected -update -overwrite -lco engine=Aria -t_srs EPSG:4326
ogr2ogr -f MySQL MySQL:FACT_mine,host=$HOST,user=$USER,password=$PASSWORD ./temp/PP1802_CritMin_pts.shp -nln global_selected -update -overwrite -lco engine=Aria -t_srs EPSG:4326
chmod -R u+w temp/
rm -r ./temp
#!/bin/bash
# Assign parameters to variables
HOST=$1
USER=$2
PASSWORD=$3
echo "*** Create database:"
mariadb -h "" -u "root" -p < inputs/sql/create_db.sql
mariadb --h "$HOST" -u "$USER" -p"$PASSWORD" < inputs/sql/create_db.sql
#echo "*** Create tables:"
#mariadb -h "" -u "root" -p < inputs/sql/create_tables.sql
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment