Invidious: role "postgres" does not exist

Created on 19 Aug 2020  Â·  5Comments  Â·  Source: iv-org/invidious

Subject of the issue

there is message role "postgres" does not exist when running invidio.us through docker-compose

Your environment

  • invidio.us, 2ce82f3da59037d533c58c8c8f78bb81904850ae
  • OS: Ubuntu 20.04.1 LTS x86_64

Steps to reproduce

run sudo docker-compose up and after some time the message should not pop up

Expected behaviour

the message should not pop up

Actual behaviour

log output

Starting invidious_postgres_1 ... done
Starting invidious_invidious_1 ... done
Attaching to invidious_postgres_1, invidious_invidious_1
postgres_1   |
postgres_1   | PostgreSQL Database directory appears to contain a database; Skipping initialization
postgres_1   |
postgres_1   | 2020-08-19 08:03:45.336 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
postgres_1   | 2020-08-19 08:03:45.336 UTC [1] LOG:  listening on IPv6 address "::", port 5432
postgres_1   | 2020-08-19 08:03:45.341 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres_1   | 2020-08-19 08:03:45.381 UTC [26] LOG:  database system was interrupted; last known up at 2020-08-12 08:25:02 UTC
postgres_1   | 2020-08-19 08:03:45.625 UTC [27] FATAL:  the database system is starting up
invidious_1  | Unhandled exception: (no message) (DB::ConnectionRefused)
postgres_1   | 2020-08-19 08:03:45.677 UTC [26] LOG:  database system was not properly shut down; automatic recovery in progress
postgres_1   | 2020-08-19 08:03:45.695 UTC [26] LOG:  redo starts at 0/220FE28
postgres_1   | 2020-08-19 08:03:45.695 UTC [26] LOG:  invalid record length at 0/220FE60: wanted 24, got 0
postgres_1   | 2020-08-19 08:03:45.695 UTC [26] LOG:  redo done at 0/220FE28
postgres_1   | 2020-08-19 08:03:45.881 UTC [1] LOG:  database system is ready to accept connections
invidious_1  |   from lib/pg/src/pg/connection.cr:16:9 in 'initialize'
invidious_1  |   from lib/pg/src/pg/connection.cr:7:5 in 'new'
invidious_1  |   from lib/pg/src/pg/driver.cr:3:5 in 'build_connection'
invidious_1  |   from lib/db/src/db/database.cr:57:16 in '->'
invidious_1  |   from ../usr/share/crystal/src/primitives.cr:255:3 in 'build_resource'
invidious_1  |   from lib/db/src/db/pool.cr:45:34 in 'initialize'
invidious_1  |   from lib/db/src/db/pool.cr:38:5 in 'new:initial_pool_size:max_pool_size:max_idle_pool_size:checkout_timeout:retry_attempts:retry_delay'
invidious_1  |   from lib/db/src/db/database.cr:56:15 in 'initialize'
invidious_1  |   from lib/db/src/db/database.cr:49:5 in 'new'
invidious_1  |   from lib/db/src/db.cr:152:5 in 'build_database'
invidious_1  |   from lib/db/src/db.cr:116:5 in 'open'
invidious_1  |   from ../usr/share/crystal/src/primitives.cr:255:3 in 'once'
invidious_1  |   from ../usr/share/crystal/src/crystal/once.cr:50:3 in '__crystal_once'
invidious_1  |   from src/invidious.cr:46:1 in '__crystal_main'
invidious_1  |   from ../usr/share/crystal/src/crystal/main.cr:105:5 in 'main_user_code'
invidious_1  |   from ../usr/share/crystal/src/crystal/main.cr:91:7 in 'main'
invidious_1  |   from ../usr/share/crystal/src/crystal/main.cr:114:3 in 'main'
invidious_1  |   from src/env/__libc_start_main.c:94:2 in 'libc_start_main_stage2'
invidious_1  | [development] Kemal is ready to lead at http://0.0.0.0:3000
invidious_1  | 2020-08-19 08:04:12 UTC 200 GET / 22.89ms
invidious_1  | 2020-08-19 08:04:12 UTC 200 GET /css/pure-min.css?v=3f97beb 9.98ms
invidious_1  | 2020-08-19 08:04:12 UTC 200 GET /css/grids-responsive-min.css?v=3f97beb 1.14ms
invidious_1  | 2020-08-19 08:04:12 UTC 200 GET /css/ionicons.min.css?v=3f97beb 1.94ms
invidious_1  | 2020-08-19 08:04:12 UTC 200 GET /css/default.css?v=3f97beb 1.04ms
invidious_1  | 2020-08-19 08:04:12 UTC 200 GET /css/darktheme.css?v=3f97beb 454.17µs
invidious_1  | 2020-08-19 08:04:12 UTC 200 GET /css/lighttheme.css?v=3f97beb 457.46µs
invidious_1  | 2020-08-19 08:04:12 UTC 200 GET /vi/youtube-video-id/mqdefault.jpg 67.81ms
invidious_1  | 2020-08-19 08:04:12 UTC 200 GET /js/handlers.js?v=3f97beb 1.8ms
invidious_1  | 2020-08-19 08:04:12 UTC 200 GET /js/themes.js?v=3f97beb 836.75µs
invidious_1  | 2020-08-19 08:04:12 UTC 200 GET /js/sse.js?v=3f97beb 2.73ms
invidious_1  | 2020-08-19 08:04:12 UTC 200 GET /js/notifications.js?v=3f97beb 889.72µs
invidious_1  | 2020-08-19 08:04:12 UTC 200 GET /vi/youtube-video-id/mqdefault.jpg 234.33ms
invidious_1  | 2020-08-19 08:04:13 UTC 200 GET /fonts/ionicons.woff2?v=4.6.3 3.92ms
invidious_1  | 2020-08-19 08:04:12 UTC 200 GET /vi/youtube-video-id/mqdefault.jpg 362.96ms
invidious_1  | 2020-08-19 08:04:14 UTC 200 GET /apple-touch-icon.png?v=3f97beb 754.79µs
invidious_1  | 2020-08-19 08:04:14 UTC 200 GET /favicon-16x16.png?v=3f97beb 442.69µs
invidious_1  | 2020-08-19 08:04:14 UTC 200 GET /api/v1/auth/subscriptions?fields=authorId 39.74ms
postgres_1   | 2020-08-19 08:04:15.194 UTC [44] FATAL:  role "postgres" does not exist

note

if needed i can upload my docker-compose.yaml as well

bug critical docker

All 5 comments

This issue is because the init script fails to create the postgres role in the database: https://github.com/iv-org/invidious/blob/master/docker/init-invidious-db.sh

The issue might be from the set -eou pipefail requiring the full bash environment instead of a simple sh. Changing the first line from #!/bin/sh to #!/bin/bash then rebuilding the docker container worked for me.

I created a branch in my fork with the commit to test if it is fixed: https://github.com/resttime/invidious/commit/ccbbe81141665a41490041eb84e7c6c4f7c437cd

i'm still new with docker so i tried what you described but it stll not working

log output

➜  invidious git:(master) sudo docker image ls
REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
invidious_invidious   latest              f161d8f0b86c        13 days ago         73.9MB
postgres              10                  145b344769a8        2 weeks ago         200MB
redis                 6.0.4-alpine        e008f2ff99d0        2 months ago        31.5MB
alpine                latest              a24bb4013296        2 months ago        5.57MB
➜  invidious git:(master) sudo docker image rm f161
Error response from daemon: conflict: unable to delete f161d8f0b86c (must be forced) - image is being used by stopped container 1a8afd1a35a1
➜  invidious git:(master) sudo docker container ls
CONTAINER ID        IMAGE                 COMMAND             CREATED             STATUS              PORTS                    NAMES
ceef431ee676        linuxserver/jackett   "/init"             2 weeks ago         Up 8 minutes        0.0.0.0:9117->9117/tcp   jackett
➜  invidious git:(master) sudo docker container ls -a
CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS                        PORTS                              NAMES
1a8afd1a35a1        invidious_invidious    "/invidious/invidious"   12 days ago         Exited (137) 59 seconds ago                                      invidious_invidious_1
3f234f32683b        postgres:10            "docker-entrypoint.s…"   12 days ago         Exited (137) 59 seconds ago                                      invidious_postgres_1
➜  invidious git:(master) sudo docker container rm 1a8
1a8
➜  invidious git:(master) sudo docker container ls -a
CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS                            PORTS                              NAMES
3f234f32683b        postgres:10            "docker-entrypoint.s…"   12 days ago         Exited (137) About a minute ago                                      invidious_postgres_1
➜  invidious git:(master) sudo docker image ls
REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
invidious_invidious   latest              f161d8f0b86c        13 days ago         73.9MB
postgres              10                  145b344769a8        2 weeks ago         200MB
redis                 6.0.4-alpine        e008f2ff99d0        2 months ago        31.5MB
alpine                latest              a24bb4013296        2 months ago        5.57MB
hello-world           latest              bf756fb1ae65        7 months ago        13.3kB
➜  invidious git:(master) sudo docker image rm f161
Untagged: invidious_invidious:latest
Deleted: sha256:f161d8f0b86c1ced13df601ef6c975c697ecb2266854f5d07104a8af52a06b97
Deleted: sha256:6180be9619f110a906e187a806f2f73b5279e43d929727acd4b3465f37bcc4f4
Deleted: sha256:d61df43eae63bf1b5c74dfcfc57bcc6014e9afa629d9d224d3353903cdcc1294
Deleted: sha256:5ddebbdba94e1af95602f436d715647b7117c7ef0a6837b3b59793e110fcbba4
Deleted: sha256:c57cdd3135c280452786640cbe96b81caa0e153b57e1cda388dbb45ab492a691
Deleted: sha256:00c957c94c1514435e02f715c219c5ad3eaa95a62398cc1f693b9f04b22d7d71
Deleted: sha256:a0e0b454dcdabe97bcdf6eb189f91d2cd729245d001459f4dd5deb5dca1e70c3
Deleted: sha256:d3541947254f10a17c66d44a74ea45a81cfda6bcc6400fbdd350a95e60c86e8c
Deleted: sha256:19589658f2d39584e1e06062c4a9bd6c9ecd25ee36d780f99ff1b4d36800b813
Deleted: sha256:34033acf55de1d339e0d67f180650be5010a441b9b22a8fa170f55bcaad10421
Deleted: sha256:1031c25100c7b9b400a31ae98e5041f54c22d78237da34d3409d83921dd986e6
Deleted: sha256:71589e1550487a4325f57d5f2fed21e58089a5aff0326ab06e0147f35117ebfc
Deleted: sha256:de992c3cfc070bc3548f615b904ea8b4572b8e30688ef13f5fb7c59a883076f6
Deleted: sha256:7aaa00187fd824553b0b2e0778937d901df7c776965e84db4a3c07125bb3171d
Deleted: sha256:356378ee595f3a5d56c7441d7002b508e7ddd7b8913ab0bea62a0cb93599adae
Deleted: sha256:8ef712c76581345491b1963277a3213fe52dbf73c08be5b0a16d585d6feaceca
Deleted: sha256:9d573cefe0d204cf4e62792df2d69f3e98c6944db39a6c84eabe144ac2e487f4
Deleted: sha256:7b134a25f47d3c7688cd386c41ed69cfdf9bdadc3a7c7c4e30e5303bddd8bad2
Deleted: sha256:1520fac5a29b5814adf71824eb34f74732fb7a435411e0e93066420573d124f8
Deleted: sha256:f5f9ac191221d2c46037d68fd462f350ac4e4295e646a67c57aa536f0b1d6804
➜  invidious git:(master) sudo docker-compose build
postgres uses an image, skipping
Building invidious
Step 1/20 : FROM crystallang/crystal:0.35.1-alpine AS builder
 ---> 6a09b54a6eb8
Step 2/20 : RUN apk add --no-cache curl sqlite-static
 ---> Running in 4167e48f44f8
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
(1/2) Installing curl (7.67.0-r0)
(2/2) Installing sqlite-static (3.30.1-r2)
Executing busybox-1.31.1-r9.trigger
OK: 168 MiB in 58 packages
Removing intermediate container 4167e48f44f8
 ---> ecc622a5da92
Step 3/20 : WORKDIR /invidious
 ---> Running in 15311bfe0a1a
Removing intermediate container 15311bfe0a1a
 ---> 5abf74d6df7b
Step 4/20 : COPY ./shard.yml ./shard.yml
 ---> f9b103bbb110
Step 5/20 : RUN shards update && shards install &&     curl -Lo ./lib/lsquic/src/lsquic/ext/liblsquic.a https://omar.yt/lsquic/liblsquic-v2.18.1.a
 ---> Running in c85cab54e467
Resolving dependencies
Fetching https://github.com/will/crystal-pg.git
Fetching https://github.com/crystal-lang/crystal-sqlite3.git
Fetching https://github.com/kemalcr/kemal.git
Fetching https://github.com/ysbaddaden/pool.git
Fetching https://github.com/omarroth/protodec.git
Fetching https://github.com/iv-org/lsquic.cr.git
Fetching https://github.com/crystal-lang/crystal-db.git
Fetching https://github.com/luislavena/radix.git
Fetching https://github.com/jeromegn/kilt.git
Fetching https://github.com/crystal-loot/exception_page.git
Installing db (0.9.0)
Installing pg (0.21.1)
Installing sqlite3 (0.16.0)
Installing radix (0.3.9)
Installing kilt (0.4.0)
Installing exception_page (0.1.4)
Installing kemal (0.26.1 at dfe7dca)
Installing pool (0.2.3)
Installing protodec (0.1.3)
Installing lsquic (2.18.1)
Writing shard.lock
Resolving dependencies
Fetching https://github.com/will/crystal-pg.git
Fetching https://github.com/crystal-lang/crystal-db.git
Fetching https://github.com/crystal-lang/crystal-sqlite3.git
Fetching https://github.com/kemalcr/kemal.git
Fetching https://github.com/luislavena/radix.git
Fetching https://github.com/jeromegn/kilt.git
Fetching https://github.com/crystal-loot/exception_page.git
Fetching https://github.com/ysbaddaden/pool.git
Fetching https://github.com/omarroth/protodec.git
Fetching https://github.com/iv-org/lsquic.cr.git
Using db (0.9.0)
Using pg (0.21.1)
Using sqlite3 (0.16.0)
Using radix (0.3.9)
Using kilt (0.4.0)
Using exception_page (0.1.4)
Using kemal (0.26.1 at dfe7dca)
Using pool (0.2.3)
Using protodec (0.1.3)
Using lsquic (2.18.1)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 7024k  100 7024k    0     0   562k      0  0:00:12  0:00:12 --:--:--  693k
Removing intermediate container c85cab54e467
 ---> 9154c09b2d61
Step 6/20 : COPY ./src/ ./src/
 ---> f9b96fd8fdba
Step 7/20 : COPY ./.git/ ./.git/
 ---> 9901f67cec8f
Step 8/20 : RUN crystal build ./src/invidious.cr     --static --warnings all     --link-flags "-lxml2 -llzma"
 ---> Running in 36b0db908f1b
Removing intermediate container 36b0db908f1b
 ---> c5da058a0773
