watzon / paste69

Simple CURL-able pastebin
https://0x45.st
MIT License
11 stars 2 forks source link

issues with sqlite driver on the docker image #1

Open etra0 opened 5 months ago

etra0 commented 5 months ago

Hello, I'm trying to use the docker image (with docker-compose) to run the project, when I start it I get the following message:

pastebin_1  | stty: 'standard input': Inappropriate ioctl for device
pastebin_1  | stty: 'standard input': Inappropriate ioctl for device
pastebin_1  |
pastebin_1  | In db.cr line 101:
pastebin_1  |
pastebin_1  |   no driver was registered for the schema "sqlite", did you maybe forget to r
pastebin_1  |   equire the database driver?
pastebin_1  |
pastebin_1  |
pastebin_1  | prune
pastebin_1  |
pastebin_1  | 2024-06-08T21:23:05.921285Z   INFO - athena.framework: Server has started and is listening at http://0.0.0.0:4633

And it starts correctly, but as soon as I try to use it, the sqlite error bites back:

pastebin_1  | 2024-06-08T21:23:10.626409Z   INFO - athena.framework: Matched route 'paste69_home_controller_index' -- route: "paste69_home_controller_index", route_parameters: {"_route" => "paste69_home_controller_index", "_controller" => "Paste69::HomeController#index"}, request_uri: "/", method: "GET"
pastebin_1  | 2024-06-08T21:24:35.379922Z   INFO - athena.framework: Matched route 'paste69_home_controller_index' -- route: "paste69_home_controller_index", route_parameters: {"_route" => "paste69_home_controller_index", "_controller" => "Paste69::HomeController#index"}, request_uri: "/", method: "GET"
pastebin_1  | 2024-06-08T21:24:52.100878Z   INFO - athena.framework: Matched route 'paste69_paste_controller_create_paste' -- route: "paste69_paste_controller_create_paste", route_parameters: {"_route" => "paste69_paste_controller_create_paste", "_controller" => "Paste69::PasteController#create_paste"}, request_uri: "/", method: "POST"
pastebin_1  | 2024-06-08T21:24:52.363819Z  ERROR - athena.framework: Uncaught exception #<ArgumentError:no driver was registered for the schema "sqlite", did you maybe forget to require the database driver?> at /usr/share/crystal/src/primitives.cr:36:1 in 'get_connection'
pastebin_1  | no driver was registered for the schema "sqlite", did you maybe forget to require the database driver? (ArgumentError)
pastebin_1  |   from /usr/share/crystal/src/primitives.cr:36:1 in 'get_connection'
pastebin_1  |   from lib/crecto/src/crecto/repo.cr:88:30 in 'all'
pastebin_1  |   from /usr/share/crystal/src/indexable.cr:574:11 in 'get_by:sha256'
pastebin_1  |   from src/models/paste.cr:81:18 in 'create_paste'
pastebin_1  |   from lib/athena/src/action.cr:42:13 in 'handle_raw'
pastebin_1  |   from lib/athena/src/route_handler.cr:19:5 in '->'
pastebin_1  |   from /usr/share/crystal/src/http/server/request_processor.cr:51:20 in 'handle_client'
pastebin_1  |   from /usr/share/crystal/src/fiber.cr:146:11 in 'run'
pastebin_1  |   from ???

do I need a specific configuration that I'm missing? the docker-compose is fairly simple:

version: '3.3'
services:
    pastebin:
      image: ghcr.io/watzon/paste69
      ports:
        - <private>
      environment:
        - PORT=<private>
        - SITE_URL=<private>
watzon commented 5 months ago

I think you need to do sqlite3 for the schema. Try that and let me know if it works.

etra0 commented 5 months ago

I'm not sure how would I do that within the container. Do I need to build the image myself?

watzon commented 5 months ago

You should be able to do it in the environment variable. DATABASE_URL=sqlite3://./db.sqlite or something to that effect.

etra0 commented 5 months ago

ok that actually did something but it's now broken in different ways 😅

I'm doing

echo "hello" | curl -F"file=@-" "http://<host>:4633"

and I get the message:

pastebin_1  | stty: 'standard input': Inappropriate ioctl for device
pastebin_1  | stty: 'standard input': Inappropriate ioctl for device
pastebin_1  | Pruned 0 expired files
pastebin_1  | 2024-06-22T21:17:14.861566Z   INFO - athena.framework: Server has started and is listening at http://0.0.0.0:4633
pastebin_1  | 2024-06-22T21:17:18.003719Z   INFO - athena.framework: Matched route 'paste69_paste_controller_create_paste' -- route: "paste69_paste_controller_create_paste", route_parameters: {"_route" => "paste69_paste_controller_create_paste", "_controller" => "Paste69::PasteController#create_paste"}, request_uri: "/", method: "POST"
pastebin_1  | 2024-06-22T21:17:18.292685Z  ERROR - athena.framework: Uncaught exception #<NilAssertionError:Nil assertion failed> at /usr/share/crystal/src/nil.cr:113:7 in 'not_nil!'
pastebin_1  | Nil assertion failed (NilAssertionError)
pastebin_1  |   from /usr/share/crystal/src/nil.cr:113:7 in 'not_nil!'
pastebin_1  |   from /usr/share/crystal/src/nil.cr:109:3 in 'not_nil!'
pastebin_1  |   from lib/totem/src/totem/config.cr:179:40 in 'url'
pastebin_1  |   from src/models/paste.cr:10:5 in 'create_paste'
pastebin_1  |   from lib/athena/src/action.cr:42:13 in 'handle_raw'
pastebin_1  |   from lib/athena/src/route_handler.cr:19:5 in '->'
pastebin_1  |   from /usr/share/crystal/src/http/server/request_processor.cr:51:20 in 'handle_client'
pastebin_1  |   from /usr/share/crystal/src/fiber.cr:146:11 in 'run'
pastebin_1  |   from ???
pastebin_1  |