Difference between revisions of "Importing DB Seed Manually"

From iDempiere en
Tag: visualeditor
 
(23 intermediate revisions by 8 users not shown)
Line 5: Line 5:
 
[[Setting up Eclipse]] |
 
[[Setting up Eclipse]] |
 
Importing DB Seed Manually |
 
Importing DB Seed Manually |
[[Running iDempiere within Eclipse]]
+
[[Configuring iDempiere within Eclipse]]
 
⇒
 
⇒
 
</font>
 
</font>
Line 13: Line 13:
 
Let's check the steps to create an idempiere postgres database:
 
Let's check the steps to create an idempiere postgres database:
  
== Create adempiere user ==
+
== Set a password for the postgres user ==
  
 
  sudo su - postgres
 
  sudo su - postgres
  psql -U postgres -c "CREATE ROLE adempiere SUPERUSER LOGIN PASSWORD 'adempiere'"
+
  psql -U postgres -c "ALTER USER postgres PASSWORD 'TheSystemPassword'"
  logout
+
  exit
  
'''WARNING:''' Of course this is an insecure password, it is recommended that you set up a proper password for this user account
+
'''WARNING:''' Of course this is an insecure password, it is recommended that you set up a proper password for this user account.  You need this password for the instructions below
  
== Create the idempiere database ==
+
== Run console-setup-alt.sh to initialize the parameters ==
  
  createdb --template=template0 -E UNICODE -O adempiere -U adempiere idempiere
+
  cd $HOME/sources/idempiere/org.idempiere.p2/target/products/org.adempiere.server.product/linux/gtk/x86_64
  psql -d idempiere -U adempiere -c "ALTER ROLE adempiere SET search_path TO adempiere, pg_catalog"
+
  bash console-setup-alt.sh
 +
# answer all questions from this program, you can choose here database name, etc, take care of the two passwords:
 +
  Database Password [adempiere]:
 +
    answer this question with your desired password for the adempiere user
 +
  Database System User Password []:
 +
    TheSystemPassword <- answer this question with the password you set on the previous step
 +
# at the end the program must have generated two files, move them:
 +
mv idempiere.properties .idpass $HOME/sources/idempiere
  
When asked the password please provide the adempiere password that you set up in the previous step.
+
== Import the database ==
 +
cd $HOME/sources/idempiere
 +
bash RUN_ImportIdempiereDev.sh
  
'''NOTE:''' It is possible that you will confront problems related to pg_hba.conf configuration, it's beyond of 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.
+
The last command must import the database and apply all the migration scripts.
  
== 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
+
'''NOTE:''' See [[Talk:Importing_DB_Seed_Manually|Discussion]] tab for additional notes.
  
