hedgedoc / container

HedgeDoc container image resources
https://docs.hedgedoc.org/setup/docker/
196 stars 52 forks source link

Can't Login After CodiMd Upgrade #427

Closed fredfortier closed 1 year ago

fredfortier commented 1 year ago

I've upgraded from CodiMd docker container following official docs. Basically, pg_dump codimd role/db and restore as hedgedocs.

services:
  database:
    image: postgres:13.4-alpine
    environment:
      - POSTGRES_USER=hedgedoc
      - POSTGRES_PASSWORD=censored
      - POSTGRES_DB=hedgedoc
    volumes:
      - database-data:/var/lib/postgresql/data
    restart: always
  hedgedoc:
    # Make sure to use the latest release from https://hedgedoc.org/latest-release
    image: quay.io/hedgedoc/hedgedoc:1.9.7
    environment:
      - CMD_ALLOW_ANONYMOUS=true
      - CMD_ALLOW_EMAIL_REGISTER=true
      - CMD_EMAIL=true
      # freely, editable, limited, locked, protected or private
      - CMD_DEFAULT_PERMISSION=limited
      - CMD_PROTOCOL_USESSL=true
      - CMD_DOMAIN=md.myorg.io
      - CMD_URL_ADDPORT=false
      - CMD_IMAGE_UPLOAD_TYPE=filesystem
      - CMD_PORT=3010
      - CMD_USECDN=false

      - CMD_DB_URL=postgres://hedgedoc:censored@database:5432/hedgedoc
      - DEBUG=true
    volumes:
      - upload-data:/hedgedoc/public/uploads
    ports:
      - "3010:3010"
    restart: always
    depends_on:
      - database
volumes:
  database-data:
  upload-data:

The nginx reverse proxy is the same. The SSL handshake seems to work just fine, and the HedgeDoc page renders. However, nothing happens when I click sign-in. I figured it may have been old session data, so I truncated the Sessions table, but to no avail.

The logs look clean for the most part. It's definitely connecting to the db, and I don't get any obvious broken relations. However, there is something that looks like an error in the logs during my login attempts.

hedgedoc_1  | 2023-05-09T18:21:06.957Z info:    Executing (default): SELECT "sid", "expires", "data", "createdAt", "updatedAt" FROM "Sessions" AS "Session" WHERE "Session"."sid" = 'CN4n3SFt0nBS-H1GE3iUHo5JIj4TGC6X';
hedgedoc_1  | 2023-05-09T18:21:06.963Z info:    Executing (default): INSERT INTO "Sessions" ("sid","expires","data","createdAt","updatedAt") VALUES ($1,$2,$3,$4,$5) RETURNING *;
hedgedoc_1  | 2023-05-09T18:21:06.966Z info:    98.210.121.45 - - [09/May/2023:18:21:06 +0000] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
hedgedoc_1  |
hedgedoc_1  | var __line = 1
hedgedoc_1  |   , __lines = "window.domain = '<%- domain %>'\nwindow.urlpath = '<%- urlpath %>'\nwindow.debug = <%- debug %>\nwindow.version = '<%- version %>'\n\nwindow.allowedUploadMimeTypes = <%- JSON.stringify(allowedUploadMimeTypes) %>\n\nwindow.linkifyHeaderStyle = '<%- linkifyHeaderStyle %>'\n\nwindow.DROPBOX_APP_KEY = '<%- DROPBOX_APP_KEY %>'\n\nwindow.cookiePolicy = '<%- cookiePolicy %>'\n"
hedgedoc_1  |   , __filename = "/hedgedoc/public/js/lib/common/constant.ejs";
hedgedoc_1  | try {
hedgedoc_1  |   var __output = "";
hedgedoc_1  |   function __append(s) { if (s !== undefined && s !== null) __output += s }
hedgedoc_1  |   with (locals || {}) {
hedgedoc_1  |     ; __append("window.domain = '")
hedgedoc_1  |     ; __append( domain )
hedgedoc_1  |     ; __append("'\nwindow.urlpath = '")
hedgedoc_1  |     ; __line = 2
hedgedoc_1  |     ; __append( urlpath )
hedgedoc_1  |     ; __append("'\nwindow.debug = ")
hedgedoc_1  |     ; __line = 3
hedgedoc_1  |     ; __append( debug )
hedgedoc_1  |     ; __append("\nwindow.version = '")
hedgedoc_1  |     ; __line = 4
hedgedoc_1  |     ; __append( version )
hedgedoc_1  |     ; __append("'\n\nwindow.allowedUploadMimeTypes = ")
hedgedoc_1  |     ; __line = 6
hedgedoc_1  |     ; __append( JSON.stringify(allowedUploadMimeTypes) )
hedgedoc_1  |     ; __append("\n\nwindow.linkifyHeaderStyle = '")
hedgedoc_1  |     ; __line = 8
hedgedoc_1  |     ; __append( linkifyHeaderStyle )
hedgedoc_1  |     ; __append("'\n\nwindow.DROPBOX_APP_KEY = '")
hedgedoc_1  |     ; __line = 10
hedgedoc_1  |     ; __append( DROPBOX_APP_KEY )
hedgedoc_1  |     ; __append("'\n\nwindow.cookiePolicy = '")
hedgedoc_1  |     ; __line = 12
hedgedoc_1  |     ; __append( cookiePolicy )
hedgedoc_1  |     ; __append("'\n")
hedgedoc_1  |     ; __line = 13
hedgedoc_1  |   }
hedgedoc_1  |   return __output;
hedgedoc_1  | } catch (e) {
hedgedoc_1  |   rethrow(e, __lines, __filename, __line, escapeFn);
hedgedoc_1  | }
hedgedoc_1  |
hedgedoc_1  | 2023-05-09T18:21:07.272Z info:    Executing (default): SELECT "sid", "expires", "data", "createdAt", "updatedAt" FROM "Sessions" AS "Session" WHERE "Session"."sid" = '8dF4_ptcev-1kJqEWVfBvDNniqXrVHzq';
hedgedoc_1  | 2023-05-09T18:21:07.277Z info:    Executing (default): INSERT INTO "Sessions" ("sid","expires","data","createdAt","updatedAt") VALUES ($1,$2,$3,$4,$5) RETURNING *;
hedgedoc_1  | 2023-05-09T18:21:07.279Z info:    98.210.121.45 - - [09/May/2023:18:21:07 +0000] "GET /config HTTP/1.1" 304 - "https://md.derivadex.io/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
hedgedoc_1  |
hedgedoc_1  | 2023-05-09T18:21:07.496Z info:    Executing (default): SELECT "sid", "expires", "data", "createdAt", "updatedAt" FROM "Sessions" AS "Session" WHERE "Session"."sid" = 'jRjjOGwTBRrmhcxekkw63TrbNlTAw3jE';
hedgedoc_1  | 2023-05-09T18:21:07.500Z info:    Executing (default): INSERT INTO "Sessions" ("sid","expires","data","createdAt","updatedAt") VALUES ($1,$2,$3,$4,$5) RETURNING *;
hedgedoc_1  | 2023-05-09T18:21:07.502Z info:    98.210.121.45 - - [09/May/2023:18:21:07 +0000] "GET /me HTTP/1.1" 304 - "https://md.derivadex.io/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"

Any idea? I apologize in advance if this has already been answered.

fredfortier commented 1 year ago

I figured it out. It turns out the old reverse proxy settings must be refreshed: https://docs.hedgedoc.org/guides/reverse-proxy/