Issue creating databases/users after 3.0.5.1 upgrade, multiserver setup

Discussion in 'General' started by snowfly, Mar 18, 2013.

  1. snowfly

    snowfly Member

    Hi,
    Firstly thank you to Falko, Till, and all the other developers/contributors on ISPConfig 3.0.5.1, good work.

    Just begun upgrading a multiserver setup today, all gone well, except for the new change to database-user relationship.

    We heavily use the API into our own billing control panel.
    So for now to keep similar functionality as pre-3.0.5, our CP creates one database with one database user.

    However can't get this to work on remote servers.
    Steps:
    1. Create database user: sites_database_user_add()
    2. Create database (with user_id from above): sites_database_add()

    This is successful if creating a database on the primary ISPConfig server (e.g. server-CP).
    But fails if creating a databaase on a remote server (e.g. server-webX)

    The database is created on the remote server, but the user is not.

    Checked the primary ISPConfig server 'dbispconfig' database, the 'web_database' table correctly shows both databases, and the 'web_database_user' correctly shows both users, with correct server_id's (1 for primary, and 14 for remote)

    Then checked the remote ISPConfig server 'dbispconfig' database, 'web_database' record is correct, but 'web_database_user' does not have user record.

    So looks like the remote server does not process the 'sites_database_user_add' command from the primary queue.

    Have I missed something?
     
  2. snowfly

    snowfly Member

    Update:

    Q: Do databases now need to be linked to a client website (parent_domain_id) using the API in 3.0.5.1?
    Previously databases were linked to a client itself, not a website

    The API example for sites_database_add() does not appear to take a 'parent_domain_id' param, only a $client_id.
    BUT, in the dbispconfig.web_database table there is a parent_domain_id field, which appears to be populated when using the original ISPConfig web interface.

    Upon further inspection, when using the original ISPConfig web interface to create a DB+User on a remote server, sys_datalog contains a record like:
    dbtable=web_database_user, dbidx=database_user_id:376, action=i
    (which suggests insert)

    But when creating a DB and user with the API, there is no sys_datalog entry for web_database_user.
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes. Databases are now assigned to a website so that the database backup can be included in the website backup. The client selector has been removed as the owendershoip can be determined trogh the website ownership.

    CReate the database user first with the api and then create the db and assign the db to the database user. If a database user exists already that you want to reuse, then you dont have to create a new one.
     
  4. snowfly

    snowfly Member


    Our API scripts were creating the database first, and then the database itself.

    Found the problem, we were not passing 'parent_domain_id' into sites_database_add(), as per the API examples.

    Once we added 'parent_domain_id', the database would then get created successfully on the remote server.

    Interestingly, all our existing databases (pre 3.0.5.1) do not have a 'parent_domain_id' relationship, and we can still update database passwords ok on remote server. Thanks for the backwards compatibility.
     

Share This Page