Source Environment Prepartion
- For this activity we will be installing nop commerce
- overview of architecture
- Create two
- Azure ubuntu linux vms of size standard_b1s
- AWS ubuntu linux instances of size t2.micro or t3.micro
- Consider one vm to be database server and install mysql
- Steps: Refer Here
sudo apt update
sudo apt install mysql-server
sudo mysql - In the mysql shell try to execute following commands
CREATE USER 'nop'@'localhost' IDENTIFIED BY 'nop12345';
GRANT ALL PRIVILEGES ON *.* TO 'nop'@'localhost';
FLUSH PRIVILEGES;
exit - To verify the nop execute
mysql -u nop -p
enter password and you should be allowed in sql shell
- note: we need to fix the issue with external connectivity
- Steps: Refer Here
- Application: nopcommerce Refer Here
- Steps:
- Install .net core 7 Refer Here
- download nopcommerce zip
sudo apt install unzip -y
Refer Here
sudo mkdir /usr/share/nopCommerce
cd /usr/share/nopCommerce/
sudo wget https://github.com/nopSolutions/nopCommerce/releases/download/release-4.60.3/nopCommerce_4.60.3_NoSource_linux_x64.zip
sudo unzip nopCommerce_4.60.3_NoSource_linux_x64.zip
sudo mkdir bin
sudo mkdir logs
- Create a user called as nop
sudo adduser nop
- Give full permissions to
/usr/share/nopCommerce
to nop
sudo chgrp -R nop /usr/share/nopCommerce/
sudo chown -R nop /usr/share/nopCommerce/
- Create a file in
/etc/systemd/system/nopCommerce.service
with following content
[Unit]
Description=Example nopCommerce app running on Xubuntu
[Service]
WorkingDirectory=/usr/share/nopCommerce
ExecStart=/usr/bin/dotnet /usr/share/nopCommerce/Nop.Web.dll
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=nopCommerce-example
User=nop
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=ASPNETCORE_URLS=http://0.0.0.0:5000
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
[Install]
WantedBy=multi-user.target
- Now execute
sudo systemctl enable nopCommerce.service
sudo systemctl start nopCommerce.service
sudo systemctl status nopCommerce.service
-
Now access the application using http://
:5000
- Enabling mysql connections from anywhere Refer Here
- Step 1:
The first thing we must do is configure MySQL for remote connections. To do this, log into your MySQL database server and open the configuration file with the command:
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
In that file, look for the line:
bind-address = 127.0.0.1
Change that line to:
bind-address = 0.0.0.0
Save and close the file. Restart the MySQL service with:
sudo systemctl restart mysql
- Step 2: launch mysql shell
sudo mysql
CREATE USER 'nop'@'%' IDENTIFIED BY 'nop12345';
GRANT ALL PRIVILEGES ON *.* to 'nop'@'%';
FLUSH PRIVILEGES;
exit
- Lets configure ecommerce application in webpage
http://<ip>:5000
- Enter database details and credentials
nop/nop12345
- wait for few minutes for the page to be reloaded.