You can install and run Survey Solutions Headquarters using our official Docker image.
Survey Solutions container can be executed on any hosting system that is capable of running linux/amd64 containers. Please refer to docker documentation page on how to install Docker for Your operating system - https://docs.docker.com/get-docker
Survey Solutions has linux based container image and cannot be run in Windows Containers. To run Survey Solutions in Docker on Windows you will need WSL2
You still need to have PostgreSQL server running, there is an example on doing it using docker with docker-compose.
Run Survey Solutions
Note: If you are on a Linux system, you might need to add
sudobefore the commands.
docker run -p 80:80 --name hq \ -e "HQ_Headquarters__TenantName=hq" \ -e "HQ_Headquarters__BaseUrl=http://localhost" \ -e "HQ_ConnectionStrings__DefaultConnection: 'Persist Security Info=true;Server=db;Port=5432;User Id=postgres;Password=pg_password;Database=SurveySolutions" \ surveysolutions/surveysolutions:latest
HQ_Headquarters__TenantNameis required env variable in this release, this setting will be optional in future
HQ_ConnectionStrings__DefaultConnectionConnection String to Postgres instance. For parameters documentation refer to documentation
Survey Solutions has 3 usages of file system that should be persisted: interview binary data (images), asp.net core data protection keys and logs.
When hosting in Docker, aspnet core applications should manage a volume for Data Protection keys: https://docs.microsoft.com/en-us/aspnet/core/security/data-protection/configuration/overview?view=aspnetcore-3.1#persisting-keys-when-hosting-in-a-docker-containe.
Use following volume map to handle:
dataprotection is a volume name.
All images uploaded to HQ during interviews are stored in
Using docker volumes
docker create volume hq_data docker create volume data_protection docker run -p 80:80 --name hq \ -e "HQ_Headquarters__TenantName=hq" \ -e "HQ_Headquarters__BaseUrl=http://localhost" \ -e "HQ_ConnectionStrings__DefaultConnection=Server=db;Port=5432;User Id=postgres;Password=pg_password;Database=SurveySolutions" \ -v "hq_data:/app/AppData" \ -v "data_protection:/root/.aspnet/DataProtection-Keys" \ surveysolutions/surveysolutions:latest
Using local folder
docker run -p 80:80 --name hq \ -e "HQ_Headquarters__TenantName=hq" \ -e "HQ_Headquarters__BaseUrl=http://localhost" \ -e "HQ_ConnectionStrings__DefaultConnection=Server=db;Port=5432;User Id=postgres;Password=pg_password;Database=SurveySolutions" \ -v "./data/app:/app/AppData" \ -v "./data/protection:/root/.aspnet/DataProtection-Keys" \ surveysolutions/surveysolutions:latest
It is possible to run Survey Solutions with SSL in Docker. You can refer to Microsoft documentation on how to run in docker with HTTPS - https://docs.microsoft.com/en-us/aspnet/core/security/docker-compose-https?view=aspnetcore-3.1
Following configuration can be provided to Survey Solutions with enviroment variables
-e ASPNETCORE_Kestrel__Certificates__Default__Path=/ssl/cert.pfx- path to SSL certificate inside docker
-e ASPNETCORE_Kestrel__Certificates__Default__Password- password for PFX certificate
Full example with SSL
Assume that certificate is located in folder
/srv/hq/.ssl/cert.pfx with password
docker run -p 80:80 -p 443:443 --name hq \ -e "HQ_Headquarters__TenantName=hq" \ -e "HQ_Headquarters__BaseUrl=https://mysurvey.example.com" \ -e "HQ_ConnectionStrings__DefaultConnection=Server=192.168.192.72;Port=5432;User Id=postgres;Password=Qwerty1234;Database=SurveySolutions" \ -e "ASPNETCORE_URLS=https://+:443;http://+:80" \ -e "ASPNETCORE_Kestrel__Certificates__Default__Path=/ssl/cert.pfx" \ -e "ASPNETCORE_Kestrel__Certificates__Default__Password=password" \ -v "/srv/hq/hq_data/app:/app/AppData" \ -v "/srv/hq/.ssl/cert.pfx:/ssl/cert.pfx" \ -v "/srv/hq/protection:/root/.aspnet/DataProtection-Keys" \ surveysolutions/surveysolutions:latest
Typing all those docker run parameters can be quite error prone. We provide a template for sample repository for running Survey Solutions with
docker-compose in this repository https://github.com/surveysolutions/docker-compose.
While running Postgres instance in docker is viable solution, we strongly recommend to run PostgreSQL in separate server or use “managed” solutions provided by cloud providers(i.e. Amazon RDS, Azure Database for PostgreSQL, Google Cloud SQL, etc…)
Required configuration settings
There is several required configuration that You should be aware of to run in Docker.
HQ_Headquarters__TenantNameis required in Survey Solution as of version
v20.10. There is no visual features linked to this configuration. Will be dropped in future versions.
HQ_ConnectionStrings__DefaultConnection- connection string to Postgres database instance
HQ_Headquarters__BaseUrl- Base URL for HQ. Used in Web mode and emails.
HQ_Logging__LogsLocation: /app/AppData/logscan be configured to specify logs locations
Export_ExportSettings__DirectoryPath: /app/AppData/Exportto preserve data export artifacts
Updating Survey Solutions
- Stop docker container with Survey Solutions
docker pull surveysolutions/surveysolutions
- Restart docker container