Skip to content

Latest commit

 

History

History
145 lines (129 loc) · 3.46 KB

Readme.develop.md

File metadata and controls

145 lines (129 loc) · 3.46 KB

Develop

If you need FULL develop environment

./pre.sh -p all -c dev

Code 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=/home

For full develop environment:

# NOC_CODE_PATH '/home' for PROD or '/opt/noc' for DEV
NOC_CODE_PATH=/opt/noc

Generate 'cythonize' file

After ./pre.sh -p all -c dev run:

docker-compose up noc-code-cythonize

Restore database from dump

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 
docker-compose up -d

Create database dump

docker-compose up -d mongo 
docker-compose up -d postgres
docker-compose -f docker-compose-storedb.yml up 
docker-compose up -d

Use database from other installation

Create PG dump:

pg_dump -Fc noc > pg-`date +%Y%m%d-%H-%M`.dump

Put 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.dump

Load newest file

Create MONGO dump:

mongodump -d noc --archive=mongodb-`date +%Y%m%d-%H-%M`.archive

Put file in .data/mongorestore

ls -1 ./data/mongorestore
mongodb-20200327-13-50.archive
mongodb-20200327-14-07.archive
mongodb-20200327-14-14.archive

Load 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 

Custom

Use ./data/noc/custom if need make custom:

FAQ

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__.py

Put you version get_version.py and restart activator-default container

docker-compose restart activator-default

Q: I need access to code that not worked in custom

A: Run:

./pre.sh -p all -c dev

It 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/noc

and restart noc-dc

docker-compose down
docker-compose up -d

Code 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:

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.