To learn more about the DeepCode Server and the prerequisites, go here.
We support GitLab 9.0.0 or greater for both GitLab Community Edition and GitLab Enterprise Edition.
Creating a user account
DeepCode needs to have access to one user account at which it will create comments on your pull requests and commits. It is recommended to choose a name for the user that signals that this user is controlled artificially (e.g. "DeepCode Bot"). The user can either be created as normal user or as admin user. The latter is easier to setup but you might feel more comfortable not assigning admin rights.
1. Normal user
Create a normal user. DeepCode's code review will work for all repositories for which the user has "developer" permissions. Thus you need to manually give it these permissions on all repositories for which you want to enable the code review.
2. Admin user
Create an admin user. DeepCode's code review will work for all current and future repositories.
Creating a personal access token
To give DeepCode Server access to the user account please follow these instructions to create a personal access token for the created user. The required scopes are api, read_user, read_repository. It is not recommended to set an expiration date on the token. Record the access token as it is required later.
Setting up an application inside GitLab
- Visit your GitLab instance and log in.
- Navigate to user settings.
- Navigate to "Applications".
- In the name field, enter "DeepCode".
- In the redirect URI field, enter the full URL to the DeepCode server and append "/api/gl/login". For example: http://my-deepcode/api/gl/login
- Select the scopes "api", "read_user" and "read_repository".
- Click "Save application"
The Application details page contains secret keys. You are going to need both Application ID and
Secret to configure DeepCode server in the next step.
DeepCode Server is the self-managed software that will integrate with GitLab. Before you set it up, first create the configuration files that are necessary to run DeepCode Server:
- Create a directory at some path that will hold all configuration files.
- Change working directory to this folder.
- Create a file gl.env with the following content:
PRODUCT=gl_op HOST_URL=http://my-deepcode-url FRONT_PORT=any port available on your host, 8080 by default GIT_LAB_URL=http://my-gitlab-url GIT_LAB_APP_ID=MyGitLabAppId GIT_LAB_APP_SECRET=MyGitLabAppSecret GIT_LAB_PERSONAL_ACCESS_TOKEN=MyGitLabPersonalAccessToken NODE_TLS_REJECT_UNAUTHORIZED=0 or 1
Replace this with the URL under which DeepCode Server will be reachable. E.g.
http://22.214.171.124:8081. Please note that because the server is running inside a docker container the hostname localhost will not work. Further, if you use any IP address that points to the local network e.g. 192.168.*.* you need to enable a special option in GitLab.
Insert the URL of your GitLab Server. E.g.
GIT_LAB_APP_ID and GIT_LAB_APP_SECRET
Application ID and
Secret of your GitLab Application created earlier.
Insert the personal access token that you created earlier.
If you host GitLab using self-signed SSL certificate, please set this value or
0 (number zero) Otherwise, remove it or leave it 1
The container exposes a webserver on port 8080 by default. Usually, you would bind it to port 80 by replacing
Command for starting the server
The full command to start DeepCode Server is as follows:
docker run --rm -it -v '/var/run/docker.sock:/var/run/docker.sock' -v $PWD:$PWD -w $PWD --env-file ./gl.env --name deepcode deepcode
docker run \ # Run a docker container --rm \ # Remove the container after it was stopped. -it \ # (Optional) to acquire terminal -v '/var/run/docker.sock:/var/run/docker.sock' \ # Mount Docker socket file -v $PWD:$PWD \ # Mount working dir for storing container data between restarts -w $PWD \ # set working directory --env-file ./gl.env \ # Configuration file created earlier --name deepcode \ # (Optional) set container name deepcode # Name of docker image to run.
This folder will contain data of the running container:
- mysqldata for persistent database
- redisdata for cache
clonesfor temporary cache with cloned repositories
To finish the integration, manage the DeepCode Server
If you encounter problems at any point during the setup please don't hesitate to ask for help at firstname.lastname@example.org