edissyum / opencapture

Open-Capture is the one and only 100% Open Source intelligent document capture solution
https://kutt.it/OpenCaptureWebSite
GNU General Public License v3.0
24 stars 11 forks source link

Brand new installation failed #377

Closed Denis-Leblanc closed 1 year ago

Denis-Leblanc commented 1 year ago

Bonjour à Tous,

I had some difficulties while installing the application. So I started again from a brand new installation, a disposable debian 11 instance. I launched the installation procedure by following the documentation line by line from there : installation I have an error regarding the database connection information.

Capture d’écran du 2022-11-12 11-30-23 install_error.log install_info.log

After investigating, I have the impression that these lines of the install.sh file execute incorrectly because the password would be registered incorrectly when creating the roles earlier in the installation file. `####################

Create database using custom_id

echo "Create database and fill it with default data....." databaseName="opencapture$customId" if [[ "$customId" = *"opencapture"* ]]; then databaseName="$customId" fi export PGPASSWORD=$databasePassword && psql -U"$databaseUsername" -h"$hostname" -p"$port" -c "CREATE DATABASE $databaseName WITH template=template0 encoding='UTF8'" postgres >>$INFOLOG_PATH 2>>$ERRORLOG_PATH export PGPASSWORD=$databasePassword && psql -U"$databaseUsername" -h"$hostname" -p"$port" -c "\i $defaultPath/instance/sql/structure.sql" "$databaseName" >>$INFOLOG_PATH 2>>$ERRORLOG_PATH export PGPASSWORD=$databasePassword && psql -U"$databaseUsername" -h"$hostname" -p"$port" -c "\i $defaultPath/instance/sql/global.sql" "$databaseName" >>$INFOLOG_PATH 2>>$ERRORLOG_PATH export PGPASSWORD=$databasePassword && psql -U"$databaseUsername" -h"$hostname" -p"$port" -c "\i $defaultPath/instance/sql/data_fr.sql" "$databaseName" >>$INFOLOG_PATH 2>>$ERRORLOG_PATH

echo "" echo "######################################################################################################################" echo ""

docserverDefaultPath="/var/docservers/opencapture/"

export PGPASSWORD=$databasePassword && psql -U"$databaseUsername" -h"$hostname" -p"$port" -c "UPDATE docservers SET path=REPLACE(path, '$docserverDefaultPath' , '/$docserverDefaultPath/$customId/')" "$databaseName" >>$INFOLOG_PATH 2>>$ERRORLOG_PATH export PGPASSWORD=$databasePassword && psql -U"$databaseUsername" -h"$hostname" -p"$port" -c "UPDATE docservers SET path='$customPath/bin/scripts/' WHERE docserver_id = 'SCRIPTS_PATH'" "$databaseName" >>$INFOLOG_PATH 2>>$ERRORLOG_PATH export PGPASSWORD=$databasePassword && psql -U"$databaseUsername" -h"$hostname" -p"$port" -c "UPDATE docservers SET path='$customPath/bin/data/tmp/' WHERE docserver_id = 'TMP_PATH'" "$databaseName" >>$INFOLOG_PATH 2>>$ERRORLOG_PATH export PGPASSWORD=$databasePassword && psql -U"$databaseUsername" -h"$hostname" -p"$port" -c "UPDATE docservers SET path='$customPath/bin/data/exported_pdfa/' WHERE docserver_id = 'SEPARATOR_OUTPUT_PDFA'" "$databaseName" >>$INFOLOG_PATH 2>>$ERRORLOG_PATH export PGPASSWORD=$databasePassword && psql -U"$databaseUsername" -h"$hostname" -p"$port" -c "UPDATE docservers SET path='$customPath/bin/data/exported_pdf/' WHERE docserver_id = 'SEPARATOR_OUTPUT_PDF'" "$databaseName" >>$INFOLOG_PATH 2>>$ERRORLOG_PATH export PGPASSWORD=$databasePassword && psql -U"$databaseUsername" -h"$hostname" -p"$port" -c "UPDATE docservers SET path='$customPath/instance/referencial/' WHERE docserver_id = 'REFERENTIALS_PATH'" "$databaseName" >>$INFOLOG_PATH 2>>$ERRORLOG_PATH export PGPASSWORD=$databasePassword && psql -U"$databaseUsername" -h"$hostname" -p"$port" -c "UPDATE inputs SET input_folder=REPLACE(input_folder, '/var/share/' , '/var/share/$customId/')" "$databaseName" >>$INFOLOG_PATH 2>>$ERRORLOG_PATH export PGPASSWORD=$databasePassword && psql -U"$databaseUsername" -h"$hostname" -p"$port" -c "UPDATE outputs SET data = jsonb_set(data, '{options, parameters, 0, value}', '\"/var/share/$customId/export/verifier/\"') WHERE data #>>'{options,parameters, 0, id}' = 'folder_out' AND module = 'verifier';" "$databaseName" >>$INFOLOG_PATH 2>>$ERRORLOG_PATH export PGPASSWORD=$databasePassword && psql -U"$databaseUsername" -h"$hostname" -p"$port" -c "UPDATE outputs SET data = jsonb_set(data, '{options, parameters, 0, value}', '\"/var/share/$customId/entrant/verifier/\"') WHERE data #>>'{options,parameters, 0, id}' = 'folder_out' AND module = 'splitter' AND output_type_id = 'export_pdf';" "$databaseName" >>$INFOLOG_PATH 2>>$ERRORLOG_PATH export PGPASSWORD=$databasePassword && psql -U"$databaseUsername" -h"$hostname" -p"$port" -c "UPDATE outputs SET data = jsonb_set(data, '{options, parameters, 0, value}', '\"/var/share/$customId/export/splitter/\"') WHERE data #>>'{options,parameters, 0, id}' = 'folder_out' AND module = 'splitter' AND output_type_id = 'export_xml';" "$databaseName" >>$INFOLOG_PATH 2>>$ERRORLOG_PATH export PGPASSWORD=$databasePassword && psql -U"$databaseUsername" -h"$hostname" -p"$port" -c "UPDATE configurations SET data = jsonb_set(data, '{value, batchPath}', '\"$customPath/bin/data/MailCollect/\"') WHERE label = 'mailCollectGeneral';" "$databaseName" >>$INFOLOG_PATH 2>>$ERRORLOG_PATH `

I have given you as much information as possible. I remain at your disposal for any further information.

Congratulations for this work ! Cordialement Denis

Brich40 commented 1 year ago

Hello,

Apparently, something went wrong during the database configuration.

Can you please check if the database information is correct in the config file custom/[YOUR_CUSTOM]/config/config.ini

And if the database is created properly using the command :

psql -h localhost -U [databaseUsername] -d [databasename]

Note that the database configuration can be done manually following the steps below :

  1. Create your PostgreSQL user
  2. Create your database owner by the created user
  3. Execute the sql files below on the created database :
    instance/sql/structure.sql
    instance/sql/data_fr.sql
    instance/sql/global.sql
  4. Edit the config file with the rights database information (DATABASE section)
  5. Verify path column in docservers table
Denis-Leblanc commented 1 year ago

Hello, Here is the content of the config.ini file :

[DATABASE] postgresHost = localhost postgresPort = 5432 postgresDatabase = opencapture_leblancBros postgresUser = leblancBros postgresPassword = leblancBros

Here is the answer to the psql command :

debian@testcapture:$ psql -h localhost -U leblancBros -d opencapture_leblancBros Password for user leblancBros: psql: error: FATAL: password authentication failed for user "leblancBros" FATAL: password authentication failed for user "leblancBros" debian@testcapture:$

Here is the list of the users :

debian@testcapture:$ sudo su postgres -c psql psql (13.8 (Debian 13.8-0+deb11u1)) Type "help" for help.

postgres=# \du+ List of roles Role name | Attributes | Member of | Description -------------+------------------------------------------------------------+-----------+------------- leblancbros | Create DB | {} | postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {} |

postgres=# quit debian@testcapture:$

At this level of investigation, we can see a problem with the name "leblancBros" which appears without a capital B in the list of users in the database. The documentation specifies that the special characters "." and "-" will be replaced by an underscore "_" during installation. Perhaps one could extend this rule to uppercase letters? I think a leblancBros -> leblanc_bros wouldn't have caused the database any problems.

So, I restarted my installation from scratch because there is no data on the production server yet :

debian@cdn:/var/www/html/opencapture$ rm leblancBros debian@cdn:/var/www/html/opencapture$ rm -r custom/leblancBros/ debian@cdn:/var/www/html/opencapture$ rm custom/custom.ini debian@cdn:/var/www/html/opencapture$ rm bin/install/install_info.log debian@cdn:/var/www/html/opencapture$ rm bin/install/install_error.log

debian@cdn:/var/www/html/opencapture/bin/install$ sudo ./install.sh -c leblanc_bros

Humm Sounds good, error.log is empty :

debian@cdn:/var/www/html/opencapture/bin/install$ cat install_error.log debian@cdn:/var/www/html/opencapture/bin/install$

The solution to my problem was simply: "do not put capital letters in the custom". Cordialement Denis LEBLANC

Brich40 commented 1 year ago

OK, capital letters handling will be added in the upcoming release.