Coder Social home page Coder Social logo

compositionalit / farmer Goto Github PK

View Code? Open in Web Editor NEW
513.0 13.0 155.0 32.97 MB

Repeatable Azure deployments with ARM templates - made easy!

Home Page: https://compositionalit.github.io/farmer

License: MIT License

F# 100.00%
arm-templates azure dotnet-core

farmer's Introduction

Farmer makes repeatable Azure deployments easy!

See the full docs here.

Want to edit the docs? Check out the docs folder.

Build Status

Farmer on Nuget

farmer's People

Contributors

aaron-gill avatar aebaid avatar amine-mejaouel avatar bigjonroberts avatar blakewills avatar brase avatar brianvallelunga avatar chmarshall10450 avatar dburriss avatar duncanmak avatar duncanworthy avatar dzoukr avatar et1975 avatar forki avatar hravnx avatar huaxinli123 avatar iamabdul avatar isaacabraham avatar jordanmarr avatar martinbryant avatar mattgallagher92 avatar michaelwade-c5 avatar ninjarobot avatar outofscopeia avatar raymens avatar seankilleen avatar thersp avatar thinkdavid avatar thorium avatar viktorvan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

farmer's Issues

Remove use of FsHttp

Whilst it's a fine library and looks excellent, for the limited usage we're giving it, it seems overkill to use it. It would be great if we could remove it and replace with "standard" dotnet code, even if this meant wrapping the HTTP interop into a separate file / module.

Support for standalone AppInsights

This one should be quite easy, but I am not so skilled with ARM templates yet.

It would be really hand to have possibility to create standalone instance of AppInsights using comp. expression and have other parts depend on it and use its key. For example in our scenario we have a webApp and functionApp and want them both to be logged by same AppInsights where we need to setup InstrumentationKey.

Comparison to Azure Management Libraries

I think this is a great project, and a month or so ago I'd have been all over it, but as Microsoft already provide libraries to manage ARM resources from code, I'm wondering how Farmer compares.

If you don't know what I'm talking about, and I wouldn't blame you as Microsoft haven't heavily promoted it, I'm talking about the Azure Management Libraries:
https://github.com/Azure/azure-libraries-for-net

Thanks in advance.

Support for ACR

I wanted to check if there were plans for ACR support? Either way, unless someone is already working on it, I would like to take a stab at contributing.

Can't deploy Linux web app

The following template generates a Linux ARM template that is invalid:

let template =
    let myWebApp = webApp {
        name "mysuperwebappisaac"
        sku WebApp.Sku.F1
        operating_system Linux
        runtime_stack DotNetCore22
    }

    arm {
        location NorthEurope
        add_resource myWebApp
    }

The service host is deployed, but the web app is not, with an error that the LinuxFxVersion is invalid (in the generated template it's DOTNETCORE|2.2).

What do you think this is @Dzoukr ?

Support for Logic Apps

Logic Apps are defined in a custom Workflow Definition Language (WDL) which is rather similar to ARM templates.

When you deploy a Logic App via ARM template, a workflow definition is embedded as a resource, see for example this reference on deploying Logic Apps using CI/CD.

This issue is a request to add support for the Logic App WDL in Farmer such that we can safely generate Logic Apps using code.

Create resource group

One of the things I do today with ARM templates is create resource groups. Does Farmer support resource group specification? I didn’t see it in the README or the examples.

Support for Validation

We should plug into the ARM Validation REST call / Azure CLI so that we can automatically pre-validate templates before deploying.

Time for NuGet package?

Farmer's API seems to be quite stable and personally I don't expect any wild changes now. Maybe we can consider convention (add_resource vs addResource), but if you want to keep it that way, maybe it's good time for v1.0.0 release on NuGet?

Support deployment with service principle in F#

It's evident that we need a more streamlined and opinionated way to deploy Farmer templates from anywhere e.g. FAKE, CAKE, .NET console apps, GitLab etc..

  • Write simple wrapper around the REST API calls of ARM for getting a bearer token and deploying a template.
  • Document a way to easily create a service principle
  • Investigate if you can get a bearer token interactively somehow (without resorting to the Azure CLI)
  • Document the API
  • Handle returning outputs from a deployment

Move to System.Text.Json

Remove Newtonsoft and migrate to Text.Json. This benefits netcore3 consumers who get it for free. The serialization we're doing is extremely limited so I'm hopeful this would be possible.

Make Writer.quickDeploy cross-platform

Is anyone working on making Writer.quickDeploy cross-platform?

I have written something that at least works on my mac, so that would at least be one more platform 🙂 but I think it should work on linux as well. I can make a pull-request from that to get a discussion going. Maybe you have some more requirements for this function that my solution doesn't support.

Support for Redis Cache

Hi,

we'd like to see support for Redis cache. A possible ARM template could look like this:

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "cache_name": {
            "defaultValue": "cache_name",
            "type": "String"
        }
    },
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.Cache/Redis",
            "apiVersion": "2019-07-01",
            "name": "[parameters('cache_name')]",
            "location": "West Europe",
            "properties": {
                "sku": {
                    "name": "Basic",
                    "family": "C",
                    "capacity": 0
                },
                "enableNonSslPort": false,
                "redisConfiguration": {
                    "maxclients": "256",
                    "maxmemory-reserved": "2",
                    "maxfragmentationmemory-reserved": "12",
                    "maxmemory-delta": "2"
                }
            }
        }
    ]
}

/cc @atheck

Support templates with variables

I could see this being really useful for creating reusable templates to add to an Azure .org for repeat deployments with different names. I get that is not the primary use case, but this would certainly help that use case.

Using SecureParameters when running quickDeploy

A question, when trying to deploy a sql-server by running the quickDeploy-command I get an error that the password parameter is missing:

Please provide securestring value for 'password-for-v-test-sql'

When deploying the generated arm-template manually I can provide the parameter, of course, so in a production scenario it works fine.

But what is a good way to do this when using quickDeploy?

I actually interpreted the following section in the readme to mean that a (development) password would be automatically generated, but maybe I misunderstood:

Farmer does support securestring parameters for e.g. SQL and Virtual Machine passwords - these are automatically generated based on the contents of the template rather than explicitly by yourself. However, we don't currently plan on providing rich support for either parameters or variables for several reasons:

So is there a workaround for this that I am not seeing, or can I not use quickDeploy for resources that require SecureParameters?

Make FUNCTIONS_EXTENSION_VERSION configurable

To deploy a function app with runtime v3 using the azure function core tools version 3 you need to set FUNCTIONS_EXTENSION_VERSION = ~3. See https://docs.microsoft.com/sv-se/azure/azure-functions/set-runtime-version

Right now this value is hardcoded to ~2 in the generated arm-template.

This should be configurable, I think, and it shouldn’t be too hard to make that change. Probably you could use a DU for the supported values 1, 2, and 3 and then add a CustomOperation use_extension_version in the function builder. I can take a crack at it in a PR if that’s fine? Unless there are any other specific design decisions to consider?

Support for Event Hubs

Hi,

we'd like to see support for EventHubs. A possible ARM template looks like this

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "events_name": {
            "defaultValue": "events_name",
            "type": "String"
        }
    },
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.EventHub/namespaces",
            "apiVersion": "2018-01-01-preview",
            "name": "[parameters('events_name')]",
            "location": "West Europe",
            "sku": {
                "name": "Standard",
                "tier": "Standard",
                "capacity": 1
            },
            "properties": {
                "zoneRedundant": false,
                "isAutoInflateEnabled": false,
                "maximumThroughputUnits": 0,
                "kafkaEnabled": true
            }
        },
        {
            "type": "Microsoft.EventHub/namespaces/AuthorizationRules",
            "apiVersion": "2017-04-01",
            "name": "[concat(parameters('events_name'), '/', parameters('events_name'))]",
            "location": "West Europe",
            "dependsOn": [
                "[resourceId('Microsoft.EventHub/namespaces', parameters('events_name'))]"
            ],
            "properties": {
                "rights": [
                    "Listen",
                    "Send"
                ]
            }
        },
        {
            "type": "Microsoft.EventHub/namespaces/AuthorizationRules",
            "apiVersion": "2017-04-01",
            "name": "[concat(parameters('events_name'), '/RootManageSharedAccessKey')]",
            "location": "West Europe",
            "dependsOn": [
                "[resourceId('Microsoft.EventHub/namespaces', parameters('events_name'))]"
            ],
            "properties": {
                "rights": [
                    "Listen",
                    "Manage",
                    "Send"
                ]
            }
        },
        {
            "type": "Microsoft.EventHub/namespaces/eventhubs",
            "apiVersion": "2017-04-01",
            "name": "[concat(parameters('events_name'), '/hub')]",
            "location": "West Europe",
            "dependsOn": [
                "[resourceId('Microsoft.EventHub/namespaces', parameters('events_name'))]"
            ],
            "properties": {
                "messageRetentionInDays": 1,
                "partitionCount": 2,
                "status": "Active"
            }
        },
        {
            "type": "Microsoft.EventHub/namespaces/networkRuleSets",
            "apiVersion": "2018-01-01-preview",
            "name": "[concat(parameters('events_name'), '/default')]",
            "location": "West Europe",
            "dependsOn": [
                "[resourceId('Microsoft.EventHub/namespaces', parameters('events_name'))]"
            ],
            "properties": {
                "defaultAction": "Deny",
                "virtualNetworkRules": [],
                "ipRules": []
            }
        },
        {
            "type": "Microsoft.EventHub/namespaces/eventhubs/consumergroups",
            "apiVersion": "2017-04-01",
            "name": "[concat(parameters('events_name'), '/hub/$Default')]",
            "location": "West Europe",
            "dependsOn": [
                "[resourceId('Microsoft.EventHub/namespaces/eventhubs', parameters('events_name'), 'hub')]",
                "[resourceId('Microsoft.EventHub/namespaces', parameters('events_name'))]"
            ],
            "properties": {}
        }
    ]
}

/cc @atheck

Split FunctionApp & WebApp

I am trying to create support for selecting runtime stack for WebApp, but now in code the function for creating ArmTemplate record considers functionApp as another "version" of WebApp. The problem is, that even if they are close together, they do not offer exactly the same options for setup.

FunctionApp:
image

WebApp:
image

Also each template writes Runtime Stack in slightly different way.

FunctionApp:

"appSettings": [
{
  "name": "FUNCTIONS_WORKER_RUNTIME",
  "value": "dotnet"
}

WebApp:

"appSettings": ... omited
"metadata": [
 {
  "name": "CURRENT_STACK",
  "value": "dotnetcore"
 }],

This would force me to do another if logic in writer logic (where anonymous record would differ based on whether Kind contains functionApp or not), which doesn't sound too clean to me. Also thinking about adding another options like always_on, which is not available in FunctionApp template, the if would appear more than once.

Proposal: Add FunctionApp as another SupportedResource case (even if it is neeearly same as WebApp) and also add different Runtime stack values for each type as it is now in Azure Portal.

Good idea, wrong idea, total nonsense? What do you think @isaacabraham?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.