Share via

it is possible to have two host.json in the same service plan?

Visan, Nicolae 36 Reputation points
2023-06-14T09:49:57.44+00:00

Hello,

We have the following function structure in the repo:

circleCI

.github

libraries

services

--service1(FunctionApp1)

----src

------functions

----host.json

--service2(FunctionApp2)

----src

------functions

----host.json

Each service is running on different FunctionApp, but under the same ServicePlan.

The questions are:

  • If service1 host.json has the same setting like service2 host.json (eg. maxConcurentCalls) but with different values, does the Azure Service know which setting to use for each Azure Function?
  • Does Azure Service merge the host.json files using specific rule?
  • Should be the host.json identical?
Azure Functions
Azure Functions

An Azure service that provides an event-driven serverless compute platform.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Ryan Hill 30,336 Reputation points Microsoft Employee Moderator
    2023-06-14T18:18:33.7366667+00:00

    Hi @Visan, Nicolae

    The host.json affects all functions within the instance. Meaning your service1 and service2 will have to be deployed separately to different function app instances. Both instances can be assigned to the same app service plan. Having said that,

    If service1 host.json has the same setting like service2 host.json (eg. maxConcurentCalls) but with different values, does the Azure Service know which setting to use for each Azure Function?

    The app will only look at a single host.json and apply to all functions running under that instance.

    Does Azure Service merge the host.json files using specific rule? Should be the host.json identical?

    No, it doesn't merge any files.

    Under your current structure, you can either configure two separate GitHub actions for service1 and service2; this way when changes are merged with the trunk, the updates can be applied to both function app instances. Another option within a single yaml pipeline, you separate service1 and service2 into their respective artifact folders and include two different function app deployments.

    name: Deploy to Azure Functions
    
    on:
      push:
        branches:
          - main
    
    jobs:
      deploy:
        runs-on: ubuntu-latest
        steps:
        - name: Checkout code
          uses: actions/checkout@v2
    
        - name: Deploy function1
          uses: Azure/functions-action@v1
          with:
            app-name: 'function1'
            package: './function1'
            publish-profile: ${{ secrets.function1_publish_profile }}
    
        - name: Deploy function2
          uses: Azure/functions-action@v1
          with:
            app-name: 'function2'
            package: './function2'
            publish-profile: ${{ secrets.function2_publish_profile }}
    

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.