diff --git a/postgres/Dockerfile b/postgres/Dockerfile index 8f4b8c5..e4d7a7d 100644 --- a/postgres/Dockerfile +++ b/postgres/Dockerfile @@ -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 diff --git a/psql-app/scripts/run b/psql-app/scripts/run index 3ee8cd4..73961c0 100755 --- a/psql-app/scripts/run +++ b/psql-app/scripts/run @@ -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