Skip to content

Deploying a nopCommerce App

Introduction

nopCommerce is a popular open-source ASP.NET e-commerce platform. This guide shows how to containerize nopCommerce with a Dockerfile, connect it to SQL Server, persist media and plugins, and deploy it to Klutch.sh over HTTP.

Prerequisites

  • GitHub repository containing your Dockerfile.
  • SQL Server database (managed or deployed separately).
  • Klutch.sh project ready in klutch.sh/app.

Project structure

.
└── Dockerfile

Sample Dockerfile

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
ENV ASPNETCORE_URLS=http://+:8080
EXPOSE 8080
# Copy prebuilt nopCommerce publish output
COPY . /app
ENTRYPOINT ["dotnet", "Nop.Web.dll"]

If you need to build from source in the container, add a build stage with the SDK image to restore and publish before copying into the runtime image.

Required environment variables

  • ConnectionStrings__DefaultConnection – SQL Server connection string, e.g., Server=tcp:HOST,1433;Database=nop;User Id=USER;Password=PASS;TrustServerCertificate=True;
  • ASPNETCORE_URLS=http://+:8080
  • Nop__UseFastInstallationService=true (for first run, optional)

Optional environment variables

  • ASPNETCORE_ENVIRONMENT=Production
  • Nop__DisplayFullErrorStack=false
  • Nop__UseRedisForCaching=false (enable and configure if you add Redis)

Persistence

Persist media, plugins, and logs:

  • Mount path: /app/App_Data
  • Mount path: /app/wwwroot
  • Size: based on expected catalog assets, logs, and plugin packages

Networking

  • Protocol: HTTP
  • Internal port: 8080
  • Users reach https://example-app.klutch.sh while Klutch.sh routes to port 8080 inside the container.
Terminal window
curl -I http://localhost:8080

Deployment on Klutch.sh

  1. Push your Dockerfile and published nopCommerce files to GitHub.
  2. In klutch.sh/app, create a new app and select GitHub as the source.
  3. Klutch.sh automatically detects the Dockerfile in the repository root.
  4. Select HTTP traffic and set the internal port to 8080.
  5. Add environment variables for the SQL Server connection string and any nopCommerce settings. Mark secrets as sensitive.
  6. Attach persistent volumes at /app/App_Data and /app/wwwroot sized for media, plugins, and logs.
  7. Deploy. On first run, complete the nopCommerce setup using your SQL Server credentials.

Verification

  • UI: open https://example-app.klutch.sh and confirm the storefront or setup screen loads.

  • Quick check:

    Terminal window
    curl -I https://example-app.klutch.sh

Next steps

  • Disable the fast installation service after initial setup.
  • Configure CDN/cache for static assets and enable HTTPS at the edge.
  • Schedule backups for SQL Server and the mounted data directories.