Store assets in Azure blob storage config/demo/example


#1

I’m planning on storing all of my images in Azure. I already have a storage account with blobs nicely organized in containers and folders.

According to the docs it is possible to hook my own store implementation to Squidex. For Azure I would use AzureBlobAssetStore but how do I actually use/configure it? Can someone post an example config?

Also, how will my URL:s look like once this is in place? Will they have the GUID in them or will it just be a normal Azure blob URL?

Currently my links look like this: https://mydomain.westeurope.cloudapp.azure.com/api/assets/ab032d96-19a5-4a7c-9706-8450e4d6c31d

which is bad for SEO.

I would like Azure blob storage to take care of the URL generation and have my links look like this instead:
https://mydomain.westeurope.cloudapp.azure.com/my/own/file/path/cat.jpg


#2

Hi,

have you checked the configs: https://github.com/Squidex/squidex/blob/master/src/Squidex/appsettings.json#L96?

You have to set

ASSETSTORE__TYPE=AzureBlob
ASSETSTORE__AZUREBLOB__CONNECTIONSTRING=...

The Urls will contain Guids, it is actually this endpoint: https://cloud.squidex.io/api/docs#operation/AssetContent_GetAssetContent

You do not have to and should not make your blob storage public.

I am thinking about a second endpoint which contains a placeholder where you can add some text.

e.g. /apps/{app}/assets/my-file-name.jpg?id=GUID

But the my-file-name part will be ignored. The reason is that file names are not unique. It is just metadata.


#3

Thanks, I think I might stick with folder as storage type for now. Will try this in the future.


#4

If you do not have to scale squidex folders are totally fine. The primary usage of cloud storage providers is for clustering.

You can also use GridFS and store the assets directly in MongoDB. It is much for backups, because you only have to backup your database.


#5

Actually GridFS makes sense. That way I would only need to backup just one managed disk (where the mongodb data lives), and not the OS-disk (which is much bigger => higher costs) in my cluster.

How would I configure it in my squidex.yml?

ASSETSTORE__TYPE=GridFS
ASSETSTORE__MONGODB__CONFIGURATION=??? <-- The same configuration string as EVENTSTORE__MONGODB__CONFIGURATION and STORE__MONGODB__CONFIGURATION?

I’m looking at the config options here:


#6

it is:

ASSETSTORE__TYPE=MongoDB
ASSETSTORE__MONGODB__CONFIGURATION=<-- The same configuration string as EVENTSTORE__MONGODB__CONFIGURATION and STORE__MONGODB__CONFIGURATION!


#7

Does casing matter?

In appsettings.json it’s MongoDb


#8

No, it does not matter.


#9

Ok, thank you. Will try it.


#10

Seems to be working. Thanks.


#11

Great :slight_smile: … you are welcome


#12

I have to ask…how do you know that using these Azure blob hostnames is bad for SEO?


#13

@lukeydukey google first looks at the image file name. If it can’t figure out what the image is about it will secondly look what’s specified in the alt tag. I guess you can get away with by only using the alt tag, but if you leave it empty google will have no idea what your image represents.

Also, it makes much more sense to have a human readable image URL. If it’s readable by humans it is readable by bots too.