Git Product home page Git Product logo

cnc-skeleton's Introduction

cnc-skeleton

Canned skeleton setup for pan-cnc. This repo can be used as a starting point to build a new CNC application. CNC is a library that makes it easy to build API driven web based applications. With this you can quickly build web-forms to populate API payloads, generate XML fragments for PAN-OS API calls, or spin up infra using terraform. The operator of the application only interacts with the simple menu system and is abstracted away from the underlying technology.

For complete details, see the PAN-CNC app. on Github.

Building a new App using the CNC library

Generic folder structure

cnc-skeleton/
└── src
    └── cnc-app-name
        ├── .pan-cnc.yaml
        ├── snippets
        │   └── README.md
        └── views.py

All folders in the 'src' directory are treated as cnc 'apps'. The CNC library will try to automatically load them as Django apps on startup. The two most important files are the .pan-cnc.yaml and the views.py files. All your code will live in src/$APP_NAME/views.py

Install CNC as a submodule to your repo

git submodule add -b master [email protected]:PaloAltoNetworks/pan-cnc.git cnc

You may have to do

git submodule update --init

inside the cnc directory to activate and pull the submodule content to cnc. First time user may also require a python virtual environment and install of the cnc requirements

cd cnc
pip install -r requirements.txt

You should now have two top level directories: src and cnc.

Running Pan-CNC

1. Build the database

./cnc/manage.py migrate

2. Create a new user

NOTE: In the below command, change email address and passwd to your respective entries .Common practice is to have the password be the name of the app, unless specifically spelled out in your documentation.

./cnc/manage.py shell -c "from django.contrib.auth.models import User; User.objects.create_superuser('paloalto', '[email protected]', 'passwd')"

Local Development

You can launch this new app with the following commands:

cd cnc
celery -A pan_cnc worker --loglevel=info  & ./manage.py runserver 8080

This will start a background task worker and then start the application on port 8080. You can login using the username and password specified above.

cnc-skeleton's People

Contributors

nembery avatar scotchoaf avatar

Watchers

 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.