Giter Club home page Giter Club logo

drupal-nfs's Introduction

Drupal-nfs Cookbook

Setup nfs shares

Build Status

Requirements

Platform:

Ubuntu

Cookbooks:

nfs

Drupal-lamp usage

Try this cookbook with drupal-lamp https://github.com/newmediadenver/drupal-lamp

To get it working with drupal-lamp:

  • Open Berksfile in your drupal-lamp directory and place the following line in there
cookbook "drupal-nfs", git: "https://github.com/arknoll/drupal-nfs", branch: "master"
  • Open chef/roles/drupal_lamp.rb in your drupal-lamp directory and add "recipe[drupal-nfs]", to the env_run_lists run list array

  • run either 'vagrant up' or 'vagrant provision'

Usage

Mac Example:

Expose a share of /srv/www/example/current

This example will open up an nfs share:

  • for the folder located at /srv/www/example/current
  • it will be writeable
  • when written to from the mount it will act as if you are user www-data and group www-data
"nfs_exports": {
    "/srv/www/example/current": {
      "clients": {
        "*": {
          "writeable": true,
          "sync": false,
          "options": [
            "no_subtree_check",
            "all_squash",
            "async"
          ],
          "anon_user_name": "www-data",
          "anon_group_name": "www-data"
        }
      }
    }
  }

Mount the share on your mac

sudo mount -o resvport [server ip]:/srv/www/example/current test

Linux Example:

Expose a share of /assets

This example will open up an nfs share of the /assets folder on the virtualized server with the following details:

  • Only clients with the IP address of 192.168.50.1 can mount this share (the default IP of a drupal-lamp host machine as seen by the virtualized server).
  • Those who mount this will have write access.
  • The NFS sync option will be used to ensure greater data cache coherence.
  • Those who mount this will come through as www-data:www-data (uid 33 & gid 33 in a default drupal-lamp virtualized Ubuntu server).
  "nfs_exports": {
    "/assets": {
      "clients": {
        "192.168.50.1": {
          "writeable": true,
          "sync": true,
          "options": [
            "all_squash",
            "anonuid=33",
            "anongid=33"
          ]
        }
      }
    }
  }

Mount the share on your linux machine

Note: Assumes you've exposed the share /assets on your virtualized server and you've created an empty assets folder in your drupal-lamp directory.

From the host machine:

sudo mount 192.168.50.5:/assets /home/[your_user_name]/drupal-lamp/assets

Attributes

"nfs_exports": {
  "[share directory]": { # directory to share
    "clients": { # who can access
      "[ip address or *]": {
        "writeable": true, # true or false
        "sync": , # true or false
        "options": [], # array of nfs exports options. See nfs cookbook for options
        "user_map": "www-data", # this sets the anon user by name
        "group_map": "www-data" # this sets the anon group by name
      }
    }
  }
}

Recipes

drupal-nfs::default

Adds a mountable nfs share

Testing

Build Status

The cookbook provides the following Rake tasks for testing:

rake foodcritic                   # Lint Chef cookbooks
rake integration                  # Alias for kitchen:all
rake kitchen:all                  # Run all test instances
rake kitchen:default-centos-64    # Run default-centos-64 test instance
rake kitchen:default-ubuntu-1204  # Run default-ubuntu-1204 test instance
rake rubocop                      # Run RuboCop style and lint checks
rake spec                         # Run ChefSpec examples
rake test                         # Run all tests

License

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.

Contributing

We welcome contributed improvements and bug fixes via the usual workflow:

  1. Fork this repository
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new pull request

drupal-nfs's People

Contributors

arknoll avatar chrisolof avatar mlafeldt avatar

Watchers

 avatar  avatar  avatar

drupal-nfs's Issues

Rename top level to drupal_nfs

Does it make sense to rename the top level to drupal_nfs instead of nfs export to make sure that the cookbook name matches the key

managing file ownership re: vagrant ssh/drush

So drupal-nfs works pretty damn well for me, and I encounter no permissions fun manipulating files from my host. I do, however, run into permission issues using drush via vagrant ssh, which runs as the vagrant user and can't manipulate files the files that are all owned by www-data unless i sudo. Is there a good way to address this?

Rename user_map and group_map

To avoid confusion I'd suggest we rename:

user_map to anon_user_name
group_map to anon_group_name

(Since those variables are essentially used in place of anonuid and anongid.

NFS needs a restart

Trying to mount on 14.04 give the error:

mount_nfs: can't mount /assets from 192.168.50.5 onto /assets: RPC prog. not avail

To resolve:

  1. vagrant ssh
  2. sudo su
  3. /etc/init.d/nfs-kernel-server restart

We might need to restart the kernel server in the cookbook to resolve this issue.

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.