=== For postgresql versions 8.X, 9.0 ===
 
  
* Run via psql the script provided at db/ddlutils/postgresql/uuid-ossp.sql
+
''This How-To is brought to you by [[User:CarlosRuiz|Carlos Ruiz]] from [https://www.bx-service.com/ BX Service GmbH].  Feel free to improve directly or suggest using the Discussion tab.
** psql -d idempiere -U adempiere -f db/ddlutils/postgresql/uuid-ossp.sql
 
  
=== For postgresql 9.1 and above ===
+
[[Category:User Manual|I]]
 +
[[Category:Installation|E]]
 +
[[Category:Installation Eclipse]]
 +
[[Category:Development‏‎]]
 +
[[Category:Developer documentation‏‎]]
 +
[[Category:HowTo]]
 +
[[Category:Updated2022]]
  
* Run the command CREATE EXTENSION "uuid-ossp" using psql
+
<!-- breadcrumb -->
** psql -d idempiere -U adempiere -c 'CREATE EXTENSION "uuid-ossp"'
+
<font size=-2>
 
+
&lArr;
== Import the seed ==
+
[[Installing_iDempiere|Table of Contents]] |
 
+
[[Setting up Eclipse]] |
== PostgreSQL 8.4 or 9.0 ==
+
Importing DB Seed Manually |
 
+
[[Configuring iDempiere within Eclipse]]
This tutorial uses postgres 8.4 - please note the following instructions are applicable if you use postgresql 8.4 or 9.0, for 9.1 or higher see below.
+
&rArr;
 
+
</font>
cd /tmp
 
jar xvf $IDEMPIERE_REPOSITORY/org.adempiere.server-feature/data/seed/Adempiere_pg84.jar
 
psql -d idempiere -U adempiere -f Adempiere_pg84.dmp
 
 
 
You must replace $IDEMPIERE_REPOSITORY with the folder of your cloned repository.
 
 
 
== PostgreSQL 9.1 or higher ==
 
 
 
cd /tmp
 
jar xvf $IDEMPIERE_REPOSITORY/org.adempiere.server-feature/data/seed/Adempiere_pg.jar
 
psql -d idempiere -U adempiere -f Adempiere_pg.dmp
 
 
 
== Applying additional migration scripts ==
 
 
 
See also [http://wiki.idempiere.org/en/Upgrade_from_1.0c_to_2.0#Periodic_upgrade_within_same_version Periodic upgrade within same version]
 
 
 
=== Manual way ===
 
 
 
Now, you must check if there are new migration scripts after the last applied, you can check the migration scripts this way:
 
 
 
ls $IDEMPIERE_REPOSITORY/migration/i1.0c-release/postgresql
 
 
 
And compare the list of migration scripts with the contents of your AD_MigrationScript table, execute this in postgres:
 
 
 
select name from ad_migrationscript order by 1
 
 
 
Please note that you must do this check every time you upgrade your version.
 
 
 
If you find there are unapplied migration scripts then you can apply them with:
 
 
 
psql -d idempiere -U adempiere -f $IDEMPIERE_REPOSITORY/migration/i1.0c-release/postgresql/20130627011956_ProbableFutureMigrationScript.sql
 
 
 
Please check carefully the output of the migration scripts, if you find errors please ask for help on the [http://groups.google.com/group/idempiere support forums]
 
 
 
You must repeat the previous for each unapplied migration scripts, it's recommended also to take note of the last applied for future reference.
 
 
 
At the end you can run the post-migration processes like this:
 
 
 
cat $IDEMPIERE_REPOSITORY/migration/processes_post_migration/postgresql/*.sql | psql -d idempiere -U adempiere
 
 
 
=== Automated way (linux) ===
 
 
 
There are two scripts contributed that help with this task:
 
 
 
* [http://bitbucket.org/CarlosRuiz_globalqss/idempiere-stuff/raw/tip/script_to_sync_db/syncApplied.sh syncApplied.sh for PostgreSQL]
 
* [http://bitbucket.org/CarlosRuiz_globalqss/idempiere-stuff/raw/tip/script_to_sync_db/syncApplied_ora.sh syncApplied_ora.sh for Oracle]
 
 
 
You can download the corresponding file, edit the variables on top to fit your configuration and then you can run periodically the script every time you update source code.
 
 
 
''This tutorial is brought to you by [[User:CarlosRuiz|Carlos Ruiz]] from [http://globalqss.com GlobalQSS].  Feel free to improve directly or suggest using the Discussion tab.
 
 
 
[[Category:Install]]
 

Latest revision as of 14:35, 17 October 2025

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:

Set a password for the postgres user

sudo su - postgres
psql -U postgres -c "ALTER USER postgres PASSWORD 'TheSystemPassword'"
exit

WARNING: Of course this is an insecure password, it is recommended that you set up a proper password for this user account. You need this password for the instructions below

Run console-setup-alt.sh to initialize the parameters

cd $HOME/sources/idempiere/org.idempiere.p2/target/products/org.adempiere.server.product/linux/gtk/x86_64
bash console-setup-alt.sh
# answer all questions from this program, you can choose here database name, etc, take care of the two passwords:
  Database Password [adempiere]:
    answer this question with your desired password for the adempiere user
  Database System User Password []:
    TheSystemPassword  <- answer this question with the password you set on the previous step
# at the end the program must have generated two files, move them:
mv idempiere.properties .idpass $HOME/sources/idempiere

Import the database

cd $HOME/sources/idempiere
bash RUN_ImportIdempiereDev.sh

The last command must import the database and apply all the migration scripts.


NOTE: See Discussion tab for additional notes.


This How-To is brought to you by Carlos Ruiz from BX Service GmbH. 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

Cookies help us deliver our services. By using our services, you agree to our use of cookies.