Step 9/20 : FROM alpine:latest
 ---> a24bb4013296
Step 10/20 : RUN apk add --no-cache librsvg ttf-opensans
 ---> Running in 0fbef39decda
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
(1/40) Installing libxau (1.0.9-r0)
(2/40) Installing libbsd (0.10.0-r0)
(3/40) Installing libxdmcp (1.1.3-r0)
(4/40) Installing libxcb (1.14-r1)
(5/40) Installing libx11 (1.6.11-r0)
(6/40) Installing libxext (1.3.4-r0)
(7/40) Installing libxrender (0.9.10-r3)
(8/40) Installing expat (2.2.9-r1)
(9/40) Installing brotli-libs (1.0.7-r5)
(10/40) Installing libbz2 (1.0.8-r1)
(11/40) Installing libpng (1.6.37-r1)
(12/40) Installing freetype (2.10.2-r0)
(13/40) Installing libuuid (2.35.2-r0)
(14/40) Installing fontconfig (2.13.1-r2)
(15/40) Installing pixman (0.40.0-r2)
(16/40) Installing cairo (1.16.0-r2)
(17/40) Installing libffi (3.3-r2)
(18/40) Installing libintl (0.20.2-r0)
(19/40) Installing libblkid (2.35.2-r0)
(20/40) Installing libmount (2.35.2-r0)
(21/40) Installing pcre (8.44-r0)
(22/40) Installing glib (2.64.4-r0)
(23/40) Installing cairo-gobject (1.16.0-r2)
(24/40) Installing libgcc (9.3.0-r2)
(25/40) Installing pkgconf (1.7.2-r0)
(26/40) Installing xz-libs (5.2.5-r0)
(27/40) Installing libxml2 (2.9.10-r4)
(28/40) Installing shared-mime-info (1.15-r0)
(29/40) Installing libjpeg-turbo (2.0.5-r0)
(30/40) Installing tiff (4.1.0-r0)
(31/40) Installing gdk-pixbuf (2.40.0-r2)
(32/40) Installing libxft (2.3.3-r0)
(33/40) Installing fribidi (1.0.9-r0)
(34/40) Installing graphite2 (1.3.14-r0)
(35/40) Installing harfbuzz (2.6.6-r0)
(36/40) Installing pango (1.44.7-r2)
(37/40) Installing librsvg (2.48.8-r0)
(38/40) Installing libfontenc (1.1.4-r0)
(39/40) Installing mkfontscale (1.2.1-r1)
(40/40) Installing ttf-opensans (1.10-r0)
Executing ttf-opensans-1.10-r0.post-install
Executing busybox-1.31.1-r16.trigger
Executing fontconfig-2.13.1-r2.trigger
Executing shared-mime-info-1.15-r0.trigger
Executing gdk-pixbuf-2.40.0-r2.trigger
Executing mkfontscale-1.2.1-r1.trigger
OK: 38 MiB in 54 packages
Removing intermediate container 0fbef39decda
 ---> a3c77a565f3b
Step 11/20 : WORKDIR /invidious
 ---> Running in 369fc828c57d
Removing intermediate container 369fc828c57d
 ---> 2e360f6d7cf4
Step 12/20 : RUN addgroup -g 1000 -S invidious &&     adduser -u 1000 -S invidious -G invidious
 ---> Running in 5dbbecb83323
Removing intermediate container 5dbbecb83323
 ---> 8e62d10cfbfe
Step 13/20 : COPY ./assets/ ./assets/
 ---> 62a79b44dcd1
Step 14/20 : COPY --chown=invidious ./config/config.yml ./config/config.yml
 ---> c84ae5d21abe
Step 15/20 : RUN sed -i 's/host: \(127.0.0.1\|localhost\)/host: postgres/' config/config.yml
 ---> Running in 70729ac6b5b3
Removing intermediate container 70729ac6b5b3
 ---> 95c991a2b2d8
Step 16/20 : COPY ./config/sql/ ./config/sql/
 ---> f8520a36d574
Step 17/20 : COPY ./locales/ ./locales/
 ---> 516d545a6cbf
Step 18/20 : COPY --from=builder /invidious/invidious .
 ---> 407d65f6bf68
Step 19/20 : USER invidious
 ---> Running in c3ab24bce1cb
Removing intermediate container c3ab24bce1cb
 ---> c3a42fda3065
Step 20/20 : CMD [ "/invidious/invidious" ]
 ---> Running in 2b1b3bf7ec56
Removing intermediate container 2b1b3bf7ec56
 ---> 4cc783036cff
