Current PostgreSQL Instructions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Current PostgreSQL Instructions

stimits
Hi,
 
I'm just trying to evaluate ofbiz for some simple POS needs (which is of course not really simple). I see there is a lot of ofbiz development activity, and thus a lot of documents which are actually out of date. Sometimes for example the instructions use "ant" directly and do not know of the gradlew command. In entityengine.xml information I sometimes see PostgreSQL info which refers to "org.ofbiz", but this is out of date and is actually "org.apache.ofbiz". The little things like that are derailing me.
 
To make a long story short, I have PostgreSQL running on Fedora, and apache-ofbiz-16.11.01 working with Derby, but need to change to PostgreSQL (and PostgreSQL is up and running with both my regular user and with "ofbiz/ofbiz" name/pass), and getting connection refused (I can manually run commands such as createdb and dropdb without issue). Basically there is some small detail I'm missing and am wondering if there is current documentation on setting up ofbiz with PostgreSQL which I'm missing?
 
I really like this documentation...but unfortunately it is wrong (out of date):
https://cwiki.apache.org/confluence/display/OFBIZ/Apache+OFBiz+Technical+Production+Setup+Guide
 
This in turn points out a lot of facts through here:
https://cwiki.apache.org/confluence/display/OFBIZ/Entity+Engine+Configuration+Guide
 
...but I'm more interested in getting it working and that information appears to only be for people who already understand ofbiz setup (there are a lot of facts there and no example which works with 16.11.01). I was under the impression that if PostgreSQL were set up and the ofbiz name/pass is able to create tables then the "gradlew loadDefault" would be able to load sample data into PostgreSQL without manually creating each table. Am I incorrect on this? Do I need to manually create tables? I can attach my entityengine.xml edits, but wanted to know first if there are explicit instructions somewhere for the current 16.11.01 (I am not interested in customization and developing new apps, I just want to see the minimal sample data using PostgreSQL).
 
Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Current PostgreSQL Instructions

james yong
Hi Stimits,

Just to be sure, have you add the postgres driver info in the build.gradle file?
Something like the following before running the gradlew:
       runtime 'postgresql:postgresql:9.0-801.jdbc4'

Regards,
James Yong

stimits wrote
Hi,
 
I'm just trying to evaluate ofbiz for some simple POS needs (which is of course not really simple). I see there is a lot of ofbiz development activity, and thus a lot of documents which are actually out of date. Sometimes for example the instructions use "ant" directly and do not know of the gradlew command. In entityengine.xml information I sometimes see PostgreSQL info which refers to "org.ofbiz", but this is out of date and is actually "org.apache.ofbiz". The little things like that are derailing me.
 
To make a long story short, I have PostgreSQL running on Fedora, and apache-ofbiz-16.11.01 working with Derby, but need to change to PostgreSQL (and PostgreSQL is up and running with both my regular user and with "ofbiz/ofbiz" name/pass), and getting connection refused (I can manually run commands such as createdb and dropdb without issue). Basically there is some small detail I'm missing and am wondering if there is current documentation on setting up ofbiz with PostgreSQL which I'm missing?
 
I really like this documentation...but unfortunately it is wrong (out of date):
https://cwiki.apache.org/confluence/display/OFBIZ/Apache+OFBiz+Technical+Production+Setup+Guide
 
This in turn points out a lot of facts through here:
https://cwiki.apache.org/confluence/display/OFBIZ/Entity+Engine+Configuration+Guide
 
...but I'm more interested in getting it working and that information appears to only be for people who already understand ofbiz setup (there are a lot of facts there and no example which works with 16.11.01). I was under the impression that if PostgreSQL were set up and the ofbiz name/pass is able to create tables then the "gradlew loadDefault" would be able to load sample data into PostgreSQL without manually creating each table. Am I incorrect on this? Do I need to manually create tables? I can attach my entityengine.xml edits, but wanted to know first if there are explicit instructions somewhere for the current 16.11.01 (I am not interested in customization and developing new apps, I just want to see the minimal sample data using PostgreSQL).
 
Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Current PostgreSQL Instructions

Mike Z
In reply to this post by stimits
What is your output using "\du ofbiz"

postgres=# \du ofbiz
           List of roles
 Role name | Attributes | Member of
-----------+------------+-----------
 ofbiz  | Create DB  | {}


On Sun, Mar 12, 2017 at 2:57 PM, <[hidden email]> wrote:

> Hi,
>
> I'm just trying to evaluate ofbiz for some simple POS needs (which is of
> course not really simple). I see there is a lot of ofbiz development
> activity, and thus a lot of documents which are actually out of date.
> Sometimes for example the instructions use "ant" directly and do not know
> of the gradlew command. In entityengine.xml information I sometimes see
> PostgreSQL info which refers to "org.ofbiz", but this is out of date and is
> actually "org.apache.ofbiz". The little things like that are derailing me.
>
> To make a long story short, I have PostgreSQL running on Fedora, and
> apache-ofbiz-16.11.01 working with Derby, but need to change to PostgreSQL
> (and PostgreSQL is up and running with both my regular user and with
> "ofbiz/ofbiz" name/pass), and getting connection refused (I can manually
> run commands such as createdb and dropdb without issue). Basically there is
> some small detail I'm missing and am wondering if there is current
> documentation on setting up ofbiz with PostgreSQL which I'm missing?
>
> I really like this documentation...but unfortunately it is wrong (out of
> date):
> https://cwiki.apache.org/confluence/display/OFBIZ/Apache+OFBiz+Technical+
> Production+Setup+Guide
>
> This in turn points out a lot of facts through here:
> https://cwiki.apache.org/confluence/display/OFBIZ/
> Entity+Engine+Configuration+Guide
>
> ...but I'm more interested in getting it working and that information
> appears to only be for people who already understand ofbiz setup (there are
> a lot of facts there and no example which works with 16.11.01). I was under
> the impression that if PostgreSQL were set up and the ofbiz name/pass is
> able to create tables then the "gradlew loadDefault" would be able to load
> sample data into PostgreSQL without manually creating each table. Am I
> incorrect on this? Do I need to manually create tables? I can attach my
> entityengine.xml edits, but wanted to know first if there are explicit
> instructions somewhere for the current 16.11.01 (I am not interested in
> customization and developing new apps, I just want to see the minimal
> sample data using PostgreSQL).
>
> Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Current PostgreSQL Instructions

stimits
Hi,
 
...logged in to psql as user postgres...
 psql (9.4.9)Type "help" for help. postgres=# \du                             List of roles Role name |                   Attributes                   | Member of -----------+------------------------------------------------+----------- ofbiz     | Create role, Create DB, Replication            | {} dan       | Create role, Create DB, Replication            | {} postgres  | Superuser, Create role, Create DB, Replication | {}
Earlier I had fewer permissions, errors changed to transaction errors after adding more permissions/roles to user ofbiz in PostgreSQL. I'm wondering, since I'm running ofbiz from my regular system account user (user ofbiz exists only in PostgreSQL and is not a system account), yet seeing failures in file reads from my regular user (ofbiz is located in ~dan/ofbiz/), if perhaps some aspect of the SQL query is somehow unable to read files because of an suid within ofbiz? Ofbiz is run in "~dan/ofbiz/" as user dan via "./gradlew loadDefault"...I would think that any file reads would be as user dan, but apparently this isn't true. Example failure:
2017-03-12 19:07:26,728 |main                 |EntityDataLoadContainer       |I| [loadData]: Error loading XML Resource "file:/home/dan/ofbiz/framework/security/data/SecurityPermissionSeedData.xml"; Error was: A transaction error occurred reading data
Basically user "dan" running gradlew cannot read his own file verified to be accessible in /home/dan/ofbiz/framework/security/data/SecurityPermissionSeedData.xml as if he isn't really user dan. Is gradlew performing some sort of sudo and reading files as someone other than the user that starts gradlew?
 
Thanks!
 
----- Original Message -----From: Mike <[hidden email]>To: user <[hidden email]>Sent: Mon, 13 Mar 2017 01:55:09 -0000 (UTC)Subject: Re: Current PostgreSQL Instructions

What is your output using "\du ofbiz"

postgres=# \du ofbiz List of roles Role name | Attributes | Member of-----------+------------+----------- ofbiz | Create DB | {}

On Sun, Mar 12, 2017 at 2:57 PM, <[hidden email]> wrote:

> Hi,>> I'm just trying to evaluate ofbiz for some simple POS needs (which is of> course not really simple). I see there is a lot of ofbiz development> activity, and thus a lot of documents which are actually out of date.> Sometimes for example the instructions use "ant" directly and do not know> of the gradlew command. In entityengine.xml information I sometimes see> PostgreSQL info which refers to "org.ofbiz", but this is out of date and is> actually "org.apache.ofbiz". The little things like that are derailing me.>> To make a long story short, I have PostgreSQL running on Fedora, and> apache-ofbiz-16.11.01 working with Derby, but need to change to PostgreSQL> (and PostgreSQL is up and running with both my regular user and with> "ofbiz/ofbiz" name/pass), and getting connection refused (I can manually> run commands such as createdb and dropdb without issue). Basically there is> some small detail I'm missing and am wondering if there is current> documentation on setting up ofbiz with PostgreSQL which I'm missing?>> I really like this documentation...but unfortunately it is wrong (out of> date):> https://cwiki.apache.org/confluence/display/OFBIZ/Apache+OFBiz+Technical+> Production+Setup+Guide>> This in turn points out a lot of facts through here:> https://cwiki.apache.org/confluence/display/OFBIZ/> Entity+Engine+Configuration+Guide>> ...but I'm more interested in getting it working and that information> appears to only be for people who already understand ofbiz setup (there are> a lot of facts there and no example which works with 16.11.01). I was under> the impression that if PostgreSQL were set up and the ofbiz name/pass is> able to create tables then the "gradlew loadDefault" would be able to load> sample data into PostgreSQL without manually creating each table. Am I> incorrect on this? Do I need to manually create tables? I can attach my> entityengine.xml edits, but wanted to know first if there are explicit> instructions somewhere for the current 16.11.01 (I am not interested in> customization and developing new apps, I just want to see the minimal> sample data using PostgreSQL).>> Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Current PostgreSQL Instructions

Mike Z
You should be able to, as the user running ofbiz, type the following.  The
IP must match what is in the  file: entityengine.xml

psql -h IP_OF_DB_HOST -U ofbiz -d ofbiz
[ENTER PASSWORD]  ("ofbiz")

If the above doesn't work, then you may need to tweak the postgres
file: pg_hba.conf, and perform a postgresql "reload" (or restart):
 Examples:

host    all             all             0.0.0.0/0               md5
host    all             all             127.0.0.1/32            md5
local   all             all                                     peer

Depend on that you have locally setup.  For your entityengine.xml, use

       <group-map group-name="org.ofbiz" datasource-name="localpostnew"/>

[localpostnew is superior]

Under the localpostnew section, make sure you have:

        <inline-jdbc
                jdbc-driver="org.postgresql.Driver"
                jdbc-uri="jdbc:postgresql://IP_OF_DB_HOST/ofbiz"
                jdbc-username="ofbiz"
                jdbc-password="ofbiz"


Also, to have ofbiz re-init the database, it first has to exist:

postgres> CREATE DATABASE ofbiz;

Remember, use the "psql" command above to test whether ofbiz can properly
login as he user "dan".  A better test:

dan> psql -h IP_OF_DB_HOST -U ofbiz -d ofbiz -c "CREATE DATABASE ofbiz;"
[ENTER PASSWORD]  ("ofbiz")

Good luck

On Sun, Mar 12, 2017 at 7:23 PM, <[hidden email]> wrote:

> Hi,
>
> ...logged in to psql as user postgres...
>  psql (9.4.9)Type "help" for help. postgres=# \du
>    List of roles Role name |                   Attributes
>  | Member of -----------+------------------------------------------------+-----------
> ofbiz     | Create role, Create DB, Replication            | {} dan       |
> Create role, Create DB, Replication            | {} postgres  | Superuser,
> Create role, Create DB, Replication | {}
> Earlier I had fewer permissions, errors changed to transaction errors
> after adding more permissions/roles to user ofbiz in PostgreSQL. I'm
> wondering, since I'm running ofbiz from my regular system account user
> (user ofbiz exists only in PostgreSQL and is not a system account), yet
> seeing failures in file reads from my regular user (ofbiz is located in
> ~dan/ofbiz/), if perhaps some aspect of the SQL query is somehow unable to
> read files because of an suid within ofbiz? Ofbiz is run in "~dan/ofbiz/"
> as user dan via "./gradlew loadDefault"...I would think that any file reads
> would be as user dan, but apparently this isn't true. Example failure:
> 2017-03-12 19:07:26,728 |main                 |EntityDataLoadContainer
>    |I| [loadData]: Error loading XML Resource "file:/home/dan/ofbiz/
> framework/security/data/SecurityPermissionSeedData.xml"; Error was: A
> transaction error occurred reading data
> Basically user "dan" running gradlew cannot read his own file verified to
> be accessible in /home/dan/ofbiz/framework/security/data/SecurityPermissionSeedData.xml
> as if he isn't really user dan. Is gradlew performing some sort of sudo and
> reading files as someone other than the user that starts gradlew?
>
> Thanks!
>
> ----- Original Message -----From: Mike <[hidden email]>To: user <
> [hidden email]>Sent: Mon, 13 Mar 2017 01:55:09 -0000 (UTC)Subject:
> Re: Current PostgreSQL Instructions
>
> What is your output using "\du ofbiz"
>
> postgres=# \du ofbiz List of roles Role name | Attributes | Member
> of-----------+------------+----------- ofbiz | Create DB | {}
>
> On Sun, Mar 12, 2017 at 2:57 PM, <[hidden email]> wrote:
>
> > Hi,>> I'm just trying to evaluate ofbiz for some simple POS needs (which
> is of> course not really simple). I see there is a lot of ofbiz
> development> activity, and thus a lot of documents which are actually out
> of date.> Sometimes for example the instructions use "ant" directly and do
> not know> of the gradlew command. In entityengine.xml information I
> sometimes see> PostgreSQL info which refers to "org.ofbiz", but this is out
> of date and is> actually "org.apache.ofbiz". The little things like that
> are derailing me.>> To make a long story short, I have PostgreSQL running
> on Fedora, and> apache-ofbiz-16.11.01 working with Derby, but need to
> change to PostgreSQL> (and PostgreSQL is up and running with both my
> regular user and with> "ofbiz/ofbiz" name/pass), and getting connection
> refused (I can manually> run commands such as createdb and dropdb without
> issue). Basically there is> some small detail I'm missing and am wondering
> if there is current> documentation on setting up ofbiz with PostgreSQL
> which I'm missing?>> I really like this documentation...but unfortunately
> it is wrong (out of> date):> https://cwiki.apache.org/
> confluence/display/OFBIZ/Apache+OFBiz+Technical+>
> Production+Setup+Guide>> This in turn points out a lot of facts through
> here:> https://cwiki.apache.org/confluence/display/OFBIZ/>
> Entity+Engine+Configuration+Guide>> ...but I'm more interested in getting
> it working and that information> appears to only be for people who already
> understand ofbiz setup (there are> a lot of facts there and no example
> which works with 16.11.01). I was under> the impression that if PostgreSQL
> were set up and the ofbiz name/pass is> able to create tables then the
> "gradlew loadDefault" would be able to load> sample data into PostgreSQL
> without manually creating each table. Am I> incorrect on this? Do I need to
> manually create tables? I can attach my> entityengine.xml edits, but wanted
> to know first if there are explicit> instructions somewhere for the current
> 16.11.01 (I am not interested in> customization and developing new apps, I
> just want to see the minimal> sample data using PostgreSQL).>> Thanks!
>
Reply | Threaded
Open this post in threaded view
|

Re: Current PostgreSQL Instructions

stimits
Hi,
 
I had been using this as reference:
https://blogs.oracle.com/robertlor/entry/ofbiz_and_postgresql
 
Your check made me realize the db was name "ofbizdb" and not "ofbiz". Once that was fixed it worked. I still need to see if I can make it work for a simple store cash register function (with later addition of online sales), but permission issues seem to be gone.
 
Incidentally, the sample data "initialsetup" page lists several fields for the Party Id "Company", and although groups are explained, can someone tell me the difference and meaning for "Group Name Local" and "Office Site Name" versus just "Group Name"? My setup is for a single store with no external warehouse and no other offices, I'm unsure of what the intent was with those fields.
 
Thanks!
 
----- Original Message -----From: Mike <[hidden email]>To: user <[hidden email]>Sent: Mon, 13 Mar 2017 04:28:34 -0000 (UTC)Subject: Re: Current PostgreSQL Instructions

You should be able to, as the user running ofbiz, type the following. TheIP must match what is in the file: entityengine.xml

psql -h IP_OF_DB_HOST -U ofbiz -d ofbiz[ENTER PASSWORD] ("ofbiz")

If the above doesn't work, then you may need to tweak the postgresfile: pg_hba.conf, and perform a postgresql "reload" (or restart): Examples:

host all all 0.0.0.0/0 md5host all all 127.0.0.1/32 md5local all all peer

Depend on that you have locally setup. For your entityengine.xml, use

<group-map group-name="org.ofbiz" datasource-name="localpostnew"/>

[localpostnew is superior]

Under the localpostnew section, make sure you have:

<inline-jdbc jdbc-driver="org.postgresql.Driver" jdbc-uri="jdbc:postgresql://IP_OF_DB_HOST/ofbiz" jdbc-username="ofbiz" jdbc-password="ofbiz"

Also, to have ofbiz re-init the database, it first has to exist:

postgres> CREATE DATABASE ofbiz;

Remember, use the "psql" command above to test whether ofbiz can properlylogin as he user "dan". A better test:

dan> psql -h IP_OF_DB_HOST -U ofbiz -d ofbiz -c "CREATE DATABASE ofbiz;"[ENTER PASSWORD] ("ofbiz")

Good luck

On Sun, Mar 12, 2017 at 7:23 PM, <[hidden email]> wrote:

> Hi,>> ...logged in to psql as user postgres...> psql (9.4.9)Type "help" for help. postgres=# \du> List of roles Role name | Attributes> | Member of -----------+------------------------------------------------+-----------> ofbiz | Create role, Create DB, Replication | {} dan |> Create role, Create DB, Replication | {} postgres | Superuser,> Create role, Create DB, Replication | {}> Earlier I had fewer permissions, errors changed to transaction errors> after adding more permissions/roles to user ofbiz in PostgreSQL. I'm> wondering, since I'm running ofbiz from my regular system account user> (user ofbiz exists only in PostgreSQL and is not a system account), yet> seeing failures in file reads from my regular user (ofbiz is located in> ~dan/ofbiz/), if perhaps some aspect of the SQL query is somehow unable to> read files because of an suid within ofbiz? Ofbiz is run in "~dan/ofbiz/"> as user dan via "./gradlew loadDefault"...I would think that any file reads> would be as user dan, but apparently this isn't true. Example failure:> 2017-03-12 19:07:26,728 |main |EntityDataLoadContainer> |I| [loadData]: Error loading XML Resource "file:/home/dan/ofbiz/> framework/security/data/SecurityPermissionSeedData.xml"; Error was: A> transaction error occurred reading data> Basically user "dan" running gradlew cannot read his own file verified to> be accessible in /home/dan/ofbiz/framework/security/data/SecurityPermissionSeedData.xml> as if he isn't really user dan. Is gradlew performing some sort of sudo and> reading files as someone other than the user that starts gradlew?>> Thanks!>> ----- Original Message -----From: Mike <[hidden email]>To: user <> [hidden email]>Sent: Mon, 13 Mar 2017 01:55:09 -0000 (UTC)Subject:> Re: Current PostgreSQL Instructions>> What is your output using "\du ofbiz">> postgres=# \du ofbiz List of roles Role name | Attributes | Member> of-----------+------------+----------- ofbiz | Create DB | {}>> On Sun, Mar 12, 2017 at 2:57 PM, <[hidden email]> wrote:>> > Hi,>> I'm just trying to evaluate ofbiz for some simple POS needs (which> is of> course not really simple). I see there is a lot of ofbiz> development> activity, and thus a lot of documents which are actually out> of date.> Sometimes for example the instructions use "ant" directly and do> not know> of the gradlew command. In entityengine.xml information I> sometimes see> PostgreSQL info which refers to "org.ofbiz", but this is out> of date and is> actually "org.apache.ofbiz". The little things like that> are derailing me.>> To make a long story short, I have PostgreSQL running> on Fedora, and> apache-ofbiz-16.11.01 working with Derby, but need to> change to PostgreSQL> (and PostgreSQL is up and running with both my> regular user and with> "ofbiz/ofbiz" name/pass), and getting connection> refused (I can manually> run commands such as createdb and dropdb without> issue). Basically there is> some small detail I'm missing and am wondering> if there is current> documentation on setting up ofbiz with PostgreSQL> which I'm missing?>> I really like this documentation...but unfortunately> it is wrong (out of> date):> https://cwiki.apache.org/> confluence/display/OFBIZ/Apache+OFBiz+Technical+>> Production+Setup+Guide>> This in turn points out a lot of facts through> here:> https://cwiki.apache.org/confluence/display/OFBIZ/>> Entity+Engine+Configuration+Guide>> ...but I'm more interested in getting> it working and that information> appears to only be for people who already> understand ofbiz setup (there are> a lot of facts there and no example> which works with 16.11.01). I was under> the impression that if PostgreSQL> were set up and the ofbiz name/pass is> able to create tables then the> "gradlew loadDefault" would be able to load> sample data into PostgreSQL> without manually creating each table. Am I> incorrect on this? Do I need to> manually create tables? I can attach my> entityengine.xml edits, but wanted> to know first if there are explicit> instructions somewhere for the current> 16.11.01 (I am not interested in> customization and developing new apps, I> just want to see the minimal> sample data using PostgreSQL).>> Thanks!>
Reply | Threaded
Open this post in threaded view
|

Re: Current PostgreSQL Instructions

Mike Z
OK, that blog was a good reference, but it doesn't go far enough.  If you
don't want absolutely horrible performance, you absolutely NEED to tune
postgresql.  Remember, ofbiz has over 800 tables, which is huge by any
standard.  Here is a basic guide:

1) Find out where the postgresql.conf file is.  On some systems (ubuntu),
it's in /etc/postgresql/9.4/main or similar

2) Run "pgtune" and let it create a new config file, tuned to the system
(you may have to install it first)... Example

# pgtune -i postgresql.conf -o postgresql.conf.pgtune -T Web

3) Look at the bottom of postgresql.conf.pgtune, add these entries to your
postgresql.conf

#
------------------------------------------------------------------------------
# CUSTOMIZED OPTIONS
#------------------------------------------------------------------------------

#custom_variable_classes = ''           # list of custom variable class
names
maintenance_work_mem = 1GB # pgtune wizard 2017-03-13
checkpoint_completion_target = 0.7 # pgtune wizard 2017-03-13
effective_cache_size = 22GB # pgtune wizard 2017-03-13
work_mem = 160MB # pgtune wizard 2017-03-13
wal_buffers = 4MB # pgtune wizard 2017-03-13
checkpoint_segments = 8 # pgtune wizard 2017-03-13
shared_buffers = 7680MB # pgtune wizard 2017-03-13
max_connections = 200 # pgtune wizard 2017-03-13

You can see "22GB" above... My sample system has 32GB of ram.

4) Restart postgresql... It might complain about "shared memory".  That
needs to be placed in /etc/sysctl.conf... Examples:

kernel.shmmax = 16870928384

Don't use the above number!...  Use the number provided by the postgresql
logs (or console) during restart.

5) Reload /etc/sysctl.conf, if necessary, restart postgresql, if necessary.

# sysctl -p
# /etc/init.d/postgres restart

If you don't tune postgresql, its performance will be as lousy... Maybe not
as bad as derby.


On Mon, Mar 13, 2017 at 1:42 PM, <[hidden email]> wrote:

> Hi,
>
> I had been using this as reference:
> https://blogs.oracle.com/robertlor/entry/ofbiz_and_postgresql
>
> Your check made me realize the db was name "ofbizdb" and not "ofbiz". Once
> that was fixed it worked. I still need to see if I can make it work for a
> simple store cash register function (with later addition of online sales),
> but permission issues seem to be gone.
>
> Incidentally, the sample data "initialsetup" page lists several fields for
> the Party Id "Company", and although groups are explained, can someone tell
> me the difference and meaning for "Group Name Local" and "Office Site Name"
> versus just "Group Name"? My setup is for a single store with no external
> warehouse and no other offices, I'm unsure of what the intent was with
> those fields.
>
> Thanks!
>
> ----- Original Message -----From: Mike <[hidden email]>To: user <
> [hidden email]>Sent: Mon, 13 Mar 2017 04:28:34 -0000 (UTC)Subject:
> Re: Current PostgreSQL Instructions
>
> You should be able to, as the user running ofbiz, type the following.
> TheIP must match what is in the file: entityengine.xml
>
> psql -h IP_OF_DB_HOST -U ofbiz -d ofbiz[ENTER PASSWORD] ("ofbiz")
>
> If the above doesn't work, then you may need to tweak the postgresfile:
> pg_hba.conf, and perform a postgresql "reload" (or restart): Examples:
>
> host all all 0.0.0.0/0 md5host all all 127.0.0.1/32 md5local all all peer
>
> Depend on that you have locally setup. For your entityengine.xml, use
>
> <group-map group-name="org.ofbiz" datasource-name="localpostnew"/>
>
> [localpostnew is superior]
>
> Under the localpostnew section, make sure you have:
>
> <inline-jdbc jdbc-driver="org.postgresql.Driver"
> jdbc-uri="jdbc:postgresql://IP_OF_DB_HOST/ofbiz" jdbc-username="ofbiz"
> jdbc-password="ofbiz"
>
> Also, to have ofbiz re-init the database, it first has to exist:
>
> postgres> CREATE DATABASE ofbiz;
>
> Remember, use the "psql" command above to test whether ofbiz can
> properlylogin as he user "dan". A better test:
>
> dan> psql -h IP_OF_DB_HOST -U ofbiz -d ofbiz -c "CREATE DATABASE
> ofbiz;"[ENTER PASSWORD] ("ofbiz")
>
> Good luck
>
> On Sun, Mar 12, 2017 at 7:23 PM, <[hidden email]> wrote:
>
> > Hi,>> ...logged in to psql as user postgres...> psql (9.4.9)Type "help"
> for help. postgres=# \du> List of roles Role name | Attributes> | Member of
> -----------+------------------------------------------------+----------->
> ofbiz | Create role, Create DB, Replication | {} dan |> Create role, Create
> DB, Replication | {} postgres | Superuser,> Create role, Create DB,
> Replication | {}> Earlier I had fewer permissions, errors changed to
> transaction errors> after adding more permissions/roles to user ofbiz in
> PostgreSQL. I'm> wondering, since I'm running ofbiz from my regular system
> account user> (user ofbiz exists only in PostgreSQL and is not a system
> account), yet> seeing failures in file reads from my regular user (ofbiz is
> located in> ~dan/ofbiz/), if perhaps some aspect of the SQL query is
> somehow unable to> read files because of an suid within ofbiz? Ofbiz is run
> in "~dan/ofbiz/"> as user dan via "./gradlew loadDefault"...I would think
> that any file reads> would be as user dan, but apparently this isn't true.
> Example failure:> 2017-03-12 19:07:26,728 |main |EntityDataLoadContainer>
> |I| [loadData]: Error loading XML Resource "file:/home/dan/ofbiz/>
> framework/security/data/SecurityPermissionSeedData.xml"; Error was: A>
> transaction error occurred reading data> Basically user "dan" running
> gradlew cannot read his own file verified to> be accessible in
> /home/dan/ofbiz/framework/security/data/SecurityPermissionSeedData.xml>
> as if he isn't really user dan. Is gradlew performing some sort of sudo
> and> reading files as someone other than the user that starts gradlew?>>
> Thanks!>> ----- Original Message -----From: Mike <[hidden email]>To:
> user <> [hidden email]>Sent: Mon, 13 Mar 2017 01:55:09 -0000
> (UTC)Subject:> Re: Current PostgreSQL Instructions>> What is your output
> using "\du ofbiz">> postgres=# \du ofbiz List of roles Role name |
> Attributes | Member> of-----------+------------+----------- ofbiz |
> Create DB | {}>> On Sun, Mar 12, 2017 at 2:57 PM, <[hidden email]>
> wrote:>> > Hi,>> I'm just trying to evaluate ofbiz for some simple POS
> needs (which> is of> course not really simple). I see there is a lot of
> ofbiz> development> activity, and thus a lot of documents which are
> actually out> of date.> Sometimes for example the instructions use "ant"
> directly and do> not know> of the gradlew command. In entityengine.xml
> information I> sometimes see> PostgreSQL info which refers to "org.ofbiz",
> but this is out> of date and is> actually "org.apache.ofbiz". The little
> things like that> are derailing me.>> To make a long story short, I have
> PostgreSQL running> on Fedora, and> apache-ofbiz-16.11.01 working with
> Derby, but need to> change to PostgreSQL> (and PostgreSQL is up and running
> with both my> regular user and with> "ofbiz/ofbiz" name/pass), and getting
> connection> refused (I can manually> run commands such as createdb and
> dropdb without> issue). Basically there is> some small detail I'm missing
> and am wondering> if there is current> documentation on setting up ofbiz
> with PostgreSQL> which I'm missing?>> I really like this
> documentation...but unfortunately> it is wrong (out of> date):>
> https://cwiki.apache.org/> confluence/display/OFBIZ/Apache+OFBiz+Technical+>>
> Production+Setup+Guide>> This in turn points out a lot of facts through>
> here:> https://cwiki.apache.org/confluence/display/OFBIZ/>>
> Entity+Engine+Configuration+Guide>> ...but I'm more interested in
> getting> it working and that information> appears to only be for people who
> already> understand ofbiz setup (there are> a lot of facts there and no
> example> which works with 16.11.01). I was under> the impression that if
> PostgreSQL> were set up and the ofbiz name/pass is> able to create tables
> then the> "gradlew loadDefault" would be able to load> sample data into
> PostgreSQL> without manually creating each table. Am I> incorrect on this?
> Do I need to> manually create tables? I can attach my> entityengine.xml
> edits, but wanted> to know first if there are explicit> instructions
> somewhere for the current> 16.11.01 (I am not interested in> customization
> and developing new apps, I> just want to see the minimal> sample data using
> PostgreSQL).>> Thanks!>
>
Reply | Threaded
Open this post in threaded view
|

