Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

    If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

    BuildMaster and Otter SQL connection issue (Docker/ Linux)

    Scheduled Pinned Locked Moved Support
    6 Posts 2 Posters 11 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • I Offline
      informatique_1359
      last edited by

      I created a docker-compose file in Portainer to use proget, buildmaster and otter. I already had a SQL Server Express as a Linux Docker. I created the 3 databases and 3 different access to each of one.

      I then started everything. The only docker that accept to run is Proget. BuildMaster and Otter refuses to start because it detect a network issue contacting SQL Server (which is not the case with Proget).

      The network and environment is the same on all 3 containers.

      Here's the complete docker-compose file. After is the "docker logs buildmaster" with the connection error.

      docker-compose.yml

      version: '3.8'
      services:
        proget:
          image: proget.inedo.com/productimages/inedo/proget:latest
          container_name: proget
          restart: unless-stopped
          environment:
            - SQL_CONNECTION_STRING=Data Source=mssql; Initial Catalog=ProGet; User ID=proget; Password='MyPassWord!!'; MultipleActiveResultSets=true
            - TZ=America/Toronto
          networks:
            - nginx-proxy
            - databases
          volumes:
            - /opt/docker/data/proget-packages:/var/proget/packages
        buildmaster:
          image: proget.inedo.com/productimages/inedo/buildmaster:latest
          container_name: buildmaster
          restart: unless-stopped
          environment:
            - SQL_CONNECTION_STRING=Data Source=mssql; Initial Catalog=BuildMaster; User ID=buildmaster; Password='MyPassWord!!';
            - TZ=America/Toronto
          networks:
            - nginx-proxy
            - databases
          volumes:
            - /opt/docker/data/buildmaster-artifacts:/var/buildmaster/artifacts
        otter:
          image: proget.inedo.com/productimages/inedo/otter:latest
          container_name: otter
          restart: unless-stopped
          environment:
            - SQL_CONNECTION_STRING=Data Source=mssql; Initial Catalog=Otter; User ID=otter; Password='MyPassWord!!';
            - TZ=America/Toronto
          networks:
            - nginx-proxy
            - databases
      networks:
        nginx-proxy:
          external: true
        databases:
          external: true
      

      docker logs buildmaster

      BuildMaster version is 22.0.3.8.
      Current DB schema version is unknown.
      Unhandled exception: Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 35 - An internal exception was caught)
       ---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (00000001, 11): Resource temporarily unavailable
         at System.Net.Dns.GetHostEntryOrAddressesCore(String hostName, Boolean justAddresses, AddressFamily addressFamily, ValueStopwatch stopwatch)
         at System.Net.Dns.GetHostAddresses(String hostNameOrAddress, AddressFamily family)
         at System.Net.Dns.GetHostAddresses(String hostNameOrAddress)
         at Microsoft.Data.SqlClient.SNI.SNICommon.GetDnsIpAddresses(String serverName)
         at Microsoft.Data.SqlClient.SNI.SNITCPHandle.Connect(String serverName, Int32 port, TimeSpan timeout, Boolean isInfiniteTimeout, SqlConnectionIPAddressPreference ipPreference, String cachedFQDN, SQLDNSInfo& pendingDNSInfo)
         at Microsoft.Data.SqlClient.SNI.SNITCPHandle..ctor(String serverName, Int32 port, Int64 timerExpire, Boolean parallel, SqlConnectionIPAddressPreference ipPreference, String cachedFQDN, SQLDNSInfo& pendingDNSInfo, Boolean tlsFirst, String hostNameInCertificate)
         at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
         at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
         at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
         at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
         at Microsoft.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
         at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides)
         at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides)
         at Microsoft.Data.SqlClient.SqlConnection.Open()
         at Inedo.DbUpdater.SqlServer.SqlServerDatabaseConnection.GetConnection()
         at Inedo.DbUpdater.SqlServer.SqlServerDatabaseConnection.ExecuteTable[TResult](String query, Func`2 adapter, SqlTransaction transaction, SqlParameter[] args)
         at Inedo.DbUpdater.SqlServer.SqlServerDatabaseConnection.GetChangeScriptVersion(SqlTransaction transaction)
         at Inedo.DbUpdater.SqlServer.SqlServerDatabaseConnection.GetState()
         at Inedo.DbUpdater.ConsoleHost.Update(String scriptPath, String connectionString, Boolean force)
         at Inedo.DbUpdater.ConsoleHost.Run(ArgList args)
         at Inedo.DbUpdater.ConsoleHost.RunAsync(IEnumerable`1 args)
         at Inedo.BuildMaster.Windows.ServiceApplication.Program.UpdateDatabaseSchemaAsync() in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp\_E306669\Src\BuildMasterSolution\BuildMaster.Service\Program.cs:line 286
         at Inedo.BuildMaster.Windows.ServiceApplication.Program.Run(WebServerMode mode, Boolean runAsService, Boolean linuxContainer, String nodeName) in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp\_E306669\Src\BuildMasterSolution\BuildMaster.Service\Program.cs:line 26
      ClientConnectionId:00000000-0000-0000-0000-000000000000
      
      1 Reply Last reply Reply Quote 0
      • rhessingerR Offline
        rhessinger inedo-engineer
        last edited by

        Hi @informatique_1359,

        The error is definitely that the BuildMaster and Otter containers cannot find a server with the name of mssql. I'm surprised that ProGet works, but Docker can be confusing. This seems to be a pretty common docker issue. How I have solved this in the past is to add an alias to the network section on your SQL Server container. For example:

        networks:
          databases:
            name: mssql
        

        Because you are using the databases network on ProGet, BuildMaster, and Otter containers also, that will add a hostname of mssql to the docker network and make it accessible by name. I would also suggest adding an alias to your ProGet, BuildMaster, and Otter container configurations to prevent issues with these servers being able to communicate with each other as well.

        For more information, see our Docker-Compose installation guide.

        Thanks,
        Rich

        Products Engineer, Inedo

        1 Reply Last reply Reply Quote 0
        • I Offline
          informatique_1359
          last edited by

          I tried setting aliasses and names. I moved my MSSQL to another "stack" in Portainer. The network need to be force as "external" in order for the network to speak with other stacks (other docker-compose).

          I tested each password using sqlcmd and SQL Studio. I even tried connecting with SA without success.

          This is the last connection string I use on all 3 containers using the IP address of my Linux SQL Server. As all my tests, ProGet starts and don't have any issues. But BuildMaster and Otter don't.

          Is it possible that a driver or packages is missing from those 2 images? I can access the SQL using telnet or ping within "buildmaster" (between recreation), but connecting seems to always fails...

          SQL_CONNECTION_STRING=Server=172.23.0.15,1433; Database=BuildMaster; User ID=buildmaster; Password=MyStrongPassword;
          
          1 Reply Last reply Reply Quote 0
          • I Offline
            informatique_1359
            last edited by

            Strangely enough, it seems your doc there is not up to date...
            https://docs.inedo.com/docs/docker-compose-installation-guide

            As per this link, I changed buildmaster's environment variable to use "BUILDMASTER_SQL_CONNECTION_STRING" and not "SQL_CONNECTION_STRING". Now buildmaster is starting without issue!
            https://docs.inedo.com/docs/installation-troubleshooting-docker-installations

            But Otter won't start using BUILDMASTER_SQL_CONNECTION_STRING, SQL_CONNECTION_STRING or OTTER_SQL_CONNECTION_STRING. What could be the correct environment variable for Otter?

            1 Reply Last reply Reply Quote 0
            • I Offline
              informatique_1359
              last edited by

              There was an error in my last message. I made a error on the connection string of Otter.

              The correct environment variable to use is OTTER_SQL_CONNECTION_STRING.

              So, per container, it seems that images wants those environment variable to contain the MSSQL connection string.

              ProGet: SQL_CONNECTION_STRING
              BuildMaster: BUILDMASTER_SQL_CONNECTION_STRING
              Otter: OTTER_SQL_CONNECTION_STRING

              Using those variables, my original docker-compose file is working fine...

              1 Reply Last reply Reply Quote 0
              • rhessingerR Offline
                rhessinger inedo-engineer
                last edited by

                Hi @informatique_1359,

                Good catch! I updated the Docker-Compose docs to reflect that.

                Thanks,
                Rich

                Products Engineer, Inedo

                1 Reply Last reply Reply Quote 0

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • 1 / 1
                • First post
                  Last post
                Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation