|
|
||
|---|---|---|
| dependencies | ||
| pics | ||
| services | ||
| .dockerignore | ||
| .flake8 | ||
| .isort.cfg | ||
| LICENSE | ||
| README.md | ||
| pyproject.toml | ||
| requirements.txt | ||
README.md
OSCH_server
OSCH (open source clone hunter)
How to use this
First of all, you need to clone this repository into your own server.
As all the dependent parts are based on docker. So install docker on your server first. Here is a guide for ubuntu 20.04.
Then install docker-compose by running sudo apt install docker-compose.
Add priviledge for the user.
sudo groupadd docker
sudo gpasswd -a $USER docker
newgrp docker
docker ps # test whether docker command can be used
Install docker-compose following this guide.
Install the dependencies using the following steps:
docker network create OSCHto create the network.cd dependenciesdocker-compose up -dto install all the dependent services, including gitea (the dependent mysql), rabbitmq, elasticsearch, kibana.
- Error may occur when installing elasticsearch and kibana, you need to:
sudo chmod 777 -R elasticsearchsudo chmod 777 -R kibanadocker-compose up -d
- Configure the gitea settings for initialization. See the figure below.
- Configure the gitea system webhook for the incremental perception service. See the figure below.
-
Create python virtual environment using command
conda create -n OSCH python=3.7.11based on conda. (Before this you need to install conda following this guide.) -
Activate the python virtual environment using command
conda activate OSCH. -
Install dependent python packages using command
pip install -r requirements.txt. -
Change the working directory to the
servicesdirectory using command:cd ../services. -
Change the configuration:
- Copy the configuration file from the template using command:
cp config-template.yml config.yml; - Change
gitea/repositories_path; - Change
elasticsearch/urlsand the names of indexes, includingelasticsearch/index_ngramandelasticsearch/index_handled_commitsas you want; - Change
mysql; - Change
rabbitmq; - Change the number of threads for running
coldstart_serviceandincremental_service; - Change the absolute base path of
nil; - Change
client_service:gitea_urlis the address of your local gitea service;tokenis personal account token in which you installed the client service.
-
Change the python path in
restart_services.shfile. -
Run the service using command:
bash restart_services.sh.
The tree of this project
.
├── dependencies -- the dir for dependencies of OSCH
│ ├── docker-compose.yml -- the docker-compose starting the dependencies
├── LICENSE -- the license file
├── pics -- the pictures in README.md file
│ ├── gitea-setting.jpeg
│ └── gitea-system-webhook-setting.png
├── pyproject.toml
├── README.md
├── requirements.txt -- the requirements of python packages
└── services -- the services of OSCH
├── ChangedMethodExtractor.py -- the class for extracting changes in source code file
├── CloneDetectionAPI.py -- the Clone Detection and Search services
├── CloneDetection.py -- the class for clone detection related methods
├── ColdStartPerception.py -- the Cold Start Service
├── config-template.yml -- the template of configuration file
├── ESUtils.py -- the utility file of Elasticsearch
├── IncrementalPerceptionAPI.py -- the producer of Incremental Service
├── IncrementalPerceptionHandler.py -- the consumer of Incremental Service
├── __init__.py
├── LCS.py -- Longest Common Subsequence algorithm
├── models -- the models defined for running the service
├── MySQLUtils.py -- the utility file of mysql
├── parser
| ├── FuncExtractor_nil.py -- the script of invoking function extractor of NIL
| └── nil -- the function extractor of NIL
├── RabbitmqUtils.py -- the utility file of rabbitmq
├── restart_services.sh -- the script for restarting OSCH's services
└── utils.py -- the utility file

