### azfloci Table Storage CLI Example Source: https://github.com/floci-io/floci-az/blob/main/README.md Example of using `azfloci` to create a table storage table. ```bash # Create a table az storage table create --name MyTable ``` -------------------------------- ### azfloci Queue Storage CLI Examples Source: https://github.com/floci-io/floci-az/blob/main/README.md Examples of using `azfloci` to manage queue storage and messages. ```bash # Create a queue az storage queue create --name my-queue # Send a message az storage message put --queue-name my-queue --content "Hello from CLI" ``` -------------------------------- ### az setup Source: https://context7.com/floci-io/floci-az/llms.txt Prints the connection string and suggests an alias for the azfloci CLI. ```APIDOC ## az setup ### Description Prints the connection string and suggests an alias for the azfloci CLI. ### Command az setup ``` -------------------------------- ### Install Java using SDKMAN Source: https://github.com/floci-io/floci-az/blob/main/CONTRIBUTING.md Installs Java 25 using SDKMAN. Ensure SDKMAN is installed first. ```bash curl -s "https://get.sdkman.io" | bash source "$HOME/.sdkman/bin/sdkman-init.sh" sdk install java 25-open ``` -------------------------------- ### azfloci Blob Storage CLI Examples Source: https://github.com/floci-io/floci-az/blob/main/README.md Examples of using `azfloci` to manage blob storage containers and blobs. ```bash # Create a container az storage container create --name my-container # Upload a blob az storage blob upload --container-name my-container --name hello.txt --file hello.txt # List blobs az storage blob list --container-name my-container --output table ``` -------------------------------- ### Start Local Emulator with Docker Compose Source: https://github.com/floci-io/floci-az/blob/main/docs/contributing.md Initialize and start the local development emulator using Docker Compose. This is a prerequisite for running local compatibility tests. ```bash docker compose up -d ``` -------------------------------- ### Upload, Download, and List Blobs Source: https://context7.com/floci-io/floci-az/llms.txt Java example for uploading a file, downloading it, and listing blobs in a container. Uses the Azure SDK for Java. ```java // Java — Azure SDK for Java import com.azure.storage.blob.*; import java.io.ByteArrayInputStream; BlobServiceClient client = new BlobServiceClientBuilder() .connectionString( "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;" + "AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMh0==;" + "BlobEndpoint=http://localhost:4577/devstoreaccount1") .buildClient(); BlobContainerClient container = client.createBlobContainerIfNotExists("my-container"); BlobClient blob = container.getBlobClient("hello.txt"); blob.upload(new ByteArrayInputStream("Hello from floci-az!".getBytes()), 20, true); // Download blob.downloadToFile("/tmp/hello.txt"); // List blobs container.listBlobs().forEach(b -> System.out.println(b.getName())); ``` -------------------------------- ### Run floci-az with Docker Compose Source: https://github.com/floci-io/floci-az/blob/main/README.md Command to start the floci-az service using Docker Compose. ```bash docker compose up ``` -------------------------------- ### Multi-container Docker Compose Setup Source: https://github.com/floci-io/floci-az/blob/main/README.md Example Docker Compose configuration for running Floci-AZ alongside your application. Ensure your application container can reach the 'floci-az' service by using its service name as the hostname. ```yaml services: floci-az: image: floci/floci-az:latest ports: - "4577:4577" volumes: - /var/run/docker.sock:/var/run/docker.sock # required for Azure Functions networks: - app-net my-app: environment: AZURE_BLOB_ENDPOINT: http://floci-az:4577/devstoreaccount1 AZURE_QUEUE_ENDPOINT: http://floci-az:4577/devstoreaccount1-queue AZURE_TABLE_ENDPOINT: http://floci-az:4577/devstoreaccount1-table AZURE_FUNCTIONS_ENDPOINT: http://floci-az:4577/devstoreaccount1-functions depends_on: floci-az: condition: service_healthy networks: - app-net networks: app-net: ``` -------------------------------- ### Clone and Run Floci Source: https://github.com/floci-io/floci-az/blob/main/CONTRIBUTING.md Clones the Floci repository and starts the development server with hot-reloading. ```bash git clone https://github.com/floci-io/floci.git cd floci ./mvnw quarkus:dev # hot reload on port 4566 ``` -------------------------------- ### Alias azfloci as az Source: https://github.com/floci-io/floci-az/blob/main/docs/getting-started/azure-setup.md Optional: alias `azfloci` as `az` for a seamless experience with the Azure CLI wrapper. Run `az setup` to initialize or get connection string info. ```bash # Optional: alias azfloci as az for a seamless experience alias az='python3 /path/to/floci-az/azfloci/azfloci.py' # Initialize or get connection string info az setup ``` -------------------------------- ### azfloci CLI Wrapper for Azure Storage Commands Source: https://context7.com/floci-io/floci-az/llms.txt Examples of using the azfloci Python CLI wrapper to interact with Azure Blob, Queue, and Table storage without manually specifying connection strings. ```bash # Setup: alias azfloci as az alias az='python3 /path/to/floci-az/azfloci/azfloci.py' # Print connection string and alias suggestion az setup # Output: # Connection String: DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;... # Alias suggestion: alias az='python3 /path/to/azfloci.py' # Blob — create container, upload, list, download az storage container create --name my-container az storage blob upload --container-name my-container --name hello.txt --file hello.txt az storage blob list --container-name my-container --output table az storage blob download --container-name my-container --name hello.txt --file downloaded.txt # Queue — create, send, receive az storage queue create --name my-queue az storage message put --queue-name my-queue --content "Hello from CLI" az storage message peek --queue-name my-queue # Table — create, insert entity az storage table create --name MyTable az storage entity insert --table-name MyTable \ --entity PartitionKey=pk1 RowKey=rk1 Value=hello # With explicit account name (defaults to devstoreaccount1) az storage container list --account-name devstoreaccount1 ``` -------------------------------- ### Queue Storage Operations Source: https://context7.com/floci-io/floci-az/llms.txt Python example for creating a queue, sending, peeking, receiving, and deleting messages, and deleting the queue. Requires azure-storage-queue. ```python # Python — azure-storage-queue from azure.storage.queue import QueueServiceClient CONN = ( "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;" "AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMh0==;" "QueueEndpoint=http://localhost:4577/devstoreaccount1-queue;" ) service = QueueServiceClient.from_connection_string(CONN) queue = service.create_queue("my-queue") # Send messages queue.send_message("Hello from floci-az!") queue.send_message("Second message") # Peek (non-destructive) for msg in queue.peek_messages(max_messages=5): print("Peek:", msg.content) # Receive and delete messages = list(queue.receive_messages(messages_per_page=10)) for msg in messages: print("Received:", msg.content) queue.delete_message(msg) # Delete queue queue.delete_queue() ``` -------------------------------- ### Create and Get Azure Table Entity (Python) Source: https://github.com/floci-io/floci-az/blob/main/README.md Shows how to create a table, insert an entity, and retrieve it using the azure-data-tables SDK. Verify the connection string points to the emulator's table endpoint. ```python from azure.data.tables import TableServiceClient conn_str = ( "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;" "AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMh0==;" "TableEndpoint=http://localhost:4577/devstoreaccount1-table;" ) service = TableServiceClient.from_connection_string(conn_str) table = service.create_table("MyTable") table.create_entity({"PartitionKey": "pk1", "RowKey": "rk1", "Value": "hello"}) entity = table.get_entity("pk1", "rk1") print(entity["Value"]) ``` -------------------------------- ### Conventional Commit Examples Source: https://github.com/floci-io/floci-az/blob/main/CONTRIBUTING.md Examples of commit messages following the Conventional Commits specification for automated changelog generation and version bumping. ```git feat: add SQS SendMessageBatch action fix: correct DynamoDB QueryFilter comparison operators feat!: change default storage mode to persistent ``` -------------------------------- ### Create, Get, and List Entities in Azure Data Tables Source: https://context7.com/floci-io/floci-az/llms.txt Demonstrates creating a table, adding an entity, retrieving it, and listing entities with an OData filter using the @azure/data-tables SDK. ```typescript // Node.js / TypeScript — @azure/data-tables import { TableClient } from "@azure/data-tables"; const CONN = "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;" + "AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMh0==;" + "TableEndpoint=http://localhost:4577/devstoreaccount1-table;"; const client = TableClient.fromConnectionString(CONN, "Employees"); await client.createTable(); await client.createEntity({ partitionKey: "engineering", rowKey: "emp001", name: "Alice", active: true, }); const entity = await client.getEntity("engineering", "emp001"); console.log(entity.name); // Alice // OData filter query for await (const e of client.listEntities({ queryOptions: { filter: "active eq true" }, })) { console.log(e.name); } ``` -------------------------------- ### Queue Storage Operations (Node.js/TypeScript) Source: https://context7.com/floci-io/floci-az/llms.txt Node.js/TypeScript example for queue operations including creation, sending, receiving, and deleting messages. Uses @azure/storage-queue. ```typescript // Node.js / TypeScript — @azure/storage-queue import { QueueServiceClient } from "@azure/storage-queue"; const CONN = "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;" + "AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMh0==;" + "QueueEndpoint=http://localhost:4577/devstoreaccount1-queue;"; const service = QueueServiceClient.fromConnectionString(CONN); const queue = service.getQueueClient("my-queue"); await queue.createIfNotExists(); await queue.sendMessage("Hello from floci-az!"); const response = await queue.receiveMessages({ numberOfMessages: 5 }); for (const msg of response.receivedMessageItems) { console.log(msg.messageText); await queue.deleteMessage(msg.messageId, msg.popReceipt); } ``` -------------------------------- ### Basic Docker Compose Setup Source: https://github.com/floci-io/floci-az/blob/main/docs/configuration/docker-compose.md This is the most basic Docker Compose configuration for the floci-az service. It specifies the image to use, maps ports, and mounts necessary volumes, including the Docker socket for Azure Functions. ```yaml services: floci-az: image: floci/floci-az:latest ports: - "4577:4577" volumes: - ./data:/app/data - /var/run/docker.sock:/var/run/docker.sock # required for Azure Functions ``` -------------------------------- ### Python SDK Integration for Blob Storage Source: https://github.com/floci-io/floci-az/blob/main/README.md Example of using the `azure-storage-blob` Python SDK with floci-az. Creates a container, uploads a blob, and downloads its content. ```python # Python (azure-storage-blob) from azure.storage.blob import BlobServiceClient conn_str = ( "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;" "AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMh0==;" "BlobEndpoint=http://localhost:4577/devstoreaccount1;" ) client = BlobServiceClient.from_connection_string(conn_str) client.create_container("my-container") blob = client.get_container_client("my-container").get_blob_client("hello.txt") blob.upload_blob(b"Hello from floci-az!") data = blob.download_blob().readall() print(data) ``` -------------------------------- ### Get a specific app Source: https://context7.com/floci-io/floci-az/llms.txt Retrieves details for a specific function app. ```APIDOC ## GET /admin/apps/:appName ### Description Gets details for a specific function app. ### Method GET ### Endpoint /admin/apps/my-app ``` -------------------------------- ### Table Storage Operations Source: https://context7.com/floci-io/floci-az/llms.txt Python example for table operations including table creation, entity insertion, retrieval, querying with OData filters, and upserting. Uses azure-data-tables. ```python # Python — azure-data-tables from azure.data.tables import TableServiceClient CONN = ( "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;" "AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMh0==;" "TableEndpoint=http://localhost:4577/devstoreaccount1-table;" ) service = TableServiceClient.from_connection_string(CONN) table = service.create_table_if_not_exists("Employees") # Insert entity table.create_entity({ "PartitionKey": "engineering", "RowKey": "emp001", "Name": "Alice", "Department": "Engineering", "Active": True }) # Get entity entity = table.get_entity(partition_key="engineering", row_key="emp001") print(entity["Name"]) # Alice # Query with OData filter for e in table.query_entities("Department eq 'Engineering'"): print(e["Name"]) # Upsert entity table.upsert_entity({ "PartitionKey": "engineering", "RowKey": "emp001", "Name": "Alice Smith" }) ``` -------------------------------- ### Multi-Container Docker Compose Setup Source: https://context7.com/floci-io/floci-az/llms.txt This Docker Compose configuration sets up Floci-AZ and a dependent application service ('my-app'). It configures networking, health checks for Floci-AZ, and passes a connection string to 'my-app' that points to the Floci-AZ service. ```yaml services: floci-az: image: floci/floci-az:latest ports: - "4577:4577" volumes: - /var/run/docker.sock:/var/run/docker.sock networks: - app-net healthcheck: test: ["CMD", "curl", "-f", "http://localhost:4577/health"] interval: 5s timeout: 3s retries: 5 my-app: build: . environment: AZURE_STORAGE_CONNECTION_STRING: >- DefaultEndpointsProtocol=http;AccountName=devstoreaccount1; AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMh0==; BlobEndpoint=http://floci-az:4577/devstoreaccount1; QueueEndpoint=http://floci-az:4577/devstoreaccount1-queue; TableEndpoint=http://floci-az:4577/devstoreaccount1-table; depends_on: floci-az: condition: service_healthy networks: - app-net networks: app-net: ``` -------------------------------- ### Docker Compose with Persistent Storage Source: https://github.com/floci-io/floci-az/blob/main/docs/configuration/docker-compose.md This configuration enables persistent storage for the floci-az service by setting the `FLOCI_AZ_STORAGE_MODE` environment variable to `hybrid`. It also includes the basic setup for image, ports, and volumes. ```yaml services: floci-az: image: floci/floci-az:latest ports: - "4577:4577" volumes: - ./data:/app/data - /var/run/docker.sock:/var/run/docker.sock environment: FLOCI_AZ_STORAGE_MODE: hybrid ``` -------------------------------- ### Build and Run Native Application (Manual) Source: https://github.com/floci-io/floci-az/blob/main/docs/getting-started/installation.md Compile the application into a native executable for faster startup. Requires GraalVM/Mandrel and native-image support. ```bash ./mvnw package -Dnative -DskipTests ./target/*-runner ``` -------------------------------- ### Build and Run JVM Application (Manual) Source: https://github.com/floci-io/floci-az/blob/main/docs/getting-started/installation.md Package the application using Maven and then run the generated JAR file. Requires Java 25 and Maven 3.9+. ```bash ./mvnw package -DskipTests java -jar target/quarkus-app/quarkus-run.jar ``` -------------------------------- ### Building Floci-AZ from Source Source: https://context7.com/floci-io/floci-az/llms.txt Commands for building Floci-AZ from source using Maven. Includes instructions for a standard JVM build, a native binary build with GraalVM, and creating Docker images for both JVM and native versions. ```bash # Requirements: Java 25, Maven 3.9+, Docker # JVM build and run ./mvnw package -DskipTests java -jar target/quarkus-app/quarkus-run.jar # Native binary (requires GraalVM / Mandrel) ./mvnw package -Dnative -DskipTests ./target/*-runner # Docker images docker build -f Dockerfile -t floci-az:dev . # JVM docker build -f Dockerfile.native -t floci-az:dev-native . # Native ``` -------------------------------- ### Invoke a function Source: https://context7.com/floci-io/floci-az/llms.txt Invokes a deployed function. Supports HTTP GET and POST methods. ```APIDOC ## GET /api/:appName/:functionName ### Description Invokes a function with an HTTP trigger using the GET method. ### Method GET ### Endpoint /api/my-app/hello?msg=world ## POST /api/:appName/:functionName ### Description Invokes a function with an HTTP trigger using the POST method. ### Method POST ### Endpoint /api/my-app/hello ### Parameters #### Request Body - **(JSON object)** - Optional - Request payload for the function. ``` -------------------------------- ### Initialize azfloci Source: https://github.com/floci-io/floci-az/blob/main/README.md Command to initialize floci-az or retrieve connection string information. ```bash # Initialize or get connection string info az setup ``` -------------------------------- ### Create Symlinks for Agent Instructions Source: https://github.com/floci-io/floci-az/blob/main/CONTRIBUTING.md Creates symbolic links to AGENT.md for different AI agent compatibility. ```bash ln -s AGENT.md CLAUDE.md ln -s AGENT.md GEMINI.md ln -s AGENT.md COPILOT.md ``` -------------------------------- ### Create Azure Storage Container Source: https://github.com/floci-io/floci-az/blob/main/docs/getting-started/azure-setup.md Use the standard `az` CLI to create a storage container. You must provide the connection string for each command when not using the `azfloci` wrapper. ```bash az storage container create --name mycontainer --connection-string "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMh0==;BlobEndpoint=http://localhost:4577/devstoreaccount1;" ``` -------------------------------- ### Create Release Branch and Push Source: https://github.com/floci-io/floci-az/blob/main/CONTRIBUTING.md Steps for maintainers to create a new release branch, push it, and trigger the automated release process. ```bash git checkout main && git pull git checkout -b release/1.2.x git push origin release/1.2.x ``` -------------------------------- ### Upload and Download Azure Blob (Java) Source: https://github.com/floci-io/floci-az/blob/main/README.md Illustrates creating a blob container, uploading a blob, and downloading its content using the Azure SDK for Java. Ensure the connection string is configured for the blob endpoint. ```java // Java (Azure SDK for Java) import com.azure.storage.blob.BlobServiceClient; import com.azure.storage.blob.BlobServiceClientBuilder; import com.azure.storage.blob.BlobClient; import com.azure.storage.blob.BlobDownloadResponse; import java.io.ByteArrayInputStream; BlobServiceClient client = new BlobServiceClientBuilder() .connectionString( "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;" "AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMh0==;" "BlobEndpoint=http://localhost:4577/devstoreaccount1;") .buildClient(); client.createBlobContainer("my-container"); BlobClient blob = client.getBlobContainerClient("my-container").getBlobClient("hello.txt"); blob.upload(new ByteArrayInputStream("Hello from floci-az!".getBytes()), 20); BlobDownloadResponse response = blob.downloadWithResponse(/* ... */); ``` -------------------------------- ### Send and Receive Azure Queue Messages (Python) Source: https://github.com/floci-io/floci-az/blob/main/README.md Demonstrates creating a queue, sending a message, and receiving it using the azure-storage-queue SDK. Ensure the connection string is correctly configured for the emulator. ```python from azure.storage.queue import QueueServiceClient conn_str = ( "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;" "AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMh0==;" "QueueEndpoint=http://localhost:4577/devstoreaccount1-queue;" ) client = QueueServiceClient.from_connection_string(conn_str) queue = client.create_queue("my-queue") queue.send_message("Hello from floci-az!") messages = list(queue.receive_messages()) print(messages[0].content) ``` -------------------------------- ### Upload and Download Azure Blob (Node.js/TypeScript) Source: https://github.com/floci-io/floci-az/blob/main/README.md Shows how to create a container, upload a blob, and download it using the @azure/storage-blob SDK. The connection string must be set to the emulator's blob endpoint. ```typescript // Node.js / TypeScript (Azure SDK) import { BlobServiceClient } from "@azure/storage-blob"; const CONN = "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;" "AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMh0==;" "BlobEndpoint=http://localhost:4577/devstoreaccount1;"; const client = BlobServiceClient.fromConnectionString(CONN); const { containerClient } = await client.createContainer("my-container"); const blob = containerClient.getBlockBlobClient("hello.txt"); await blob.upload(Buffer.from("Hello from floci-az!"), 20); const downloaded = await blob.downloadToBuffer(); console.log(downloaded.toString()); ``` -------------------------------- ### Run Node.js SDK Compatibility Tests Source: https://github.com/floci-io/floci-az/blob/main/docs/contributing.md Execute compatibility tests for the Node.js SDK using npm. This requires the local emulator to be running. ```bash make test-node-compat ``` -------------------------------- ### Run Compatibility Tests Source: https://github.com/floci-io/floci-az/blob/main/README.md Commands to execute compatibility tests for different SDKs against the running emulator. These tests help validate the emulator's adherence to real Azure SDK workflows. ```bash make test-python make test-java-compat make test-node-compat ``` -------------------------------- ### Upload and Download Blob Source: https://context7.com/floci-io/floci-az/llms.txt Demonstrates uploading a file to Blob Storage and then downloading it. Requires the @azure/storage-blob SDK. ```typescript // Node.js / TypeScript — @azure/storage-blob import { BlobServiceClient } from "@azure/storage-blob"; const CONN = "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;" + "AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMh0==;" + "BlobEndpoint=http://localhost:4577/devstoreaccount1"; const client = BlobServiceClient.fromConnectionString(CONN); const containerClient = client.getContainerClient("my-container"); await containerClient.createIfNotExists(); const blockBlob = containerClient.getBlockBlobClient("hello.txt"); await blockBlob.upload(Buffer.from("Hello from floci-az!"), 20); const downloaded = await blockBlob.downloadToBuffer(); console.log(downloaded.toString()); // "Hello from floci-az!" ``` -------------------------------- ### Run Java SDK Compatibility Tests Source: https://github.com/floci-io/floci-az/blob/main/docs/contributing.md Execute compatibility tests for the Java SDK using Maven. This requires the local emulator to be running. ```bash make test-java-compat ``` -------------------------------- ### Build Local Docker Images Source: https://github.com/floci-io/floci-az/blob/main/docs/getting-started/installation.md Build Docker images for local development. Supports both JVM and native configurations. ```bash # JVM image docker build -f Dockerfile -t floci-az:dev . # Native image (single-arch, current machine) docker build -f Dockerfile.native -t floci-az:dev-native . ``` -------------------------------- ### Run Unit Tests with Maven Source: https://github.com/floci-io/floci-az/blob/main/docs/contributing.md Execute all unit tests for the project using the Maven wrapper. ```bash ./mvnw test ``` -------------------------------- ### Run Python SDK Compatibility Tests Source: https://github.com/floci-io/floci-az/blob/main/docs/contributing.md Execute compatibility tests for the Python SDK. Ensure your Python environment is set up (e.g., using a virtual environment). ```bash make test-python ``` -------------------------------- ### Run Floci-AZ Docker Image Source: https://github.com/floci-io/floci-az/blob/main/docs/getting-started/installation.md Quickly run the latest Floci-AZ Docker image. Mounts local data and Docker socket for Azure Functions compatibility. ```bash docker run -d --name floci-az \ -p 4577:4577 \ -v ./data:/app/data \ -v /var/run/docker.sock:/var/run/docker.sock \ floci/floci-az:latest ``` -------------------------------- ### Python Blob Storage Operations with Floci-Az Source: https://context7.com/floci-io/floci-az/llms.txt Demonstrates basic Blob Storage operations using the `azure-storage-blob` Python SDK. This includes creating a container, uploading a blob, downloading a blob, and listing blobs. Ensure the `CONN` string is correctly configured for Floci-Az. ```python # Python — azure-storage-blob from azure.storage.blob import BlobServiceClient CONN = ( "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;" "AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMh0==;" "BlobEndpoint=http://localhost:4577/devstoreaccount1;" ) client = BlobServiceClient.from_connection_string(CONN) # Create container client.create_container("my-container") # Upload blob container = client.get_container_client("my-container") blob = container.get_blob_client("hello.txt") blob.upload_blob(b"Hello from floci-az!", overwrite=True) # Download blob data = blob.download_blob().readall() print(data) # b"Hello from floci-az!" # List blobs for b in container.list_blobs(): print(b.name) ``` -------------------------------- ### Run Floci-AZ with Docker Compose Source: https://github.com/floci-io/floci-az/blob/main/docs/getting-started/quick-start.md Use this Docker Compose configuration to set up Floci-AZ. Ensure the Docker socket is mounted for Azure Functions to work. ```yaml services: floci-az: image: floci/floci-az:latest ports: - "4577:4577" volumes: - ./data:/app/data - /var/run/docker.sock:/var/run/docker.sock # required for Azure Functions ``` ```bash docker compose up ``` -------------------------------- ### Run Floci-Az with Docker Compose Source: https://context7.com/floci-io/floci-az/llms.txt Use this Docker Compose file to set up and run Floci-Az. Mount the Docker socket if Azure Functions support is needed. The `hybrid` storage mode ensures data persistence across container restarts. ```yaml services: floci-az: image: floci/floci-az:latest ports: - "4577:4577" volumes: - ./data:/app/data - /var/run/docker.sock:/var/run/docker.sock # required for Azure Functions environment: FLOCI_AZ_STORAGE_MODE: hybrid # survive container restarts ``` -------------------------------- ### Run Compatibility Tests in Docker Source: https://github.com/floci-io/floci-az/blob/main/docs/contributing.md Build and run compatibility tests within Docker containers, mirroring the CI environment. This command builds test images and runs them against the floci-az container. ```bash make compat-docker ``` -------------------------------- ### az storage queue create Source: https://context7.com/floci-io/floci-az/llms.txt Creates an Azure Storage queue using the azfloci CLI. ```APIDOC ## az storage queue create ### Description Creates an Azure Storage queue. ### Command az storage queue create --name ### Parameters - **--name** (string) - Required - The name of the queue. ``` -------------------------------- ### List all apps Source: https://context7.com/floci-io/floci-az/llms.txt Retrieves a list of all deployed function apps. ```APIDOC ## GET /admin/apps ### Description Lists all deployed function apps. ### Method GET ### Endpoint /admin/apps ``` -------------------------------- ### az storage table create Source: https://context7.com/floci-io/floci-az/llms.txt Creates an Azure Storage table using the azfloci CLI. ```APIDOC ## az storage table create ### Description Creates an Azure Storage table. ### Command az storage table create --name ### Parameters - **--name** (string) - Required - The name of the table. ``` -------------------------------- ### Create a function app Source: https://context7.com/floci-io/floci-az/llms.txt Creates a new function app with the specified runtime and environment variables. Supported runtimes include node, python, java, and dotnet. ```APIDOC ## PUT /admin/apps/:appName ### Description Creates a function app with the specified runtime and environment variables. ### Method PUT ### Endpoint /admin/apps/my-app ### Parameters #### Request Body - **runtime** (string) - Required - The runtime for the function app (e.g., node, python, java, dotnet). - **environment** (object) - Optional - Environment variables for the function app. ``` -------------------------------- ### Deploy a function Source: https://context7.com/floci-io/floci-az/llms.txt Deploys a function to a specified app. The function code should be provided as a base64-encoded ZIP file. ```APIDOC ## PUT /admin/apps/:appName/functions/:functionName ### Description Deploys a function to a specified app. The function code must be a base64-encoded ZIP file. ### Method PUT ### Endpoint /admin/apps/my-app/functions/hello ### Parameters #### Request Body - **handler** (string) - Required - The entry point for the function (e.g., index.handler). - **timeoutSeconds** (integer) - Optional - The timeout for the function in seconds. - **zipBase64** (string) - Required - The base64-encoded ZIP file containing the function code. ``` -------------------------------- ### az storage container create Source: https://context7.com/floci-io/floci-az/llms.txt Creates an Azure Storage container using the azfloci CLI. ```APIDOC ## az storage container create ### Description Creates an Azure Storage container. ### Command az storage container create --name ### Parameters - **--name** (string) - Required - The name of the container. ``` -------------------------------- ### Run Floci-AZ with Docker Run Source: https://github.com/floci-io/floci-az/blob/main/docs/getting-started/quick-start.md Alternatively, run Floci-AZ directly using the `docker run` command. This command mounts the Docker socket, which is necessary for Azure Functions. ```bash docker run -d --name floci-az \ -p 4577:4577 \ -v /var/run/docker.sock:/var/run/docker.sock \ floci/floci-az:latest ``` -------------------------------- ### Floci-AZ Application Configuration (application.yml) Source: https://context7.com/floci-io/floci-az/llms.txt This YAML configuration shows the default settings for Floci-AZ, including port, authentication mode, storage options, and Docker settings. Environment variables can override these defaults. ```yaml # application.yml (all defaults shown) floci-az: port: 4577 base-url: http://localhost:4577 # hostname: myhost.internal # override hostname in returned URLs auth: mode: dev # dev = accept any credentials | strict = validate HMAC-SHA256 storage: mode: memory # memory | persistent | hybrid | wal path: /app/data wal: compaction-interval-ms: 30000 hybrid: flush-interval-ms: 5000 services: blob: # mode: wal queue: # mode: hybrid table: # mode: persistent docker: docker-host: unix:///var/run/docker.sock log-max-size: "10m" log-max-file: "3" services: blob: enabled: true queue: enabled: true table: enabled: true functions: enabled: true code-path: /app/data/functions ephemeral: false # true = fresh container per invocation idle-timeout-ms: 300000 # evict warm containers idle > 5 min ``` -------------------------------- ### Patch Release Workflow Source: https://github.com/floci-io/floci-az/blob/main/CONTRIBUTING.md Use this sequence of commands to perform a patch release on an existing release branch. The semver workflow will then create the patch version and trigger a Docker publish. ```bash git checkout release/1.1.x git cherry-pick git push origin release/1.1.x # semver workflow creates 1.1.x and triggers Docker publish ``` -------------------------------- ### Alias azfloci to az Source: https://github.com/floci-io/floci-az/blob/main/README.md Optional alias to use `azfloci` as `az` for a seamless experience with the Azure CLI. ```bash # Optional: alias azfloci as az for a seamless experience alias az='python3 /path/to/floci-az/azfloci/azfloci.py' ``` -------------------------------- ### Run Floci Tests Source: https://github.com/floci-io/floci-az/blob/main/CONTRIBUTING.md Commands to run all tests, a single test class, or a specific test method. ```bash ./mvnw test # all tests ``` ```bash ./mvnw test -Dtest=SsmIntegrationTest # single class ``` ```bash ./mvnw test -Dtest=SsmIntegrationTest#putParameter # single method ``` -------------------------------- ### Floci-AZ Environment Variable Reference Source: https://context7.com/floci-io/floci-az/llms.txt This table lists key environment variables for configuring Floci-AZ, their default values, and a brief description of their function. These variables allow for runtime customization of the application's behavior. ```markdown | Variable | Default | Description | |---|---|---| | `FLOCI_AZ_PORT` | `4577` | Listening port | | `FLOCI_AZ_AUTH_MODE` | `dev` | `dev` or `strict` (HMAC-SHA256) | | `FLOCI_AZ_STORAGE_MODE` | `memory` | Global storage mode | | `FLOCI_AZ_STORAGE_PATH` | `/app/data` | Persistence directory | | `FLOCI_AZ_STORAGE_SERVICES_BLOB_MODE` | _(global)_ | Per-service blob override | | `FLOCI_AZ_STORAGE_SERVICES_QUEUE_MODE` | _(global)_ | Per-service queue override | | `FLOCI_AZ_STORAGE_SERVICES_TABLE_MODE` | _(global)_ | Per-service table override | | `FLOCI_AZ_SERVICES_FUNCTIONS_EPHEMERAL` | `false` | Fresh container per invocation | | `FLOCI_AZ_SERVICES_FUNCTIONS_IDLE_TIMEOUT_MS` | `300000` | Warm-pool idle eviction (ms) | | `FLOCI_AZ_DOCKER_DOCKER_HOST` | `unix:///var/run/docker.sock` | Docker daemon socket | ``` -------------------------------- ### Set Global and Per-Service Storage Modes Source: https://github.com/floci-io/floci-az/blob/main/docs/configuration/storage.md Override the global storage mode or configure specific services like blob and queue storage using environment variables. This allows fine-grained control over data persistence and performance. ```yaml environment: FLOCI_AZ_STORAGE_MODE: memory FLOCI_AZ_STORAGE_SERVICES_BLOB_MODE: wal FLOCI_AZ_STORAGE_SERVICES_QUEUE_MODE: hybrid ``` -------------------------------- ### Floci-AZ Application Configuration Source: https://github.com/floci-io/floci-az/blob/main/docs/configuration/application-yml.md Defines the main configuration for Floci-AZ, including port, base URL, authentication mode, and storage settings. Environment variables can override these properties. ```yaml floci-az: port: 4577 base-url: http://localhost:4577 # When set, overrides the hostname used in URLs returned by the API # (e.g. blob SAS URLs, function invoke URLs). # hostname: myhost.internal auth: # dev: accept any credentials without signature validation (default) # strict: validate HMAC-SHA256 shared-key signatures mode: dev storage: # Global default — applies to every service unless overridden below. # Supported: memory | persistent | hybrid | wal mode: memory path: /app/data wal: compaction-interval-ms: 30000 hybrid: flush-interval-ms: 5000 # Per-service storage overrides (uncomment to activate) services: blob: # mode: wal flush-interval-ms: 5000 queue: # mode: hybrid flush-interval-ms: 5000 table: # mode: persistent flush-interval-ms: 5000 dns: # When floci-az runs inside Docker, an embedded DNS server starts on UDP/53 # and is injected into every Azure Functions container as their resolver. # It resolves *.hostname (above) and any extra suffixes to floci-az's # Docker-network IP so virtual-hosted URLs work from inside function containers. # extra-suffixes: # - myapp.internal docker: docker-host: unix:///var/run/docker.sock log-max-size: "10m" log-max-file: "3" services: blob: enabled: true queue: enabled: true table: enabled: true functions: enabled: true # Directory where extracted function code is stored on the host. code-path: /app/data/functions # ephemeral: true → fresh container per invocation (no warm reuse) ephemeral: false # Evict warm containers idle longer than this (ms) idle-timeout-ms: 300000 ``` -------------------------------- ### Docker Compose with Named Network Source: https://github.com/floci-io/floci-az/blob/main/docs/configuration/docker-compose.md This configuration sets up the floci-az service on a named network called `test-net`. This is recommended for integration tests, allowing other containers on the same network to reach floci-az using its service name. ```yaml services: floci-az: image: floci/floci-az:latest ports: - "4577:4577" volumes: - /var/run/docker.sock:/var/run/docker.sock networks: - test-net networks: test-net: name: test-net ``` -------------------------------- ### Floci-AZ Docker Compose Configuration Source: https://context7.com/floci-io/floci-az/llms.txt Configure Floci-AZ service with environment variables to set storage modes for different data types. 'memory' is the default, 'wal' offers maximum durability for blobs, and 'hybrid' provides a balance for queues. ```yaml services: floci-az: image: floci/floci-az:latest ports: - "4577:4577" volumes: - ./data:/app/data - /var/run/docker.sock:/var/run/docker.sock environment: FLOCI_AZ_STORAGE_MODE: memory # default for all services FLOCI_AZ_STORAGE_SERVICES_BLOB_MODE: wal # max durability for blobs FLOCI_AZ_STORAGE_SERVICES_QUEUE_MODE: hybrid # balanced for queues # TABLE falls back to global: memory ``` -------------------------------- ### List functions in an app Source: https://context7.com/floci-io/floci-az/llms.txt Retrieves a list of all functions deployed within a specific function app. ```APIDOC ## GET /admin/apps/:appName/functions ### Description Lists all functions deployed within a specific function app. ### Method GET ### Endpoint /admin/apps/my-app/functions ``` -------------------------------- ### Allow Docker0 Traffic in UFW Source: https://github.com/floci-io/floci-az/blob/main/docs/services/functions.md On native Linux Docker with UFW, allow incoming traffic on the docker0 interface to prevent invocation timeouts. This is not needed on Docker Desktop. ```bash sudo ufw allow in on docker0 ``` -------------------------------- ### Standard Azure Connection String for Floci-Az Source: https://github.com/floci-io/floci-az/blob/main/README.md Use this connection string with Azure SDKs and tools to connect to Floci-Az. It specifies the protocol, account name, account key, and endpoints for Blob, Queue, and Table storage services. ```text DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMh0==;BlobEndpoint=http://localhost:4577/devstoreaccount1;QueueEndpoint=http://localhost:4577/devstoreaccount1-queue;TableEndpoint=http://localhost:4577/devstoreaccount1-table; ``` -------------------------------- ### Management API: Functions Source: https://github.com/floci-io/floci-az/blob/main/docs/services/functions.md Endpoints for deploying, retrieving, listing, and deleting individual functions within an app. ```APIDOC ## PUT /admin/apps/{appName}/functions/{funcName} ### Description Deploy a function to a function app. This typically involves uploading a ZIP archive containing the function code. ### Method PUT ### Endpoint /admin/apps/{appName}/functions/{funcName} ### Request Body - **handler** (string) - Required - The entry point for the function (e.g., "index.handler"). - **timeoutSeconds** (integer) - Optional - The timeout for the function in seconds (default 60). - **zipBase64** (string) - Required - The base64 encoded ZIP archive of the function code. ### Request Example ```json { "handler": "index.handler", "timeoutSeconds": 60, "zipBase64": "" } ``` ### Note The ZIP must contain your function code in the Azure Functions v4 layout: ``` host.json {funcName}/function.json {funcName}/index.js (or handler file for the runtime) ``` ``` ```APIDOC ## GET /admin/apps/{appName}/functions/{funcName} ### Description Get details of a specific function. ### Method GET ### Endpoint /admin/apps/{appName}/functions/{funcName} ``` ```APIDOC ## GET /admin/apps/{appName}/functions ### Description List all functions within a specific app. ### Method GET ### Endpoint /admin/apps/{appName}/functions ``` ```APIDOC ## DELETE /admin/apps/{appName}/functions/{funcName} ### Description Delete a specific function from an app. ### Method DELETE ### Endpoint /admin/apps/{appName}/functions/{funcName} ``` -------------------------------- ### Docker Compose for Floci-AZ Source: https://github.com/floci-io/floci-az/blob/main/docs/index.md This configuration sets up Floci-AZ as a Docker service. It maps the local port 4577 and mounts volumes for data persistence and Docker socket access, which is required for Azure Functions. ```yaml services: floci-az: image: floci/floci-az:latest ports: - "4577:4577" volumes: - ./data:/app/data - /var/run/docker.sock:/var/run/docker.sock # required for Azure Functions ``` -------------------------------- ### az storage blob download Source: https://context7.com/floci-io/floci-az/llms.txt Downloads a blob from Azure Storage using the azfloci CLI. ```APIDOC ## az storage blob download ### Description Downloads a blob from Azure Storage. ### Command az storage blob download --container-name --name --file ### Parameters - **--container-name** (string) - Required - The name of the container. - **--name** (string) - Required - The name of the blob. - **--file** (string) - Required - The path to save the downloaded file. ``` -------------------------------- ### Manage Azure Functions with cURL Source: https://github.com/floci-io/floci-az/blob/main/README.md Provides cURL commands for interacting with the Azure Functions emulator's management API. This includes creating function apps, deploying functions via ZIP archives, and invoking them. ```bash BASE="http://localhost:4577/devstoreaccount1-functions" # 1. Create a function app curl -s -X PUT "$BASE/admin/apps/my-app" \ -H "Content-Type: application/json" \ -d '{"runtime":"node","environment":{"MY_VAR":"hello"}}' # 2. Deploy a function (ZIP of your function code, base64-encoded) ZIP_B64=$(base64 < my-function.zip) curl -s -X PUT "$BASE/admin/apps/my-app/functions/hello" \ -H "Content-Type: application/json" \ -d "{"handler":"index.handler","timeoutSeconds":60,"zipBase64":"$ZIP_B64"}" # 3. Invoke curl "$BASE/api/my-app/hello?msg=world" ``` -------------------------------- ### Create Function App Request Body Source: https://github.com/floci-io/floci-az/blob/main/docs/services/functions.md Use this JSON payload to create or update a function app. Specify the runtime and any environment variables required. ```json { "runtime": "node", "environment": { "MY_VAR": "hello" } } ```