Summary

This page contains information on how to create an environment in AppBase.

The environment can be created in two ways:

  • auto-generated environment schema mode
  • existing empty schema mode

Auto-generated environment schema mode environment creation requires a user with DBA privilege and is used when there aren't any specific requirements to the schema name or environment directory names, because all environment properties are configured by the AppBase and an arbitrary schema name is used.

Common use for automatic environment creation is either AppBase Cloud installation or a developers AppBase installation when a DBA user is available for the developer database.

Existing empty schema mode environment creation is most commonly used on UAT or Production environments where it makes more sense to use limited security credentials for AppBase schema users or when particular schema names must be used. For manual environment creation a DBA user creates an empty environment schema and assigns necessary privileges to it - after this AppBase User Interface is used to create database objects in the empty schema necessary for the AppBase environment to function and finalizes the environment creation.

Auto-generated Environment Schema Mode

This mode also known as "automatic environment creation" mode requires a user with DBA role available to AppBase.

It is possible to automatically create AppBase environment from these AppBase forms: New Solution and New Environment.

New Solution AppBase Form

To use New Solution Form you need to have access to the System Setup section:

To automatically create environment when creating new solution you need to simply check the corresponding checkbox on the New Solution form:

After selecting the checkbox the environment properties controls will appear under the checkbox which allow you to modify some of the environment properties:

If you proceed with the solution creation by click "Save" or "Save and New" button then the environment with the selected properties will be created for you after the solution is created.

Disabled automatic solution environment mode

On most AppBase installation the feature to automatically create environment for solution will be disabled:

As it is explained in the help message above the disabled control the feature is disabled because AppBase has not been provided with a DBA user information. This is how most AppBase installations are configured and it is normal to have this feature disabled.

In AppBase versions prior to 6.5 GA SP1 Update 1 this feature was enabled even when there were no DBA user provided for AppBase. Only versions starting from 6.5 GA SP1 Update 1 validate for DBA User. Previous AppBase versions would allow to create environment record and the asynchronous call will fail after that dues to lack of DBA privileges leading to an environment record with empty data connection string in error state.

 

New Environment AppBase Form

AppBase environment cannot be created without a solution. To start creating the environment you need to have a solution created first.

To use New Environment Form you need to have access to the System Setup section:

To create AppBase environment in auto-generated environment schema mode you need to select "Automatically configure server settings" option on the New Environment page and click "Save" or "Save and New" button

 

When using the auto-generated schema mode it is not possible to modify any of the environment properties other than "Environment Name" and "Environment Type".

Disabled automatic environment creation mode

On most AppBase installation the feature to automatically create environment for solution will be disabled:

 As it is explained in the help message above the disabled control the feature is disabled because AppBase has not been provided with a DBA user information. This is how most AppBase installations are configured and it is normal to have this feature disabled.

In AppBase versions prior to 6.5 GA SP1 Update 1 this feature was enabled even when there were no DBA user provided for AppBase. Only versions starting from 6.5 GA SP1 Update 1 validate for DBA User. Previous AppBase versions would allow to create environment record and the asynchronous call will fail after that dues to lack of DBA privileges leading to an environment record with empty data connection string in error state.

Existing Empty Schema Mode

For AppBase versions prior to AppBase 6.5 SP1 we issued this warning:

By default Existing Empty Schema Mode supports only single tenant AppBase installations. Having multiple tenants and using Existing Empty Schema Mode is considered an advanced configuration and is out of the scope of this document

With release of AppBase 6.5 GA SP1 and later versions the above warning is no longer actual for 6.5 GA SP1 and later versions. However it is still actual for the versions prior to AppBase 6.5 GA SP1

User with DBA level access needs to create an empty environment schema. Please refer to this article for the information how to create an empty tenant schema and assign necessary privileges: Pre Installation Steps

1.1 Assigning privileges

 The DBA user must assign correct privileges to the new empty environment schema.

On Oracle and Sql Server databases the ways the privileges are assigned are different. The next two paragraphs explains how to assign the privileges for each database

Oracle Database Environment Schema privileges

For Oracle Database we require the environment schema to have these privileges:

