SurveySolutions connect to cloud database (AWS RDS)

How to run SurveySolutions container on the local machine and connect to cloud providers databases such as AWS RDS and Linode database cluster…

Could someone write the example of docker-compose or docker commands, please :pray::pray::pray:

Because surveysolutions encourage us to do that. SS provides almost clear guidelines, but I still don’t understand and am confused.

Thanks

I suspect that you are using environment value like this:
HQ_ConnectionStrings__DefaultConnection: ‘Server=db;Port=5432;User Id=postgres;Password=pg_password;Database=SurveySolutions’
You need to change it to
HQ_ConnectionStrings__DefaultConnection: ‘Server=RDS_server_IP_address;Port=5432;User Id=postgres;Password=pg_password;Database=SurveySolutions’

1 Like

Silly question for newbies like me: the DB specified in the DB connection needs to exist already–right? Put in other terms, docker-compose simply points to/mounts the external volume, but does not create it–right?

Recall the server installation instructions (Server Installation), where the parameters of the connection to RDS are acquired interactively. You don’t create the DB manually when you launch Survey Solutions, and a few instances later it gets created all by itself. So if the DB doesn’t exist, it will be the same situation as with a fresh install.

(Note the database name is not asked in the screenshot of the installation wizard at this step).

Best, Sergiy

This is the answer I’m looking for but let me try​​ first if something happens, I come back.
Thanks so much.

Hello I run this command:

sudo docker run -p 80:80 --name hq
-e “HQ_Headquarters__TenantName=hq”
-e “HQ_Headquarters__BaseUrl=http://54.119.93.223
-e “HQ_ConnectionStrings__DefaultConnection: Server=database-ss.c7vzdbbmf.ap-southeast-1.rds.amazonaws.com;Port=5432;User Id=postgres;Password=database-SS*-*5432;Database=SurveySolutions”
surveysolutions/surveysolutions:latest

Below the error during run this command:

Unhandled exception. System.ArgumentException: Host can’t be null
at Npgsql.NpgsqlConnectionStringBuilder.Validate()
at Npgsql.NpgsqlConnection.GetPoolAndSettings()
at Npgsql.NpgsqlConnection.set_ConnectionString(String value)
at Npgsql.NpgsqlConnection…ctor(String connectionString)
at WB.Infrastructure.Native.Storage.Postgre.MigrationLock…ctor(String connectionString, Int64 id) in /src/Infrastructure/WB.Infrastructure.Native/Storage/Postgre/MigrationLock.cs:line 15
at WB.Infrastructure.Native.Storage.Postgre.Implementation.DatabaseManagement.CreateDatabase(String connectionString) in /src/Infrastructure/WB.Infrastructure.Native/Storage/Postgre/Implementation/DatabaseManagement.cs:line 29
at WB.Infrastructure.Native.Storage.Postgre.Implementation.DatabaseManagement.InitDatabase(String connectionString, String schemaName) in /src/Infrastructure/WB.Infrastructure.Native/Storage/Postgre/Implementation/DatabaseManagement.cs:line 19
at WB.UI.Headquarters.Services.Quartz.QuartzIntegrationExtensions.RunQuartzMigrations(IServiceProvider services, DbUpgradeSettings dbUpgradeSettings) in /src/UI/WB.UI.Headquarters.Core/Services/Quartz/QuartzIntegrationExtensions.cs:line 96
at WB.UI.Headquarters.Services.Quartz.QuartzIntegrationExtensions.QuartzMigrator.StartAsync(CancellationToken cancellationToken) in /src/UI/WB.UI.Headquarters.Core/Services/Quartz/QuartzIntegrationExtensions.cs:line 142
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at WB.UI.Headquarters.Program.Main(String[] args) in /src/UI/WB.UI.Headquarters.Core/Program.cs:line 32
at WB.UI.Headquarters.Program.(String[] args)
[03:08:13 ERR] Headquarters BackgroundService failed
System.OperationCanceledException: The operation was canceled.
at System.Threading.CancellationToken.ThrowOperationCanceledException()
at System.Threading.ManualResetEventSlim.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at WB.UI.Headquarters.Metrics.DashboardStatisticsService.<>c__DisplayClass7_0.<b__0>d.MoveNext() in /src/UI/WB.UI.Headquarters.Core/Metrics/DashboardStatisticsService.cs:line 45
— End of stack trace from previous location —
at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)
[03:08:13 FTL] Headquarters The HostOptions.BackgroundServiceExceptionBehavior is configured to StopHost. A BackgroundService has thrown an unhandled exception, and the IHost instance is stopping. To avoid this behavior, configure this to Ignore; however the BackgroundService will not be restarted.
System.OperationCanceledException: The operation was canceled.
at System.Threading.CancellationToken.ThrowOperationCanceledException()
at System.Threading.ManualResetEventSlim.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at WB.UI.Headquarters.Metrics.DashboardStatisticsService.<>c__DisplayClass7_0.<b__0>d.MoveNext() in /src/UI/WB.UI.Headquarters.Core/Metrics/DashboardStatisticsService.cs:line 45
— End of stack trace from previous location —
at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)

Please use parametrer for connection string in this way:

-e “HQ_ConnectionStrings__DefaultConnection=Server=database-ss.c7vzdbbmf.ap-southeast-1.rds.amazonaws.com;Port=5432;User Id=postgres;Password=database-SS*-*5432;Database=SurveySolutions”

and ensure that target RDS is reachable from the instance.

1 Like

Thanks, I have the solutions now