Re: Current PostgreSQL Instructions

Jacques Le Roux
Administrator
Thanks Mike

This deserves and entry in the OFBiz FAQ!

Jacques


Le 13/03/2017 à 23:49, Mike a écrit :

> OK, that blog was a good reference, but it doesn't go far enough.  If you
> don't want absolutely horrible performance, you absolutely NEED to tune
> postgresql.  Remember, ofbiz has over 800 tables, which is huge by any
> standard.  Here is a basic guide:
>
> 1) Find out where the postgresql.conf file is.  On some systems (ubuntu),
> it's in /etc/postgresql/9.4/main or similar
>
> 2) Run "pgtune" and let it create a new config file, tuned to the system
> (you may have to install it first)... Example
>
> # pgtune -i postgresql.conf -o postgresql.conf.pgtune -T Web
>
> 3) Look at the bottom of postgresql.conf.pgtune, add these entries to your
> postgresql.conf
>
> #
> ------------------------------------------------------------------------------
> # CUSTOMIZED OPTIONS
> #------------------------------------------------------------------------------
>
> #custom_variable_classes = ''           # list of custom variable class
> names
> maintenance_work_mem = 1GB # pgtune wizard 2017-03-13
> checkpoint_completion_target = 0.7 # pgtune wizard 2017-03-13
> effective_cache_size = 22GB # pgtune wizard 2017-03-13
> work_mem = 160MB # pgtune wizard 2017-03-13
> wal_buffers = 4MB # pgtune wizard 2017-03-13
> checkpoint_segments = 8 # pgtune wizard 2017-03-13
> shared_buffers = 7680MB # pgtune wizard 2017-03-13
> max_connections = 200 # pgtune wizard 2017-03-13
>
> You can see "22GB" above... My sample system has 32GB of ram.
>
> 4) Restart postgresql... It might complain about "shared memory".  That
> needs to be placed in /etc/sysctl.conf... Examples:
>
> kernel.shmmax = 16870928384
>
> Don't use the above number!...  Use the number provided by the postgresql
> logs (or console) during restart.
>
> 5) Reload /etc/sysctl.conf, if necessary, restart postgresql, if necessary.
>
> # sysctl -p
> # /etc/init.d/postgres restart
>
> If you don't tune postgresql, its performance will be as lousy... Maybe not
> as bad as derby.
>
>
> On Mon, Mar 13, 2017 at 1:42 PM, <[hidden email]> wrote:
>
>> Hi,
>>
>> I had been using this as reference:
>> https://blogs.oracle.com/robertlor/entry/ofbiz_and_postgresql
>>
>> Your check made me realize the db was name "ofbizdb" and not "ofbiz". Once
>> that was fixed it worked. I still need to see if I can make it work for a
>> simple store cash register function (with later addition of online sales),
>> but permission issues seem to be gone.
>>
>> Incidentally, the sample data "initialsetup" page lists several fields for
>> the Party Id "Company", and although groups are explained, can someone tell
>> me the difference and meaning for "Group Name Local" and "Office Site Name"
>> versus just "Group Name"? My setup is for a single store with no external
>> warehouse and no other offices, I'm unsure of what the intent was with
>> those fields.
>>
>> Thanks!
>>
>> ----- Original Message -----From: Mike <[hidden email]>To: user <
>> [hidden email]>Sent: Mon, 13 Mar 2017 04:28:34 -0000 (UTC)Subject:
>> Re: Current PostgreSQL Instructions
>>
>> You should be able to, as the user running ofbiz, type the following.
>> TheIP must match what is in the file: entityengine.xml
>>
>> psql -h IP_OF_DB_HOST -U ofbiz -d ofbiz[ENTER PASSWORD] ("ofbiz")
>>
>> If the above doesn't work, then you may need to tweak the postgresfile:
>> pg_hba.conf, and perform a postgresql "reload" (or restart): Examples:
>>
>> host all all 0.0.0.0/0 md5host all all 127.0.0.1/32 md5local all all peer
>>
>> Depend on that you have locally setup. For your entityengine.xml, use
>>
>> <group-map group-name="org.ofbiz" datasource-name="localpostnew"/>
>>
>> [localpostnew is superior]
>>
>> Under the localpostnew section, make sure you have:
>>
>> <inline-jdbc jdbc-driver="org.postgresql.Driver"
>> jdbc-uri="jdbc:postgresql://IP_OF_DB_HOST/ofbiz" jdbc-username="ofbiz"
>> jdbc-password="ofbiz"
>>
>> Also, to have ofbiz re-init the database, it first has to exist:
>>
>> postgres> CREATE DATABASE ofbiz;
>>
>> Remember, use the "psql" command above to test whether ofbiz can
>> properlylogin as he user "dan". A better test:
>>
>> dan> psql -h IP_OF_DB_HOST -U ofbiz -d ofbiz -c "CREATE DATABASE
>> ofbiz;"[ENTER PASSWORD] ("ofbiz")
>>
>> Good luck
>>
>> On Sun, Mar 12, 2017 at 7:23 PM, <[hidden email]> wrote:
>>
>>> Hi,>> ...logged in to psql as user postgres...> psql (9.4.9)Type "help"
>> for help. postgres=# \du> List of roles Role name | Attributes> | Member of
>> -----------+------------------------------------------------+----------->
>> ofbiz | Create role, Create DB, Replication | {} dan |> Create role, Create
>> DB, Replication | {} postgres | Superuser,> Create role, Create DB,
>> Replication | {}> Earlier I had fewer permissions, errors changed to
>> transaction errors> after adding more permissions/roles to user ofbiz in
>> PostgreSQL. I'm> wondering, since I'm running ofbiz from my regular system
>> account user> (user ofbiz exists only in PostgreSQL and is not a system
>> account), yet> seeing failures in file reads from my regular user (ofbiz is
>> located in> ~dan/ofbiz/), if perhaps some aspect of the SQL query is
>> somehow unable to> read files because of an suid within ofbiz? Ofbiz is run
>> in "~dan/ofbiz/"> as user dan via "./gradlew loadDefault"...I would think
>> that any file reads> would be as user dan, but apparently this isn't true.
>> Example failure:> 2017-03-12 19:07:26,728 |main |EntityDataLoadContainer>
>> |I| [loadData]: Error loading XML Resource "file:/home/dan/ofbiz/>
>> framework/security/data/SecurityPermissionSeedData.xml"; Error was: A>
>> transaction error occurred reading data> Basically user "dan" running
>> gradlew cannot read his own file verified to> be accessible in
>> /home/dan/ofbiz/framework/security/data/SecurityPermissionSeedData.xml>
>> as if he isn't really user dan. Is gradlew performing some sort of sudo
>> and> reading files as someone other than the user that starts gradlew?>>
>> Thanks!>> ----- Original Message -----From: Mike <[hidden email]>To:
>> user <> [hidden email]>Sent: Mon, 13 Mar 2017 01:55:09 -0000
>> (UTC)Subject:> Re: Current PostgreSQL Instructions>> What is your output
>> using "\du ofbiz">> postgres=# \du ofbiz List of roles Role name |
>> Attributes | Member> of-----------+------------+----------- ofbiz |
>> Create DB | {}>> On Sun, Mar 12, 2017 at 2:57 PM, <[hidden email]>
>> wrote:>> > Hi,>> I'm just trying to evaluate ofbiz for some simple POS
>> needs (which> is of> course not really simple). I see there is a lot of
>> ofbiz> development> activity, and thus a lot of documents which are
>> actually out> of date.> Sometimes for example the instructions use "ant"
>> directly and do> not know> of the gradlew command. In entityengine.xml
>> information I> sometimes see> PostgreSQL info which refers to "org.ofbiz",
>> but this is out> of date and is> actually "org.apache.ofbiz". The little
>> things like that> are derailing me.>> To make a long story short, I have
>> PostgreSQL running> on Fedora, and> apache-ofbiz-16.11.01 working with
>> Derby, but need to> change to PostgreSQL> (and PostgreSQL is up and running
>> with both my> regular user and with> "ofbiz/ofbiz" name/pass), and getting
>> connection> refused (I can manually> run commands such as createdb and
>> dropdb without> issue). Basically there is> some small detail I'm missing
>> and am wondering> if there is current> documentation on setting up ofbiz
>> with PostgreSQL> which I'm missing?>> I really like this
>> documentation...but unfortunately> it is wrong (out of> date):>
>> https://cwiki.apache.org/> confluence/display/OFBIZ/Apache+OFBiz+Technical+>>
>> Production+Setup+Guide>> This in turn points out a lot of facts through>
>> here:> https://cwiki.apache.org/confluence/display/OFBIZ/>>
>> Entity+Engine+Configuration+Guide>> ...but I'm more interested in
>> getting> it working and that information> appears to only be for people who
>> already> understand ofbiz setup (there are> a lot of facts there and no
>> example> which works with 16.11.01). I was under> the impression that if
>> PostgreSQL> were set up and the ofbiz name/pass is> able to create tables
>> then the> "gradlew loadDefault" would be able to load> sample data into
>> PostgreSQL> without manually creating each table. Am I> incorrect on this?
>> Do I need to> manually create tables? I can attach my> entityengine.xml
>> edits, but wanted> to know first if there are explicit> instructions
>> somewhere for the current> 16.11.01 (I am not interested in> customization
>> and developing new apps, I> just want to see the minimal> sample data using
>> PostgreSQL).>> Thanks!>
>>