Importing DB Seed Manually

From iDempiere en
Jump to navigation Jump to search

Table of Contents | Setting up Eclipse | Importing DB Seed Manually | Configuring iDempiere within Eclipse

Please note this procedure is intended for technical people wanting to configure iDempiere to run in Eclipse, there is an easier mechanism on the installers to create the database.

Let's check the steps to create an idempiere postgres database:

Create adempiere user

sudo su - postgres
psql -U postgres -c "CREATE ROLE adempiere SUPERUSER LOGIN PASSWORD 'adempiere'"

WARNING: Of course this is an insecure password, it is recommended that you set up a proper password for this user account

Create the idempiere database

createdb  --template=template0 -E UNICODE -O adempiere -U adempiere idempiere
psql -d idempiere -U adempiere -c "ALTER ROLE adempiere SET search_path TO adempiere, pg_catalog"

When asked the password please provide the adempiere password that you set up in the previous step.

NOTE: It is possible that you will confront problems related to pg_hba.conf configuration (/etc/postgresql/{version}/main/pg_hba.conf), it's beyond the scope of this tutorial to solve those problems at this moment, please check and configure proper permissions. Also, this tutorial is intended to work on a postgres installed locally, if your postgres is elsewhere you must use corresponding -h (host) and -p (port) parameters for createdb and psql. If you receive the error createdb: could not connect to database template1: FATAL: Peer authentication failed for user "adempiere" you might be able to add -h localhost to resolve quickly. For a more permanent solution visit stackoverflow.

NOTE: createdb will use default collate of OS. some condition it's bad.

I experiment use Thailand text on db with collate=en_US, it very slow on operator

for that case full command is

 createdb --template=template0 -E UNICODE -O adempiere -U adempiere -E UNICODE --lc-collate "th_TH.utf8" --lc-ctype "th_TH.utf8" idempiere

but one day i get error about wrong collate with th_TH.utf8 when run this command. bellow is how to fix postgres-createdb-invalid-locale-name

 locale -a # list current support collate of OS
 sudo apt-get install locales
 sudo dpkg-reconfigure locales

Installing UUID (required to apply some migration scripts)

Some migration scripts references the function generate_uuid, unfortunately the way to install this is different on different postgres versions, so we were not able to include it by default on the DB seed, next are the instructions per version:

  • Remember from the prerequisites you must have installed postgresql-contrib to make the generate_uuid function to work
  • Run the command CREATE EXTENSION "uuid-ossp" using psql
    • psql -d idempiere -U adempiere -c 'CREATE EXTENSION "uuid-ossp"'

Import the seed

cd /tmp
jar xvf $IDEMPIERE_REPOSITORY/org.adempiere.server-feature/data/seed/Adempiere_pg.jar
psql -d idempiere -U adempiere -f Adempiere_pg.dmp

This tutorial is brought to you by Carlos Ruiz from GlobalQSS. Feel free to improve directly or suggest using the Discussion tab.

Table of Contents | Setting up Eclipse | Importing DB Seed Manually | Configuring iDempiere within Eclipse