pentacent / keila

Open Source Newsletter Tool.
https://keila.io
GNU Affero General Public License v3.0
1.26k stars 61 forks source link

"Internal Server Error" #212

Closed Turney1337 closed 1 year ago

Turney1337 commented 1 year ago

Trying to set up Keila via Docker Compose (via Portainer), I can't get past an "Internal Server Error" trying to access the webUI.

compose file:

version: "3"

services:
  keila:
    image: pentacent/keila:latest
    container_name: keila-web
    restart: unless-stopped
    ports:
      - 4000:4000
    depends_on:
      - postgres
    build:
      context: ../
      dockerfile: ops/Dockerfile
    environment:
      - SECRET_KEY_BASE=password
      - DB_URL=postgres://postgres:postgres@postgres/postgres
      - URL_HOST=192.168.100.25
      - URL_PORT=4000
      - MAILER_SMTP_HOST=smtp.mail.de
      - MAILER_SMTP_PORT=465
      - MAILER_SMTP_USER=mail@mail.com
      - MAILER_SMTP_PASSWORD=smtppassword

  postgres:
    image: postgres:alpine
    container_name: keila-db
    restart: unless-stopped
    ports:
      - 5432:5432
    environment:
      POSTGRES_PASSWORD: postgres

Container logs:

08:28:57.140 [info] create index tracking_links_url_campaign_id_index
08:28:57.142 [info] create table tracking_clicks
08:28:57.149 [info] == Migrated 20210625202500 in 0.0s
08:28:57.152 [info] == Running 20210630205000 PreluApi.Repo.Migrations.SubscriptionUpserts.up/0 forward
08:28:57.152 [info] alter table billing_subscriptions
08:28:57.154 [info] == Migrated 20210630205000 in 0.0s
08:28:57.158 [info] == Running 20210722042200 Keila.Repo.Migrations.AddContactSoftDelete.change/0 forward
08:28:57.158 [info] alter table contacts
08:28:57.159 [info] create table contacts_events
08:28:57.167 [info] create index contacts_events_contact_id_index
08:28:57.170 [info] == Migrated 20210722042200 in 0.0s
08:28:57.173 [info] == Running 20210809112000 Keila.Repo.Migrations.AddRecipeintReceipt.change/0 forward
08:28:57.173 [info] alter table mailings_recipients
08:28:57.174 [info] == Migrated 20210809112000 in 0.0s
08:28:57.176 [info] == Running 20210816142200 Keila.Repo.Migrations.DefaultContactStatus.change/0 forward
08:28:57.176 [info] alter table contacts
08:28:57.178 [info] == Migrated 20210816142200 in 0.0s
08:28:57.181 [info] == Running 20211101230000 Keila.Repo.Migrations.AddContactCustomData.change/0 forward
08:28:57.181 [info] alter table contacts
08:28:57.182 [info] == Migrated 20211101230000 in 0.0s
08:28:57.184 [info] == Running 20211116040700 Keila.Repo.Migrations.Segments.change/0 forward
08:28:57.184 [info] create table contacts_segments
08:28:57.192 [info] alter table mailings_campaigns
08:28:57.195 [info] == Migrated 20211116040700 in 0.0s
08:28:57.198 [info] == Running 20220114154000 Keila.Repo.Migrations.AddCampaignCustomData.change/0 forward
08:28:57.198 [info] alter table mailings_campaigns
08:28:57.199 [info] create check constraint max_data_size on table mailings_campaigns
08:28:57.200 [info] create check constraint max_data_size on table contacts
08:28:57.201 [info] == Migrated 20220114154000 in 0.0s
08:28:57.203 [info] == Running 20220324085800 Keila.Repo.Migrations.AddUserLocale.change/0 forward
08:28:57.203 [info] alter table users
08:28:57.204 [info] == Migrated 20220324085800 in 0.0s
08:28:57.206 [info] == Running 20220523235000 Keila.Repo.Migrations.AddFiles.change/0 forward
08:28:57.206 [info] create table files
08:28:57.215 [info] == Migrated 20220523235000 in 0.0s
08:28:57.217 [info] == Running 20220825151500 Keila.Repo.Migrations.UpgradeObanJobsToV11.up/0 forward
08:28:57.218 [info] == Migrated 20220825151500 in 0.0s
08:28:57.221 [info] == Running 20220905125000 Keila.Repo.Migrations.EmailsToCitext.up/0 forward
08:28:57.221 [info] execute "CREATE EXTENSION IF NOT EXISTS citext"
08:28:57.247 [info] alter table users
08:28:57.253 [info] alter table contacts
08:28:57.257 [info] == Migrated 20220905125000 in 0.0s
08:28:57.262 [info] == Running 20221227145500 Keila.Repo.Migrations.AddRecipientStates.change/0 forward
08:28:57.262 [info] alter table mailings_recipients
08:28:57.264 [info] alter table contacts_events
08:28:57.267 [info] == Migrated 20221227145500 in 0.0s
08:28:57.270 [info] == Running 20230104115500 Keila.Repo.Migrations.AddRecipientFailedAt.change/0 forward
08:28:57.270 [info] alter table mailings_recipients
08:28:57.271 [info] == Migrated 20230104115500 in 0.0s
08:28:57.274 [info] == Running 20230111222000 Keila.Repo.Migrations.AddCampaignJsonBody.change/0 forward
08:28:57.274 [info] alter table mailings_campaigns
08:28:57.275 [info] == Migrated 20230111222000 in 0.0s
08:28:57.277 [info] == Running 20230120223000 Keila.Repo.Migrations.AddSegmentDefaultFilter.change/0 forward
08:28:57.279 [info] == Migrated 20230120223000 in 0.0s
08:28:57.281 [info] == Running 20230308111500 Keila.Repo.Migrations.AddCampaignPreviewText.change/0 forward
08:28:57.281 [info] alter table mailings_campaigns
08:28:57.282 [info] == Migrated 20230308111500 in 0.0s
08:28:57.284 [info] == Running 20230324104000 Keila.Repo.Migrations.MigrateToHybridTemplateStyles.up/0 forward
08:28:57.285 [info] == Migrated 20230324104000 in 0.0s
08:28:57.312 [warning] KEILA_USER not set. Creating root user with email: root@localhost
08:28:57.313 [warning] KEILA_PASSWORD not set. Setting random root user password: j8vHD1yo3b__dSCDqmkqvp5p1J4IXPN0
08:28:58.042 [info] Created root user with root@localhost
08:28:58.055 [info] Running KeilaWeb.Endpoint with cowboy 2.9.0 at 0.0.0.0:4000 (http)
08:28:58.056 [info] Access KeilaWeb.Endpoint at http://192.168.100.25:4000
08:28:59.404 [info] tzdata release in place is from a file last modified Fri, 22 Oct 2021 02:20:47 GMT. Release file on server was last modified Tue, 28 Mar 2023 20:25:39 GMT.
08:29:01.192 [info] Tzdata has updated the release from 2021e to 2023c
08:32:11.860 request_id=F1-Sj8YPTJuQNAcAAAWi [info] GET /
08:32:11.860 request_id=F1-Sj8YPTJuQNAcAAAWi [info] Sent 302 in 237µs
08:32:11.894 request_id=F1-Sj8gNdcdCXdYAAAXC [info] GET /auth/login
08:32:11.894 request_id=F1-Sj8gNdcdCXdYAAAXC [info] Sent 500 in 642µs
08:32:11.895 [error] #PID<0.2870.0> running KeilaWeb.Endpoint (connection #PID<0.2868.0>, stream id 2) terminated
Server: 192.168.100.25:4000 (http)
Request: GET /auth/login
** (exit) an exception was raised:
    ** (ArgumentError) cookie store expects conn.secret_key_base to be at least 64 bytes
        (plug 1.13.6) lib/plug/session/cookie.ex:185: Plug.Session.COOKIE.validate_secret_key_base/1
        (plug 1.13.6) lib/plug/session/cookie.ex:177: Plug.Session.COOKIE.derive/3
        (plug 1.13.6) lib/plug/session/cookie.ex:96: Plug.Session.COOKIE.put/4
        (plug 1.13.6) lib/plug/session.ex:96: anonymous fn/3 in Plug.Session.before_send/2
        (elixir 1.14.4) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
        (plug 1.13.6) lib/plug/conn.ex:1690: Plug.Conn.run_before_send/2
        (plug 1.13.6) lib/plug/conn.ex:399: Plug.Conn.send_resp/1
        (keila 0.12.2) lib/keila_web/controllers/auth_controller.ex:1: KeilaWeb.AuthController.action/2
09:37:53.413 request_id=F1-WJXzlrIOm3xgAAAXi [info] GET /
09:37:53.413 request_id=F1-WJXzlrIOm3xgAAAXi [info] Sent 302 in 191µs
09:37:53.428 request_id=F1-WJX3QM5MQcscAAAYC [info] GET /auth/login
09:37:53.429 request_id=F1-WJX3QM5MQcscAAAYC [info] Sent 500 in 548µs
09:37:53.429 [error] #PID<0.2972.0> running KeilaWeb.Endpoint (connection #PID<0.2970.0>, stream id 2) terminated
Server: 192.168.100.25:4000 (http)
Request: GET /auth/login
** (exit) an exception was raised:
    ** (ArgumentError) cookie store expects conn.secret_key_base to be at least 64 bytes
        (plug 1.13.6) lib/plug/session/cookie.ex:185: Plug.Session.COOKIE.validate_secret_key_base/1
        (plug 1.13.6) lib/plug/session/cookie.ex:177: Plug.Session.COOKIE.derive/3
        (plug 1.13.6) lib/plug/session/cookie.ex:96: Plug.Session.COOKIE.put/4
        (plug 1.13.6) lib/plug/session.ex:96: anonymous fn/3 in Plug.Session.before_send/2
        (elixir 1.14.4) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
        (plug 1.13.6) lib/plug/conn.ex:1690: Plug.Conn.run_before_send/2
        (plug 1.13.6) lib/plug/conn.ex:399: Plug.Conn.send_resp/1
        (keila 0.12.2) lib/keila_web/controllers/auth_controller.ex:1: KeilaWeb.AuthController.action/2

Where am I going wrong?

wmnnd commented 1 year ago

Like the error message says, SECRET_KEY_BASE needs to be least 64 bytes. You can generate them like this: head -c 48 /dev/urandom | base64