Successfully built 4cc783036cff
Successfully tagged invidious_invidious:latest
➜  invidious git:(master) (cd ~/git/invidious && sudo docker-compose up)
[sudo] password for r3r:
Starting invidious_postgres_1 ... done
Creating invidious_invidious_1 ... done
Attaching to invidious_postgres_1, invidious_invidious_1
postgres_1   |
postgres_1   | PostgreSQL Database directory appears to contain a database; Skipping initialization
postgres_1   |
postgres_1   | 2020-08-20 06:33:00.955 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
postgres_1   | 2020-08-20 06:33:00.955 UTC [1] LOG:  listening on IPv6 address "::", port 5432
postgres_1   | 2020-08-20 06:33:00.970 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres_1   | 2020-08-20 06:33:01.019 UTC [25] LOG:  database system was interrupted; last known up at 2020-08-20 06:10:04 UTC
postgres_1   | 2020-08-20 06:33:01.167 UTC [26] FATAL:  the database system is starting up
invidious_1  | Unhandled exception: (no message) (DB::ConnectionRefused)
postgres_1   | 2020-08-20 06:33:01.203 UTC [25] LOG:  database system was not properly shut down; automatic recovery in progress
postgres_1   | 2020-08-20 06:33:01.219 UTC [25] LOG:  redo starts at 0/2F2ACC0
postgres_1   | 2020-08-20 06:33:01.439 UTC [25] LOG:  invalid record length at 0/461A548: wanted 24, got 0
postgres_1   | 2020-08-20 06:33:01.439 UTC [25] LOG:  redo done at 0/461A520
postgres_1   | 2020-08-20 06:33:01.439 UTC [25] LOG:  last completed transaction was at log time 2020-08-20 06:12:15.316697+00
postgres_1   | 2020-08-20 06:33:01.732 UTC [1] LOG:  database system is ready to accept connections
invidious_1  |   from lib/pg/src/pg/connection.cr:16:9 in 'initialize'
invidious_1  |   from lib/pg/src/pg/connection.cr:7:5 in 'new'
invidious_1  |   from lib/pg/src/pg/driver.cr:3:5 in 'build_connection'
invidious_1  |   from lib/db/src/db/database.cr:57:16 in '->'
invidious_1  |   from ../usr/share/crystal/src/primitives.cr:255:3 in 'build_resource'
invidious_1  |   from lib/db/src/db/pool.cr:45:34 in 'initialize'
invidious_1  |   from lib/db/src/db/pool.cr:38:5 in 'new:initial_pool_size:max_pool_size:max_idle_pool_size:checkout_timeout:retry_attempts:retry_delay'
invidious_1  |   from lib/db/src/db/database.cr:56:15 in 'initialize'
invidious_1  |   from lib/db/src/db/database.cr:49:5 in 'new'
invidious_1  |   from lib/db/src/db.cr:152:5 in 'build_database'
invidious_1  |   from lib/db/src/db.cr:116:5 in 'open'
invidious_1  |   from ../usr/share/crystal/src/primitives.cr:255:3 in 'once'
invidious_1  |   from ../usr/share/crystal/src/crystal/once.cr:50:3 in '__crystal_once'
invidious_1  |   from src/invidious.cr:46:1 in '__crystal_main'
invidious_1  |   from ../usr/share/crystal/src/crystal/main.cr:105:5 in 'main_user_code'
invidious_1  |   from ../usr/share/crystal/src/crystal/main.cr:91:7 in 'main'
invidious_1  |   from ../usr/share/crystal/src/crystal/main.cr:114:3 in 'main'
invidious_1  |   from src/env/__libc_start_main.c:94:2 in 'libc_start_main_stage2'
invidious_1  | [development] Kemal is ready to lead at http://0.0.0.0:3000
postgres_1   | 2020-08-20 06:33:30.298 UTC [44] FATAL:  role "postgres" does not exist

e: second try, this time i also remove postgres image and invidious volume. i think it is working

log output

➜  invidious git:(master) sudo docker volume rm invidious_postgresdata
# 
➜  invidious git:(master) sudo docker-compose build
postgres uses an image, skipping
Building invidious
Step 1/20 : FROM crystallang/crystal:0.35.1-alpine AS builder
 ---> 6a09b54a6eb8
Step 2/20 : RUN apk add --no-cache curl sqlite-static
 ---> Using cache
 ---> 0e110ef71c91
Step 3/20 : WORKDIR /invidious
 ---> Using cache
 ---> d7671aa77bf3
Step 4/20 : COPY ./shard.yml ./shard.yml
 ---> Using cache
 ---> 917477789940
Step 5/20 : RUN shards update && shards install &&     curl -Lo ./lib/lsquic/src/lsquic/ext/liblsquic.a https://omar.yt/lsquic/liblsquic-v2.18.1.a
 ---> Using cache
 ---> 6e05e03cdf85
Step 6/20 : COPY ./src/ ./src/
 ---> Using cache
 ---> 1ac36d33900a
Step 7/20 : COPY ./.git/ ./.git/
 ---> Using cache
 ---> 1b0e2437a9d7
Step 8/20 : RUN crystal build ./src/invidious.cr     --static --warnings all     --link-flags "-lxml2 -llzma"
 ---> Using cache
 ---> a6b370f74bfb
Step 9/20 : FROM alpine:latest
 ---> a24bb4013296
