Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issues with sqlite driver on the docker image #1

Open
etra0 opened this issue Jun 8, 2024 · 4 comments · May be fixed by #2
Open

issues with sqlite driver on the docker image #1

etra0 opened this issue Jun 8, 2024 · 4 comments · May be fixed by #2

Comments

@etra0
Copy link

etra0 commented Jun 8, 2024

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
Copy link
Owner

watzon commented Jun 14, 2024

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

@etra0
Copy link
Author

etra0 commented Jun 19, 2024

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

@watzon
Copy link
Owner

watzon commented Jun 22, 2024

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

@etra0
Copy link
Author

etra0 commented Jun 22, 2024

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  |

etra0 added a commit to etra0/paste69 that referenced this issue Sep 18, 2024
From the crecto spec, they use INTEGER NOT NULL for the id, and this change fixes watzon#1.
@etra0 etra0 linked a pull request Sep 18, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants