Compare commits

..

No commits in common. "82b41342fc6a0d03928f5ecf59a10c0ba1efbfb8" and "9138d574295598ad7dd76cb3460ac61d324b7408" have entirely different histories.

5 changed files with 8 additions and 34 deletions

View file

@ -5,4 +5,4 @@ COPY ./data_init/*.sql /opt/init/init.sql
ENTRYPOINT ["/opt/entrypoint.sh"]
CMD ["/bin/sh", "-c", "/usr/sbin/dcrond -f -d 5 > /var/log/dcrond.log 2>&1"]
CMD ["/usr/sbin/dcrond", "-f" ]

View file

@ -8,7 +8,7 @@ set -e
cat<<EOF | dcrontab -
# min hour day month weekday command
*/15 * * * * sh /opt/update_camera.sh >> /var/log/update_camera_$(date +\%Y\%m\%d\%H\%M\%S).log 2>&1
5 * * * * sh /opt/update_camera.sh
EOF
####################################################################################################
@ -20,15 +20,7 @@ php /opt/init_db.php
echo "Prescripts done"
####################################################################################################
### Run script once immediately
####################################################################################################
echo "Running update once initially..."
sh /opt/update_camera.sh >> /var/log/update_camera_$(date +\%Y\%m\%d\%H\%M\%S).log 2>&1
echo "Initial update done"
####################################################################################################
### Run cron to schedule periodic task
### Run cmd
####################################################################################################
# see: https://github.com/dubiousjim/dcron/issues/13

View file

@ -63,7 +63,7 @@ do
rm "change_file.osc.gz"
fi
echo `date "+%d/%m/%Y %H:%M"`" - Start processing sequence number $curSeqNum of $newSeqNum" > "$logFileName"
echo `date "+%d/%m/%Y %H:%M"`" - Start processing sequence number $curSeqNum" > "$logFileName"
targetDirName=`echo "000000000$curSeqNum" | sed 's#.*\(...\)\(...\)\(...\)$#\1/\2/\3.osc.gz#'`
targetDirName="$REPLICATE_URL/$targetDirName"
@ -87,7 +87,7 @@ do
targetDirName=`echo "$targetDirName" | sed 's/.osc.gz$/.state.txt/'`
curl -L "$targetDirName" -o lastState.txt 2>&1 | tee -a $logFileName
echo `date "+%d/%m/%Y %H:%M"`" - Finish processing sequence number $curSeqNum of $newSeqNum" | tee -a "$logFileName"
echo `date "+%d/%m/%Y %H:%M"`" - Finish processing sequence number $curSeqNum" | tee -a "$logFileName"
done
rm "/var/lock/update_camera"

View file

@ -1,7 +1,6 @@
services:
db:
image: mariadb:12.0.2
restart: unless-stopped
command: --max_allowed_packet=3250585600
environment:
MYSQL_ROOT_PASSWORD: rootpassword # ${{secrets.MYSQL_ROOT_PASSWORD}}
@ -19,7 +18,6 @@ services:
web:
image: git.hamburg.ccc.de/ccchh/sunders/web:latest
restart: unless-stopped
environment:
MYSQL_HOST: db
MYSQL_DB: camera # ${{secrets.MYSQL_DATABASE}}
@ -31,22 +29,13 @@ services:
DEFAULT_LANGUAGE: en
IMPRESSUM_URL: https://hamburg.ccc.de/imprint/
ports:
- "8081:80"
- "8080:80"
depends_on:
data_handler:
condition: service_started
# all the way zoomed out, with hamburg at the center, at least one camera should be returned
healthcheck:
test: >
["CMD", "curl -s 'http://localhost/camera.php?bbox=-92.52991540527346,30.683278176916133,131.7689595947266,72.87186315234298&zoom=4&width=2552&height=867' | grep '^\[.+\]$'"]
interval: 10s
timeout: 5s
start_period: 30s
retries: 5
data_handler:
image: git.hamburg.ccc.de/ccchh/sunders/data_handler:latest
restart: unless-stopped
environment:
MYSQL_HOST: db
MYSQL_DB: camera # ${{secrets.MYSQL_DATABASE}}
@ -60,13 +49,6 @@ services:
db:
condition: service_healthy
restart: true
# if the latest `update_camera_*.log` contains "error", fail the healthcheck
healthcheck:
test: ["CMD", "sh", "-c", "ls /var/log | grep '^update_camera_' | xargs -I {} sh -c 'grep -q error /var/log/{} || exit 0; exit 1'"]
interval: 10s
timeout: 5s
start_period: 30s
retries: 5
volumes:
mariadb:

View file

@ -60,7 +60,7 @@ do
rm "change_file.osc.gz"
fi
echo `date "+%d/%m/%Y %H:%M"`" - Start processing sequence number $curSeqNum of $newSeqNum" > "$logFileName"
echo `date "+%d/%m/%Y %H:%M"`" - Start processing sequence number $curSeqNum" > "$logFileName"
targetDirName=`echo "000000000$curSeqNum" | sed 's#.*\(...\)\(...\)\(...\)$#\1/\2/\3.osc.gz#'`
targetDirName="$REPLICATE_URL/$targetDirName"
@ -84,7 +84,7 @@ do
targetDirName=`echo "$targetDirName" | sed 's/.osc.gz$/.state.txt/'`
wget -nv "$targetDirName" -O lastState.txt 2>&1 | tee -a $logFileName
echo `date "+%d/%m/%Y %H:%M"`" - Finish processing sequence number $curSeqNum of $newSeqNum" | tee -a "$logFileName"
echo `date "+%d/%m/%Y %H:%M"`" - Finish processing sequence number $curSeqNum" | tee -a "$logFileName"
done
rm "/var/lock/update_camera"