Giter Site home page Giter Site logo

immortalin / nfs-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from danquack/nfs-api

0.0 3.0 0.0 38 KB

A containerized flask api that manages a nfs mounts through a mounts.yml file

License: Apache License 2.0

Dockerfile 3.34% Python 94.53% Shell 2.12%

nfs-api's Introduction

Build Status

The NFS API was designed to manage a mounts.yml file within nfs_mounts mounts puppet repo. This Python3 application is dockerized and posts to git using ssh keys embeded into the container.

Structure:

main.py - flask application that defines the endpoints
mounts.py - the behind the scenes worker to read and update the mounts file
requirements.txt - pip3 install -r requirements.txt - will install the necesary packages needed to run the app

Pre cursor

Acting as a container, the main purpose of this project is to managed a git based hiera defintion. Therefore, you must have a NFS Mounts project in git, that utilizes a hiera based defintion.

Install Instructions

  1. Clone Project
  2. Modify git user profile configuration in dockerfile
  3. Run docker build -t nfs_api:latest .
  4. Run
docker run \
-e REPO_URI=<full ssh git (ex. [email protected]:someuser/NFS-MOUNTS.git)> \
-v /path/to/ssh/on/host:/root/.ssh \
-e GIT_DIRECTORY=/path/to/store/repo
-p 5000:5000 \
nfs_api:latest
  1. Interact with the api on your servers ip address on port 80.

Context

API

HTTP method URI path Description
GET / Returns health status to show node is active
GET /mounts Retrieves all mounts
GET /mounts/hosts, /mounts/hostgroups Retrieves just [hostname/hostgroup] mount.
GET /mounts/[hosts/hostgroups]/[servername/hostgroupname] Retrieves servers/hostgroups mounts
GET /mounts/[hosts/hostgroups]/[servername/hostgroupname]/uuid Retrieves invidiual mount point for given UUID
POST/PUT /mounts/[hosts/hostgroups] Create new NAS Point for a particular host or hostgroup
PATCH /mounts/[hosts/hostgroups]/[servername/hostgroupname]/uuid Modifies a NAS Point for a particular host or hostgroup
DELETE /mounts/[hosts/hostgroups]/[servername/hostgroupname] Removes the management for a particular host or hostgroup
DELETE /mounts/[hosts/hostgroups]/[servername/hostgroupname]/uuid Removes the management of a NAS Point for a particular host or hostgroup

YAML File:

The structure of the hiera based yaml that defines an array of mount objects, located in the external REPO_SSH_URI (NFS-Mounts under a data directory), is as follows

nfs_mounts::Hosts:
   Hostname.company.com:
    -	uuid
        share_path
        local_path
        options
        owner
        group
   Hostname2.company.com:
    -	...
nfs_mounts::Hostgroups:
    Group1:
    -	uuid
        share_path
        local_path
        options
        owner
        group
    -	...
     Group2
    ...

nfs-api's People

Contributors

danquack avatar

Watchers

James Cloos avatar Lin 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.