Skip to content

Instantly share code, notes, and snippets.

@dk0r
Created August 25, 2020 13:05
Show Gist options
  • Save dk0r/844c8284aea8dee6a3fe9f44ff91e875 to your computer and use it in GitHub Desktop.
Save dk0r/844c8284aea8dee6a3fe9f44ff91e875 to your computer and use it in GitHub Desktop.
Making Oncall v1.2.3 for python3

Make Oncall v.1.2.3 on Ubuntu 18.04LTS for python3

  1. Docker Image Preparation
  2. Source Modifications
  3. Database Preparation
  4. Install Oncall
  5. Manually Start Oncall

Docker Image Preparation

Start an ubuntu v18.04 docker container

docker run -itd -p 8080:8080 ubuntu:bionic

TTY into Container

docker exec -it <containerID> /bin/bash

Prepare system for Oncall

apt update && apt -y upgrade &&
apt install -y git

Clone Oncall v1.2.3

cd /home &&
git clone --branch v1.2.3 https://github.com/linkedin/oncall.git &&
cd /home/oncall && git checkout -b v1.2.3-modification

Install oncall dependencies

apt install -y libssl-dev libxml2-dev libxslt1-dev libsasl2-dev
python3-dev libldap2-dev python3-pip python3-setuptools mysql-client mysql-server

Upgrade pip

python3 -m pip install --upgrade pip

Install pip pkg dependencies to avoid errors whe upgrading packages in next step

apt install -y libcairo2-dev libgirepository1.0-dev

Upgrade all outdated pip packages

python3 -m pip list --outdated --format=freeze | grep -v '^-e' | cut -d = -f 1 | xargs -n1 python3 -m pip install -U

⚠️ Received and Ignored the following errors:
ERROR: Cannot uninstall 'pygobject'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall

ERROR: Cannot uninstall 'pyxdg'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall

Install pip pkgs utilized by .github/workflows/create-release-and-publish.yml (may be unnecessary for making from source)

python3 -m pip install setuptools wheel twine

Install following to resolve PyYaml errors incurred when making onCall

apt install -y libyaml-dev libpython2.7-dev


Source Modifications

Commit history is presently available only in the early-notification/Docker/images/oncall:dev.tar.gz docker image. Until the original modifications are pushed to aoc-pathfinder, commit history may be viewed vis the following:

  1. load the aforementioned image
  2. run it as a container
  3. exec into that container
  4. git log --reflog

Pull down image, load, exec and see following commits in branch v1.2.3-modification

Commit History (v1.2.3-modification):

  • d344b2c: Modified interpreters from python to python3
  • 6277930: Converted all 'python' and 'pip install' calls to their python3 equivalents

Database Preparation

Set mysql_native_password as auth plugin so passwords may be utilized
Note: By default, mysql on ubuntu:bionic utilizes the 'auth_socket' auth plugin causing mysql+pymysql to fail to auth w/ a password; additional details here. Note: You may verify the current plugin by doing mysql> SELECT plugin from mysql.user where User="root";

service mysql start &&
mysql mysql -e "UPDATE user SET plugin='mysql_native_password' WHERE User='root';FLUSH PRIVILEGES;" &&
service mysql restart

Set mysql root password

mysql_secure_installation && service mysql restart Responses: [No, 1234, 1234, Yes. Yes, Yes, Yes]

Disable ONLY_FULL_GROUP_BY mysql mode as described here Note: these commands need to be run @ each mysql restart

mysql -u root -p1234 -e " SET SESSION sql_mode = sys.list_drop(@@SESSION.sql_mode, 'ONLY_FULL_GROUP_BY'); SET GLOBAL sql_mode = sys.list_drop(@@GLOBAL.sql_mode, 'ONLY_FULL_GROUP_BY'); CREATE DATABASE oncall; "

Load Schema

mysql -u root -p1234 < /home/oncall/db/schema.v0.sql

Load Mock Data

mysql -u root -p1234 -o oncall < /home/oncall/db/dummy_data.sql


Install Oncall

python3 setup.py develop &&
python3 -m pip install -e '.[dev]'

⚠️ 14-Aug: When testing this ReadMe using only python2, we had to run the following commands in the following order and separately (i.e. don't use &&):

python -m pip install -e '.[dev]'
python3 setup.py develop &&


Make Oncall

oncall-dev ./configs/config.yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment