Fix psql-app cron entry and update postgres install

This commit is contained in:
Tim Evens 2021-04-12 11:47:32 -07:00
parent eba244cdf7
commit 3847a19ea9
2 changed files with 11 additions and 5 deletions

View File

@ -41,9 +41,9 @@ RUN apk update \
&& sed -i -e "s/^\#*work_mem.*=.*/work_mem = $(( (${MEM:-1} * 1024) * 5 / 100))MB/" /usr/local/share/postgresql/postgresql.conf.sample
# Init timesries location
RUN echo 'chown postgres:postgres /var/lib/postgresql/ts' > /docker-entrypoint-initdb.d/0_obmp_init.sh \
echo 'chmod 0700 /var/lib/postgresql/ts' >> /docker-entrypoint-initdb.d/0_obmp_init.sh \
&& echo 'psql -U $POSTGRES_USER -c "CREATE TABLESPACE timeseries LOCATION '\''/var/lib/postgresql/ts'\'';" $POSTGRES_DB' > /docker-entrypoint-initdb.d/0_obmp_init.sh
RUN echo 'mkdir -p /var/lib/postgresql/ts/data' > /docker-entrypoint-initdb.d/0_obmp_init.sh \
&& echo 'chmod 0700 /var/lib/postgresql/ts/data' >> /docker-entrypoint-initdb.d/0_obmp_init.sh \
&& echo 'psql -U $POSTGRES_USER -c "CREATE TABLESPACE timeseries LOCATION '\''/var/lib/postgresql/ts/data'\'';" $POSTGRES_DB' >> /docker-entrypoint-initdb.d/0_obmp_init.sh

View File

@ -161,7 +161,13 @@ MAILTO=""
21 * * * * root . /usr/local/openbmp/pg_profile && psql -c "select update_global_ip_rib();"
# Purge time series data that is older than desired retention
0 * */3 * * root . /usr/local/openbmp/pg_profile && psql -c "SELECT drop_chunks(interval '4 weeks');"
0 * */3 * * root . /usr/local/openbmp/pg_profile && psql -c "SELECT drop_chunks('peer_event_log', interval '1 year');"
1 * */3 * * root . /usr/local/openbmp/pg_profile && psql -c "SELECT drop_chunks('stat_reports', 'interval 4 weeks');"
2 * */3 * * root . /usr/local/openbmp/pg_profile && psql -c "SELECT drop_chunks('ip_rib_log', interval '4 weeks');"
3 * */3 * * root . /usr/local/openbmp/pg_profile && psql -c "SELECT drop_chunks('alerts', interval '6 months');"
4 * */3 * * root . /usr/local/openbmp/pg_profile && psql -c "SELECT drop_chunks('ls_nodes_log', interval '4 months');"
5 * */3 * * root . /usr/local/openbmp/pg_profile && psql -c "SELECT drop_chunks('ls_links_log', interval '4 months');"
6 * */3 * * root . /usr/local/openbmp/pg_profile && psql -c "SELECT drop_chunks('ls_prefixes_log', interval '4 months');"
SETVAR
@ -240,7 +246,7 @@ initdb_postgres
rm -f /var/run/rsyslogd.pid
service cron start
service rsyslogd start
service rsyslog start
run_consumer