Build and launch NopCommerce

Now that we have created Aurora PostgreSQL database, it’s time to build and run nopCommerce web application.

Switch back to home directory:

cd ~

Clone sources from official nopCommerce GitHub repository:

git clone https://github.com/nopSolutions/nopCommerce.git

The project is quite big (that’s why we have created c6g instance):

  • Over 13Mb of C# sources
  • Over 3000 source files
  • Over 800 views

Switch to the Nop.Web project (main ASP.NET application):

cd nopCommerce/src/Presentation/Nop.Web

Build the project (and all required dependencies):

dotnet build

It will take few minutes to build the solution.

Once build is complete, you will see the output similar to this one:

Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  Restored /home/ubuntu/nopCommerce/src/Libraries/Nop.Data/Nop.Data.csproj (in 31.88 sec).
  Restored /home/ubuntu/nopCommerce/src/Libraries/Nop.Core/Nop.Core.csproj (in 31.88 sec).
  Restored /home/ubuntu/nopCommerce/src/Presentation/Nop.Web/Nop.Web.csproj (in 14.33 sec).
  Restored /home/ubuntu/nopCommerce/src/Presentation/Nop.Web.Framework/Nop.Web.Framework.csproj (in 14.33 sec).
  Restored /home/ubuntu/nopCommerce/src/Libraries/Nop.Services/Nop.Services.csproj (in 198 ms).
  Nop.Core -> /home/ubuntu/nopCommerce/src/Libraries/Nop.Core/bin/Debug/net5.0/Nop.Core.dll
  Nop.Data -> /home/ubuntu/nopCommerce/src/Libraries/Nop.Data/bin/Debug/net5.0/Nop.Data.dll
  Nop.Services -> /home/ubuntu/nopCommerce/src/Libraries/Nop.Services/bin/Debug/net5.0/Nop.Services.dll
  Nop.Web.Framework -> /home/ubuntu/nopCommerce/src/Presentation/Nop.Web.Framework/bin/Debug/net5.0/Nop.Web.Framework.dll
  Nop.Web -> /home/ubuntu/nopCommerce/src/Presentation/Nop.Web/bin/Debug/net5.0/Nop.Web.dll
  Nop.Web -> /home/ubuntu/nopCommerce/src/Presentation/Nop.Web/bin/Debug/net5.0/Nop.Web.Views.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:01:45.35

Next you need to make files writable so that during installation nopCommerce can update various configuration files:

sudo chmod -R a+rw /home/ubuntu/nopCommerce/src/Presentation/Nop.Web/

Now you can run the application and expose it on port 5000:

sudo dotnet run --no-build --urls=http://0.0.0.0:5000

If you have your sample web application from previous lesson still listening on port 5000, you can find the process listening on port 5000 by running the following command: sudo lsof -n -i :5000 | grep LISTEN and then kill the process by providing it’s process Id: sudo kill PID

Open Web browser and navigate to public IPv4 address of the instance, port 5000:

Nop

When you run application for the first time, you need to provide details on what database to use. Add the following:

  • Create admin password (this is nopCommerce application administrator)
  • Check Create sample data
  • Select PostgreSQL as type of the database
  • Check Create database if it doesn't exist
  • Enter Aurora writer endpoint URL in Server name field
  • Enter NopCommerce as database name
  • Provide SQL username and password that you created when you set up Aurora

And click Install.

Nop

During installation nopCommerce will create database, populate it with sample data and update configuration files. Also note that once installation is finished, web server will be automatically stopped, so you need to manually start it again:

Run the application again:

sudo dotnet run --no-build --urls=http://0.0.0.0:5000

Now you can browse the application again and see that it’s up and running on AWS Graviton2 processor backed by Aurora PostgreSQL database also running on AWS Graviton2:

Nop

Congratulations! You have successfully built and run nopCommerce application on AWS Graviton2!