What are my options for private image hosting for a private website <100 users - reactjs

I have created an operations journal website where users can write and read what happened during their shifts and report (on-going) incidents. I was looking to expand the solution by letting the users attatch images as well. The images should not be hosted publicly, so what are the common options?
Technologies that I've used to build the app are primarily: React, NextJS, Next-auth, MongoDB, and it's all hosted on Azure.
Should I just host the images with MongoDB?
Is it possible to use say OneDrive or Workplace, which we already pay for, for image hosting?
Or is there some other practice that is highly recommended?

The natural storage option for things like images (or any other kind of media files) is Azure Blob Storage. Cost effective and well suited for what you usually want to do with them. Putting binary data into any kind of database is usually a waste of resources.

Using Azure Blobs to Store the Images as blobs is the standard
if you don't want the Images to be available publicly then use a shared access signature (SAS),
https://learn.microsoft.com/en-us/azure/storage/blobs/sas-service-create?tabs=dotnet
But from the Stack you are using Mongodb can be sufficent create a seperate Collection and save the blobs there bcos
blob storage is a Nosql db. are you using azure's NoSql db Cosmosdb ? or mongodb itself.
Do you want to trigger code using events from the db?. such as after the image is uploaded do xxxx automatically.

Related

How can I track a users storage usage in Amazon S3?

I am designing a react app (with mySQL as my backend) which allows users to add photos to an Amazon S3 bucket; however, I can't find any information on how I can keep track of a users current storage usage.
One way I am thinking of solving this is by simply adding a column in my mySQL database and adding/removing the file size whenever a user uploads/deletes a photo.
The only issue I am having is that this does not seem like an efficient solution. Any advice or knowledge shared is appreciated.

Where to put SQLite database file in Azure App Service?

