lemur/docker/entrypoint

44 lines
1.7 KiB
Plaintext
Raw Normal View History

2018-12-30 21:37:46 +01:00
#!/bin/sh
2018-12-30 23:54:31 +01:00
export SQLALCHEMY_DATABASE_URI="postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB"
2018-12-30 21:37:46 +01:00
2018-12-30 22:25:11 +01:00
PGPASSWORD=$POSTGRES_PASSWORD psql -h $POSTGRES_HOST -p $POSTGRES_PORT -U $POSTGRES_USER -d $POSTGRES_DB --command 'select 1;'
echo "Create Postgres trgm extension"
2018-12-30 21:37:46 +01:00
PGPASSWORD=$POSTGRES_PASSWORD psql -h $POSTGRES_HOST -p $POSTGRES_PORT -U $POSTGRES_USER -d $POSTGRES_DB --command 'CREATE EXTENSION pg_trgm;'
2018-12-30 22:25:11 +01:00
echo "Done"
2018-12-30 21:37:46 +01:00
2018-12-31 13:21:13 +01:00
2018-12-31 13:33:58 +01:00
if [ ! -f /etc/nginx/ssl/server.crt ] && [ ! -f /etc/nginx/ssl/server.key ]; then
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -subj "/C=US/ST=Oregon/L=Portland/O=Company Name/OU=Org/CN=FAKE"
fi
2018-12-31 13:21:13 +01:00
2018-12-30 22:43:55 +01:00
# if [ ! -f /home/lemur/.lemur/lemur.conf.py ]; then
# echo "Creating config"
# https://github.com/Netflix/lemur/issues/2257
# python3 /opt/lemur/lemur/manage.py create_config
# echo "Done"
# fi
2018-12-30 21:47:27 +01:00
echo "Running init"
2018-12-30 23:20:29 +01:00
su lemur -c "python3 /opt/lemur/lemur/manage.py init"
2018-12-31 00:04:58 +01:00
#export LEMUR_CONF=/home/lemur/.lemur/lemur.conf.py ; python3 /opt/lemur/lemur/manage.py init
2018-12-30 22:25:11 +01:00
echo "Done"
2018-12-30 22:43:55 +01:00
# echo "Creating user"
# https://github.com/Netflix/lemur/issues/
# echo "something that will create user" | python3 /opt/lemur/lemur/manage.py shell
# echo "Done"
2018-12-30 21:37:46 +01:00
2018-12-30 21:47:27 +01:00
cron_notify="${CRON_NOTIFY:-"0 22 * * *"}"
cron_sync="${CRON_SYNC:-"*/15 * * * *"}"
cron_check_revoked="${CRON_CHECK_REVOKED:-"0 22 * * *"}"
2018-12-30 21:37:46 +01:00
2018-12-30 22:25:11 +01:00
echo "Populating crontab"
2018-12-30 21:47:27 +01:00
echo "${cron_notify} lemur python3 /opt/lemur/lemur/manage.py notify expirations" >> /etc/crontabs/root
echo "${cron_sync} lemur python3 /opt/lemur/lemur/manage.py source sync -s all" >> /etc/crontabs/root
echo "${cron_check_revoked} lemur /opt/lemur/lemur/manage.py certificate check_revoked" >> /etc/crontabs/root
2018-12-30 22:25:11 +01:00
echo "Done"
2018-12-30 21:37:46 +01:00
exec "$@"