ghost-azurestorage:适配器以将Ghost图像存储在Azure存储中并使用可选的Azure CDN

  • U1_167799
    了解作者
  • 21.2KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-27 21:25
    上传日期
Ghost存储Azure适配器 此模块基于原始的,该使您可以使用Azure存储和Azure内容传递网络资源存储媒体文件,而不是将图像存储在本地计算机或本地存储上。 这个更新模块将上传图片到指定的Blob存储与文件格式<container>/images/image-name.jpg和不使用date格式<container>/images/<year>/month/date-hours-min_image-name.jpg默认情况下, <container>/images/<year>/month/date-hours-min_image-name.jpg (此设置现在可以配置)。 适配器的上载过程将自动将CacheControl设置为30天或更具体地: public, max-age=2592000并将适当的contentType设置为等于映像类型(Az
ghost-azurestorage-master.zip
  • ghost-azurestorage-master
  • config.sample.json
    351B
  • .gitignore
    28B
  • README.md
    6.1KB
  • azure-pipelines.yml
    682B
  • .github
  • workflows
  • staleChecker.yml
    427B
  • LICENSE
    1.1KB
  • package.json
    785B
  • index.js
    3.4KB
  • scripts
  • updateblob.sh
    891B
  • lib
  • fileService.js
    1.6KB
  • getDate.js
    287B
  • resize.js
    592B
  • resolveUrl.js
    480B
  • sizes.js
    207B
  • package-lock.json
    37.4KB
内容介绍
# Ghost Storage Azure Adapter [![npm version](https://badge.fury.io/js/ghost-storage-azure.svg)](https://badge.fury.io/js/ghost-storage-azure) [![Build Status](https://dev.azure.com/jessicadeen/ghost-storage-azure/_apis/build/status/jldeen.ghost-azurestorage?branchName=master)](https://dev.azure.com/jessicadeen/ghost-storage-azure/_build/latest?definitionId=9&branchName=master) This module is based on the original [Ghost Azure Storage Adapter](https://github.com/Niyo/ghost-azurestorage) by [Niyo](https://github.com/Niyo), which allows you to store media files using Azure Storage and Azure Content Delivery Network resources instead of storing images on your local machine or local storage. This updated module will upload your images to the specified blob storage with the file format `<container-name>/images/image-name.jpg` and does __not__ use the `date` format `<container-name>/images/<year>/month/date-hours-min_image-name.jpg` by default (this setting is now configurable). The adapter's upload process will automatically set `CacheControl` to 30 days, or more specifically: `public, max-age=2592000` and set the appropriate `contentType` to be equal to the image type (default for Azure Storage is `application/octet-stream` so this adapter will override). ### Features - Ghost version `2.x` (not tested on previous Ghost versions) - Latest Azure Storage Client Library [SDK](https://github.com/Azure/azure-storage-node) - Image upload - Ability to upload in dated sub-directories (similar to Ghost default Local storage adapter `<container-name>/images/YYYY/MM/dd-hh-mm_image-name.jpg`) - Ability to upload images into a directory `<container-name>/images/image-name.jpg` - NEW (9/2019) - Upon upload, you will have your upload image available at your desired container path as well as size options to chose from. You can choose the following widths: 300, 600, 900. 1300 I.E: - Original image: without date enabled `/container-name/images/image.png` - Original image: with date enabled `/container-name/images/YYYY/MM/dd-hh-mm_image-name.jpg` - Original image size format(without date): `/container-name/images/size/300/image.png` - Original image size fromat (with date): `/container-name/images/size/300/YYYY/MM/dd-hh-mm_image-name.jpg` In the above examples you would just change `300` to whichever width you wish to use out of the 4 available, or remove `size/300` entirely to use the original image. ### TO-DO Tasks - ~~Update CacheControl to optional parameter with configurable settings~~(Completed 9/2019 in 1.1.0-rc) - ~~Add in contentType based on image extension (Azure Storage defaults to application/octet-stream)~~ (Completed 9/2019 in 1.1.0-rc) - ~~Update adapter methods to support Ghost's added support of [custom image sizes upon request](https://github.com/TryGhost/Ghost/pull/10184).~~ (Completed in release Candidate 1.1.0-rc which now includes custom image sizes: 300, 600, 900, 1300) - Add in support for Azure Files (currently only works with blob storage) - Update documentation/readme to include how to use a Connection String from Azure KeyVault instead. ## Installation Run the following commands in the directory where Ghost is installed: #### *nix * `npm install ghost-storage-azure` (note the absence of `--save`) * `mkdir -p content/adapters/storage` (make the adapters and storage folders if they do not already exist yet) * `cp -vR node_modules/ghost-storage-azure content/adapters/storage/ghost-storage-azure` (copy the module into the right location, the name must match) #### powershell * `npm install ghost-storage-azure` (note the absence of `--save`) * `mkdir content/adapters` (make the adapters folder if it doesn't already exist yet) * `mkdir content/storage/adapters` (make the storage folder if it doesn't already exist) * `cp -Recurse node_modules/ghost-storage-azure content/adapters/storage/ghost-storage-azure` (copy the module into the right location) #### alpine docker container Add the following code snippet to your Dockerfile ``` # Add necessary packages for Sharp to work RUN apk add --update --no-cache gcc g++ make libc6-compat python python3 RUN apk add vips-dev fftw-dev build-base --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/community --repository https://alpine.global.ssl.fastly.net/alpine/edge/main # Install Azure Storage RUN npm install ghost-storage-azure RUN cp -vR node_modules/ghost-storage-azure current/core/server/adapters/storage/ghost-storage-azure ``` ## Configuration 1. Create new Azure Storage Account. 2. [Optional] Create a new container. This will be created on demand if it does not already exist. 3. Get the connection string to your storage account. You can find this in the preview portal, or from running the below [Azure CLI](https://docs.microsoft.com/cli/azure/install-azure-cli?view=azure-cli-latest) commands: * `az login` (login to your azure account) * `az account list -o table` (list available azure subscriptions) * `az account set --subscription "<subscription-id>"` (set your az cli instance to use the appropriate subscription with the relevant storage account) * `az storage account show-connection-string --resource-group <resource-group-name> --name <storage-account-name>` (outputs a connection string to use, example is below) ``` { "connectionString": "DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=<storage-account-name>;AccountKey=<storage-account-key>" } ``` Add `storage` block to file `config.js` in each environment as below: ``` "storage": { "active": "ghost-storage-azure", "ghost-storage-azure": { "connectionString": "YourConnectionStringHere", "container": "YourOptionalContainerName", "cdnUrl": "YourCDNEndpointDomain", "useHttps" : "true", //Optional: CDN protocol. Defaults to http if omitted. Set to "true", to enable. "cacheControl" : "2592000", //Optional: cacheControl override. Defaults to 2592000 (30 days). "useDatedFolder" : true //Optional: Defaults to false. Set to `true` to enable. } }, ``` ## Environment Variables You can set your connection string as the Environment Variable `AZURE_STORAGE_CONNECTION_STRING` Released under the [MIT license](https://github.com/jldeen/ghost-azurestorage/blob/master/LICENSE).
评论
    相关推荐
    • AquaExplorer:Azure 存储资源管理器
      水族探险家 Azure 存储资源管理器
    • Windows Azure存储
      简单了解什么是Windows Azure存储以及如何使用它
    • ex_azure_storage:Elixir Azure存储客户端
      Azure存储 Elixir Azure Storage Rest API客户端。 支持Azure Blob,队列,文件共享和表存储。 安装 该软件包可以通过添加安装ex_azure_storage你在依赖列表mix.exs : def deps do [ { :ex_azure_storage , " ~...
    • Azure_knowledge:存储Azure知识
      Azure_knowledge 存储Azure知识
    • 使用C#处理Azure存储
      本文演示了如何创建一个新的Azure存储表并对该表执行CRUD操作。
    • AzureMasterClass:Azure主类的回购
      John Savill的Azure大师课程的存储库 这是与Azure Master类相关的材料的存储库 该类旨在从头到尾依次查看,因为每个模块都建立在最后一个模块上。 该存储库提供: 幻灯片的讲义格式为PDF 创建的白板图像 任何其他...
    • Azure.Data.Wrappers:简化了Azure存储
      简化了Azure存储 队列/ blob /表/文件共享 Azure存储资源 依赖注入 可模拟测试 优先使用异步通话 运行测试 确保Azure存储模拟器正在运行 针对测试程序集执行NUnit控制台运行程序 PM> Install-Package Azure.Data....
    • ghost-azurestorage:将ghost内容存储azure存储
      此模块允许您将媒体文件存储Azure上,而不是存储在本地计算机上。 安装 您需要在安装ghost的目录中输入以下命令。 例如,如果您遵循了,它将位于/var/www/ghost 。 *尼克斯 sudo npm install ghost-azure-storage ...
    • azure
      该服务可以是Azure服务,例如例如Azure存储Azure Cosmos数据库,SQL等,或您自己的专用链接服务。” 专用终结点可使用VPN或Express Route和由Private Link提供的服务,在同一VNet,区域对等VNet,全球对等VNet...
    • GaussDB_100_1.0.1-DATABASE-REDHAT-64bit.tar.gz
      guassdb100在redhat上安装包,单机部署的包,安装步骤请看我的文中介绍,经过大量实验搭建总结出来的文档