Maintenance
A useful guide to operating the FOSSLight Hub.
DB backup and recovery
1. Backup
Option 1. Full DB backup
mysqldump -u[id] -p[password] [database_name] > [backup_file_name].sql
$ mysqldump -ufosslight -pfosslight fosslight > fosslight_backup.sql
Option 2. DB backup for updating to the latest version of FOSSLight (data only)
- Download DBMS. (Recommended DBMS: HeidiSQL https://github.com/HeidiSQL/HeidiSQL)
- After connecting to the DB, click ‘Export database as SQL'.
- Extract data with DELETE + INSERT.
2. Recovery
mysql -u[id] -p[password] [database_name] < [backup_file_name].sql
$ mysql -ufosslight -pfosslight fosslight < fosslight_backup.sql
Upgrading the DB version
How to upgrade DB version using MyBatis Migrations (It is provided from the version that migrates from v1.5.0.)
- Modify DB connection information in migration/migration/environments/development.properties file.
$ cd migration/migration $ cat environments/development.properties ## Base time zone to ensure times are consistent across machines time_zone=GMT+0:00 ## The character set that scripts are encoded with # script_char_set=UTF-8 ## JDBC connection properties. driver=org.mariadb.jdbc.Driver url=jdbc:mysql://localhost:3306/fosslight username=fosslight password=fosslight
- Export the fosslight/migration/mybatis-migrations-3.3.11 folder to MIGRATIONS_HOME.
$ cd fosslight $ pwd $ /home/test/fosslight $ export MIGRATIONS_HOME=/home/test/fosslight/migration/mybatis-migrations-3.3.11 $ export MIGRATIONS=$MIGRATIONS_HOME/bin $ export PATH=$MIGRATIONS:$PATH
- Upgrade after checking the migrate status.
$ cd /home/test/fosslight/migration/migration $ migrate status ------------------------------------------------------------------------ -- MyBatis Migrations - status ------------------------------------------------------------------------ ID Applied At Description ================================================================================ 20230322085317 ...pending... create changelog 20230322091138 ...pending... update v1.4.9 20230322092534 ...pending... update v1.5.0 ------------------------------------------------------------------------ -- MyBatis Migrations SUCCESS -- Total time: 0s -- Finished at: Wed Mar 22 20:12:07 KST 2023 -- Final Memory: 7M/500M $ migrate up
- Check if the version up has been applied.
$ migrate status ------------------------------------------------------------------------ -- MyBatis Migrations - status ------------------------------------------------------------------------ ID Applied At Description ================================================================================ 20230322085317 2023-03-22 20:12:35 create changelog 20230322091138 2023-03-22 20:12:35 update v1.4.9 20230322092534 2023-03-22 20:12:36 update v1.5.0 ------------------------------------------------------------------------ -- MyBatis Migrations SUCCESS -- Total time: 0s -- Finished at: Wed Mar 22 20:12:39 KST 2023 -- Final Memory: 7M/500M ------------------------------------------------------------------------
✏️Note. For detailed commands, see MyBatis Migrations.
Download NVD Data from 2002
FOSSLight Hub downloads NVD Data Feeds provided from NVD(NATIONAL VULNERABILITY DATABASE) once a day and stores them in the database, and the stored NVD data is viewed in the Vulnerability List.
At this time, when downloading NVD data from 2002 data, set as follows.
(If you set it only once for the first time, there is no need to set it additionally because the data will be accumulated afterwards.)
Change the setting value in DB
UPDATE T2_CODE_DTL SET CD_DTL_NM = 'Y' WHERE CD_NO = '990' AND CD_DTL_NO = '100';
The default value of NVD Data Feed initialize flag Code is set to "N", and if you change it to "Y" directly as above, all NVD data is cleaned during the next NVD schedule operation, and registration is processed sequentially from the 2002 data file.
The value is changed to the default value ("N") regardless of whether there is an error when performing NVD Data initialization.