summaryrefslogtreecommitdiffstats
path: root/docker/entrypoint.postgres.sh
blob: 1588c56cfbf80f9ed77a4d88d8d9af695a9b5a52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash

CMD="$@"
if [ ! -f /var/lib/postgresql/data/setupFinished ]; then
    echo "### first run - setting up invidious database"
    /usr/local/bin/docker-entrypoint.sh postgres &
    sleep 10
    until runuser -l postgres -c 'pg_isready' 2>/dev/null; do
        >&2 echo "### Postgres is unavailable - waiting"
        sleep 5
    done
    >&2 echo "### importing table schemas"
    su postgres -c 'createdb invidious'
    su postgres -c 'psql -c "CREATE USER kemal WITH PASSWORD '"'kemal'"'"'
    su postgres -c 'psql invidious kemal < config/sql/channels.sql'
    su postgres -c 'psql invidious kemal < config/sql/videos.sql'
    su postgres -c 'psql invidious kemal < config/sql/channel_videos.sql'
    su postgres -c 'psql invidious kemal < config/sql/users.sql'
    su postgres -c 'psql invidious kemal < config/sql/session_ids.sql'
    su postgres -c 'psql invidious kemal < config/sql/nonces.sql'
    su postgres -c 'psql invidious kemal < config/sql/annotations.sql'
    su postgres -c 'psql invidious kemal < config/sql/privacy.sql'
    su postgres -c 'psql invidious kemal < config/sql/playlists.sql'
    su postgres -c 'psql invidious kemal < config/sql/playlist_videos.sql'
    touch /var/lib/postgresql/data/setupFinished
    echo "### invidious database setup finished"
    exit
fi

echo "running postgres /usr/local/bin/docker-entrypoint.sh $CMD"
exec /usr/local/bin/docker-entrypoint.sh $CMD
> 2020-02-25Fix OSM embed bbox & add default zoom (17)v1.1.13SimonBrazell 2020-02-25Basic support for OSM embed & directionsv1.1.12SimonBrazell 2020-02-24Fix OSM redirectsv1.1.11SimonBrazell 2020-02-24OSM redirects (except embedded maps)SimonBrazell 2020-02-23OSM redirects (experimental)SimonBrazell 2020-02-22Add date retrieved and source to YT assetsSimonBrazell 2020-02-22Always proxy video through Invidious without an accountv1.1.9SimonBrazell 2020-02-19Redirect requests for 'YouTube Player API' assets to local files instead.v1.1.8SimonBrazell 2020-02-12Avoid redirecting `tweetdeck.twitter.com` & list instancesv1.1.7SimonBrazell 2020-02-09Updated screenshotsSimonBrazell 2020-02-09Avoid redirecting `studio.youtube.com` & basic instance validationv1.1.6SimonBrazell 2020-02-06Fix missing query strings in redirectsv1.1.5SimonBrazell 2020-02-01Add support for Bibliogram redirectsv1.1.4SimonBrazell 2020-01-15Fix embedded video redirectsSimonBrazell 2019-10-30Update screen shots for latest buildSimonBrazell 2019-10-30Add instances to popup menuSimonBrazell