Tutorial: Deploy on-premises server (via installation script)
⚠️ Note: This tutorial covers the installation of the BeeCR on-premises via an installation script. If you are an advanced user and want to control many aspects of the installation and configuration process, please refer to the extended guide "Deploy on-premises server (manual)" tutorial.
This tutorial provides a step-by-step guide to installing and setting up the BeeCR solution on an on-premises server without using Docker. The installation process will be demonstrated on a machine equipped with an NVIDIA Tesla V100 GPU running Ubuntu 20.04 LTS Linux OS. This guide is intended to help users navigate the installation process, ensuring that all prerequisites are met and that the necessary components are correctly installed and configured.
⚠️ Note: As of summer 2024, Ubuntu 20.04 LTS is still supported by Canonical but is somewhat outdated. We chose this OS for our tutorial because it requires additional steps to set up the environment, and we want to demonstrate those. If you are using a more recent version of Ubuntu, you can skip any steps that are not required.
📄 Prerequirements
To deploy the solution on a server, you need the following:
- An "x86_64" server running Linux (preferably Ubuntu or Debian).
- A graphics card with at least 24 GB of memory.
- The
curl
command-line tool. - Python (versions 3.9 to 3.12) and the
virtualenv
command-line tool. - The user running the installation process must have root or sudo privileges.
- You have downloaded the archive with BeeCR installation files.
1️⃣ Run the installation script
Run the installation script install.sh
with the -i
option (which means "install").
⚠️ Note: Pass also
-6
command line option, if you wish to bind the API server to an IPv6 socket.
Possible output:
WARNING [BeeCR Installer] 🟡 Current user is not root. This script will ask for superuser permissions.
INFO [BeeCR Installer] 👉 Step 1 – Check environment...
INFO [BeeCR Installer] ✅ OS is Linux.
INFO [BeeCR Installer] ✅ Architecture is "x86_64".
INFO [BeeCR Installer] ✅ Kernel is non-WSL.
INFO [BeeCR Installer] ✅ "cURL" is available.
ERROR [BeeCR Installer] ❌ The "virtualenv" (Python virtual environment creator) is not available. You can install it, for example, using your system package manager (search for the "python3-virtualenv" package or similar).
The installer has checked the environment and reported an error related to Python.
It requires virtualenv
(Python virtual environment creator) which is missing.
2️⃣ Install Python virtualenv
Skip this step if virtualenv
is already installed on your system.
To install virtualenv on Ubuntu, use the apt
package manager:
3️⃣ Rerun the installation script
Once virtualenv
is installed, rerun the installation script. Possible output:
WARNING [BeeCR Installer] 🟡 Current user is not root. This script will ask for superuser permissions.
INFO [BeeCR Installer] 👉 Step 1 – Check environment...
INFO [BeeCR Installer] ✅ OS is Linux.
INFO [BeeCR Installer] ✅ Architecture is "x86_64".
INFO [BeeCR Installer] ✅ Kernel is non-WSL.
INFO [BeeCR Installer] ✅ "cURL" is available.
ERROR [BeeCR Installer] ❌ Python 3.9 (or higher) is required.
INFO [BeeCR Installer] Note:
Installing Python 3.9 alongside older versions of Python may be tricky and
highly dependent on your Linux distribution.
Once you have installed Python 3.9 (e.g., using your system package manager),
consider updating symbolic links to your Python interpreter and shared libraries.
For example, on Ubuntu 20.04 with Python 3.8 preinstalled, you may need to
run the following commands as a superuser:
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 2
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
sudo ln -s /usr/lib/python3/dist-packages/apt_pkg{.cpython-38-x86_64-linux-gnu,}.so
The installer still fails because Ubuntu 20.04 has Python 3.8 preinstalled. The script provides hints on how to install and configure a newer version of Python (e.g., 3.9).
4️⃣ Install a newer Python version
Skip this step if your Python installation already meets the requirements (3.9 – 3.12).
To install Python 3.9 on Ubuntu, use the apt
package manager:
Once the newer Python version is installed, you may need to make it the default Python interpreter.
Use the update-alternatives
command-line tool:
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 2
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
sudo ln -s /usr/lib/python3/dist-packages/apt_pkg{.cpython-38-x86_64-linux-gnu,}.so
These commands do the following:
- Set the priority level for
python3.8
(the old Python version) to1
for thepython3
alias. - Set a higher priority level for
python3.9
(the new Python version) to2
for thepython3
alias. - Set the priority level for the
python
alias topython3
. - Fix a potential issue with
apt_pkg
by creating a symlink to a shared library that belongs to an older Python version.
5️⃣ Rerun the installation script
Once your Python installation satisfies the requirements (3.9 – 3.12), rerun the installation script again.
⚠️ Note: If you run the script as a regular user, it will ask for superuser permissions. Ensure you have sudo privileges and can enter your password during the installation process.
If everything is correct, the output will look similar to this (third-party logs are hidden by ...
for clarity):
WARNING [BeeCR Installer] 🟡 Current user is not root. This script will ask for superuser permissions.
INFO [BeeCR Installer] 👉 Step 1 – Check environment...
INFO [BeeCR Installer] ✅ OS is Linux.
INFO [BeeCR Installer] ✅ Architecture is "x86_64".
INFO [BeeCR Installer] ✅ Kernel is non-WSL.
INFO [BeeCR Installer] ✅ "cURL" is available.
INFO [BeeCR Installer] ✅ "Python 3" and "virtualenv" are available.
INFO [BeeCR Installer] 👉 Step 2 – Install AI server...
...
INFO [BeeCR Installer] ✅ AI server installed.
INFO [BeeCR Installer] 👉 Step 3 – Configure AI server...
INFO [BeeCR Installer] ✅ AI server configured.
INFO [BeeCR Installer] 👉 Step 4 – Pull AI model...
...
INFO [BeeCR Installer] ✅ AI model pulled.
...
INFO [BeeCR Installer] 👉 Step 5 – Install ASGI server to serve API...
...
INFO [BeeCR Installer] ✅ "ASGI server" installed.
INFO [BeeCR Installer] 👉 Step 6 – Install API server...
...
INFO [BeeCR Installer] ✅ "API server" installed.
INFO [BeeCR Installer] 👉 Step 7 – Configure API server...
...
WARNING [BeeCR Installer] 🟡 API server license is missing. Put the license file "beecr.lic" to the "/opt/beecr" directory and restart the service using command "systemctl restart beecr".
INFO [BeeCR Installer] Note: To request a license file, please provide this information to beecr@cvisionlab.com: "GPU 0: Tesla V100-PCIE-32GB (UUID: GPU-d541606d-4910-6857-7cc0-4821bec3f358)".
6️⃣ Obtain and install the license
As seen in the previous step, all prerequisite checks should pass, and all components should be installed. However, the installation script warns that the API server license is missing.
If you don't have a license file, follow these steps:
- Contact our team via beecr@cvisionlab.com (or any other communication channel if you have contacted us before).
- Privide to our team the information about your GPU (e.g.
GPU 0: Tesla V100-PCIE-32GB (UUID: GPU-d541606d-4910-6857-7cc0-4821bec3f358)
).
Once you have received the license file (it must be named beecr.lic
), place it in the /opt/beecr
directory and restart the beecr
service by running the following command:
7️⃣ Check the logs and configure (optionally)
The installation script creates a "systemd" daemon service named beecr
.
Use the standard "systemd" daemon commands to manage the service.
For example, to view (and follow) the logs, use the journalctl
command-line tool:
Output example:
Jul 16 10:53:42 code-review-2004-v100 python3[41610]: INFO [BeeCR--] Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
Jul 16 10:53:42 code-review-2004-v100 systemd[1]: beecr.service: Succeeded.
Jul 16 10:53:45 code-review-2004-v100 systemd[1]: Stopped BeeCR Service.
Jul 16 10:53:45 code-review-2004-v100 systemd[1]: Started BeeCR Service.
Jul 16 10:53:46 code-review-2004-v100 python3[41624]: 🟢 License check passed. License info: GPU based license.
Jul 16 10:53:46 code-review-2004-v100 python3[41624]: INFO [BeeCR--] Started server process [41624]
Jul 16 10:53:46 code-review-2004-v100 python3[41624]: INFO [BeeCR--] Waiting for application startup.
Jul 16 10:53:46 code-review-2004-v100 python3[41624]: INFO [BeeCR--] Settings: pkg_name='beecr-api' version='v1.26.2' domain='beecr.dev' protocol='http' port=8000 model='ollama/codestral:22b' temperature=0.8 use_original_code=True language='English' openai_host='https://api.openai.com' openai_api_key='*****' ollama_host='http://localhost:11435' gitlab_host='https://gitlab.com' target=None target_extra=None target_exclude=None.
Jul 16 10:53:46 code-review-2004-v100 python3[41624]: INFO [BeeCR--] Application startup complete.
Jul 16 10:53:46 code-review-2004-v100 python3[41624]: INFO [BeeCR--] Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
Look for the "🟢 License check passed" message, which indicates that the Code Review API server sees and accepts the license.
To control the API server's settings, edit the related systemd service configuration files:
/etc/systemd/system/beecr.service
– core settings (e.g. port)/etc/systemd/system/beecr.service.d/env.conf
– additional settings
👍 Conclusion
By following this tutorial, you have successfully installed and configured the BeeCR code review solution on your on-premises server. You have learned how to address common installation issues, such as missing prerequisites and outdated software, and how to manage the service using "systemd" daemon. With the BeeCR solution up and running, you can now leverage its powerful capabilities to enhance your code review processes. If you encounter any further issues or require a license, please contact our team for support.