Q1: Where do you think is the right place to put a SQLite database file (database.sqlite) in Azure Web App file system? For example:
D:\home\data\database.sqlite
D:\home\site\database.sqlite
D:\home\site\wwwroot\database.sqlite
other?
Q2: What else should be taken into consideration in order to make sure that the database file won't be accessible to public users as well as not being accidentally overwritten during deployments or when the app is scaled up/down? (The Web App is configured for deployments from a Local Git Repository)
Q3: Where to learn more about the file system used in Azure App Service, the official source URL? E.g. how it's shared between multiple VMs within a single Web App, how does it work when the App is scaled up/down, what's the difference between D:\home (persistent) vs D:\local (non-persistent)...
Note that SQLite does not work in Azure Blob Storage, so that one is not an option. Please, don't suggest alternative storage solutions, this question is specifically about SQLite.
References
Appropriate Uses For SQLite
In a Web App, your app is deployed to d:\home\site\wwwroot. This is the area where you may write files. As an example, the ghost deployment writes its SQLite database to d:\home\site\wwwroot\content\data\ghost.db. (easy to see this, if you open up the kudu console via yourapp.scm.azurewebsites.net):
This file area is shared amongst your web app instances. Similar to an SMB file share, but specific to web apps (and different than Azure's File Service).
The content under wwwroot is durable, unless you delete your app service. Scaling up/down impacts the amount of space available. (I have no idea what happens if you scale down and the smaller size has less disk space than what you're consuming already).
I would say the best location would be app_data folder in the site/wwwroot folder. Create the folder if it doesn't exist.
Web Apps can connect to storage accounts so you can in fact use blob storage and connect that to your web app. So in terms of learning more about it then you need to be looking at the appropriate page of documentation.
In your Web App settings you can then select which storage account to use. You can find this under Settings > Data Connections where you can select Storage from the drop down box.

Storing images? Database or Filesystem on the cloud

I'm building a photo sharing app which has to store images. So I am thinking of using Azure mobile services for storing user data and links to their images stored in Azure Storage. The problem I think with this approach is that if the image is modified, there may not be referential integrity.
Is this a good approach or should I be storing both of these in the database(This approach is more expensive, monetarily).
PS: The images are standard images captured using a Mobile Camera.
The approach you're thinking about taking (referencing the image from the structured data stored in Azure Mobile Apps) is good.
For the actual image storage, instead of using the file system on the service, the recommended approach would be to leverage something like Azure Blob Storage.
This recently published article about a new file management feature being added to Mobile Apps might be helpful (it should at least serve as guidance on how to manage file storage in the context of a mobile app):
https://azure.microsoft.com/en-us/blog/file-management-with-azure-mobile-apps/
I hope this helps!

What database to use with PhoneGap

I am creating my first mobile app using Phonegap and I am not sure what database to use with it. I have read a few articles and am finding it hard to decide on which is best to use. Two of the ones mentioned most seem to be MongoDB or SQLite
Because PhoneGap needs Nodejs, I thought that MongoDB would be a good option but is that too robust? I am familar with Mongo but don't want to choose it just because it is convenient, I would prefer to use what is best.
The app will hopefully store information both locally and on the server. Will probably be information like you would store for a messaging app - user info, contacts, messages etc.
Anyone know which would be best to use? - or if another would suit my needs more?
The phonegap is a framework that allows you to create mobile applications using API's multi-platform web. The choice of the database in my view
should not be given by the framework, but for what kind of application you are doing.
I see three ways to store data from your mobile application.
1: Local Storage (http://www.w3schools.com/html/html5_webstorage.asp)
2: SQLite (https://github.com/brodysoft/Cordova-SQLitePlugin)
3: Database on server (can be anyone.)
The choice will depend on what you want from your application. If it is a simple application that will be stored few data, use the local storage of html5 that stores documents. If your application is already a bit bigger and more complex, you can use SQLite implemented in the browser using HTML5 which is supported by most current mobiles browser. The advantage here is that access to the base is done without the need to build a server. In the third case your application would be the type client server, in which case you should use the database on the server. The choice of database can be what you feel is appropriate.
I suggest you go with IndexedDB if you want to store a lot of data in the client or LocalStorage which is able to store 5MB worth JSON data.
This is just the front end but for the back-end there are so many to choose from and if you plan to write the back-end with Node then it will be wise to use MongoDB.
I would suggest using the Cordova-SQLitePlugin as it offers a native interface to sqlite, avoiding quota restrictions associated with WebSQL on mobile devices. The plugin is supported on Android, iOS and Windows Phone 8 platforms.
If you want to keep a local and remote database in sync, you may consider using this in conjunction with PouchDB
PhoneGap can use LocalStorage, SessionStorage, or SQLite databases. You can also use PhoneGap to connect to the devices native classes via a plugin, and pass the native class data, that it will then store on the device. check this link to find more details
What database does PhoneGap use and what is the size limit?

How to backup image files uploaded and stored as blobs in GAE Blobstore(Python)

How to backup (and restore) image files uploaded and stored as blobs in GAE Blobstore(Python)
I have gone through the GAE help doc on this topic. I could not find any way but I am sure there must be a very simple and intuitive way to do this since this is a fundamental need to develop any big commercial web app
Although a feature to download the backed up data would be better but I am even ok with Google Cloud Storage based approach if some definite guide is present for the same
I want to use the backup of my web app data in case of some accidental data deletion or corruption.. I plan to use the Datastore Admin to backup my NDB entities which could be easily restored using the same.. I was hoping for a similar solution(backup and also easy restore) for the image(picture) files stored as blobs in Blobstore..
I have gone through this GAE Blobstore help page and it does not say anything about its deprecation (Files API is deprecated and I am not using that)
I would advice against storing images in the AppEngine blobstore to store anything given that it's set for deprecation (and has been so for the last few months). So, in addition to back up I would strongly suggest migrating your app to store images directly in Google Cloud Storage asap.
The best way to back up images stored in Blobstore is to create a migration via TaskQueues. In this migration, grab each of the blobs and store them to a container which can be AWS S3 or Google Cloud Storage (via boto library). The reason you need to make is TaskQueue is because it will likely take a LONG time if you have lots of images stored in the blobstore.
Here's the SO question I asked and got a response about:
GAE Blobstore file-like API deprecation timeline (py 2.7 runtime)

Resources