Giter Site home page Giter Site logo

Comments (5)

johnbellone avatar johnbellone commented on May 28, 2024

This may be easier with the develop branch. I am writing tests for it now
and hoping to have it ready to ship in a week or so.

You would use the new LWRP for different consul instances.
On Sat, May 23, 2015 at 12:02 Spencer Owen [email protected] wrote:

I'm trying to figure out how to use this cookbook to deploy different
configs on different servers.

I have

consul-server01
consul-server02
consul-server03
web01
database01

How can I make it so that the web servers and the database servers have
different configs?

I'm thinking I could do one of the following. None of which seems optimal.

  1. Create wrapper cookbooks for each server type, the cookbook manages
    /etc/consul.d/web.conf ect..
  2. Create single cookbook with conditional statements that deploy
    different templates based on hostnames.

Is there something that I am missing? Whats the best way to deploy
different configs to different servers?


Reply to this email directly or view it on GitHub
#177.

from consul.

tgwizard avatar tgwizard commented on May 28, 2024

One simple way would be to create three chef roles: consul-server, web, and database. Each of these include a their own recipe in their runlist, e.g. consul_server.rb, web.rb, and database.rb. These recipes could be in separate cookbooks, or in one common cookbook, depending on your use-case. The recipes depend on the consul cookbook and uses its resources/providers/LWRP to define services and checks.

Then either your roles also includes the consul cookbook directly, or your recipes does. We have a separate consul-agent role with its own attributes (specifying consul version, user to run as, which datacenter to run in, and extra common configuration). All roles that use consul also include the consul-agent role.

from consul.

spuder avatar spuder commented on May 28, 2024

Good idea,

Can a runlist include just a single recipe?

If so, I could make a consul-agent cookbook, where the default recipe is blank.

consul-agent::default   #blank
consul-agent::webserver
consul-agent::database

Then I just include the specific recipies in the role.

{
  "run_list": [
    "recipe[mywebserver]",
    "recipe[consul-agent::webserver]",
    "role[mywebserver]"
  ]
}

from consul.

spuder avatar spuder commented on May 28, 2024

^ This is what I ended up doing. It works well enough.

from consul.

lock avatar lock commented on May 28, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from consul.

Related Issues (20)

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.