Step 10/20 : RUN apk add --no-cache librsvg ttf-opensans
 ---> Running in 027e96e73e97
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
(1/40) Installing libxau (1.0.9-r0)
(2/40) Installing libbsd (0.10.0-r0)
(3/40) Installing libxdmcp (1.1.3-r0)
(4/40) Installing libxcb (1.14-r1)
(5/40) Installing libx11 (1.6.11-r0)
(6/40) Installing libxext (1.3.4-r0)
(7/40) Installing libxrender (0.9.10-r3)
(8/40) Installing expat (2.2.9-r1)
(9/40) Installing brotli-libs (1.0.7-r5)
(10/40) Installing libbz2 (1.0.8-r1)
(11/40) Installing libpng (1.6.37-r1)
(12/40) Installing freetype (2.10.2-r0)
(13/40) Installing libuuid (2.35.2-r0)
(14/40) Installing fontconfig (2.13.1-r2)
(15/40) Installing pixman (0.40.0-r2)
(16/40) Installing cairo (1.16.0-r2)
(17/40) Installing libffi (3.3-r2)
(18/40) Installing libintl (0.20.2-r0)
(19/40) Installing libblkid (2.35.2-r0)
(20/40) Installing libmount (2.35.2-r0)
(21/40) Installing pcre (8.44-r0)
(22/40) Installing glib (2.64.4-r0)
(23/40) Installing cairo-gobject (1.16.0-r2)
(24/40) Installing libgcc (9.3.0-r2)
(25/40) Installing pkgconf (1.7.2-r0)
(26/40) Installing xz-libs (5.2.5-r0)
(27/40) Installing libxml2 (2.9.10-r4)
(28/40) Installing shared-mime-info (1.15-r0)
(29/40) Installing libjpeg-turbo (2.0.5-r0)
(30/40) Installing tiff (4.1.0-r0)
(31/40) Installing gdk-pixbuf (2.40.0-r2)
(32/40) Installing libxft (2.3.3-r0)
(33/40) Installing fribidi (1.0.9-r0)
(34/40) Installing graphite2 (1.3.14-r0)
(35/40) Installing harfbuzz (2.6.6-r0)
(36/40) Installing pango (1.44.7-r2)
(37/40) Installing librsvg (2.48.8-r0)
(38/40) Installing libfontenc (1.1.4-r0)
(39/40) Installing mkfontscale (1.2.1-r1)
(40/40) Installing ttf-opensans (1.10-r0)
Executing ttf-opensans-1.10-r0.post-install
Executing busybox-1.31.1-r16.trigger
Executing fontconfig-2.13.1-r2.trigger
Executing shared-mime-info-1.15-r0.trigger
Executing gdk-pixbuf-2.40.0-r2.trigger
Executing mkfontscale-1.2.1-r1.trigger
OK: 38 MiB in 54 packages
Removing intermediate container 027e96e73e97
 ---> ffa238db95ff
Step 11/20 : WORKDIR /invidious
 ---> Running in 4bc4b3309777
Removing intermediate container 4bc4b3309777
 ---> c85290fd8702
Step 12/20 : RUN addgroup -g 1000 -S invidious &&     adduser -u 1000 -S invidious -G invidious
 ---> Running in a7022f44065f
Removing intermediate container a7022f44065f
 ---> edaaeceaf1dc
Step 13/20 : COPY ./assets/ ./assets/
 ---> b096f6fd88e2
Step 14/20 : COPY --chown=invidious ./config/config.yml ./config/config.yml
 ---> d24aa2ce5043
Step 15/20 : RUN sed -i 's/host: \(127.0.0.1\|localhost\)/host: postgres/' config/config.yml
 ---> Running in d06e0ba255f7
Removing intermediate container d06e0ba255f7
 ---> 49b57263a5b7
Step 16/20 : COPY ./config/sql/ ./config/sql/
 ---> ee500259df84
Step 17/20 : COPY ./locales/ ./locales/
 ---> 2df9931016c2
Step 18/20 : COPY --from=builder /invidious/invidious .
 ---> 2e4a2ed923f8
Step 19/20 : USER invidious
 ---> Running in 8928ab125c7a
Removing intermediate container 8928ab125c7a
 ---> f781dbc66c1f
Step 20/20 : CMD [ "/invidious/invidious" ]
 ---> Running in c11916aaa0fa
Removing intermediate container c11916aaa0fa
 ---> 357a6aa3d31f
