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!

The ConnectionString property has not been initialized



  • I waited for 25.11 to get the permission check logic in place. Now that's resolved, there appears to be a new issue, but based on the error alone, I can't be 100% sure on what it is, although I'm betting it's tied to permissions.

    The instance shows healthy, but it fails to run due to a connection string issue. See error:

    Updating certificates in /etc/ssl/certs...
    142 added, 0 removed; done.
    Running hooks in /etc/ca-certificates/update.d...
    done.
    info: Microsoft.Hosting.Lifetime[0]
          Application started. Press Ctrl+C to shut down.
    info: Microsoft.Hosting.Lifetime[0]
          Hosting environment: Production
    info: Microsoft.Hosting.Lifetime[0]
          Content root path: /usr/local/proget
    Initializing embedded database...
    fail: Microsoft.Extensions.Hosting.Internal.Host[11]
          Hosting failed to start
          System.InvalidOperationException: The ConnectionString property has not been initialized.
             at Npgsql.ThrowHelper.ThrowInvalidOperationException(String message)
             at Npgsql.NpgsqlConnection.Open(Boolean async, CancellationToken cancellationToken)
             at Npgsql.NpgsqlConnection.Open()
             at Inedo.ProGet.Data.PostgresDatabaseContext.CreateConnection() in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp\_E597550\Src\src\ProGet\Data\PostgresDatabaseContext.cs:line 58
             at Inedo.ProGet.Data.VirtualDatabaseContext.PostgresContext.CreateConnection() in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp\_E597550\Src\src\ProGet\Data\VirtualDatabaseContext.cs:line 49
             at Inedo.ProGet.Data.VirtualDatabaseContext.CreateConnection() in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp\_E597550\Src\src\ProGet\Data\VirtualDatabaseContext.cs:line 24
             at Inedo.Data.DatabaseContext.ExecuteInternal(String storedProcName, GenericDbParameter[] parameters, DatabaseCommandReturnType returnType)
             at Inedo.Data.DatabaseContext.ExecuteNonQuery(String storedProcName, GenericDbParameter[] parameters)
             at Inedo.Data.DatabaseContext.ExecuteScalar[TResult](String storedProcName, GenericDbParameter[] parameters, Int32 outParameterIndex)
             at Inedo.ProGet.Data.DB.Context.CheckSqlServerDbo(Nullable`1 IsOwner_Indicator) in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp\_E597550\Src\src\ProGet\obj\Release\net8.0\linux-x64\InedoLib.Analyzers\InedoLib.Analyzers.DatabaseContextGenerator\DB.g.cs:line 2191
             at Inedo.ProGet.Data.DB.CheckSqlServerDbo(Nullable`1 IsOwner_Indicator) in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp\_E597550\Src\src\ProGet\obj\Release\net8.0\linux-x64\InedoLib.Analyzers\InedoLib.Analyzers.DatabaseContextGenerator\DB.g.cs:line 183
             at Inedo.ProGet.Data.DatabaseMan.CheckConnection(Boolean asyncWithRetryMode, CancellationToken cancellationToken) in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp\_E597550\Src\src\ProGet\Data\DatabaseMan.cs:line 62
             at Inedo.ProGet.Service.ProGetService.OnStartAsync(CancellationToken cancellationToken) in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp\_E597550\Src\src\ProGet\Service\ProGetService.cs:line 40
             at Inedo.ProGet.Service.ProGetService.ExecuteAsync(CancellationToken stoppingToken) in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp\_E597550\Src\src\ProGet\Service\ProGetService.cs:line 26
             at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token)
             at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)
    

    And config (note, I added the SSL Certificate directory as a mounted volume to avoid a different permission problem when running the certificate updates).

    spec:
      replicas: 1
      selector:
        matchLabels:
          app: proget
      template:
        metadata:
          labels:
            app: proget
        spec:
          securityContext:
            runAsUser: 1024
            runAsGroup: 100
            runAsNonRoot: false
          containers:
            - name: proget
              image: proget.inedo.com/productimages/inedo/proget:latest
              ports:
                - containerPort: 8624
                  name: http
              volumeMounts:
                - name: proget-data
                  mountPath: /var/proget/database
                - name: proget-package
                  mountPath: /var/proget/packages
                - name: proget-backup
                  mountPath: /var/proget/backups
                - name: proget-certs
                  mountPath: /etc/ssl/certs
          volumes:
            - name: proget-data
              persistentVolumeClaim:
                claimName: proget-data
            - name: proget-package
              persistentVolumeClaim:
                claimName: proget-package
            - name: proget-backup
              persistentVolumeClaim:
                claimName: proget-backup
            - name: proget-certs
              persistentVolumeClaim:
                claimName: proget-certs
    

  • inedo-engineer

    Hi @tyler_5201

    The underlying error is that there is no connection string, as you noticed.

    The connection string is stored in a file (/var/proget/database/.pgsqlconn) that should be accessible to the container. I haven't tested it, but I guess if file is missing or deleted, then I suppose you might run into these issues.

    It should be created on startup of a new container, however. So it's kind of weird. I think you'll want to "play" with it a bit, since there's clearly something going on with your permissions I'm thinking.

    Note that the connection string can also be specified as an environment variable, but I don't think that applies here since you're trying to configure the embedded datbase:
    https://docs.inedo.com/docs/installation/linux/docker-guide#supported-environment-variables

    Thanks,
    Alana


Log in to reply
 

Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation