Tool for extract avalanche danger levels from Pyrenees zones.
Available zones:
- Andorra - Andorra National Weather Service
- Aragón & Navarra - AEMET
- Aran - Lauegi
- Catalunya - ICGC
- France - Meteofrance
Run using docker image from Docker HUB.
docker run \
-e "DB_HOST=YOUR_DB_HOST" \
-e "DB_NAME=YOUR_DB_NAME" \
-e "DB_USER=YOUR_DB_USER" \
-e "DB_PASSWD=YOUR_DB_PASSWORD" \
--rm \
--name atesmaps-bpa-extractor \
atesmaps/atesmaps-bpa-extractor:latest >> {PATH_LOG_FILE} 2>&1
The extractor allows you to select a specific date keeping in mind that if it is not specified this will always be the current day.
To run the extractor with a specific date use the environment variable CUSTOM_DATE
when run docker image:
docker run \
-e "DB_HOST=YOUR_DB_HOST" \
-e "DB_NAME=YOUR_DB_NAME" \
-e "DB_USER=YOUR_DB_USER" \
-e "DB_PASSWD=YOUR_DB_PASSWORD" \
-e "CUSTOM_DATE=1970-01-01"
--rm \
--name atesmaps-bpa-extractor \
atesmaps/atesmaps-bpa-extractor:latest >> {PATH_LOG_FILE} 2>&1
IMPORTANT: The date format must be YYYY-MM-DD.
Deploy BPA extractor service requires Docker engine in your host.
Follow this steps:
- Create Log directory to be able to review the executions.
mkdir /var/log/atesmaps-bpa-extractor
- Create Log rotate configuration file copying the file from repository
resources/deploy/logrotate/atesmaps-bpa-extractor
.
cp resources/deploy/logrotate/atesmaps-bpa-extractor /etc/logrotate.d/atesmaps-bpa-extractor
- Create trigger script in
/opt/atesmaps/scripts
copying the file from repositoryresources/deploy/run_bpa_extractor.sh
:
cp resources/deploy/run_bpa_extractor.sh /opt/atesmaps/scripts/run_bpa_extractor.sh
-
Edit trigger script with your credentials. You should replace the following fields:
- YOUR_DB_HOST
- YOUR_DB_NAME
- YOUR_DB_USER
- YOUR_DB_PASSWORD
-
Change trigger script permissions to be able execution:
chmod +x /opt/atesmaps/scripts/run_bpa_extractor.sh
- Add the following lines to crontab to schedule BPA extractor job.
> 0 * * * * /opt/atesmaps/scripts/run_bpa_extractor.sh >/dev/null 2>&1
Available SQL scripts for deploy BPA extractor are in resources/SQL
.
- create_bpa_history_table.sql: DDL for create new table for danger levels and BPA extracted data.
- load_history_from_bbdd.sql: SQL script for extract old data collected in table "bpa_bbdd" and load to new table.
If you have made changes to the code you will need to generate a new version. Keep in mind that Docker engine is required in your development environment.
-
Change to root project directory where is the Dockerfile.
-
Build docker image.
docker build . -t atesmaps-bpa-extractor:vX.Y.Z
- Tag docker image with docker hub user.
docker tag atesmaps-bpa-extractor:vX.Y.Z atesmaps/atesmaps-bpa-extractor:vX.Y.Z
- Push docker image to Docker HUB.
docker push atesmaps/atesmaps-bpa-extractor:vX.Y.Z
- Nil Torrano: ntorrano@atesmaps.org
- Atesmaps Team: info@atesmaps.org