Git Product home page Git Product logo

chef-cookbook-phoenix's Introduction

Phoenix Cookbook

A cookbook that performs a basic installation of the Phoenix Framework along with any missing dependencies.

Dependencies:

This cookbook has no direct external dependencies. It will install and configure any missing packages and dependencies. A stable and decently fast Internet connection is required.

Platforms:

The following platforms and versions are tested and supported using test-kitchen

  • CentOS 7.1

The following platform families are supported in the code.

  • Red Hat (RHEL)
  • Centos
  • Fedora

Usage

Using this cookbook is relatively straightforward. It is recommended to create a project or organization specific wrapper cookbook and add the desired recipes to the run list of a node, or create a role. Depending on your environment, you may have multiple roles that use different recipes from this cookbook. Adjust any attributes as desired. For example, to create a basic role:

{
    "name": "phoenix",
    "description": "Role to install the Phoenix Framework and its dependencies.",
    "chef_type": "role",
    "json_class": "Chef::Role",
    "default_attributes": {
    },
    "override_attributes": {
    },
    "run_list": [
        "recipe[phoenix::install_erlang]",
        "recipe[phoenix::install_elixir]",
        "recipe[phoenix::install_phoenix]"
    ]
}

Example: chef-client local-mode

If you are using chef-client you can follow this example based on the role above:

Install Latest Chef

curl -L https://www.opscode.com/chef/install.sh | bash

Create a chef-repo (placed in the /root/ directory in this example) with the following structure and files:

chef-repo/
|-- cookbooks
|   `-- phoenix
|       |-- attributes
|       |-- recipes
|       |-- spec
|       `-- test
|-- nodes
|   `-- node_phoenix.json
|   
|-- roles
|   `-- role_phoenix.json
`-- client.rb

% cat chef-repo/nodes/node_phoenix.json

{
  "name": "node_phoenix",
  "run_list": [
    "role[role_phoenix]"
  ]
}

% cat chef-repo/roles/role_phoenix.json

{
    "name": "phoenix",
    "description": "Role to install the Phoenix Framework and its dependencies.",
    "chef_type": "role",
    "json_class": "Chef::Role",
    "default_attributes": {
    },
    "override_attributes": {
    },
    "run_list": [
        "recipe[phoenix::install_erlang]",
        "recipe[phoenix::install_elixir]",
        "recipe[phoenix::install_phoenix]"
    ]
}

% cat chef-repo/client.rb

cookbook_path   "/root/chef-repo/cookbooks"
role_path '/root/chef-repo/roles'
data_bag_path  '/root/chef-repo/data_bags'
environment_path '/root/chef-repo/environments'
encrypted_data_bag_secret '/etc/chef'
local_mode 'true'
node_name 'node'
node_path '/root/chef-repo/nodes'
log_level :info

Now we can run our node/role using chef-client local mode (chef-zero):

chef-client -z -c client.rb -j nodes/node_phoenix.json

Attributes

This cookbook has attributes for a basic installation of the Phoenix Framework and dependencies. It should all be relatively straight-forward to override if different versions are desired.

Recipes

The recipes included; install_erlang and install_elixir are dependencies required unless it is known that the environment already has these requirements installed properly. The recipe install_phoenix uses Elixir to install Hex and finally Phoenix itself.

install_erlang

This recipe compiles the Erlang language from source. Installs its own required packages.

install_elixir

This recipe compiles the Elixir language from source. Requires that the system have Erlang installed.

install_phoenix

Installs Phoenix framework using Hex. Requires Elixir and Erlang be installed.

Tests

This cookbook in the source repository contains chefspec, serverspec tests.

License and Authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

chef-cookbook-phoenix's People

Contributors

amkirsch avatar

Watchers

 avatar  avatar  avatar

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.