Scope
We are moving our existing websites to AWS EC2. From a high level perspective, our plan as follow.
- Move the websites to EC2
- Move the database to RDS
- Content Images upload via CMS will go to s3
- Product Images on the websites are moved to s3
- Move the console apps to a t2.micro instance
We are using nopCommerce 3.3.
Implementation
Websites and Console Apps
Moving sites and apps to cloud instances are pretty straight forward. There are no code changes required in nopCommerce.
Database
S3
Migration to S3 required some code changes, but we are not getting much resistance because of the advantage of using OO and polymorphism.
Previously we already wrote a custom class that inherit from the PictureService.
Now, I can inherit my custom class by my new AWS class.
We will then override the image read / write method to connect to AWS. This was mentioned previously in my other post Amazon SDK S3 with .Net
In our DependencyRegister, we now register our new AWS Service.
Now my system is able to support either local or S3 images by changing the register type via DI.
Previously we already wrote a custom class that inherit from the PictureService.
public class TAPictureService : PictureService, ITAPictureService, IPictureService
Now, I can inherit my custom class by my new AWS class.
public class AwsPictureService : TAPictureService, ITAPictureService, IPictureService
We will then override the image read / write method to connect to AWS. This was mentioned previously in my other post Amazon SDK S3 with .Net
In our DependencyRegister, we now register our new AWS Service.
builder.RegisterType<AwsPictureService>().As<IPictureService>();
Hi just wondering if you can expand further on how you implemented the s3 image uploader for nopcommerce? Are your images still saving as binary to the database or youre bypassing that? And how does nop handle the different image sizes/dimensions? Thanks
ReplyDelete