update: revise installation instructions in README and adjust Azurite image in docker-compose
This commit is contained in:
89
README.md
89
README.md
@@ -4,9 +4,13 @@ This is a simple guide that will help you set up and run the Azure Storage Emula
|
||||
|
||||
Review the [Documentation](#reference) for more details on how to use the emulator and its features. This document covers a scenario where you want to run the emulator as close to the real Azure Storage service as possible, which means using triple HTTPS endpoints and OAuth simulation.
|
||||
|
||||
## Docker Installation
|
||||
## Installation
|
||||
|
||||
To run the Azure Storage Emulator in a Docker container, follow these steps:
|
||||
You can install and use the emulator in a few different ways, depending on your preferences and environment. The recommended way is to use a container runtime or Kubernetes, but you can also install it natively using Node.js.
|
||||
|
||||
### Using a container runtime
|
||||
|
||||
To run the Azure Storage Emulator in a container, follow these steps:
|
||||
|
||||
1. Ensure that a container runtime is installed. This repository supports both Docker and Apple `container` command.
|
||||
|
||||
@@ -22,9 +26,11 @@ To run the Azure Storage Emulator in a Docker container, follow these steps:
|
||||
./start-azurite
|
||||
```
|
||||
|
||||
## Native Installation
|
||||
You can also use the included example `compose.yaml` file for running it using `docker compose` (or any other compose compatible CLI).
|
||||
|
||||
To install the Azure Storage Emulator natively on your machine, ensure you have Node.js and npm installed, and follow these steps:
|
||||
### Using Node.js
|
||||
|
||||
To install the Azure Storage Emulator natively on your machine, ensure you have Node.js (with npm) and Caddy HTTP Server installed, and follow these steps:
|
||||
|
||||
1. Clone the repository:
|
||||
|
||||
@@ -59,9 +65,7 @@ To install the Azure Storage Emulator natively on your machine, ensure you have
|
||||
rm -rf azurite
|
||||
```
|
||||
|
||||
6. Install the Caddy HTTP server.
|
||||
|
||||
7. Create an `accounts.env` file in the same directory as the `run-server.sh` script with the following content:
|
||||
6. Create an `accounts.env` file in the same directory as the `run-server.sh` script with the following content:
|
||||
|
||||
```bash
|
||||
AZURITE_ACCOUNTS=accountname:accountkey
|
||||
@@ -79,13 +83,13 @@ To install the Azure Storage Emulator natively on your machine, ensure you have
|
||||
echo -n "your-seed-string" | base64
|
||||
```
|
||||
|
||||
8. Add the following line to your `/etc/hosts` file to map the custom domain names to localhost:
|
||||
7. Add the following line to your `/etc/hosts` file to map the custom domain names to localhost:
|
||||
|
||||
```
|
||||
127.0.0.1 <accountname>.blob.core.windows.net <accountname>.queue.core.windows.net <accountname>.table.core.windows.net
|
||||
```
|
||||
|
||||
9. Run the server:
|
||||
8. Run the server:
|
||||
|
||||
```bash
|
||||
./run-server.sh
|
||||
@@ -97,6 +101,72 @@ To install the Azure Storage Emulator natively on your machine, ensure you have
|
||||
./run-server.sh --oauth
|
||||
```
|
||||
|
||||
## Accessing the blob storage
|
||||
|
||||
### RClone
|
||||
|
||||
RClone is a command-line program to manage files on cloud storage. You can use it to interact with the Azure Storage Emulator the same way you would with the real Azure Storage service. Edit the rclone.conf file and add the following configuration:
|
||||
|
||||
```ini
|
||||
[azurite]
|
||||
type = azureblob
|
||||
account = accountname
|
||||
key = accountkey
|
||||
```
|
||||
|
||||
or, if you want to use simulated OAuth authentication:
|
||||
|
||||
```ini
|
||||
[azurite]
|
||||
type = azureblob
|
||||
account = accountname
|
||||
env_auth = true
|
||||
```
|
||||
|
||||
Now, you can use rclone commands to interact with the emulator. For example, to list the containers in the blob service:
|
||||
|
||||
```bash
|
||||
rclone ls azurite:
|
||||
```
|
||||
|
||||
> **Note**: On modern Linux distributions and MacOS systems the `rclone.conf` file is typically located at `~/.config/rclone/rclone.conf`.
|
||||
|
||||
### Terraform
|
||||
|
||||
Use the following Terraform Azure RM backend configuration to use the Azure Storage Emulator as the backend for storing Terraform state:
|
||||
|
||||
```hcl
|
||||
terraform {
|
||||
backend "azurerm" {
|
||||
storage_account_name = "accountname"
|
||||
container_name = "tfstate"
|
||||
key = "terraform.tfstate"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
and initialize the module:
|
||||
|
||||
```bash
|
||||
terraform init -backend-config=access_key=__base64_encoded_account_key__
|
||||
```
|
||||
|
||||
> **Note**: Be aware that AI Agents may generate or suggest using the `endpoint` parameter, which will not work. You have to create *fake* account FQDNs in your `/etc/hosts` file as described in the installation steps.
|
||||
|
||||
|
||||
You can use OAuth simulation with Terraform by adding the `use_azuread_auth` parameter to the backend configuration:
|
||||
|
||||
```hcl
|
||||
terraform {
|
||||
backend "azurerm" {
|
||||
storage_account_name = "accountname"
|
||||
container_name = "tfstate"
|
||||
key = "terraform.tfstate"
|
||||
use_azuread_auth = true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Command Reference
|
||||
|
||||
### `run-server.sh`
|
||||
@@ -158,3 +228,4 @@ You have to use the same procedure as for `run-server.sh` to install the generat
|
||||
- [Azure Storage Emulator GitHub Repository](https://github.com/azure/azurite)
|
||||
- [Azure Storage Emulator Documentation](https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite)
|
||||
- [Caddy Server](https://caddyserver.com)
|
||||
- [RClone](https://rclone.org)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
services:
|
||||
azurite:
|
||||
image: docker.io/skoszewski/azurite:latest
|
||||
image: azurite:latest
|
||||
container_name: azurite
|
||||
command:
|
||||
- --oauth
|
||||
|
||||
Reference in New Issue
Block a user