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

ADO don't find db drivers on fedora #28

Open
JulienGioux opened this issue Oct 1, 2022 · 8 comments
Open

ADO don't find db drivers on fedora #28

JulienGioux opened this issue Oct 1, 2022 · 8 comments

Comments

@JulienGioux
Copy link

JulienGioux commented Oct 1, 2022

Hello,
I've installed AWA with Alire, but it seems Ado can't find dependencies for :

  • mysql/mariadb
  • mysqlite
  • postgres
  • openssl

I'm sure i've installed all the package needed and follow your instruction on your blog to make a test:

alr init demo
cd demo
alr with awa
alr with dynamo
alr with servletada_aws
alr build

alr exec -- dynamo create-project -l apache --web demo [email protected]
alr build

but when i start the server i still have :
Some internal error occurred: Exception ADO.CONFIGS.CONNECTION_ERROR: Database driver 'postgres' not found

Something i missed ??

@stcarrez
Copy link
Owner

stcarrez commented Oct 1, 2022

It's hard to explain exactly what's your issue without having your sources...

The generated server uses the generic database driver ADO.Drivers which requires Mariadb, SQLite, PostgreSQL support for ADO. They are not available by default with your Alire configuration.

You have two solutions:

  1. Change the generated file src/demo-server.adb to replace ADO.Drivers with ADO.Sqlite for example and change the initialization from ADO.Drivers.Initialize to use ADO.Sqlite.Initialize.
  2. Add alr with ado_postgresql

The generated server comes with some default configuration file that you can change. It should have generated a demo.properties file which contains some database= property. The error message you are getting makes me think you have changed it and the configuration looks like postgresql://xxx.

If that's the case, then you may try to change the ADO.Drivers to ADO.Postgresql and also run alr with ado_postgresql to update your Alire project and make sure the ADO Postgresql support driver is linked with the server.

@JulienGioux
Copy link
Author

JulienGioux commented Oct 2, 2022

Thanks.
I've modified the demo-server.adb as you suggest many times with all the drivers.
The first thing is that alire can't find the driver libs on fedora because of different package-name.

I've finally find a way by editing the alire configuration index files in :
~/.config/alire/indexes/community/repo/index/
The name of the needed package is different on fedora and debian so:
Example with postresql : ( ~/.config/alire/indexes/community/repo/index/li/libpq/libqp-external.toml)

description = "Libraries for use with PostgreSQL"
name = "libpq"

maintainers = ["Maxim Reznik <[email protected]>"]
maintainers-logins = ["reznikmm"]

[[external]]
kind = "system"
[external.origin."case(distribution)"]
"debian|ubuntu" = ["libpq-dev"]
"fedora" = ["libpq-devel"]
"msys2" = ["mingw-w64-x86_64-postgresql"]

It need to be done for mysql, mariadb, sqlite and openssl but i'm not sure that is a good idea doing that this way cause "alire" need a lot of time to resolve the dependences. but it works.

the second thing, you're right i've modified demo.properties and the property database... my mistake, it's not "postgres://" but "postgresql://" but it was a last try before to post my message, so not really the problem.

Now the driver seems to work but when i start the server i've an error cause the bdd doesn't exist... I was thinking dynamo create it when "create-project"...

I've tried to create an empty bdd manually, but that was not a good idea, i've some SQL errors :

Error: ERREUR:  la relation « entity_type » n'existe pas
LINE 1: SELECT o.id, o."name" FROM entity_type AS o 
                                   ^

Error: ERREUR:  la relation « awa_audit_field » n'existe pas
LINE 1: SELECT id, entity_type, name FROM awa_audit_field
                                          ^

Some internal error occurred: Exception ADO.STATEMENTS.SQL_ERROR: SQL error: ERREUR:  la relation « awa_audit_field » n'existe pas
LINE 1: SELECT id, entity_type, name FROM awa_audit_field

Errors are in French but the idea is "relation doesn't exist"... normal, but what's the next step ?? create a database with dynamo ? In your different examples it seems you can start the server and access the web index page without that kind of problem. Not sure to understand how to start a simple project finally :/

@stcarrez
Copy link
Owner

stcarrez commented Oct 2, 2022

The Alire libpq package is maintained by Maxime Reznik. May be you can open a problem report on Alire project https://github.com/alire-project/alire/issues and you can also submit a pull request on the Alire index project to fix that.

My Fedora virtual machine is not up to date and I've never used Alire on it.

For the database creation, it's not easy for MySQL and PostgreSQL since it requires some root access to create the database itself. There is a create-database command in dynamo that you can use.

Now, the server also contains a number of commands that you can use. You can try the setup command that will handle the database creation with the setup of database tables according to the application.

Depending on what you want to do, it may be easier to use SQLite as database since this solves the MySQL/PostgreSQL server access issue (with all the user creation, grant access and so on).
You can prototype, play with SQLite and if you are happy you can change to PostgreSQL/MySQL for production.
I'm using MySQL for Ada France server and for my blog server. I'm using SQLite for Porion build manager.

You can run the server with the setup command and if you point your browser to the URL http://localhost:8080/demo/index.html you will have a small wizard setup that allows you to configure the database. You can switch to SQLite there or keep whatever default you have.

@stcarrez
Copy link
Owner

stcarrez commented Oct 2, 2022

@stcarrez
Copy link
Owner

stcarrez commented Oct 2, 2022

[external.origin."case(distribution)"]
"debian|ubuntu" = ["libpq-dev"]
fedora" = ["libpq-devel"]
"msys2" = ["mingw-w64-x86_64-postgresql"]

It guess there is a typo, a " is missing and it should probably be:

"debian|ubuntu" = ["libpq-dev"]
"fedora" = ["libpq-devel"]
"msys2" = ["mingw-w64-x86_64-postgresql"]

@JulienGioux
Copy link
Author

JulienGioux commented Oct 2, 2022

Ok, i'll report the issue to the alire project.
Thanks.

I've tried to run the server with "setup" but it stop with:
Missing application name

Trying with sqlite -> same error
Trying with bin/demo-server setup demo
result :

Starting...
setup.xml: File 'setup.xml' does not exist.

resulting with a redirection to http://localhost:8080/demo/setup/install.html which is an empty page... :/

@stcarrez
Copy link
Owner

stcarrez commented Oct 2, 2022

The demo.properties file is not correct and should have been updated by some dynamo generate command.
The file contains a search paths dynamo_search_dirs that contains a search path which allows to find the setup.xml and other XHTML/Javascript/CSS/configuration files used and provided by AWA and other libraries.

I think you should run (this step is missing in my original description which is my mistake):

mkdir -p db
alr exec -- dynamo generate db

this will update the demo.properties file and may be you may have to run again:

alr build

You can then run with the -v or even -vv or -vvv to multiple verbose modes:

bin/demo-server -v setup demo

If this does not work, edit the demo.properties files and replace the dynamo_search_dirs by the following definition (this is a single line):

dynamo_search_dirs=.;alire/cache/dependencies/awa_2.4.0_59135a52/awa/plugins/awa-setup;alire/cache/dependencies/awa_2.4.0_59135a52/awa/plugins/awa-wikis;alire/cache/dependencies/awa_2.4.0_59135a52/awa/plugins/awa-jobs;alire/cache/dependencies/awa_2.4.0_59135a52/awa/plugins/awa-votes;alire/cache/dependencies/awa_2.4.0_59135a52/awa/plugins/awa-questions;alire/cache/dependencies/awa_2.4.0_59135a52/awa/plugins/awa-images;alire/cache/dependencies/awa_2.4.0_59135a52/awa/plugins/awa-storages;alire/cache/dependencies/awa_2.4.0_59135a52/awa/plugins/awa-blogs;alire/cache/dependencies/awa_2.4.0_59135a52/awa/plugins/awa-comments;alire/cache/dependencies/awa_2.4.0_59135a52/awa/plugins/awa-tags;alire/cache/dependencies/awa_2.4.0_59135a52/awa/plugins/awa-mail;alire/cache/dependencies/awa_2.4.0_59135a52/awa/plugins/awa-workspaces;alire/cache/dependencies/awa_2.4.0_59135a52/.alire/../awa;alire/cache/dependencies/ado_2.3.0_a59fa70f/.alire;alire/cache/dependencies/serverfaces_1.5.0_10db0531/.alire/..;alire/cache/dependencies/utilada_2.5.0_f65f9ba9

@JulienGioux
Copy link
Author

That's it !
"dynamo generate db" was ok but you're right, the dynamo_search_dirs in demo.properties was a lot shorter !
Thanks a lot, i can experiment now ;)

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

No branches or pull requests

2 participants