Running Repository on Linux with Docker

Docker image

On Linux systems with docker, you can deploy Colectica Repository as a docker image. Follow these steps to create and run a docker image for Colectica Repository.

  1. Locate or obtain the Colectica Repository package. This is named ColecticaRepository-version-linux.zip.

  2. Extract the Colectica Repository package to a folder on your server’s disk. The archive contains a directory /ColecticaRepository/.

  3. Run the docker build command and specify the extracted directory. The Dockerfile is located in the directory with the Colectica Repository application.

    docker build -t colecticarepository ColecticaRepository/
    
  4. There is now a docker containerized version of Colectica Repository named colecticarepository.

Configure Colectica Repository

After creating the Colectica Repository colecticarepository docker image, configure the Colectica Repository.

You can either update the appsettings.json file contained on the image, or use environmental variables passed to the docker container to override default configuration values.

  • Edit the appsettings.json file contained within the docker image. See Configuration for detailed instructions.

  • Copy a specific appsettings.json file that you maintain to the image.

  • Use environmental variables passed to the docker container to override default configuration values. Add environmental variables based on the key names in the appsettings.json file, replacing : with __. Below is a minimal example docker environmental variable file that we will name docker.env

Data__DefaultConnection__ConnectionString=Host=localhost;Database=colectica-portal;Username=postgres;Password=password;
Data__DefaultConnection__ProviderName=Npgsql
Data__ColecticaRepository__ConnectionString=Host=localhost;Database=colectica;Username=postgres;Password=password;
Data__ColecticaRepository__ProviderName=Npgsql
RepositorySettings__Http__HttpsRedirectEnable=false

This environmental variable file shows the minimum configuration to start the Colectica Repository. Users should follow the configuration instructions to set appropriate database, security, and authentication options.

See also

See the Environmental Variable Configuration documentation for information on configuring Colectica Repository using environmental variables.

Run Docker image

  • You can run the configured docker image with a command. In this example we name the container colectica. Run the image with a command similar to:

docker run -d -p 8080:8080 --name colectica colecticarepository
  • If you are using environmental variables, you can run the image with a command similar to:

docker run -d -p 8080:8080 --env-file docker.env --name colectica colecticarepository

HTTPS

When running in production using docker, it is recommended to either use a proxy to enable HTTPS or turn on HTTPS on the Colectica Repository. To enable HTTPS, update the appsettings.json file with the path to your certificate’s .pfx file along with an optional password or empty password. The settings are located in the Kestrel:Certificates:Default setting. Also set the environmental variable ASPNETCORE_URLS=http://*:80;https://*:443. to listen on the https.

See also

See the Kestrel documentation for information on configuring https and certificates.