Hosting Detached Code on AWS Instance

Hosting Detached Code on AWS Instance

  
Hi,

I am looking to evaluate the detach functionality of Outsystems using the No-lockin tutorial.

Steps Followed:

1) Detached the code
2) Published the Code
3) Create an AWS instance with required configuration to host the Detached App on it
4) Hosted the app on IIS
5) Made changes in the machine.config file by including <appSettings> tag

After this when I try to open the application, I receive a configuration error related to connection string

I have modified the appSettings tab as below by adding

"user id=user; password=password; data source=database; initial catalog=catalog;" to each connection string

<add key="OutSystems.DB.Services.Session.ConnectionString (DEFAULT)" value="$2$GzjkRG4xyg4k4qaBoHNQ1Q==I72g79nIWiz3gmf4qG4OeB5XhLv6JkSVnqo7oj9j8xzqbgAdbhStUQargqVwu6x0epJ9mS09xDEicWMegmu9ubJAgIpo6jSmUHM0IlIH0cuUtFO08H7xy0riNSXhS6dF3jZ7TyETDd3yy4KA5I4BMA=="; OSState="WIN-K57AK3ECP4P\nvimal"; password="Pki@2016int"; data source="DemoDB"; initial catalog="ASPState"/>

Is this the correct way of modifying or declaring the connection string? 
Am I missing any step from above as I am getting the config error.

I suppose this error means that the app is not able to connect with the database. 

Please advise/help 

Best,
Vimal

Hi Vimal,

1) To successfully run the detach tutorial, you need an on-premises installation of the OutSystems Platform, where you can copy your database from. 
In the list of steps you did, I see no reference to a database, so i wonder if you taken care of that or not.

2) Assuming you do have a database...

In your connection string, instead of
OSState=""WIN-K57AK3ECP4P\nvimal"

you should have
user id=OSState

I strongly suggest you test the connection string (user id, password, data source and initial catalog) in another application first (e.g. ODBC Data Source Administrator), to rule out trivial configuration problems.


Joao

João Santos wrote:
Hi Vimal,

1) To successfully run the detach tutorial, you need an on-premises installation of the OutSystems Platform, where you can copy your database from. 
In the list of steps you did, I see no reference to a database, so i wonder if you taken care of that or not.

2) Assuming you do have a database...

In your connection string, instead of
OSState=""WIN-K57AK3ECP4P\nvimal"

you should have
user id=OSState

I strongly suggest you test the connection string (user id, password, data source and initial catalog) in another application first (e.g. ODBC Data Source Administrator), to rule out trivial configuration problems.


Joao
 
 Appreciate for the reply Joao.

I am having On-premise installation and trying out this for it.

In th screenshot attached I see that it is given as below:

c. SQL Server
user id=user; password=password; data source=database; initial catalog=catalog;

and in the table of screenshot , OSState was under user id column so I tried that way.

However what I have done is copy the <appsettings> tag from the machine.config of my on-premise server and pasted in the new AWS instance (WIN-K57AK3ECP4P) and made the modifications.

in the AWS instance I have SQL Server installed and I created a database with name DemoDB and trying to point the connection string to this DB.

I'm sorry as I'm a bit new to this stuff, so could you please let me know how can I test the connection string in an application? Do you mean by configuring it as an external DB by providing the details and see if its connected? 

Also what is the database for entities created in an Outsystems app? Do I have to install the same database when detaching the app using the database. I 'm a bit lost here understanding how to link the database when app is detached.

Any help is sincerely appreciated. 

Best
Vimal
Hi Vimal,

The detached application relies on information stored in the database, so you need to copy your existing OutSystems database to your AWS test instance.
If you start a new database you won't go very far. Even if you succeed in connecting, you will get lots of runtime errors as the application initialization tries to fetch info from the database that is not there.

To test the connection string, you can use ODBC Data Source Administrator to configure the connection string.
Once you have a working connection string (e.g. that you can successsfully test in ODBC Administrator) you can then copy it to your app settings.

In the line 
user id=user; password=password; data source=database; initial catalog=catalog;

these are key/value pairs, where the key is a literal constant and the value is a variable.

So, user id is a literal constant and user is a variable. In this case, user is the SQL Server user that you are logging in to SQL Server with.

Joao

João Santos wrote:
Hi Vimal,

The detached application relies on information stored in the database, so you need to copy your existing OutSystems database to your AWS test instance.
If you start a new database you won't go very far. Even if you succeed in connecting, you will get lots of runtime errors as the application initialization tries to fetch info from the database that is not there.

To test the connection string, you can use ODBC Data Source Administrator to configure the connection string.
Once you have a working connection string (e.g. that you can successsfully test in ODBC Administrator) you can then copy it to your app settings.

In the line 
user id=user; password=password; data source=database; initial catalog=catalog;

these are key/value pairs, where the key is a literal constant and the value is a variable.

So, user id is a literal constant and user is a variable. In this case, user is the SQL Server user that you are logging in to SQL Server with.

Joao
 Thanks a lot Joao. Sounds dumb but could you please let me know where can I find the existing DB to COPY and where should I be pasting it to in AWS. Also, I'll give it a try and get back on this. 
 
Well, it's probably easier to get help from one of your colleagues. Whoever installed your OutSystems Platform must know exactly where your current OutSystems database is.
If not, you can use the OutSystems Configuration Tool application, which you can run locally on your OutSystems Platform server: http://www.outsystems.com/help/configurationtool/4.1/Database_Tab_in_SQL_Server.htm.

There are different methods to copy databases. The most traditional is a backup/restore:
https://msdn.microsoft.com/en-us/library/ms187048.aspx.

Joao


João Santos wrote:
Well, it's probably easier to get help from one of your colleagues. Whoever installed your OutSystems Platform must know exactly where your current OutSystems database is.
If not, you can use the OutSystems Configuration Tool application, which you can run locally on your OutSystems Platform server: http://www.outsystems.com/help/configurationtool/4.1/Database_Tab_in_SQL_Server.htm.

There are different methods to copy databases. The most traditional is a backup/restore:
https://msdn.microsoft.com/en-us/library/ms187048.aspx.

Joao

Great!! Thanks!!
 
 
Vimal Abhishek wrote:
João Santos wrote:
Well, it's probably easier to get help from one of your colleagues. Whoever installed your OutSystems Platform must know exactly where your current OutSystems database is.
If not, you can use the OutSystems Configuration Tool application, which you can run locally on your OutSystems Platform server: http://www.outsystems.com/help/configurationtool/4.1/Database_Tab_in_SQL_Server.htm.

There are different methods to copy databases. The most traditional is a backup/restore:
https://msdn.microsoft.com/en-us/library/ms187048.aspx.

Joao

Great!! Thanks!!
 Hi,

I have been trying to copy the database "outsystems" from the on-premise server and to restore it on AWS SQL server. Using the outsystems configuration tool I could see the users as OSLOg, OSRuntime, OSAdmin but could not get the passwords for these. Is it possible to get the passwords for these as I'll have to use them while configuring in the machine.config file. Please correct me if I'm wrong or missing anything here

Thanks,
Vimal
 
 
 
You can reset the password of those users in SQL Server Management Studio, on your AWS database.
João Santos wrote:
You can reset the password of those users in SQL Server Management Studio, on your AWS database.
 Cool. Thanks!!
 
Vimal Abhishek wrote:
João Santos wrote:
You can reset the password of those users in SQL Server Management Studio, on your AWS database.
 Cool. Thanks!!
 
Hi these are the steps I followed:

1) Took a backup of "outsystems" database having users OSADMIN, OSLog etc.
2) Imported that into AWS DB
3) Added my windows login to this DB
4) My windows login is a sysadmin and securityadmin as well
5) Tried pasword reset for OSADMIN using 
ALTER LOGIN OSADMIN
WITH PASSWORD = '[outsystems]'

but I get an error as 

Msg 15151, Level 16, State 1, Line 10
Cannot alter the login 'OSADMIN', because it does not exist or you do not have permission.

I am not able to change the passwords even though I'm logged as sysadmin

Any suggestions on how this can be solved? or need to be dealt with

Thank You

Vimal
 
 
Do you have mixed mode authentication enabled on your sql server ?
João Santos wrote:
Do you have mixed mode authentication enabled on your sql server ?
 No . Do I have to enable it and login with SA to try password reset?
 
OSADMIN is not a domain user, so you need mixed mode enabled to use it. It makes sense that sql server does not let you change password if you cannot use it.
João Santos wrote:
OSADMIN is not a domain user, so you need mixed mode enabled to use it. It makes sense that sql server does not let you change password if you cannot use it.

oh ok. Will work on this and get back. Thanks!!
 
 
João Santos wrote:
OSADMIN is not a domain user, so you need mixed mode enabled to use it. It makes sense that sql server does not let you change password if you cannot use it.
 Hi Joao,

I was able to change the passwords for outsystems database on the AWS SQL Server and tried declaring the connection strings in machine.config as follows:

<connectionStrings>
 <add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
<add name="OutSystems.DB.Services.Log.ConnectionString" connectionString="user id=OSLog; password=Portal#29; data source=10.40.50.76; initial catalog=Outsystems" providerName="OutSystemsSessionProvider"/>
<add name="OutSystems.DB.Application.Log.ConnectionString" connectionString="user id=OSLog; password=Portal#29; data source=10.40.50.76; initial catalog=Outsystems" providerName="OutSystemsSessionProvider"/>
<add name="OutSystems.DB.Services.Session.ConnectionString" connectionString="user id=OSState; password=Portal#29; data source=10.40.50.76; initial catalog=ASPState" providerName="OutSystemsSessionProvider"/>
<add name="OutSystems.DB.Application.Session.ConnectionString" connectionString="user id=OSState; password=Portal#29; data source=10.40.50.76; initial catalog=ASPState" providerName="OutSystemsSessionProvider"/>
<add name="OutSystems.DB.Services.Runtime.ConnectionString" connectionString="user id=OSRuntime; password=Portal#29; data source=10.40.50.76; initial catalog=Outsystems" providerName="OutSystemsSessionProvider"/>
<add name="OutSystems.DB.Application.Runtime.ConnectionString" connectionString="user id=OSRuntime; password=Portal#29; data source=10.40.50.76; initial catalog=Outsystems" providerName="OutSystemsSessionProvider"/>
<add name="OutSystems.DB.Services.Admin.ConnectionString" connectionString="user id=OSAdmin; password=Portal#29; data source=10.40.50.76; initial catalog=Outsystems" providerName="OutSystemsSessionProvider"/>
    </connectionStrings>

but inspite of this I am getting a configuration error as follows: 

Parser Error Message: Unable to obtain the connection string. Please run Configuration Tool.

I have checked the connection string and it was sucessful

Appreciate if you could please guide what I am missing here. Evaluating this feature is very important for us to go ahead with buying the Outsystems license and it would be great if you could help in solving this. 


Thanks,
Vimal

 
 
Hi vimal,

I have no idea of what may be going wrong.
I could either try to debug the code in Visual Studio, or ask help from OutSystems Support.

E.g. just looking at the source code, you can see that that string is in DatabaseAcess.cs, in 
 
            var conf = RuntimeDatabaseConfigurations.For(pluginProvider, source, user);
            if (conf == null || conf.ConnectionString.IsEmpty()) {
                throw new InvalidOperationException("Unable to obtain the connection string. Please run Configuration Tool.");
            }

Single stepping in this code should give you some insight about where the problem is.
 

Joao
João Santos wrote:
Hi vimal,

I have no idea of what may be going wrong.
I could either try to debug the code in Visual Studio, or ask help from OutSystems Support.

E.g. just looking at the source code, you can see that that string is in DatabaseAcess.cs, in 
 
            var conf = RuntimeDatabaseConfigurations.For(pluginProvider, source, user);
            if (conf == null || conf.ConnectionString.IsEmpty()) {
                throw new InvalidOperationException("Unable to obtain the connection string. Please run Configuration Tool.");
            }

Single stepping in this code should give you some insight about where the problem is.
 

Joao
 Appreciate for the inputs Joao!! I'm wondering if it is something that I'm doing wrong or something that I might be missing to make it work appropriately.

As suggested in the document:

1) I have copy pasted the <appsettings > tag wiht key having “OutSystems.HubEdition” prefix. to the same location on the new server for both 32 bit and 64 bit machine.config files

2) I declared the 7 conenction strings (as shown in the tech notes) inside the <connectionStrings> tag available in the machine.config file

for eg: as <add name="OutSystems.DB.Services.Log.ConnectionString" connectionString="user id=OSLog; password=Portal#29; data source=WIN-MA0EMLFGP8I; initial catalog=Outsystems" providerName="SQL Server"/>

name: connection string name
user id: as provided in instructions
password: that I configured
data source: AWS machine name
initial catalog: as provided in instructions
provider name: tried OutSystemsSessionProvider & SQL Server

Before proceeding with debugging I would like to be sure if there is something that I am missing?

I'll keep working on this but if there is anything that needs my attention to realize that my approach is wrong, Please let me know.

Best,
Vimal

Hi,

Just for reference see my reply to this problem here.

Regards,
João Rosado
Thanks Joao Rosado!!

I tried this and I get an error with OSSTATE login. I already have imported databases outsystems and osSession from the old server to the new machine. I have also checked logging in with OSSTATE user. Appreciate your help on this.

 Cannot open database "ASPState" requested by the login. The login failed.
Login failed for user 'OSSTATE'.


Is there a database called ASPSTATE that I could find on the On-premise Outsystems Server?

Thanks,
Vimal