If you need FULL develop environment
./pre.sh -p all -c devCode from https://code.getnoc.com/noc/noc.git copy to
./data/noc/code and connected to '/opt/noc' in container.
See '.env' file for volume mount path:
# NOC_CODE_PATH '/home' for PROD or '/opt/noc' for DEV
NOC_CODE_PATH=/homeFor full develop environment:
# NOC_CODE_PATH '/home' for PROD or '/opt/noc' for DEV
NOC_CODE_PATH=/opt/nocAfter ./pre.sh -p all -c dev run:
docker-compose up noc-code-cythonizedocker-compose up -d mongodb-repl-set-init
docker-compose up -d mongo
docker-compose up -d postgres
docker-compose -f docker-compose-restoredb.yml up
docker-compose up -ddocker-compose up -d mongo
docker-compose up -d postgres
docker-compose -f docker-compose-storedb.yml up
docker-compose up -dCreate PG dump:
pg_dump -Fc noc > pg-`date +%Y%m%d-%H-%M`.dumpPut file in .data/postgresrestore
ls -1 ./data/postgresrestore
pg-20200327-14-06.dump
pg-20200327-14-07.dump
pg-20200327-14-14.dump
pg-20200327-15-00.dump
pg-20200327-15-04.dumpLoad newest file
Create MONGO dump:
mongodump -d noc --archive=mongodb-`date +%Y%m%d-%H-%M`.archivePut file in .data/mongorestore
ls -1 ./data/mongorestore
mongodb-20200327-13-50.archive
mongodb-20200327-14-07.archive
mongodb-20200327-14-14.archiveLoad newest file
Then run
docker-compose up -d mongodb-repl-set-init
docker-compose up -d mongo
docker-compose up -d postgres
docker-compose -f docker-compose-restoredb.yml up Use ./data/noc/custom if need make custom:
- adapter for new hardware. See doc
https://kb.nocproject.org/pages/viewpage.action?pageId=22971074 - handler
- commands
- etc
Q: I want fix script /opt/noc/sa/profiles/MikroTik/RouterOS/get_version.py.
A: Use ./data/noc/custom directory. This directory is used for priority
file load for activator service. Create directory and __init__.py files
cd ./data/noc/custom
mkdir -p ./sa/profiles/MikroTik/RouterOS/
touch __init__.py
touch ./sa/__init__.py
touch ./sa/profiles/__init__.py
touch ./sa/profiles/MikroTik/__init__.py
touch ./sa/profiles/MikroTik/RouterOS/__init__.pyPut you version get_version.py and restart activator-default container
docker-compose restart activator-defaultQ: I need access to code that not worked in custom
A: Run:
./pre.sh -p all -c devIt download noc code in ./data/noc/code
Edit .env file
# NOC_CODE_PATH '/home' for PROD or '/opt/noc' for DEV
NOC_CODE_PATH=/opt/nocand restart noc-dc
docker-compose down
docker-compose up -dCode from ./data/noc/code mount in /opt/noc/ into all docker container.
Edit and restart container.
Q: I want add new HW support in NOC
A:
- add new vendor
- add new object_profile
- add new dir in sa/profiles
- read https://kb.nocproject.org/pages/viewpage.action?pageId=22971074
- use 'Q: I want fix script'
Thats it. Be aware of if you need to add new script it has to be added to several services. Also you need discovery, sae and web.