CREATE SESSION, CREATE VIEW, CREATE TRIGGER, CREATE TYPE, CREATE CLUSTER, CREATE INDEXTYPE, CREATE OPERATOR, CREATE PROCEDURE, CREATE SEQUENCE, CREATE TABLE
Sql Server Database Environment Schema privileges

For Sql Server database we require the user created for the environment schema to have db_owner role over its own database schema, for example:

ALTER ROLE [db_owner] ADD MEMBER [ENVIRONMENT_DB]

The above command must be executed on the environment database.

Replace ENVIRONMENT_DB with the user created for the environment schema. Make sure the DBA has created database login for the environment database user.

If AppBase was not provided with real DBAUser and the tenant schema user is used to manage the environment schema objects then the tenant database user must be granted db_owner role in the environment schema.

But first you need to create a database user and a database login for TENANT_DB user inside the environment schema, for example:

CREATE USER [TENANT_DB] FOR LOGIN [TENANT_DB_LOGIN]

The above command must be executed on the environment database.

Replace TENANT_DB with the tenant database user and TENANT_DB_LOGIN with the database login created for the tenant database user.

Then you can assign db_owner role to the tenant database user:

ALTER ROLE [db_owner] ADD MEMBER [TENANT_DB]

The above command must be executed on the environment database.

Replace TENANT_DB with the user created for the tenant schema.

Now the TENANT_DB user can manage objects in the environment schema.

The last thing to do is to assign db_datareader role to the environment schema user in the tenant schema. The environment database has number of views to access some objects from its parent tenant. For that it requires at least db_datareader database role on the tenant database.

To assign that role first you need to create a database user for the environment schema in the tenant schema database:

 CREATE USER [ENVIRONMENT_DB] FOR LOGIN [ENVIRONMENT_DB_LOGIN]

The above command must be executed in the tenant schema database

Replace ENVIRONMENT_DB with the environment database user and ENVIRONMENT_DB_LOGIN with the database login created for the environment database user.

After the environment schema user has been added to the tenant database you need to add it db_datareader role:

ALTER ROLE [db_datareader] ADD MEMBER [ENVIRONMENT_DB]

Replace ENVIRONMENT_DB with the environment database user.

1.2 Assigning schema quotas

It is required to assign at least 1GB of table space quote for environment schema

On Oracle and Sql Server space quotas are managed differently

Oracle Database Environment Schema Quotas

You can use this helpful template:

alter user APPBASE_ENVIRONMENT_01 quota 1000M on users;

The command above uses APPBASE_ENVIRONMENT_01 as the environment schema name and grants 1Gb of space quota on default table space "users". If you use different table space you need to replace "users" with you table space name in the command above

Sql Server Database Environment Schema Quotas

It is required to configure the environment schema space quotas to allow at least 1GB of table space

1.3 Creating Environment

After all previous steps are completed it is now possible to finalize the environment creation in AppBase UI.

Use New Environment form to finalize the environment creation:

Enter the connection string and click 'Save' or 'Save and New' to finalize the environment creation.

The environment creation is asynchronous procedure and it may take some time for the environment finalization to complete. When you click 'Save' or 'Save and New' two things happen:

  1. First record for this environment is created in AppBase. Status of the environment creation can be tracked via this record by using Environment list page
  2. Asynchronous request is sent to the Tenant Windows Service which then provision necessary resources for the environment (creates schema in auto-mode and prepares schema database structure for both modes)

After the asynchronous environment creation request is completed the status of the environment records is updated.

 

Data connection string is validated BEFORE environment is created. AppBase must be able to open a connection to this connection string before the environment is created. If AppBase cannot validate the connection string or cannot open the connection then the environment will NOT be created

In AppBase releases before 6.5 GA SP1 the data connection string was NOT validated before the environment create request was sent. That means that in pre 6.5 GA SP1 it was possible to create an environment record with invalid data connection string but then this environment's creation would never finalized due to the invalid data connection string making this environment record non-operational. The feature to validate data connections string BEFORE saving environment record appeared starting from 6.5 GA SP1 version

 

 

  • No labels