summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2019-04-06 07:38:33 -0500
committerOmar Roth <omarroth@hotmail.com>2019-04-06 07:38:33 -0500
commitc5001f3620d6a9d4d24ce63afdf892a690b16440 (patch)
tree39f34e178887209851bd2b0aba73a80412e0ea1d
parent8d5f9418297ac8b43540c571b466da82dd9fac0f (diff)
downloadinvidious-c5001f3620d6a9d4d24ce63afdf892a690b16440.tar.gz
invidious-c5001f3620d6a9d4d24ce63afdf892a690b16440.tar.bz2
invidious-c5001f3620d6a9d4d24ce63afdf892a690b16440.zip
Add role to psql scripts
-rw-r--r--README.md6
-rwxr-xr-xconfig/migrate-scripts/migrate-db-17cf077.sh4
-rwxr-xr-xconfig/migrate-scripts/migrate-db-1c8075c.sh8
-rwxr-xr-xconfig/migrate-scripts/migrate-db-30e6d29.sh4
-rwxr-xr-xconfig/migrate-scripts/migrate-db-3646395.sh4
-rwxr-xr-xconfig/migrate-scripts/migrate-db-6e51189.sh4
-rwxr-xr-xconfig/migrate-scripts/migrate-db-88b7097.sh2
-rwxr-xr-xconfig/migrate-scripts/migrate-db-8e884fe.sh6
-rwxr-xr-xdocker/entrypoint.postgres.sh12
9 files changed, 25 insertions, 25 deletions
diff --git a/README.md b/README.md
index d8aaef47..0d02fe32 100644
--- a/README.md
+++ b/README.md
@@ -101,7 +101,7 @@ $ exit
$ sudo systemctl enable postgresql
$ sudo systemctl start postgresql
$ sudo -i -u postgres
-$ psql -c "CREATE USER kemal WITH PASSWORD 'kemal';"
+$ psql -c "CREATE USER kemal WITH PASSWORD 'kemal';" # Change 'kemal' here to a stronger password, and update `password` in config/config.yml
$ createdb -O kemal invidious
$ psql invidious < /home/invidious/invidious/config/sql/channels.sql
$ psql invidious < /home/invidious/invidious/config/sql/videos.sql
@@ -143,8 +143,8 @@ $ brew install shards crystal-lang postgres imagemagick librsvg
$ git clone https://github.com/omarroth/invidious
$ cd invidious
$ brew services start postgresql
-$ psql -c "CREATE ROLE kemal WITH LOGIN PASSWORD 'kemal';"
-$ createdb invidious -U kemal
+$ psql -c "CREATE ROLE kemal WITH PASSWORD 'kemal';" # Change 'kemal' here to a stronger password, and update `password` in config/config.yml
+$ createdb -O kemal invidious
$ psql invidious < config/sql/channels.sql
$ psql invidious < config/sql/videos.sql
$ psql invidious < config/sql/channel_videos.sql
diff --git a/config/migrate-scripts/migrate-db-17cf077.sh b/config/migrate-scripts/migrate-db-17cf077.sh
index a544f763..5e5bb214 100755
--- a/config/migrate-scripts/migrate-db-17cf077.sh
+++ b/config/migrate-scripts/migrate-db-17cf077.sh
@@ -1,4 +1,4 @@
#!/bin/sh
-psql invidious -c "ALTER TABLE channels ADD COLUMN subscribed bool;"
-psql invidious -c "UPDATE channels SET subscribed = false;"
+psql invidious kemal -c "ALTER TABLE channels ADD COLUMN subscribed bool;"
+psql invidious kemal -c "UPDATE channels SET subscribed = false;"
diff --git a/config/migrate-scripts/migrate-db-1c8075c.sh b/config/migrate-scripts/migrate-db-1c8075c.sh
index 92ad1c7b..63954397 100755
--- a/config/migrate-scripts/migrate-db-1c8075c.sh
+++ b/config/migrate-scripts/migrate-db-1c8075c.sh
@@ -1,7 +1,7 @@
#!/bin/sh
-psql invidious -c "ALTER TABLE channel_videos DROP COLUMN live_now CASCADE"
-psql invidious -c "ALTER TABLE channel_videos DROP COLUMN premiere_timestamp CASCADE"
+psql invidious kemal -c "ALTER TABLE channel_videos DROP COLUMN live_now CASCADE"
+psql invidious kemal -c "ALTER TABLE channel_videos DROP COLUMN premiere_timestamp CASCADE"
-psql invidious -c "ALTER TABLE channel_videos ADD COLUMN live_now bool"
-psql invidious -c "ALTER TABLE channel_videos ADD COLUMN premiere_timestamp timestamptz"
+psql invidious kemal -c "ALTER TABLE channel_videos ADD COLUMN live_now bool"
+psql invidious kemal -c "ALTER TABLE channel_videos ADD COLUMN premiere_timestamp timestamptz"
diff --git a/config/migrate-scripts/migrate-db-30e6d29.sh b/config/migrate-scripts/migrate-db-30e6d29.sh
index 259862df..3a377461 100755
--- a/config/migrate-scripts/migrate-db-30e6d29.sh
+++ b/config/migrate-scripts/migrate-db-30e6d29.sh
@@ -1,4 +1,4 @@
#!/bin/sh
-psql invidious -c "ALTER TABLE channels ADD COLUMN deleted bool;"
-psql invidious -c "UPDATE channels SET deleted = false;"
+psql invidious kemal -c "ALTER TABLE channels ADD COLUMN deleted bool;"
+psql invidious kemal -c "UPDATE channels SET deleted = false;"
diff --git a/config/migrate-scripts/migrate-db-3646395.sh b/config/migrate-scripts/migrate-db-3646395.sh
index 38a4f665..915f364e 100755
--- a/config/migrate-scripts/migrate-db-3646395.sh
+++ b/config/migrate-scripts/migrate-db-3646395.sh
@@ -1,5 +1,5 @@
#!/bin/sh
psql invidious < config/sql/session_ids.sql
-psql invidious -c "INSERT INTO session_ids (SELECT unnest(id), email, CURRENT_TIMESTAMP FROM users) ON CONFLICT (id) DO NOTHING"
-psql invidious -c "ALTER TABLE users DROP COLUMN id"
+psql invidious kemal -c "INSERT INTO session_ids (SELECT unnest(id), email, CURRENT_TIMESTAMP FROM users) ON CONFLICT (id) DO NOTHING"
+psql invidious kemal -c "ALTER TABLE users DROP COLUMN id"
diff --git a/config/migrate-scripts/migrate-db-6e51189.sh b/config/migrate-scripts/migrate-db-6e51189.sh
index adadc109..ce728118 100755
--- a/config/migrate-scripts/migrate-db-6e51189.sh
+++ b/config/migrate-scripts/migrate-db-6e51189.sh
@@ -1,4 +1,4 @@
#!/bin/sh
-psql invidious -c "ALTER TABLE channel_videos ADD COLUMN live_now bool;"
-psql invidious -c "UPDATE channel_videos SET live_now = false;"
+psql invidious kemal -c "ALTER TABLE channel_videos ADD COLUMN live_now bool;"
+psql invidious kemal -c "UPDATE channel_videos SET live_now = false;"
diff --git a/config/migrate-scripts/migrate-db-88b7097.sh b/config/migrate-scripts/migrate-db-88b7097.sh
index c63d37f0..6bde8399 100755
--- a/config/migrate-scripts/migrate-db-88b7097.sh
+++ b/config/migrate-scripts/migrate-db-88b7097.sh
@@ -1,3 +1,3 @@
#!/bin/sh
-psql invidious -c "ALTER TABLE channel_videos ADD COLUMN premiere_timestamp timestamptz;"
+psql invidious kemal -c "ALTER TABLE channel_videos ADD COLUMN premiere_timestamp timestamptz;"
diff --git a/config/migrate-scripts/migrate-db-8e884fe.sh b/config/migrate-scripts/migrate-db-8e884fe.sh
index 095c7632..1c8dafd1 100755
--- a/config/migrate-scripts/migrate-db-8e884fe.sh
+++ b/config/migrate-scripts/migrate-db-8e884fe.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-psql invidious -c "ALTER TABLE channels DROP COLUMN subscribed"
-psql invidious -c "ALTER TABLE channels ADD COLUMN subscribed timestamptz"
-psql invidious -c "UPDATE channels SET subscribed = '2019-01-01 00:00:00+00'"
+psql invidious kemal -c "ALTER TABLE channels DROP COLUMN subscribed"
+psql invidious kemal -c "ALTER TABLE channels ADD COLUMN subscribed timestamptz"
+psql invidious kemal -c "UPDATE channels SET subscribed = '2019-01-01 00:00:00+00'"
diff --git a/docker/entrypoint.postgres.sh b/docker/entrypoint.postgres.sh
index 8f987201..64bcfe48 100755
--- a/docker/entrypoint.postgres.sh
+++ b/docker/entrypoint.postgres.sh
@@ -12,12 +12,12 @@ if [ ! -f /var/lib/postgresql/data/setupFinished ]; then
>&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 < config/sql/channels.sql'
- su postgres -c 'psql invidious < config/sql/videos.sql'
- su postgres -c 'psql invidious < config/sql/channel_videos.sql'
- su postgres -c 'psql invidious < config/sql/users.sql'
- su postgres -c 'psql invidious < config/sql/session_ids.sql'
- su postgres -c 'psql invidious < config/sql/nonces.sql'
+ 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'
touch /var/lib/postgresql/data/setupFinished
echo "### invidious database setup finished"
exit