Successfully built 357a6aa3d31f
Successfully tagged invidious_invidious:latest
➜  invidious git:(master) sudo docker image ls
REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
invidious_invidious   latest              357a6aa3d31f        2 minutes ago       73.9MB
<none>                <none>              a6b370f74bfb        6 minutes ago       429MB
crystallang/crystal   0.35.1-alpine       6a09b54a6eb8        2 months ago        277MB
redis                 6.0.4-alpine        e008f2ff99d0        2 months ago        31.5MB
alpine                latest              a24bb4013296        2 months ago        5.57MB
➜  invidious git:(master) sudo docker-compose up
Creating volume "invidious_postgresdata" with default driver
Pulling postgres (postgres:10)...
10: Pulling from library/postgres
75cb2ebf3b3c: Pull complete
3ca6415d2bca: Pull complete
ac08e6372a7b: Pull complete
b4394fce95ce: Pull complete
6edcd5da08e3: Pull complete
3380dcb7db08: Pull complete
c7c147d9c90d: Pull complete
08ae47fef758: Pull complete
600fb961b7b5: Pull complete
370a6d5f1feb: Pull complete
5ea1202ea159: Pull complete
7eb7385d875e: Pull complete
9635213da414: Pull complete
eb56cef8815a: Pull complete
Digest: sha256:c6ab4b573c34f449cb85ef385db5f152f907951bce9f359502ec0c46273cd865
Status: Downloaded newer image for postgres:10
Creating invidious_postgres_1 ... done
Creating invidious_invidious_1 ... done
Attaching to invidious_postgres_1, invidious_invidious_1
postgres_1   | The files belonging to this database system will be owned by user "postgres".
postgres_1   | This user must also own the server process.
postgres_1   |
postgres_1   | The database cluster will be initialized with locale "en_US.utf8".
postgres_1   | The default database encoding has accordingly been set to "UTF8".
postgres_1   | The default text search configuration will be set to "english".
postgres_1   |
postgres_1   | Data page checksums are disabled.
postgres_1   |
postgres_1   | fixing permissions on existing directory /var/lib/postgresql/data ... ok
postgres_1   | creating subdirectories ... ok
postgres_1   | selecting default max_connections ... 100
postgres_1   | selecting default shared_buffers ... 128MB
postgres_1   | selecting default timezone ... Etc/UTC
postgres_1   | selecting dynamic shared memory implementation ... posix
postgres_1   | creating configuration files ... ok
postgres_1   | running bootstrap script ... ok
postgres_1   | performing post-bootstrap initialization ... ok
invidious_1  | Unhandled exception: (no message) (DB::ConnectionRefused)
postgres_1   | syncing data to disk ... ok
postgres_1   |
postgres_1   | Success. You can now start the database server using:
postgres_1   |
postgres_1   |     pg_ctl -D /var/lib/postgresql/data -l logfile start
postgres_1   |
postgres_1   |
postgres_1   | WARNING: enabling "trust" authentication for local connections
postgres_1   | You can change this by editing pg_hba.conf or using the option -A, or
postgres_1   | --auth-local and --auth-host, the next time you run initdb.
postgres_1   | waiting for server to start....2020-08-20 07:12:06.098 UTC [46] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres_1   | 2020-08-20 07:12:06.116 UTC [47] LOG:  database system was shut down at 2020-08-20 07:12:05 UTC
postgres_1   | 2020-08-20 07:12:06.124 UTC [46] LOG:  database system is ready to accept connections
postgres_1   |  done
postgres_1   | server started
invidious_1  |   from lib/pg/src/pg/connection.cr:16:9 in 'initialize'
invidious_1  |   from lib/pg/src/pg/connection.cr:7:5 in 'new'
invidious_1  |   from lib/pg/src/pg/driver.cr:3:5 in 'build_connection'
invidious_1  |   from lib/db/src/db/database.cr:57:16 in '->'
invidious_1  |   from ../usr/share/crystal/src/primitives.cr:255:3 in 'build_resource'
invidious_1  |   from lib/db/src/db/pool.cr:45:34 in 'initialize'
invidious_1  |   from lib/db/src/db/pool.cr:38:5 in 'new:initial_pool_size:max_pool_size:max_idle_pool_size:checkout_timeout:retry_attempts:retry_delay'
invidious_1  |   from lib/db/src/db/database.cr:56:15 in 'initialize'
invidious_1  |   from lib/db/src/db/database.cr:49:5 in 'new'
invidious_1  |   from lib/db/src/db.cr:152:5 in 'build_database'
invidious_1  |   from lib/db/src/db.cr:116:5 in 'open'
invidious_1  |   from ../usr/share/crystal/src/primitives.cr:255:3 in 'once'
invidious_1  |   from ../usr/share/crystal/src/crystal/once.cr:50:3 in '__crystal_once'
invidious_1  |   from src/invidious.cr:46:1 in '__crystal_main'
invidious_1  |   from ../usr/share/crystal/src/crystal/main.cr:105:5 in 'main_user_code'
invidious_1  |   from ../usr/share/crystal/src/crystal/main.cr:91:7 in 'main'
invidious_1  |   from ../usr/share/crystal/src/crystal/main.cr:114:3 in 'main'
invidious_1  |   from src/env/__libc_start_main.c:94:2 in 'libc_start_main_stage2'
postgres_1   | CREATE DATABASE
postgres_1   |
postgres_1   |
postgres_1   | /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/init-invidious-db.sh
postgres_1   | CREATE ROLE
postgres_1   | CREATE TABLE
postgres_1   | GRANT
postgres_1   | CREATE INDEX
postgres_1   | CREATE TABLE
postgres_1   | GRANT
postgres_1   | CREATE INDEX
postgres_1   | CREATE TABLE
postgres_1   | GRANT
postgres_1   | CREATE INDEX
postgres_1   | CREATE TABLE
postgres_1   | GRANT
postgres_1   | CREATE INDEX
postgres_1   | CREATE TABLE
postgres_1   | GRANT
postgres_1   | CREATE INDEX
postgres_1   | CREATE TABLE
postgres_1   | GRANT
postgres_1   | CREATE INDEX
postgres_1   | CREATE TABLE
postgres_1   | GRANT
postgres_1   | CREATE TYPE
postgres_1   | CREATE TABLE
postgres_1   | GRANT
postgres_1   | CREATE TABLE
postgres_1   | GRANT
postgres_1   |
postgres_1   | 2020-08-20 07:12:07.591 UTC [46] LOG:  received fast shutdown request
postgres_1   | waiting for server to shut down....2020-08-20 07:12:07.593 UTC [46] LOG:  aborting any active transactions
postgres_1   | 2020-08-20 07:12:07.597 UTC [46] LOG:  worker process: logical replication launcher (PID 53) exited with exit code 1
postgres_1   | 2020-08-20 07:12:07.597 UTC [48] LOG:  shutting down
postgres_1   | 2020-08-20 07:12:07.671 UTC [46] LOG:  database system is shut down
invidious_1  | Unhandled exception: (no message) (DB::ConnectionRefused)
postgres_1   |  done
postgres_1   | server stopped
postgres_1   |
postgres_1   | PostgreSQL init process complete; ready for start up.
postgres_1   |
postgres_1   | 2020-08-20 07:12:07.718 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
postgres_1   | 2020-08-20 07:12:07.718 UTC [1] LOG:  listening on IPv6 address "::", port 5432
postgres_1   | 2020-08-20 07:12:07.723 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres_1   | 2020-08-20 07:12:07.740 UTC [155] LOG:  database system was shut down at 2020-08-20 07:12:07 UTC
postgres_1   | 2020-08-20 07:12:07.749 UTC [1] LOG:  database system is ready to accept connections
invidious_1  |   from lib/pg/src/pg/connection.cr:16:9 in 'initialize'
invidious_1  |   from lib/pg/src/pg/connection.cr:7:5 in 'new'
invidious_1  |   from lib/pg/src/pg/driver.cr:3:5 in 'build_connection'
invidious_1  |   from lib/db/src/db/database.cr:57:16 in '->'
invidious_1  |   from ../usr/share/crystal/src/primitives.cr:255:3 in 'build_resource'
invidious_1  |   from lib/db/src/db/pool.cr:45:34 in 'initialize'
invidious_1  |   from lib/db/src/db/pool.cr:38:5 in 'new:initial_pool_size:max_pool_size:max_idle_pool_size:checkout_timeout:retry_attempts:retry_delay'
invidious_1  |   from lib/db/src/db/database.cr:56:15 in 'initialize'
invidious_1  |   from lib/db/src/db/database.cr:49:5 in 'new'
invidious_1  |   from lib/db/src/db.cr:152:5 in 'build_database'
invidious_1  |   from lib/db/src/db.cr:116:5 in 'open'
invidious_1  |   from ../usr/share/crystal/src/primitives.cr:255:3 in 'once'
invidious_1  |   from ../usr/share/crystal/src/crystal/once.cr:50:3 in '__crystal_once'
invidious_1  |   from src/invidious.cr:46:1 in '__crystal_main'
invidious_1  |   from ../usr/share/crystal/src/crystal/main.cr:105:5 in 'main_user_code'
invidious_1  |   from ../usr/share/crystal/src/crystal/main.cr:91:7 in 'main'
invidious_1  |   from ../usr/share/crystal/src/crystal/main.cr:114:3 in 'main'
invidious_1  |   from src/env/__libc_start_main.c:94:2 in 'libc_start_main_stage2'
invidious_invidious_1 exited with code 1
invidious_1  | [development] Kemal is ready to lead at http://0.0.0.0:3000
invidious_1  | 2020-08-20 07:13:06 UTC 200 GET / 1.58ms
invidious_1  | 2020-08-20 07:13:07 UTC 200 GET /css/pure-min.css?v=3f97beb 4.2ms
invidious_1  | 2020-08-20 07:13:07 UTC 200 GET /css/ionicons.min.css?v=3f97beb 2.02ms
invidious_1  | 2020-08-20 07:13:07 UTC 200 GET /css/grids-responsive-min.css?v=3f97beb 971.85µs
invidious_1  | 2020-08-20 07:13:07 UTC 200 GET /css/default.css?v=3f97beb 736.81µs
invidious_1  | 2020-08-20 07:13:07 UTC 200 GET /css/lighttheme.css?v=3f97beb 1.08ms
invidious_1  | 2020-08-20 07:13:07 UTC 200 GET /css/darktheme.css?v=3f97beb 385.51µs
invidious_1  | 2020-08-20 07:13:07 UTC 200 GET /apple-touch-icon.png?v=3f97beb 531.03µs
invidious_1  | 2020-08-20 07:13:07 UTC 200 GET /favicon-16x16.png?v=3f97beb 441.23µs
invidious_1  | 2020-08-20 07:13:53 UTC 200 GET /search?q=youtube-query 836.36ms
invidious_1  | 2020-08-20 07:13:54 UTC 200 GET /vi/video-id/mqdefault.jpg 71.42ms

This is actually a bug.

Solution was as resttime said. But remember to remove the old postgres db container and image before build the new one with

$ docker-compose up --build
Was this page helpful?
0 / 5 - 0 ratings

Related issues

linuxgirl22 picture linuxgirl22  Â·  4Comments

PureTryOut picture PureTryOut  Â·  3Comments

Jtasiu picture Jtasiu  Â·  3Comments

kozross picture kozross  Â·  3Comments

SebKranz picture SebKranz  Â·  3Comments