Installation & Upgrade
Docker One Click for Quick Build
Method I
- step 1:Install docker environment and Docker Compose(v2)
- Step 2: Copy project
git clone https://github.com/veops/cmdb.git
- Step 3:In the main directory, execute:
docker compose up -d
Local development environment creation
Environment and dependency
- Storage: mysql, redis
- python version:
3.8 <= python <= 3.11
Install
- Launch mysql service, redis service
mysql must set sql_mode, root to mysql execution:
set global sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
set session sql_mode='STRICT_TRANS_TABLES, NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
- Create database cmdb
- Pull code
git clone https://github.com/veops/cmdb.git
cd cmdb
cp cmdb-api/settings.example.my cmdb-api/settings.py
Set the cmdb-api/settings.py database
-
Installation Library
- Backend:
cd cmdb-api && pipenv run pipenv install && cd .
- Frontend:
cd cmdb-ui && yarn install && cd.
- Backend:
-
Can import docs/cmdb.sql into the database and log in to users and password: demo/123456
-
Create a database table: enter the cmdb-api directory to
pipenv run flask db-setup && ipenv run flask common-check-new-columns && pipenv run flask cmdb-init-cache
-
Start service
-
Backend: Enter the cmdb-api directory
pipenv run flask run -h 0.0.0.0.0.0
-
Frontend: enter cmdb-ui directory to perform
yarn run server
-
Worker:
- Enter the cmdb-api directory
pipenv run celery -A celery_worker.celery worker-E -Q one_cmdb_async --autoscale=5,2 --logfile=one_cmdb_async.log -D
- Enter the cmdb-api directory
pipenv run celery -A celery_worker.celery worker-E -Q acl_async --autocale=2,1 --logfile=one_acl_async.log -D
- Enter the cmdb-api directory
-
Browser open: http:///127.0.0.1:8000
- If not, change the IP address of the IP address for the backend at cmdb-ui/.env** in VUE_APP_APP_API_BASE_UR
-
Makefile Installation
Install by Makefile
- Launch mysql service, redis service
- Create database cmdb
- Pull code
git clone https://github.com/veops/cmdb.git
cd cmdb
cp cmdb-api/settings.example.my cmdb-api/settings.py
Set cmdb-api/settings.py database
- Sort by cmdb directory
- Environment:
make env
- Launch API:
make api
- Launch UI:
make ui
- Launch worker:
make worker
- Environment:
Pure Mode Installation
The so-called net mode or db's data is completely empty
If you have installed Veops CMDB (local or docker-compose), you want to experience pure mode (installed on condition that the current data is insignificant, otherwise pls remember to back up)
- Close service
- Delete DB, rebuild DB
- Clear redish cache
Installation step
- For local or docker-compose installation, follow the previous instructions for installation. For local deployment, do not start the services yet. It is important to note that in the
docker-compose.yml
file, the 'volumes' section under 'cmdb-db' should have the line./docs/cmdb.sql:/docker-entrypoint-initdb.d/cmdb.sql
commented out. - Enter the API environment, local execution of
pipenv shell
, container executesdocker exec -it cmdb-api sh
- Execute the following commands:
flask db-setup
flask cmdb-init-acl
flask in-department
- Local development of environmental startup service, must start celery worker. For Docker deployment, skip this step.
- Also perform
flask add-user
in the API environment to create a user. Note that the Admin option should fill in Y - Login with the user created above and then download the required template from Template Market
How to upgrade to the new version
- If Code deployed: Upgrade to the latest version of the code, implement
flask db-setup && flask common-check-new-columns
, then restart the back-to-end service - If Docker deployed: Upgrade to the latest code, perform
docker compose down
,docker compose up to -d
, upgrade don't use docker compose down -v
Issue: If data is not visible after upgrading using docker-compose.
-
The possible reason is that in versions
<=2.3.8
, the naming of the db volume is related to the directory name. If the directory name from the last deployment is "cmdb-2.3.8", then the db volume should be namedcmdb-238_db-data
when executingdocker volume ls | grep db-data
. To fix this, modify the "name" under "volumes" in the docker-compose.yml file tocmdb-238_db-data
, and then restart. Of course, if the code directory has always been "cmdb", there won't be this issue!To avoid the next same problem, it is recommended to export mysql data, then restore docker-compose, restart the service and import mysql data
Upgrade Notes
For versions greater than 2.4.5, as there have been some major changes to the table structure, after upgrading, please execute the following command
docker compose exec cmdb-api flask cmdb-patch -v {upgraded version number}